示例#1
0
        /// <summary>
        /// 通过数据读取器生成实体类
        /// </summary>
        /// <param name="rdr"></param>
        /// <returns></returns>
        private static ClerkEntity GetEntityFromrdr(NullableDataReader rdr)
        {
            ClerkEntity info = new ClerkEntity();

            info.ID               = rdr.GetInt32("ID");
            info.ClerkType        = rdr.GetString("ClerkType");
            info.ClerkName        = rdr.GetString("ClerkName");
            info.EntryTime        = rdr.GetNullableDateTime("EntryTime");
            info.ClerkEmail       = rdr.GetString("ClerkEmail");
            info.ClerkMobile      = rdr.GetString("ClerkMobile");
            info.ClerkWX          = rdr.GetString("ClerkWX");
            info.ClerkQQ          = rdr.GetString("ClerkQQ");
            info.ClerkIDCard      = rdr.GetString("ClerkIDCard");
            info.ClerkIDCardPic   = rdr.GetString("ClerkIDCardPic");
            info.ClerkPic         = rdr.GetString("ClerkPic");
            info.ClerkBankBranch  = rdr.GetString("ClerkBankBranch");
            info.ClerkAccountName = rdr.GetString("ClerkAccountName");
            info.ClerkBankAccount = rdr.GetString("ClerkBankAccount");
            info.ClerkBankPic     = rdr.GetString("ClerkBankPic");
            info.ClerkStatus      = rdr.GetInt32("ClerkStatus");
            info.Linkman          = rdr.GetString("Linkman");
            info.LinkmanTel       = rdr.GetString("LinkmanTel");
            info.LinkmanClose     = rdr.GetString("LinkmanClose");
            info.StoreID          = rdr.GetInt32("StoreID");
            info.LoginPwd         = rdr.GetString("LoginPwd");
            info.LoginTime        = rdr.GetNullableDateTime("LoginTime");
            info.LoginIP          = rdr.GetString("LoginIP");
            info.LoginStatus      = rdr.GetInt32("LoginStatus");
            info.ClerkRemark      = rdr.GetString("ClerkRemark");
            info.RemarkPic1       = rdr.GetString("RemarkPic1");
            info.RemarkPic2       = rdr.GetString("RemarkPic2");
            info.RemarkPic3       = rdr.GetString("RemarkPic3");
            return(info);
        }
示例#2
0
 /// <summary>
 /// 把实体类转换成键/值对集合
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="dict"></param>
 private static void GetParameters(ClerkEntity entity, Dictionary <string, object> dict)
 {
     dict.Add("ID", entity.ID);
     dict.Add("ClerkType", entity.ClerkType);
     dict.Add("ClerkName", entity.ClerkName);
     dict.Add("EntryTime", entity.EntryTime);
     dict.Add("ClerkEmail", entity.ClerkEmail);
     dict.Add("ClerkMobile", entity.ClerkMobile);
     dict.Add("ClerkWX", entity.ClerkWX);
     dict.Add("ClerkQQ", entity.ClerkQQ);
     dict.Add("ClerkIDCard", entity.ClerkIDCard);
     dict.Add("ClerkIDCardPic", entity.ClerkIDCardPic);
     dict.Add("ClerkPic", entity.ClerkPic);
     dict.Add("ClerkBankBranch", entity.ClerkBankBranch);
     dict.Add("ClerkAccountName", entity.ClerkAccountName);
     dict.Add("ClerkBankAccount", entity.ClerkBankAccount);
     dict.Add("ClerkBankPic", entity.ClerkBankPic);
     dict.Add("ClerkStatus", entity.ClerkStatus);
     dict.Add("Linkman", entity.Linkman);
     dict.Add("LinkmanTel", entity.LinkmanTel);
     dict.Add("LinkmanClose", entity.LinkmanClose);
     dict.Add("StoreID", entity.StoreID);
     dict.Add("LoginPwd", entity.LoginPwd);
     dict.Add("LoginTime", entity.LoginTime);
     dict.Add("LoginIP", entity.LoginIP);
     dict.Add("LoginStatus", entity.LoginStatus);
     dict.Add("ClerkRemark", entity.ClerkRemark);
     dict.Add("RemarkPic1", entity.RemarkPic1);
     dict.Add("RemarkPic2", entity.RemarkPic2);
     dict.Add("RemarkPic3", entity.RemarkPic3);
 }
示例#3
0
        /// <summary>
        /// 获取实体(异步方式)
        /// </summary>
        /// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
        /// <param name="dict">参数的名/值集合</param>
        /// <returns></returns>
        public virtual async Task <ClerkEntity> GetEntityAsync(string strWhere, Dictionary <string, object> dict = null)
        {
            ClerkEntity obj    = null;
            string      strSQL = "select top 1 * from Clerk where 1=1 " + strWhere;

            using (NullableDataReader reader = await Task.Run(() => _DB.GetDataReader(strSQL, dict)))
            {
                if (reader.Read())
                {
                    obj = GetEntityFromrdr(reader);
                }
            }
            return(obj);
        }
