Example #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ref WX_members_wxEntity Entity)
 {
     intReturn = 0;
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@id",              Entity.id),
         new SqlParameter("@openid",          Entity.openid),
         new SqlParameter("@subscribe",       Entity.subscribe),
         new SqlParameter("@nickname",        Entity.nickname),
         new SqlParameter("@sex",             Entity.sex),
         new SqlParameter("@language",        Entity.language),
         new SqlParameter("@cityid",          Entity.cityid),
         new SqlParameter("@provinceid",      Entity.provinceid),
         new SqlParameter("@country",         Entity.country),
         new SqlParameter("@mobile",          Entity.mobile),
         new SqlParameter("@headimgurl",      Entity.headimgurl),
         new SqlParameter("@subscribe_scene", Entity.subscribe_scene),
         new SqlParameter("@upwd",            Entity.upwd),
         new SqlParameter("@notpwd",          Entity.notpwd),
         new SqlParameter("@wxopenid",        Entity.wxopenid)
     };
     sqlParameters[0].Direction = ParameterDirection.Output;
     intReturn = DBHelper.ExecuteNonQuery("dbo.p_WX_members_wx_Add", CommandType.StoredProcedure, sqlParameters);
     if (intReturn == 0)
     {
         Entity.id = int.Parse(sqlParameters[0].Value.ToString());
     }
     return(intReturn);
 }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public DataTable Update(string id, string openid, string subscribe, string nickname, string sex, string language, string cityid, string provinceid, string country, string mobile, string headimgurl, string subscribe_scene, string upwd, string notpwd, string wxopenid)
        {
            dtBase.Clear();
            string spanids   = string.Empty;
            string strReturn = CheckPageInfo("update", id, openid, subscribe, nickname, sex, language, cityid, provinceid, country, mobile, headimgurl, subscribe_scene, upwd, notpwd, wxopenid, out spanids);

            //数据页面验证
            if (!CheckControl(strReturn, spanids))
            {
                return(dtBase);
            }
            //获取更新前的数据对象
            WX_members_wxEntity OldEntity = new WX_members_wxEntity();

            OldEntity = GetEntitySigInfo(" where openid='" + openid + "'");
            //更新数据
            int result = dal.Update(Entity);

            //检测执行结果
            //if (CheckResult(result))
            //{
            ////写日志
            //if (entity != null)
            //{
            //    blllog.Add<WX_members_wxEntity>(entity, Entity, OldEntity);
            //}
            //}
            return(dtBase);
        }
Example #3
0
        /// <summary>
        /// 检验表单数据
        /// </summary>
        /// <returns></returns>
        public string CheckPageInfo(string type, string id, string openid, string subscribe, string nickname, string sex, string language, string cityid, string provinceid, string country, string mobile, string headimgurl, string subscribe_scene, string upwd, string notpwd, string wxopenid, out string spanids)
        {
            string strRetuen = string.Empty;

            spanids = string.Empty;
            //要验证的实体属性
            List <string> EName = new List <string>()
            {
            };
            //要验证的实体属性值
            List <string> EValue = new List <string>()
            {
            };
            //错误信息
            List <string> errorCode   = new List <string>();
            List <string> ControlName = new List <string>();

            //验证数据
            CheckValue <WX_members_wxEntity>(EName, EValue, ref errorCode, ref ControlName, new WX_members_wxEntity());
            //特殊验证写在下面

            if (errorCode.Count > 0)
            {
                strRetuen = ErrMessage.GetMessageInfoByListCode(errorCode);
                spanids   = ListTostring(ControlName);
            }
            else//组合对象数据
            {
                Entity                 = new WX_members_wxEntity();
                Entity.id              = Helper.StringToLong(id);
                Entity.openid          = openid;
                Entity.subscribe       = subscribe;
                Entity.nickname        = nickname;
                Entity.sex             = sex;
                Entity.language        = language;
                Entity.cityid          = cityid;
                Entity.provinceid      = provinceid;
                Entity.country         = country;
                Entity.mobile          = mobile;
                Entity.headimgurl      = headimgurl;
                Entity.subscribe_scene = subscribe_scene;

                Entity.upwd     = upwd;
                Entity.notpwd   = notpwd;
                Entity.wxopenid = wxopenid;
            }
            return(strRetuen);
        }
Example #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(WX_members_wxEntity Entity)
 {
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@openid",          Entity.openid),
         new SqlParameter("@subscribe",       Entity.subscribe),
         new SqlParameter("@nickname",        Entity.nickname),
         new SqlParameter("@sex",             Entity.sex),
         new SqlParameter("@language",        Entity.language),
         new SqlParameter("@cityid",          Entity.cityid),
         new SqlParameter("@provinceid",      Entity.provinceid),
         new SqlParameter("@country",         Entity.country),
         new SqlParameter("@mobile",          Entity.mobile),
         new SqlParameter("@headimgurl",      Entity.headimgurl),
         new SqlParameter("@subscribe_scene", Entity.subscribe_scene),
         new SqlParameter("@upwd",            Entity.upwd),
         new SqlParameter("@notpwd",          Entity.notpwd),
     };
     return(DBHelper.ExecuteNonQuery("dbo.p_WX_members_wx_Update", CommandType.StoredProcedure, sqlParameters));
 }
Example #5
0
        /// <summary>
        /// 单行数据转实体对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private WX_members_wxEntity SetEntityInfo(DataRow dr)
        {
            WX_members_wxEntity Entity = new WX_members_wxEntity();

            Entity.id              = Helper.StringToLong(dr["id"].ToString());
            Entity.openid          = dr["openid"].ToString();
            Entity.subscribe       = dr["subscribe"].ToString();
            Entity.nickname        = dr["nickname"].ToString();
            Entity.sex             = dr["sex"].ToString();
            Entity.language        = dr["language"].ToString();
            Entity.cityid          = dr["cityid"].ToString();
            Entity.provinceid      = dr["provinceid"].ToString();
            Entity.country         = dr["country"].ToString();
            Entity.mobile          = dr["mobile"].ToString();
            Entity.headimgurl      = dr["headimgurl"].ToString();
            Entity.subscribe_scene = dr["subscribe_scene"].ToString();

            Entity.upwd   = dr["upwd"].ToString();
            Entity.notpwd = dr["notpwd"].ToString();
            return(Entity);
        }