예제 #1
0
        public int UpdateState(VipUserQuery query)
        {
            string sql = string.Empty;
            int result = 0;
            try
            {
                query.updatedate = Convert.ToUInt32(Common.CommonFunction.GetPHPTime(DateTime.Now.ToString()));
                sql = _vipUserDao.UpdateState(query);
                if (query.user_id == 0)
                {
                    VipUser vimodel = new VipUser();
                    vimodel = _dbAccess.getSinggleObj<VipUser>(_vipUserDao.GetSingleByID(Convert.ToInt32(query.v_id)));
                    if (vimodel != null)
                    {
                        query.user_id = vimodel.user_id;
                    }
                }
                if (query.user_id != 0)
                {
                    UserLifeDao _userLifeDao = new UserLifeDao(conn);

                    if (query.status == 1)//z狀態改為鎖定時記錄會員取消電子報的時間和操作人
                    {
                        //將取消電子報的時間和人員加入會員生活信息表(user_life)edit by shuangshuang0420j 20150814 11:00
                        UserLife modelUF = new UserLife();
                        modelUF = _userLifeDao.GetSingle(query.user_id, "cancel_edm_time");
                        if (modelUF != null)
                        {
                            sql = sql + _userLifeDao.UpdateEdmTime(query.user_id, 0, (int)query.update_id);
                        }
                        sql = sql + _userLifeDao.UpdateEdmTime(query.user_id, query.updatedate, (int)query.update_id);
                    }
                    else if (query.user_status == 0)//狀態改為解鎖時清空會員取消電子報的信息
                    {
                        sql = sql + _userLifeDao.UpdateEdmTime(query.user_id, 0, (int)query.update_id);
                    }
                }
                result = _dbAccess.execCommand(sql);
                return result;
            }
            catch (Exception ex)
            {

                throw new Exception("VipUserMgr-->UpdateState-->" + ex.Message, ex);
            }
        }