示例#4
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
        /// <param name="dict">参数的名/值集合</param>
        /// <returns></returns>
        public virtual ClerkEntity GetEntity(string strWhere, Dictionary <string, object> dict = null)
        {
            ClerkEntity obj    = null;
            string      strSQL = "select top 1 * from Clerk where 1=1 " + strWhere;

            using (NullableDataReader reader = _DB.GetDataReader(strSQL, dict))
            {
                if (reader.Read())
                {
                    obj = GetEntityFromrdr(reader);
                }
            }
            return(obj);
        }
示例#5
0
        /// <summary>
        /// 更新一条记录(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <bool> UpdateAsync(ClerkEntity entity)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);
            string strSQL = "Update Clerk SET " +
                            "ClerkType = @ClerkType," +
                            "ClerkName = @ClerkName," +
                            "EntryTime = @EntryTime," +
                            "ClerkEmail = @ClerkEmail," +
                            "ClerkMobile = @ClerkMobile," +
                            "ClerkWX = @ClerkWX," +
                            "ClerkQQ = @ClerkQQ," +
                            "ClerkIDCard = @ClerkIDCard," +
                            "ClerkIDCardPic = @ClerkIDCardPic," +
                            "ClerkPic = @ClerkPic," +
                            "ClerkBankBranch = @ClerkBankBranch," +
                            "ClerkAccountName = @ClerkAccountName," +
                            "ClerkBankAccount = @ClerkBankAccount," +
                            "ClerkBankPic = @ClerkBankPic," +
                            "ClerkStatus = @ClerkStatus," +
                            "Linkman = @Linkman," +
                            "LinkmanTel = @LinkmanTel," +
                            "LinkmanClose = @LinkmanClose," +
                            "StoreID = @StoreID," +
                            "LoginPwd = @LoginPwd," +
                            "LoginTime = @LoginTime," +
                            "LoginIP = @LoginIP," +
                            "LoginStatus = @LoginStatus," +
                            "ClerkRemark = @ClerkRemark," +
                            "RemarkPic1 = @RemarkPic1," +
                            "RemarkPic2 = @RemarkPic2," +
                            "RemarkPic3 = @RemarkPic3" +
                            " WHERE " +

                            "ID = @ID";

            return(await Task.Run(() => _DB.ExeSQLResult(strSQL, dict)));
        }
示例#6
0
 /// <summary>
 /// 增加或更新一条记录(异步方式)
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual async Task <bool> AddOrUpdateAsync(ClerkEntity entity, bool IsSave)
 {
     return(IsSave ? await AddAsync(entity) : await UpdateAsync(entity));
 }
示例#7
0
 /// <summary>
 /// 增加或更新一条记录
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual bool AddOrUpdate(ClerkEntity entity, bool IsSave)
 {
     return(IsSave ? Add(entity) : Update(entity));
 }
示例#8
0
        /// <summary>
        /// 增加一条记录,返回新的ID号。需要有一个单一主键,并且开启有标识符属性(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <int> InsertAsync(ClerkEntity entity)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);

            string strSQL = "insert into Clerk (" +
                            "ClerkType," +
                            "ClerkName," +
                            "EntryTime," +
                            "ClerkEmail," +
                            "ClerkMobile," +
                            "ClerkWX," +
                            "ClerkQQ," +
                            "ClerkIDCard," +
                            "ClerkIDCardPic," +
                            "ClerkPic," +
                            "ClerkBankBranch," +
                            "ClerkAccountName," +
                            "ClerkBankAccount," +
                            "ClerkBankPic," +
                            "ClerkStatus," +
                            "Linkman," +
                            "LinkmanTel," +
                            "LinkmanClose," +
                            "StoreID," +
                            "LoginPwd," +
                            "LoginTime," +
                            "LoginIP," +
                            "LoginStatus," +
                            "ClerkRemark," +
                            "RemarkPic1," +
                            "RemarkPic2," +
                            "RemarkPic3) " +
                            "values(" +
                            "@ClerkType," +
                            "@ClerkName," +
                            "@EntryTime," +
                            "@ClerkEmail," +
                            "@ClerkMobile," +
                            "@ClerkWX," +
                            "@ClerkQQ," +
                            "@ClerkIDCard," +
                            "@ClerkIDCardPic," +
                            "@ClerkPic," +
                            "@ClerkBankBranch," +
                            "@ClerkAccountName," +
                            "@ClerkBankAccount," +
                            "@ClerkBankPic," +
                            "@ClerkStatus," +
                            "@Linkman," +
                            "@LinkmanTel," +
                            "@LinkmanClose," +
                            "@StoreID," +
                            "@LoginPwd," +
                            "@LoginTime," +
                            "@LoginIP," +
                            "@LoginStatus," +
                            "@ClerkRemark," +
                            "@RemarkPic1," +
                            "@RemarkPic2," +
                            "@RemarkPic3)";

            return(await Task.Run(() => _DB.ReturnID(strSQL, dict)));
        }