Esempio n. 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);
            }
        }
Esempio n. 2
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);
            }
        }