123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- using LYFZ.Helper;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- namespace LYFZ.WeixinServiceDate.DAL
- {
- public class DAL_DZKJ_DistributorAccount : BaseDataOperate
- {
- public DAL_DZKJ_DistributorAccount()
- {
- this.TableFieldNameString = "";
- }
- #region 属性和字段
- string _tableName = "tb_DZKJ_DistributorAccount";
- /// <summary>
- /// 获取数据表名
- /// </summary>
- public override string TableName
- {
- get { return _tableName; }
- set { this._tableName = value; }
- }
- /// <summary>
- /// 获取当前新的数据表模型对象
- /// </summary>
- public override object ObjModel
- {
- get
- {
- return this.CurrentModel;
- }
- }
- /// <summary>
- /// 获取当前新的MOdel
- /// </summary>
- public Model.Model_DZKJ_DistributorAccount CurrentModel
- {
- get { return new Model.Model_DZKJ_DistributorAccount(); }
- }
- string _tableFieldNameString = "";
- /// <summary>
- /// 数据表字段名数组
- /// </summary>
- public override string TableFieldNameString
- {
- get { return this._tableFieldNameString; }
- set { this._tableFieldNameString = value; }
- }
- #endregion
- #region 检查记录
- //基类已经实现
- #endregion
- #region 增加数据
- /// <summary>
- /// 增加一条数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Add(Model.Model_DZKJ_DistributorAccount model, string overlookFieldList = "ID")
- {
- return base.Add(model, overlookFieldList);
- }
- #endregion
- #region 删除数据
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public bool Delete(Model.Model_DZKJ_DistributorAccount model)
- {
- return base.Delete(model.ID);
- }
- #endregion
- #region 更新数据
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(Model.Model_DZKJ_DistributorAccount model)
- {
- return base.Update(model);
- }
- /// <summary>
- /// 根据筛选字段和SQL筛选运算符号更新数据
- /// </summary>
- /// <param name="model">Model对象</param>
- /// <param name="filterFieldName">筛选字段名称</param>
- /// <param name="operators">SQL筛选运算符号</param>
- /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
- /// <returns></returns>
- public bool Update(Model.Model_DZKJ_DistributorAccount model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
- {
- return base.Update(model, filterFieldName, operators, overlookFieldList);
- }
- #endregion
- #region 查询数据
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public Model.Model_DZKJ_DistributorAccount GetModel(long ID)
- {
- return DataRowToModel(GetDataRow(ID));
- }
- public Model.Model_DZKJ_DistributorAccount GetModel(string strWhere)
- {
- return DataRowToModel(GetDataRow(strWhere));
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- /// <param name="row"></param>
- /// <returns></returns>
- public Model.Model_DZKJ_DistributorAccount DataRowToModel(DataRow row)
- {
- return DataRowToModelObject(row) as Model.Model_DZKJ_DistributorAccount;
- }
- public bool UpdateLatestLoginTime(string Account, string ip, string LatestLoginTime)
- {
- string updateSql = "update [tb_Model_DZKJ_DistributorAccount] set ip='" + ip + "',LatestLoginTime='" + LatestLoginTime + "' where Account='" + Account + "'";
- if (LYFZ.Helper.SQLHelper.ExecuteSql(updateSql) > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- #endregion
- #region 数据分页
- //基类已实现相关方法
- #endregion
- public bool Recharge(long Id, string UserName, int Mouney, int Count, string RechargeDescription)
- {
- try
- {
- LYFZ.WeixinServiceDate.DAL.DAL_DZKJ_DistributorRechargeRecords DZKJRec_Dal = new WeixinServiceDate.DAL.DAL_DZKJ_DistributorRechargeRecords();
- LYFZ.WeixinServiceDate.Model.Model_DZKJ_DistributorRechargeRecords DZKJRecModel = new WeixinServiceDate.Model.Model_DZKJ_DistributorRechargeRecords();
- DZKJRecModel.DistributorID = Id;
- DZKJRecModel.RechargeTime = DateTime.Now;
- DZKJRecModel.RechargeUser = UserName;
- DZKJRecModel.RechargeMoney = Mouney;
- DZKJRecModel.RechargeCount = Count;
- DZKJRecModel.RechargeDescription = RechargeDescription;
- DZKJRec_Dal.Add(DZKJRecModel);
- Model.Model_DZKJ_DistributorAccount MDDistAccount = this.GetModel(Id);
- MDDistAccount.ID = Id;
- MDDistAccount.StartSimulatorCount += Count;
- this.Update(MDDistAccount);
- }
- catch
- {
- return false;
- }
- return true;
- }
- }
- }
|