Ejemplo n.º 1
0
        public int UserCancel(UsersListQuery u)
        {
            StringBuilder sb = new StringBuilder();
            StringBuilder sel = new StringBuilder();
            string email = DateTime.Now.ToString("yyyyMMdd") + "_" + u.user_email;
            try
            {
                if (u.user_id > 0)
                {
                    sb.Append("set sql_safe_updates = 0;");
                    sb.AppendFormat("Update users set user_status=2,user_email='{1}' where user_id='{0}';", u.user_id, email);
                    sel.AppendFormat("SELECT * from edm_email where email_address='{0}' ;", u.user_email);
                    if (_access.getDataTable(sel.ToString()).Rows.Count > 0)
                    {//修改會員電子報信息
                        sb.AppendFormat("Update edm_email set email_updatedate='{2}' , email_address='{1}' where email_address='{0}';", u.user_email, email, CommonFunction.GetPHPTime(DateTime.Now.ToString()));
                    }
                    sel.Clear();
                    sel.AppendFormat("SELECT * from epaper_email where email_address='{0}'", u.user_email);
                    if (_access.getDataTable(sel.ToString()).Rows.Count > 0)
                    {//修改會員電子報信息
                        sb.AppendFormat("Update epaper_email set email_updatedate='{2}', email_address='{1}' where email_address='{0}';", u.user_email, email, CommonFunction.GetPHPTime(DateTime.Now.ToString()));
                    }
                    sb.Append("set sql_safe_updates = 1; ");
                    //保存禁用會員的時間和操作人至會員生活表(user_life)edit by shuangshuang0420j 20150814 09:42
                    UserLifeDao _userLifeDao = new UserLifeDao(conn);
                    sb.Append(_userLifeDao.UpdateDisableTime(u.user_id, (uint)CommonFunction.GetPHPTime(), u.update_user));

                    return _access.execCommand(sb.ToString());
                }
                else
                {
                    return 0;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("UsersListDao-->UserCancel-->" + ex.Message + sb.ToString(), ex);
            }
        }