| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- 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
- {
- /// <summary>
- /// 登陆用户和结算单位关系管理
- /// </summary>
- 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);
- }
- /// <summary>
- /// 带标题,返回数据集合
- /// </summary>
- /// <param name="sqlCondition"></param>
- /// <param name="isSetCaption"></param>
- /// <returns></returns>
- 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<Model.SEL_FUND_USERANDBALRELATION> GetSelFundUserAndBalRelationList(string sqlCondition)
- {
- return Model.SEL_FUND_USERANDBALRELATION.GetSelFundUserAndBalRealtion(GetSelFundUserAndBalRelation(sqlCondition));
- }
- /// <summary>
- /// 通过用户编码获取一个数据,唯一
- /// </summary>
- /// <param name="userId"></param>
- /// <returns></returns>
- public Model.SEL_FUND_USERANDBALRELATION GetSelFundUserAndBalRelationByUserId(string userId)
- {
- string sqlConditon = string.Format(" and userid = '{0}' ", userId);
- List<Model.SEL_FUND_USERANDBALRELATION> 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
- {
- }
- }
- }
- }
|