コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string  username = txtUser.Text;
            string  password = txtPass.Text;
            EC_User user     = new EC_User();
            C_User  active   = new C_User();

            try
            {
                user.UserName = username;
                user.Password = password;
                if (active.CheckUser(username, password))
                {
                    MessageBox.Show("Đăng Nhập Thành Công", "Chúc Mừng", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    user.PhanQuyen = active.LoadPhanQuyen(user.PhanQuyen, username);
                    user.MaNV      = active.LoadMaNVUser(user.MaNV, user.UserName);
                    fmain.Access   = user.PhanQuyen;
                    fmain.User     = user;
                    this.Hide();
                    fmain.Show();
                }
                else
                {
                    MessageBox.Show("Tài khoản đăng nhập chưa đúng. Vui lòng kiểm tra lại.", "Chú Ý", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtUser.Text = "";
                    txtPass.Text = "";
                    txtUser.Focus();
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public ActionResult Change_password(FormCollection collection)
        {
            UserModels sv = new UserModels();
            C_User     it = new C_User();

            var login_view = new Login_view();

            this.TryUpdateModel(login_view);
            login_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            if (login_view.Is_change == 1 && string.IsNullOrEmpty(login_view.Confirm_code))
            {
                ////user change password
                it = sv.GetUserbyUserName(login_view.User_name);
                if (it != null && MD5Extend.EncodePassword(login_view.Old_password) == it.Password)
                {
                    if (login_view.Password == login_view.Confirm_password)
                    {
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }

                return(this.Redirect(login_view.Return_url));
            }
            else if (login_view.Is_change == 0 && (!string.IsNullOrEmpty(login_view.Confirm_code)))
            {
                ////client reset pasword
                if (MD5Extend.EncodePassword(login_view.Code + " " + login_view.User_name) == login_view.Confirm_code)
                {
                    if (login_view.Password == login_view.Confirm_password)
                    {
                        it          = sv.GetUserbyUserName(login_view.User_name);
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }
                else
                {
                    login_view.Message = App_GlobalResources.Lang.strMessageErrorConfirmCode;
                }

                return(this.PartialView("../page/change_password", login_view));
            }
            else
            {
                return(this.PartialView("../page/change_password", login_view));
            }
        }
コード例 #3
0
ファイル: C_UserController.cs プロジェクト: Haute998/WalkTd
        public ActionResult GetChangeUserChiefIndex(int ID)
        {
            C_User cUser = C_User.GetEntityByID(ID);

            ViewBag.User = cUser;
            return(View());
        }
コード例 #4
0
        public ActionResult Change_password(FormCollection collection)
        {
            UserModels sv = new UserModels();
            C_User     it = new C_User();
            string     strBread;

            ViewBag.Title           = App_GlobalResources.Lang.strChangePassword + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.strChangePassword + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.strChangePassword;
            ViewBag.str_breadcrumbs = strBread;

            var login_view = new Login_view();

            this.TryUpdateModel(login_view);
            login_view.ParentAction     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.ParentController = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            if (login_view.IsChange == 1 && string.IsNullOrEmpty(login_view.ConfirmCode) && (!string.IsNullOrEmpty(login_view.Password)) && (!string.IsNullOrEmpty(login_view.ConfirmPassword)))
            {
                ////user change password
                it = sv.GetUserbyUserName(login_view.UserName);
                if (it != null && MD5Extend.EncodePassword(login_view.OldPassword) == it.Password)
                {
                    if (login_view.Password == login_view.ConfirmPassword)
                    {
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }
            }
            else if (login_view.IsChange == 0 && (!string.IsNullOrEmpty(login_view.ConfirmCode)) && (!string.IsNullOrEmpty(login_view.Password)) && (!string.IsNullOrEmpty(login_view.ConfirmPassword)))
            {
                ////client reset pasword
                if (MD5Extend.EncodePassword(login_view.Code + " " + login_view.UserName) == login_view.ConfirmCode)
                {
                    if (login_view.Password == login_view.ConfirmPassword)
                    {
                        it          = sv.GetUserbyUserName(login_view.UserName);
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }
                else
                {
                    login_view.Message = App_GlobalResources.Lang.strMessageErrorConfirmCode;
                }
            }

            return(this.PartialView("../page/change_password", login_view));
        }
コード例 #5
0
        /// <summary>
        /// Logouts this instance.
        /// </summary>
        /// <returns>the logout</returns>
        public ActionResult Logout()
        {
            try
            {
                UserModels sv = new UserModels();
                C_User     it = new C_User();
                it.Username = Session["mem"].ToString();
                it          = sv.GetUserbyUserName(it.Username);
                if (it.Role != 1)
                {
                    it.Online = false;
                }

                it.IP = HttpContext.Request.ServerVariables["REMOTE_ADDR"].ToString();
                sv.Update_User(it);
                this.Session["acc"]  = null;
                this.Session["mem"]  = null;
                this.Session["role"] = null;
                string[] myCookies = Request.Cookies.AllKeys;
                foreach (string ck in myCookies)
                {
                    var check = Request.Cookies[ck].Expires;
                    Response.Cookies[ck].Expires = DateTime.Now.AddDays(-1);
                }
            }
            catch
            {
                return(this.RedirectToAction("index", "home"));
            }

            return(this.RedirectToAction("index", "home"));
        }
コード例 #6
0
        public RequestResult GetUpdateNewList(int Timestamp)
        {
            RequestResult result = new RequestResult();

            try
            {
                List <C_Interface> CUser = C_User.Getusername(Timestamp);

                List <Customer> CusList = new List <Customer>();
                foreach (C_Interface user in CUser)
                {
                    Customer cus = new Customer();
                    cus.CusNo   = user.UserName;
                    cus.CusName = user.Name;
                    CusList.Add(cus);
                }

                result.data    = CusList;
                result.message = "成功";
                result.success = true;

                PDALog.Write("更新客户列表", "获取", "", PdaUser.PUserName + "-" + PdaUser.PRealName, string.Format("Timestamp:{0}", Timestamp), result.message);
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = "服务出错";
                result.success = false;
                DAL.Log.Instance.Write("获取最新客户列表出错:" + ex.Message, "PDA上传出错");
            }
            return(result);
        }
コード例 #7
0
        public RequestResult QueryList(string KeyWords)
        {
            RequestResult result = new RequestResult();

            try
            {
                List <C_Interface> CUser = C_User.Getusername(KeyWords);

                List <Customer> CusList = new List <Customer>();
                foreach (C_Interface user in CUser)
                {
                    Customer cus = new Customer();
                    cus.CusNo   = user.UserName;
                    cus.CusName = user.Name;
                    CusList.Add(cus);
                }

                result.data    = CusList;
                result.message = "成功";
                result.success = true;

                PDALog.Write("查询客户", "查询", "", PdaUser.PUserName + "-" + PdaUser.PRealName, string.Format("KeyWords:{0}", KeyWords), result.message);
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = "服务出错";
                result.success = false;
                DAL.Log.Instance.Write("客户查询出错:" + ex.Message, "PDA上传出错");
            }

            return(result);
        }
コード例 #8
0
        /// <summary>
        /// Logouts this instance.
        /// </summary>
        /// <returns>the logout</returns>
        public ActionResult Logout()
        {
            if (this.CheckAdminlogin())
            {
                UserModels sv = new UserModels();
                C_User     it = new C_User();
                it.Username = Session["mem"].ToString();
                it          = sv.GetUserbyUserName(it.Username);
                it.IP       = HttpContext.Request.ServerVariables["REMOTE_ADDR"].ToString();
                sv.Update_User(it);
                this.Session["acc"]  = string.Empty;
                this.Session["mem"]  = string.Empty;
                this.Session["role"] = string.Empty;
                string[] myCookies = Request.Cookies.AllKeys;
                foreach (string ck in myCookies)
                {
                    var check = Request.Cookies[ck].Expires;
                    Response.Cookies[ck].Expires = DateTime.Now.AddDays(-1);
                }

                return(this.RedirectToAction("login", "dashboard"));
            }
            else
            {
                return(this.RedirectToAction("login", "dashboard"));
            }
        }
コード例 #9
0
ファイル: MyCenterController.cs プロジェクト: Haute998/WalkTd
        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":"修改密码失败"));
        }
コード例 #10
0
        /// <summary>
        /// Updates the user.
        /// </summary>
        /// <param name="user">user object.</param>
        /// <returns>Updates the user</returns>
        public string Update_User(C_User user)
        {
            using (var data = new Entities())
            {
                string rt = string.Empty;
                try
                {
                    var c_gen = data.C_User.Where(p => p.Username == user.Username).FirstOrDefault();
                    c_gen.Password  = user.Password;
                    c_gen.Role      = user.Role;
                    c_gen.Online    = user.Online;
                    c_gen.IP        = user.IP;
                    c_gen.LastLogin = user.LastLogin;

                    data.SaveChanges();
                    rt = user.Username;
                }
                catch (Exception)
                {
                    rt = string.Empty;
                }

                return(rt);
            }
        }
コード例 #11
0
        public RequestResult AddUser(int typeid, string name, string contact, string phone, string area, string address)
        {
            RequestResult result = new RequestResult();

            try
            {
                #region 验证
                string msg  = string.Empty;
                bool   IsOK = VerifyAddInfo(typeid, name, contact, phone, area, address, out msg);
                if (!IsOK)
                {
                    result.message = msg;
                    result.success = false;
                    return(result);
                }
                #endregion

                C_User user = new C_User();
                user.C_UserTypeID = typeid;
                user.Name         = name;
                user.wxNo         = contact;
                user.Phone        = phone;

                string[] AreaArray = area.Split(',');
                user.Province     = AreaArray[0] != null ? AreaArray[0] : "";
                user.City         = AreaArray[1] != null ? AreaArray[1] : "";
                user.Area         = AreaArray[2] != null ? AreaArray[2] : "";
                user.WxQRCode     = address;
                user.DatPwdChange = DateTime.Now;
                user.DatCreate    = DateTime.Now;
                user.IsValid      = true;
                user.PassWord     = user.Phone.Substring(user.Phone.Length - 6, 6);
                user.Chief        = MobileUser.ID;
                user.state        = "已审核";
                user.ID           = user.InsertAndReturnIdentity();

                C_UserType usertype = C_UserType.GetEntityByLever(typeid);
                int        idLen    = user.ID.ToString().Length;
                string     idDQ     = user.ID.ToString();
                if (idLen < 5)
                {
                    string zero = new string('0', 5 - idLen);
                    idDQ = zero + idDQ;
                }
                user.UserName   = usertype.TypeCode + idDQ;
                user.Identifier = usertype.TypeCode + idDQ;
                user.UpdateByID();

                result.data    = user.ID;
                result.message = "成功";
                result.success = true;
            }
            catch (Exception ex)
            {
                result.message = "失败,error:" + ex.Message;
                result.success = false;
            }
            return(result);
        }
コード例 #12
0
        public ActionResult Index1(string ID)
        {
            try
            {
                string O_ID          = "Beware of fake products without authorization";
                string ProductNumber = "Beware of fake products without authorization";
                string ProductName   = "Beware of fake products without authorization";
                string Name          = "Beware of fake products without authorization";
                string Province      = "Beware of fake products without authorization";
                string DatCreate     = "Beware of fake products without authorization";
                if (!string.IsNullOrWhiteSpace(ID))
                {
                    List <ScaleOutStoke> Scale = ScaleOutStoke.GetSmallScaleList(ID);
                    if (Scale.Count > 0)
                    {
                        ScaleOutStokeShow show = ScaleOutStoke.GetProductC_UserByBig(ID);
                        if (show != null)
                        {
                            Name          = show.Name;
                            ProductName   = show.ProductName;
                            ProductNumber = show.ProductNumber;
                            O_ID          = show.OutOrderNo;

                            C_User user = C_User.GetC_UserByUserName(show.Consignee);
                            Province  = user == null ? "" : user.Province + user.City;
                            DatCreate = CommonFunc.GetDateTimeFromTimestamp(show.CreateTime).ToString("yyyy-MM-dd");
                        }
                    }
                    else
                    {
                        ScaleOutStokeShow showbig = ScaleOutStoke.GetProductC_UserByBig(ID);
                        if (showbig != null && showbig.Name != null && showbig.ProductName != null)
                        {
                            Name          = showbig.Name;
                            ProductName   = showbig.ProductName;
                            ProductNumber = showbig.ProductNumber;
                            O_ID          = showbig.OutOrderNo;

                            C_User user = C_User.GetC_UserByUserName(showbig.Consignee);

                            Province  = user == null ? "" : user.Province + user.City;
                            DatCreate = CommonFunc.GetDateTimeFromTimestamp(showbig.CreateTime).ToString("yyyy-MM-dd");
                        }
                    }
                }

                ViewData["O_ID"]          = O_ID;
                ViewData["ProductNumber"] = ProductNumber;
                ViewData["ProductName"]   = ProductName;
                ViewData["Name"]          = Name;
                ViewData["Province"]      = Province;
                ViewData["DatCreate"]     = DatCreate;
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.Message, "查询出错!");
            }
            return(View());
        }
コード例 #13
0
        public override void ExecuteCommand(GRSession session, StringRequestInfo requestInfo)
        {
            string req = string.Join("", requestInfo.Parameters);
            C_User ac  = JsonConvert.DeserializeObject <C_User>(req);

            C_DbTabUser.Delete(ac);
            session.Send(API_ID.API_DeleteUser, RES_STATE.FAILED);
        }
コード例 #14
0
 public ActionResult GetOptionTree(int ID)
 {
     if (!string.IsNullOrWhiteSpace(C_User.GetOptionTreeMenu(ID)))
     {
         return(Json(C_User.GetOptionTreeMenu(ID), JsonRequestBehavior.AllowGet));
     }
     return(Json("", JsonRequestBehavior.AllowGet));;
 }
コード例 #15
0
        //
        // GET: /agentback/

        public ActionResult Index()
        {
            ViewData["user"]           = C_UserVM.GetVMByID(CurrentUser.ID);
            ViewData["C_UserNoVerity"] = C_User.GetC_UserCircles(CurrentUser.ID);
            //ViewData["OrderNoVerity"] = Order.GetC_UserCircles(CurrentUser.UserName);
            ViewData["Upgrade"] = C_UserUpGrade.GetCountUpGrade(CurrentUser.UserName);
            return(View());
        }
コード例 #16
0
ファイル: C_UserController.cs プロジェクト: Haute998/WalkTd
        public ActionResult GetUserDelete(int ID)
        {
            C_User cuser = C_User.GetEntityByID(ID);

            C_User.GetUpdateChief(cuser.Chief, ID);
            int rtn = C_User.DeleteByID(ID);

            return(Content(rtn > 0 ? "ok" : "删除出错了!!"));
        }
コード例 #17
0
ファイル: C_UserController.cs プロジェクト: Haute998/WalkTd
        public ActionResult GetUserBlack(int ID)
        {
            C_User cuser = C_User.GetEntityByID(ID);

            C_User.GetUpdateChief(cuser.Chief, ID);
            int rtn = C_User.GetUpdateStateBlack(ID);

            return(Content(rtn > 0 ? "ok" : "拉黑出错了!!"));
        }
コード例 #18
0
        public ActionResult EditTo(FormCollection c)
        {
            C_User user = C_User.GetC_UserByUserName(c["UserName"].ToString());

            if (user == null)
            {
                return(Content("没有找到用户信息"));
            }
            string addressStr = c["PCAs"];

            if (string.IsNullOrWhiteSpace(addressStr))
            {
                return(Content("请选择所在地"));
            }
            string[] addre = addressStr.Split(',');

            for (int i = 0; i < addre.Length; i++)
            {
                if (i == 0)
                {
                    user.Province = addre[i];
                }
                else if (i == 1)
                {
                    user.City = addre[i];
                }
                else if (i == 2)
                {
                    user.Area = addre[i];
                }
            }

            user.Phone = c["Phone"];
            if (user.Phone.Length != 11)
            {
                return(Content("手机号有误"));
            }
            if (C_User.GetPhoneCnt(user.Phone, user.UserName) > 0)
            {
                return(Content("该手机号已存在"));
            }
            user.DatPwdChange = DateTime.Now;
            user.UpdateTime   = CommonFunc.GetNowTimestamp();
            user.Name         = c["Name"];
            user.WxQRCode     = c["WxQRCode"];
            user.PassWord     = user.Phone.Substring(user.Phone.Length - 6, 6);
            user.wxNo         = c["wxNo"];

            if (user.UpdateByID() > 0)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("保存出错"));
            }
        }
コード例 #19
0
        public ActionResult YJCustomerPieCensus(string key)
        {
            string value = C_User.YJGetPieC_UserCountCensus(key);

            if (string.IsNullOrWhiteSpace(value))
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
コード例 #20
0
ファイル: MainController.cs プロジェクト: Haute998/WalkTd
        public ActionResult CusomerCensus()
        {
            string value = C_User.GetC_UserCountCennsus();

            if (string.IsNullOrWhiteSpace(value))
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
コード例 #21
0
        public ActionResult GetOptionTree(string ID)
        {
            string SelVal = C_User.GetOptionDisTreeMenu(ID);

            if (!string.IsNullOrWhiteSpace(SelVal))
            {
                return(Json(SelVal, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
ファイル: MainController.cs プロジェクト: Haute998/WalkTd
        public ActionResult CustomerPie_cxySex_Census(string type)
        {
            string value = C_User.GetPieCustomerCountCensus(type);

            if (string.IsNullOrWhiteSpace(value))
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
コード例 #23
0
        public ActionResult GetUserMsg(int ID)
        {
            SearchZtree data = C_User.GetOptionTreeUserMsg(ID);

            if (data != null)
            {
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));;
        }
コード例 #24
0
ファイル: C_UserController.cs プロジェクト: Haute998/WalkTd
        public ActionResult GetVerify(int ID)
        {
            C_User cUser = C_User.GetEntityByID(ID);

            cUser.state     = "已审核";
            cUser.DatVerify = DateTime.Now;
            int rtn = cUser.UpdateByID();

            return(Content(rtn > 0 ? "ok" : "出错了!!"));
        }
コード例 #25
0
        public static Tuple <E_DbRState, Exception> Add(C_User user)
        {
            string cmd = "insert into grims.user (name,pwd,deptId,tel,email) values('" + user.Name + "'" +
                         ",'" + user.Pwd +
                         "','" + C_DbTabDept.GetIdByName(user.DeptName).Item2 +
                         "','" + user.Tel +
                         "','" + user.Email +
                         "');";

            return(C_Db.Exec(cmd));
        }
コード例 #26
0
ファイル: C_UserManage.cs プロジェクト: rinkako/Agenda
 public bool deleteUser(C_User user)
 {
     foreach (C_User iter in users_)
     {
         if (iter.getName() == user.getName())
         {
             users_.Remove(iter);
             return true;
         }
     }
     return false;
 }
コード例 #27
0
ファイル: C_AgendaService.cs プロジェクト: rinkako/Agenda
 public bool deleteUser(C_User user)
 {
     List<C_Meeting> _mlist;
     _mlist = listAllMeetings(user.getName());
     if (_mlist.Count == 0) {
         return (userManage_.deleteUser(user));
     }
     else
     {
         return false;
     }
 }
コード例 #28
0
ファイル: C_UserController.cs プロジェクト: Haute998/WalkTd
        public ActionResult GetChangeChiefBy(int id, int OldId)
        {
            int count = C_User.GetChiefInt(OldId);

            if (count <= 0)
            {
                return(Content("您没有下级,无法转移!!"));
            }
            int rtn = C_User.GetUpdateChief(id, OldId);

            return(Content(rtn > 0 ? "ok" : "出错了!!"));
        }
コード例 #29
0
        public ActionResult Login(string user_name, string password, string return_url, bool?remember_me)
        {
            var        login_view = new Login_view();
            UserModels sv         = new UserModels();
            C_User     it         = new C_User();

            login_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            it = sv.GetUserbyUserName(user_name);
            if (remember_me == null)
            {
                remember_me = false;
            }

            if (it != null && MD5Extend.EncodePassword(password) == it.Password)
            {
                this.Session["mem"]  = user_name;
                this.Session["role"] = it.Role.ToString();
                it.IP        = HttpContext.Request.ServerVariables["REMOTE_ADDR"].ToString();
                it.LastLogin = DateTime.Now;

                ////Client only : If Online = true is client online else is offline
                if (it.Role.ToString() == "2")
                {
                    login_view.Message    = App_GlobalResources.Lang.mess403;
                    login_view.Return_url = return_url;

                    return(this.PartialView("../page/login", login_view));
                }
                else if (it.Role.ToString() == "1" && it.Online == true)
                {
                    ////Admin only : If Online = true is active else is disable login
                    sv.Update_User(it);
                    this.Session["acc"] = user_name;
                    this.SetAccountCookies(user_name, user_name, it.Role.ToString(), 12);

                    return(this.RedirectToAction("index", "dashboard", new { area = "admin" }));
                }
                else
                {
                    login_view.Message    = App_GlobalResources.Lang.mess403;
                    login_view.Return_url = return_url;
                    return(this.PartialView("../page/login", login_view));
                }
            }
            else
            {
                login_view.Message    = App_GlobalResources.Lang.messLoginFail;
                login_view.Return_url = return_url;
                return(this.PartialView("../page/login", login_view));
            }
        }
コード例 #30
0
ファイル: MyInfoController.cs プロジェクト: Haute998/WalkTd
        public ActionResult UpMyWxQRCode(FormCollection c)
        {
            C_User cuser = C_User.GetEntityByID(CurrentUser.ID);
            //根据前台html的name获取文件
            HttpPostedFileBase upfile = Request.Files["file_temporaryImage"];

            if (upfile == null)
            {
                return(Content("您没有选择文件"));
            }
            string oldMediaName = upfile.FileName;

            //判断文件大小是否符合要求
            if (upfile.ContentLength >= (5242880))
            {
                return(Content("请上传5M以内的文件!"));
            }

            string imgName = DateTime.Now.ToString("hhmmss") + DateTime.Now.Ticks;
            string ext     = Path.GetExtension(upfile.FileName);//获得文件扩展名
            bool   flag    = false;

            string oldQRCode = cuser.WxQRCode;

            cuser.WxQRCode = "/images/MyWxQRCode/" + imgName + ext;
            cuser.UpdateByID();
            try
            {
                if (!Directory.Exists(Server.MapPath("~/images/MyWxQRCode")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/images/MyWxQRCode"));
                }
                upfile.SaveAs(Server.MapPath("~" + cuser.WxQRCode));
                flag = true;


                System.IO.File.Delete(Server.MapPath("~") + oldQRCode);
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.ToString(), "MyWxQRCode_error");
            }

            if (flag)
            {
                return(Content("ok"));
            }
            else
            {
                return(Content("保存出错"));
            }
        }
コード例 #31
0
        //// GET: api/Auth
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        //// GET: api/Auth/5
        //public string Get(int id)
        //{
        //    return "value";
        //}

        // POST: api/Auth
        public bool Post([FromBody] RegisterForm form)
        {
            C_User user = new C_User()
            {
                LastName  = form.LastName,
                FirstName = form.FirstName,
                Email     = form.Email,
                Passwd    = form.Passwd,
                Genre     = form.Genre,
            };

            return(_authRepository.Register(user));
        }
コード例 #32
0
 public static G_User ToGlobal(this C_User user)
 {
     return(new G_User()
     {
         Id = user.Id,
         LastName = user.LastName,
         FirstName = user.FirstName,
         Email = user.Email,
         IsValid = user.IsValid,
         Genre = user.Genre,
         Passwd = user.Passwd
     });
 }
コード例 #33
0
ファイル: C_UserManage.cs プロジェクト: rinkako/Agenda
 public bool createUser(string userName,
                        string userPassword,
                        string userEmail,
                        string userPhone)
 {
     foreach (C_User iter in users_)
     {
         if (iter.getName() == userName)
         {
             return false;
         }
     }
     // create
     C_User tnode = new C_User(userName, userPassword, userEmail, userPhone);
     users_.Add(tnode);
     return true;
 }
コード例 #34
0
ファイル: C_FileManage.cs プロジェクト: rinkako/Agenda
 public List<C_User> readUsersFromFile()
 {
     List<C_User> t_list = new List<C_User>();
     string t_name, t_pwd, t_email, t_phone;
     try
     {
         FileStream aFile = new FileStream(userFileName_, FileMode.OpenOrCreate);
         StreamReader sr = new StreamReader(aFile);
         string strline = sr.ReadLine();
         while (strline != null)
         {
             t_name = strline;
             t_pwd = sr.ReadLine();
             t_email = sr.ReadLine();
             t_phone = sr.ReadLine();
             // NEXT LOOP
             strline = sr.ReadLine();
             C_User t_user = new C_User(t_name, t_pwd, t_email, t_phone);
             t_list.Add(t_user);
         }
         sr.Close();
         aFile.Close();
     }
     catch (IOException ex)
     {
         MessageBox.Show("FILE READ ERROR !" + ex.ToString() + " occured!");
     }
     return t_list;
 }