예제 #2
0
        public HttpResponseBase SaveUsersList()
        {
            string json = string.Empty;
            try
            {
                #region 獲取會員基本信息
                //獲取會員基本信息
                UsersListQuery user = new UsersListQuery();
                if (!string.IsNullOrEmpty(Request.Params["user_id"]))
                {
                    user.user_id = Convert.ToUInt32(Request.Params["user_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["user_name"]))
                {
                    user.user_name = Request.Params["user_name"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["user_gender"]))
                {
                    user.user_gender = Convert.ToUInt32(Request.Params["user_gender"]);
                }
                //if (!string.IsNullOrEmpty(Request.Params["user_phone"]))
                //{
                //    user.user_phone = Request.Params["user_phone"].ToString();
                //}
                if (!string.IsNullOrEmpty(Request.Params["user_mobile"]))
                {
                     user.user_mobile = Request.Params["user_mobile"].ToString();
                   // user.user_mobile = EncryptComputer.EncryptDecryptTextByApi(Request.Params["user_mobile"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["my_birthday"]))
                {
                    DateTime birth = Convert.ToDateTime(Request.Params["my_birthday"].ToString());
                    user.user_birthday_year = Convert.ToUInt32(birth.Year);
                    user.user_birthday_month = Convert.ToUInt32(birth.Month);
                    user.user_birthday_day = Convert.ToUInt32(birth.Day);
                }
                else
                {
                    user.user_birthday_year = 1970;
                    user.user_birthday_month = 0;
                    user.user_birthday_day = 0;
                }
                if (user.user_id == 0 && !string.IsNullOrEmpty(Request.Params["user_password_add"]))
                {
                    HashEncrypt hmd5 = new HashEncrypt();
                    user.user_password = hmd5.SHA256Encrypt(Request.Params["user_password_add"].Trim());
                }
                else if (!string.IsNullOrEmpty(Request.Params["user_password_edit"]))
                {
                    HashEncrypt hmd5 = new HashEncrypt();
                    user.user_password = hmd5.SHA256Encrypt(Request.Params["user_password_edit"].Trim());
                }
                if (Request.Params["send_sms_ad"].ToString() == "on")
                {
                    user.send_sms_ad = true;
                }
                else
                {
                    user.send_sms_ad = false;
                }
                if (!string.IsNullOrEmpty(Request.Params["admNote"]))
                {
                    user.adm_note = Request.Params["admNote"].ToString();
                }
                user.user_zip = Convert.ToUInt32(Request.Params["user_zip"]);
                user.user_address = Request.Params["user_address"].ToString();
                if (!string.IsNullOrEmpty(Request.Params["paper_invoice"]))
                {
                    if (Request.Params["paper_invoice"].ToString() == "on")
                    {
                        user.paper_invoice = true;
                    }
                    else
                    {
                        user.paper_invoice = false;
                    }
                }
                #endregion
                #region 獲取會員生活屬性
                List<UserLife> userInfoList = new List<UserLife>();
                UserLife uModel = new UserLife();
                uModel.user_id = user.user_id;
                uModel.kdate = (uint)CommonFunction.GetPHPTime();
                uModel.kuser = (Session["caller"] as Caller).user_id;
                user.update_user = uModel.kuser;
                if (Request.Params["user_marriage"] == "1")
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "user_marriage";
                    model.info_name = "是否結婚";
                    model.info_code = "1";
                    userInfoList.Add(model);

                }
                if (!string.IsNullOrEmpty(Request.Params["child_num"]) && Convert.ToInt32(Request.Params["child_num"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "child_num";
                    model.info_name = "孩子個數";
                    model.info_code = Request.Params["child_num"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["vegetarian_type"]) && Convert.ToInt32(Request.Params["vegetarian_type"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "vegetarian_type";
                    model.info_name = "是否吃素";
                    model.info_code = Request.Params["vegetarian_type"];
                    userInfoList.Add(model);
                }
                if (Request.Params["like_fivespice"] == "on")
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "like_fivespice";
                    model.info_name = "是否吃五辛";
                    model.info_code = "1";
                    userInfoList.Add(model);
                }
                string contact = string.Empty;
                if (Request.Params["contact1"] == "on")
                {
                    contact += "1,";

                }
                if (Request.Params["contact2"] == "on")
                {
                    contact += "2,";

                }
                if (Request.Params["contact3"] == "on")
                {
                    contact += "3,";

                }
                contact = contact.TrimEnd(',');
                if (!string.IsNullOrEmpty(contact))
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "like_contact";
                    model.info_name = "方便聯繫方式";
                    model.info_code = contact;
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["like_time"]) && Convert.ToInt32(Request.Params["like_time"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "like_time";
                    model.info_name = "方便聯繫時間";
                    model.info_code = Request.Params["like_time"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["user_salary"]) && Convert.ToInt32(Request.Params["user_salary"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "user_salary";
                    model.info_name = "年薪";
                    model.info_code = Request.Params["user_salary"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["work_type"]) && Convert.ToInt32(Request.Params["work_type"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "work_type";
                    model.info_name = "職業";
                    model.info_code = Request.Params["work_type"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["user_educated"]) && Convert.ToInt32(Request.Params["user_educated"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "user_educated";
                    model.info_name = "教育";
                    model.info_code = Request.Params["user_educated"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["user_religion"]) && Convert.ToInt32(Request.Params["user_religion"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "user_religion";
                    model.info_name = "宗教信仰";
                    model.info_code = Request.Params["user_religion"];
                    userInfoList.Add(model);
                }
                if (!string.IsNullOrEmpty(Request.Params["user_constellation"]) && Convert.ToInt32(Request.Params["user_constellation"]) != 0)
                {
                    UserLife model = new UserLife();
                    model.user_id = uModel.user_id;
                    model.kdate = uModel.kdate;
                    model.kuser = uModel.kuser;
                    model.info_type = "user_constellation";
                    model.info_name = "星座";
                    model.info_code = Request.Params["user_constellation"];
                    userInfoList.Add(model);
                }
                #endregion
                _uslmpgr = new UsersListMgr(mySqlConnectionString);
                if (_uslmpgr.SaveUserList(user, userInfoList))
                {
                    json = "{success:true}";//返回json數據
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,error:\"" + BLL.gigade.Common.CommonFunction.MySqlException(ex) + "\"}";

            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }
예제 #3
0
        public int CancelEdm(string mail, uint update_id, out uint vid)
        {
            int result = 0;
            string sqlEmail = string.Empty;
            string sqlUpdate = string.Empty;
            uint userID = 0;
            vid = 0;
            int sum = 0;
            uint status = 0;
            VipUserQuery query = new VipUserQuery();
            try
            {
                if (_edmEmailDao.GetModel(mail) == null)//郵箱不存在
                {
                    result = -1;
                    return result;
                }
                else
                {
                    result = _IEdmContentDao.CancelEdm(mail);
                    int num = updateGroupCount(mail);
                    if (result > 0 && num > 0)
                    {
                        DataTable dt = _accessMySql.getDataTable(_usersDao.GetUserIDbyEmail(mail));//判斷郵箱是否有對應的用戶id
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            userID = Convert.ToUInt32(dt.Rows[0][0]);
                        }
                        if (string.IsNullOrEmpty(userID.ToString()) || userID == 0)
                        {
                            result = -2;
                            return result;//郵箱不存在對應的用戶
                        }
                        else
                        {
                            sqlEmail = _vipUserDao.SelectEmail(userID);//根據用戶id查詢郵箱是否已經加入黑名單
                            DataTable temail = _accessMySql.getDataTable(sqlEmail);
                            uint phpTime = (uint)Common.CommonFunction.GetPHPTime();
                            #region 將取消電子報的時間和人員加入會員生活信息表(user_life)edit by shuangshuang0420j 20150814 11:00
                            //將取消電子報的時間和人員加入會員生活信息表(user_life)edit by shuangshuang0420j 20150814 11:00
                            UserLifeDao _userLifeDao = new UserLifeDao(conn);
                            UserLife modelUF = new UserLife();
                            modelUF = _userLifeDao.GetSingle(userID, "cancel_edm_time");
                            if (modelUF != null)
                            {
                                _accessMySql.execCommand(_userLifeDao.UpdateEdmTime(userID, 0, (int)update_id));
                            }
                            _accessMySql.execCommand(_userLifeDao.UpdateEdmTime(userID, phpTime, (int)update_id));
                            #endregion
                            if (temail != null && temail.Rows.Count > 0)
                            {
                                sum = Convert.ToInt32(temail.Rows[0][0]);
                            }
                            if (sum > 0)
                            {
                                status = Convert.ToUInt32(temail.Rows[0][1]);
                                vid = Convert.ToUInt32(temail.Rows[0][2]);
                                if (status == 0)
                                {
                                    result = -3;
                                    return result;//該用戶已加入黑名單且狀態為解鎖
                                }
                                else if (status == 1)
                                {
                                    result = -4;
                                    return result;//該用戶已加入黑名單,狀態為鎖定
                                }
                            }
                            else
                            {
                                query.vuser_email = mail;
                                query.v_id = userID;
                                query.create_id = update_id;
                                query.update_id = update_id;
                                query.createdate = phpTime;
                                query.updatedate = phpTime;
                                sqlUpdate = _vipUserDao.UpdateBlackList(query);
                                result = _accessMySql.execCommand(sqlUpdate);
                                return result;
                            }

                        }
                    }
                    else
                    {
                        result = -5;
                    }
                    return result;
                }


            }
            catch (Exception ex)
            {

                throw new Exception("EdmContentMgr-->CancelEdm-->" + ex.Message, ex);
            }
        }