using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using CoreFS.CA06; using DbHelp = Core.StlMes.Client.Sale.DbHelp; namespace Core.StlMes.Client.Sale.SaleFundMgt.FundDAL.FundUserAndBalanceRelationDAL { /// /// 登陆用户和结算单位关系管理 /// public class FundUserAndBalRelationDAL : BaseDAL.BaseDAL { public FundUserAndBalRelationDAL(OpeBase ob) : base(ob) { } private const string STR_QUERY = @" select userid,balancesubject,importor,importtime from sel_fund_userandbalrelation where 1 = 1 {0} "; private const string STR_DELETE = @"delete from sel_fund_userandbalrelation where userid = '{0}' "; private const string STR_INSERT = @"insert into sel_fund_userandbalrelation(userid,balancesubject,importor,importtime) values('{0}','{1}','{2}','{3}') "; public System.Data.DataSet GetSelFundUserAndBalRelation(string sqlCondition) { string sqlStr = string.Format(STR_QUERY,sqlCondition); return base.ExecuteReaderForSaleFund(sqlStr); } /// /// 带标题,返回数据集合 /// /// /// /// public System.Data.DataSet GetSelFundUserAndBalRelation(string sqlCondition,Boolean isSetCaption) { DataSet ds = GetSelFundUserAndBalRelation(sqlCondition); if (isSetCaption) { base.SetDataSetCaption(ref ds,base.GetColumnNameAndCaption()); } return ds; } public List GetSelFundUserAndBalRelationList(string sqlCondition) { return Model.SEL_FUND_USERANDBALRELATION.GetSelFundUserAndBalRealtion(GetSelFundUserAndBalRelation(sqlCondition)); } /// /// 通过用户编码获取一个数据,唯一 /// /// /// public Model.SEL_FUND_USERANDBALRELATION GetSelFundUserAndBalRelationByUserId(string userId) { string sqlConditon = string.Format(" and userid = '{0}' ", userId); List list = GetSelFundUserAndBalRelationList(sqlConditon); if (list == null || list.Count == 0) return null; return list[0]; } public void Insert(Model.SEL_FUND_USERANDBALRELATION real,out string errMsg) { errMsg = ""; if (real == null) { errMsg = "Error"; return; } try { string sqlStr = string.Format(STR_INSERT,real.USERID,real.BALANCESUBJECT,real.IMPORTOR,real.IMPORTTIME); base.ExecuteNoReaderForSaleFund(sqlStr,out errMsg); } catch(Exception ex) { errMsg = ex.Message; } } public void Insert(Model.SEL_FUND_USERANDBALRELATION real, DbHelp.DbTransaction transaction) { // 基本判断 if (real == null) { transaction.ErrMsg = "Error"; return; } try { string sqlStr = string.Format(STR_INSERT, real.USERID, real.BALANCESUBJECT, real.IMPORTOR, real.IMPORTTIME); base.ExecuteNoReaderForSaleFund(sqlStr, transaction); } catch (Exception ex) { } } public void Delete(string userId,out string errMsg) { errMsg = ""; if (userId.Length == 0) return; try { string sqlDelete = string.Format(STR_DELETE,userId); base.ExecuteNoReaderForSaleFund(sqlDelete,out errMsg); } catch { } } public void Delete(string userId, DbHelp.DbTransaction transaction) { if (userId.Length == 0) { transaction.ErrMsg = "Error"; return; } try { string sqlDelete = string.Format(STR_DELETE, userId); base.ExecuteNoReaderForSaleFund(sqlDelete, transaction); } catch { } } } }