示例#1
0
        //[B_MenuRightsTag("修改密码", "Index")]
        public ActionResult toEditPwd(string oldpwd, string pwd, string confirmpwd)
        {
            B_User user = B_User.GetB_UserByUserName(CurrentUser.UserName);

            if (user.UserName == pwd)
            {
                return(Content("账号和密码不能一致"));
            }
            if (pwd.Length < 6)
            {
                return(Content("密码长度必须高于6位"));
            }
            if (user.PassWord != oldpwd)
            {
                return(Content("旧密码错误"));
            }
            if (pwd != confirmpwd)
            {
                return(Content("两次输入密码不一致"));
            }

            int rtn = B_User.EditPwdByUserName(pwd, CurrentUser.UserName);

            if (rtn > 0)
            {
                SYSLog.add("修改后台密码从[" + oldpwd + "]修改为[" + pwd + "]", "后台用户" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "修改密码", "电脑端后台");
                return(Content("ok"));
            }
            return(Content("修改密码失败"));
        }
示例#2
0
        public ContentResult ToSave(FormCollection c)
        {
            try
            {
                string[] parakeys = c["parakey"].Split(',');
                string[] paravals = c["paraval"].Split(',');

                if (parakeys.Length != paravals.Length)
                {
                    return(Content("保存设置出现异常"));
                }
                for (int i = 0; i < parakeys.Length; i++)
                {
                    BaseParameters oldPara = BaseParameters.GetEntityByParametersKey(parakeys[i]);


                    BaseParameters.EditByID(parakeys[i], paravals[i]);

                    SYSLog.add("系统参数[" + oldPara.NickName + "]从[" + oldPara.ParametersVal + "]修改为[" + paravals[i] + "]", "后台用户" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "系统参数", "电脑端后台");
                }
                return(Content("ok"));
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.ToString(), "BaseParameters_ToSave_error");
                return(Content("保存出错"));
            }
        }
示例#3
0
        public ContentResult toEditPwd(FormCollection c)
        {
            C_User user      = C_User.GetUserByUserName(CurrentUser.UserName);
            string oldpwd    = c["oldpwd"];
            string newpwd    = c["newpwd"];
            string twonewpwd = c["twonewpwd"];

            if (oldpwd != user.PassWord)
            {
                return(Content("原密码错误"));
            }
            if (newpwd != twonewpwd)
            {
                return(Content("两次密码输入不一致"));
            }

            int rtn = C_User.EditPwd(CurrentUser.UserName, newpwd);

            if (rtn > 0)
            {
                SYSLog.add("修改经销商手机端密码从[" + oldpwd + "]修改为[" + newpwd + "]", "代理" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "修改密码", "经销商手机端");
            }


            return(Content(rtn > 0?"ok":"修改密码失败"));
        }
示例#4
0
        public ContentResult DelIntoStockCode(string IDSet)
        {
            int iRet = Scale.BatchRemoveIntoSmall(IDSet);

            SYSLog.add("电脑端用户删除入库", "用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")删除了ID为(" + IDSet + ")的条码入库,ip为" + Request.UserHostAddress, "/InStock/DelIntoStockCode", "删除入库", "电脑端后台");

            if (iRet > 0)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("删除失败!"));
            }
        }
        public ContentResult edit(int id, decimal price)
        {
            C_UserType type = C_UserType.GetEntityByID(id);

            if (type == null)
            {
                return(Content("该客户级别不存在"));
            }

            int rtn = C_UserType.EditMinOrderPriceByID(id, price);

            if (rtn > 0)
            {
                SYSLog.add("修改[" + type.Name + "]订单最小金额从[" + type.MinOrderPrice + "]修改为[" + price + "]", "后台用户" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "订单最小金额", "电脑端后台");
            }

            return(Content(rtn > 0?"ok":"修改出错啦"));
        }
示例#6
0
        public ActionResult GetTypeEdit(C_UserType Types)
        {
            if (string.IsNullOrWhiteSpace(Types.Name))
            {
                return(Content("类型名称不能为空"));
            }
            C_UserType oldType = C_UserType.GetEntityByID(Types.ID);

            oldType.Name     = Types.Name;
            oldType.TypeCode = Types.TypeCode;
            int rtn = oldType.UpdateByID();

            if (rtn > 0)
            {
                SYSLog.add("将代理类型[" + oldType.Name + "]从[" + oldType.Name + "]修改为[" + Types.Name + "]", "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "修改代理类型", "电脑后台");
            }

            return(Content(rtn > 0 ? "ok" : "修改出错了!!"));
        }
示例#7
0
 public ContentResult RelieveBigCodeLink(string MiddleCodeSet)
 {
     if (!string.IsNullOrWhiteSpace(MiddleCodeSet))
     {
         int iRet = Scale.BatchUnboxingMiddle(MiddleCodeSet);
         SYSLog.add("电脑端用户拆除中标装箱", "用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")拆除了条码为(" + MiddleCodeSet + "),ip为" + Request.UserHostAddress, "/BarCodeLink/RelieveBigCodeLink", "拆除中标装箱", "电脑端后台");
         if (iRet > 0)
         {
             return(Content("ok"));
         }
         else
         {
             return(Content("解除失败!"));
         }
     }
     else
     {
         return(Content("没有可解除的项"));
     }
 }
示例#8
0
        public ContentResult GetVerify(int ID)
        {
            C_UserAdvice advice = C_UserAdvice.GetEntityByID(ID);

            advice.UserName  = CurrentUser.UserName;
            advice.B_Name    = CurrentUser.Name;
            advice.DatVerify = DateTime.Now;
            advice.State     = "已审核";
            int iRet = advice.UpdateByID();

            if (iRet > 0)
            {
                SYSLog.add("审核了客户名为[" + advice.Name + "]的投诉建议", "后台用户" + CurrentUser.UserName + "(" + CurrentUser.Name + ")", CurrentURL, "审核投诉建议", "电脑端后台");
                return(Content("ok"));
            }
            else
            {
                return(Content("审核失败!"));
            }
        }
示例#9
0
        public ActionResult GetUpdateLever(C_User cUser)
        {
            C_User c_user = C_User.GetEntityByID(cUser.ID);

            string oldC_UserTypeName = C_UserType.GetNameByLever(c_user.C_UserTypeID.ToString());


            c_user.C_UserTypeID = cUser.C_UserTypeID;


            string newC_UserTypeName = C_UserType.GetNameByLever(c_user.C_UserTypeID.ToString());

            int rtn = c_user.UpdateByID();

            if (rtn > 0)
            {
                SYSLog.add("将经销商[" + c_user.Name + "]的等级从[" + oldC_UserTypeName + "]修改为[" + newC_UserTypeName + "]", "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "修改经销商级别", "电脑后台");
            }

            return(Content(rtn > 0 ? "ok" : "出错了"));
        }
示例#10
0
        public ContentResult DelOutStockCode(string CodeSet)
        {
            if (ScaleOutStoke.BatchIsSubOutStock(CodeSet))
            {
                return(Content("有编码已出货下级,无法删除!"));
            }
            else
            {
                int iRet = Scale.BatchRemoveOutSmall(CodeSet);

                SYSLog.add("电脑端用户删除出货", "用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")删除了Code为(" + CodeSet + ")的条码入库,ip为" + Request.UserHostAddress, "/OutStock/DelOutStockCode", "删除出货", "电脑端后台");

                if (iRet > 0)
                {
                    return(Content("ok"));
                }
                else
                {
                    return(Content("删除失败!"));
                }
            }
        }
示例#11
0
        public ContentResult Login(B_User user)
        {
            try
            {
                string rtn = string.Empty;
                if (string.IsNullOrWhiteSpace(user.UserName))
                {
                    rtn = "账号不能为空!";
                    return(Content(rtn));
                }
                if (user.UserName == WeConfig.robot)
                {
                    rtn = "没有此账号!";
                    return(Content(rtn));
                }
                if (string.IsNullOrWhiteSpace(user.PassWord))
                {
                    rtn = "密码不能为空!";
                    return(Content(rtn));
                }
                if (string.IsNullOrWhiteSpace(user.valiCode))
                {
                    return(Content("验证码不能为空"));
                }
                if (Session["ValidateCode"] == null)
                {
                    rtn = "验证码超时!";
                    return(Content(rtn));
                }
                else
                {
                    if (!user.valiCode.Equals(Session["ValidateCode"]))
                    {
                        rtn = "验证码错误!";
                        return(Content(rtn));
                    }
                }
                string error    = string.Empty;
                string userName = user.UserName;
                string guidCode = DAL.MD5Helper.GetMD5UTF8(Request.UserHostAddress + "," + Guid.NewGuid().ToString());
                user.LoginLastDat = DateTime.Now;
                user.CurrentTime  = user.LoginLastDat.AddSeconds(System.Web.Security.FormsAuthentication.Timeout.TotalSeconds);
                user.LoginLastIp  = Request.UserHostAddress;
                user.GuidCode     = guidCode;

                //业务逻辑(判断和设置)
                Func <B_User, bool, bool> func = (dbUser, usrExists) =>
                {
                    if (usrExists)
                    {
                        TempData["Msg"] = dbUser.UserName + "已下线,请重新登录!";
                    }

                    if (dbUser.IsValid == false)
                    {
                        error = "您的帐号已被禁用,请及时联系管理员!";
                        return(false);
                    }
                    //快捷生成ticket
                    FormsAuthentication.SetAuthCookie(dbUser.UserName, false);
                    HttpCookie cookie = Request.Cookies.Get(BaseAuthorizeHelper.GuidCodeCookieKey);
                    if (cookie == null)
                    {
                        cookie = new HttpCookie(BaseAuthorizeHelper.GuidCodeCookieKey);
                    }
                    cookie.Value = guidCode;
                    Response.Cookies.Add(cookie);
                    return(true);
                };

                if (B_UserManager.Login(user, func))
                {
                    string url = string.Concat("/", this.ControllerContext.RouteData.Values["controller"].ToString(),
                                               "/", this.ControllerContext.RouteData.Values["action"].ToString());

                    SYSLog.add("电脑端后台用户登录", "后台用户" + user.Name + "(" + user.UserName + ")登录,ip为" + Request.UserHostAddress, "/Home/Login", "登录", "电脑端后台");


                    return(Content("ok"));
                }
                rtn = "账号或密码错误";
                if (!string.IsNullOrWhiteSpace(error))
                {
                    rtn = error;
                }
                return(Content(rtn));
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.ToString(), "Login_error");
                return(Content("连接数据库出错"));
            }
        }
示例#12
0
        public ActionResult DirectlyIndex_inport()
        {
            C_UserType usertype = C_UserType.GetMaxLevel_UserType();



            int    idLen = C_User.GetTopUseID().ToString().Length;
            string idDQ  = (C_User.GetTopUseID() + 1).ToString();

            if (idLen < 5)
            {
                string zero = new string('0', 5 - idLen);
                idDQ = zero + idDQ;
            }
            string msg = "";

            try
            {
                var    file = Request.Files[0];
                string path = Request.MapPath("~/");
                string ext  = Path.GetExtension(file.FileName);//获得文件扩展名
                if (!Directory.Exists(Server.MapPath("~/Codetxt/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/Codetxt/"));
                }
                if (file.ContentLength == 0 || file == null)
                {
                    msg = "上传的文件没有内容!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (file.ContentLength > 3242880)
                {
                    msg = "上传的文件不能超过3MB!!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (ext != ".txt")
                {
                    msg = "上传文件格式不对!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                string DatNow = DateTime.Now.ToString("yyyyMMddHHmmss");
                file.SaveAs(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                StreamReader sr = new StreamReader(Server.MapPath("~/Codetxt/" + DatNow + ".txt"), Encoding.Default);
                String       line;
                var          i        = 0;
                int          idDQ_num = 0;
                while ((line = sr.ReadLine()) != null)
                {
                    i++;
                    if (i == 1)
                    {
                        continue;
                    }
                    try
                    {
                        string[] list = line.ToString().Split(',');
                        if (string.IsNullOrWhiteSpace(list[0]) || string.IsNullOrWhiteSpace(list[1]))
                        {
                            continue;
                        }
                        if (C_User.GetPhoneCnt(list[1]) > 0 || C_User.GetNameCnt(list[0]) > 0)
                        {
                            SYSLog.add("导入失败(数据重复):手机号-" + list[1] + "||经销商名称-" + list[0], "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "导入用户", "电脑后台");
                            DAL.Log.Instance.Write("数据重复:手机号-" + list[1] + "||经销商名称-" + list[0], "导入用户失败");
                            continue;
                        }

                        /* var ls = idDQ.Length;
                         * if (Convert.ToInt32(idDQ)==idDQ_num)
                         * {
                         *   idDQ = (idDQ_num + 1).ToString();
                         *   idDQ_num = Convert.ToInt32(idDQ);
                         * }
                         * else
                         * {
                         *   idDQ_num = Convert.ToInt32(idDQ);0
                         * }
                         * if (ls > idDQ.ToString().Length)
                         * {
                         *   int length1 = ls - idDQ.ToString().Length;
                         *   if (length1 == 5) idDQ = "00000" + idDQ;
                         *   if (length1 == 4) idDQ = "0000" + idDQ;
                         *   if (length1 == 3) idDQ = "000" + idDQ;
                         *   if (length1 == 2) idDQ = "00" + idDQ;
                         *   if (length1 == 1) idDQ = "0" + idDQ;
                         * }*/
                        C_User para = new C_User();
                        para.state        = "已审核";
                        para.Chief        = 0;
                        para.C_UserTypeID = 1;
                        para.UserName     = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        //经销商名称 联系人 联系方式 省份 市区 城镇 详细地址

                        para.Name       = list[0];
                        para.Phone      = list[2];
                        para.PassWord   = para.Phone.Substring(para.Phone.Length - 6, 6);
                        para.Card       = "";
                        para.Identifier = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        para.wxNo       = list[1];
                        if (list.Count() > 4)
                        {
                            para.Province = string.IsNullOrWhiteSpace(list[3]) ? "" : list[4];
                        }
                        if (list.Count() > 5)
                        {
                            para.City = string.IsNullOrWhiteSpace(list[4]) ? "" : list[5];
                        }
                        if (list.Count() > 6)
                        {
                            para.Area = string.IsNullOrWhiteSpace(list[5]) ? "" : list[6];
                        }
                        if (list.Count() > 7)
                        {
                            para.WxQRCode = string.IsNullOrWhiteSpace(list[6]) ? "" : list[7];
                        }
                        para.DatCreate = DateTime.Now;
                        if (string.IsNullOrWhiteSpace(para.UserName))
                        {
                            return(Content("经销商编号不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Name))
                        {
                            return(Content("姓名不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Identifier))
                        {
                            return(Content("授权编号不能为空"));
                        }
                        if (RepeatHelper.NoRepeat("C_User", "Identifier", para.Identifier, para.ID) > 0)
                        {
                            return(Content("授权编号已存在"));
                        }



                        para.InsertAndReturnIdentity();
                    }
                    catch (Exception e)
                    {
                        DAL.Log.Instance.Write(e.Message, "导入用户失败");
                        continue;
                    }
                }
                sr.Close();
                System.IO.File.Delete(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                msg = "导入成功!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
            catch
            {
                msg = "导入失败,文件太大!!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
        }