Exemple #1
0
        public JsonResult Login(string name, string pwd)
        {
            string     txt   = CommonMethod.PasswordMD5("123456");
            ResultInfo info  = new ResultInfo();
            var        model = AccountDBOperate.LoginByMobileOrEmail(name);

            if (model == null)
            {
                info.Message = "该用户未注册"; return(Json(info));
            }
            //var txt = CommonMethod.PasswordMD5("123456");
            if (model.Password != CommonMethod.PasswordMD5(pwd))
            {
                info.Message = "密码错误";
                return(Json(info));
            }
            info.IsSuccess = true;
            //model.AccountId
            if (model.Role == 1)
            {
                var model1 = CustomerCompanyDBOperate.GetCompanyByMember(model.AccountId);
                model.AccountName = model1.Name;
            }
            CookieOperate.AccountCookie = model;
            return(Json(info));
        }
Exemple #2
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public JsonResult Register(AccountRegister account)
        {
            ResultInfo info        = new ResultInfo();
            int        companyId   = CommonMethod.GetInt(ConfigSetting.eeeYoooId);
            string     companyName = ConfigSetting.eeeYoooName;

            account.PassWord = CommonMethod.PasswordMD5(account.PassWord);
            if (AccountDBOperate.GetAccountByMobile(account.Telephone, account.Role))
            {
                info.Message = "手机号已注册";
                return(Json(info));
            }
            if (AccountDBOperate.GetAccountByEmail(account.Email, account.Role))
            {
                info.Message = "邮箱已注册";
                return(Json(info));
            }
            info.IsSuccess = AccountDBOperate.AddAccount(new Dto.CustomerCompany()
            {
                CompanyId   = companyId,
                CompanyName = companyName,
                Address     = account.CompanyAddress,
                City        = account.City,
                Infos       = account.CompanyInfo,
                Name        = account.CompanyName,
                Status      = CustomerCompanyStatusEnum.NotStart.ToString(),
                CreateBy    = account.Name,
            }, new CustomerMember()
            {
                CompanyId   = companyId,
                CompanyName = companyName,
                Email       = account.Email,
                Mobile      = account.Telephone,
                Name        = account.Name,
                CreateBy    = account.Name,
            }, new Account()
            {
                AccountName = account.Name,
                Mobile      = account.Telephone,
                Password    = account.PassWord,
                Email       = account.Email,
                Role        = account.Role,
                CreateBy    = account.Name,
            });
            return(Json(info));
        }
Exemple #3
0
        public JsonResult SaveMemberInfo(CustomerMember member)
        {
            var info    = new ResultInfo();
            var account = CookieOperate.AccountCookie;
            var id      = account.AccountId;
            var data    = CustomerMemberDBOperate.GetModelById(id);

            if (member.Sex != "")
            {
                data.Sex = member.Sex;
            }
            if (member.Name != "")
            {
                data.Name = member.Name; account.AccountName = member.Name;
            }
            if (member.Job != "")
            {
                data.Job = member.Job;
            }
            if (member.Email != "")
            {
                data.Email = member.Email; account.Email = member.Email;
            }
            if (member.Mobile != "")
            {
                data.Mobile = member.Mobile; account.Mobile = member.Mobile;
            }
            info.IsSuccess = CustomerMemberDBOperate.ModifyCustomerMember(data);
            AccountDBOperate.ModifyAccount(account);
            if (info.IsSuccess)
            {
                info.Message = "修改成功";
            }
            else
            {
                info.Message = "修改失败";
            }
            return(Json(info));
        }
Exemple #4
0
        public JsonResult ModifyAccountPwd()
        {
            ResultInfo info = new ResultInfo();
            var        flag = false;

            string old    = CommonMethod.GetString(Request["OldPwd"]);
            string newPwd = CommonMethod.GetString(Request["NewPwd"]);

            if (CookieOperate.AccountCookie.Password != CommonMethod.PasswordMD5(old))
            {
                info.Message = "旧密码错误";
            }
            var account = CookieOperate.AccountCookie;

            account.Password = CommonMethod.PasswordMD5(newPwd);
            flag             = AccountDBOperate.ModifyAccount(account);
            if (flag)
            {
                CookieOperate.AccountCookie = null;
                info.Message = "修改成功,请重新登录"; info.IsSuccess = true;
            }
            return(Json(info));
        }
Exemple #5
0
        public JsonResult AddProject(ProjectRegister account)
        {
            ResultInfo info        = new ResultInfo();
            int        companyId   = CommonMethod.GetInt(ConfigSetting.eeeYoooId);
            string     companyName = ConfigSetting.eeeYoooName;

            account.PassWord = CommonMethod.PasswordMD5(account.PassWord);
            if (AccountDBOperate.GetAccountByMobile(account.Telephone, account.Role))
            {
                info.Message = "手机号已注册";
                return(Json(info));
            }
            if (AccountDBOperate.GetAccountByEmail(account.Email, account.Role))
            {
                info.Message = "邮箱已注册";
                return(Json(info));
            }
            var list = new List <PersonSetting>()
            {
            };
            var roles   = account.RoleId.Split(',');
            var joblist = JobListDBOperate.GetPublishList();

            foreach (var item in roles)
            {
                var job = joblist.FirstOrDefault(a => a.Id == Convert.ToInt32(item));
                if (job == null)
                {
                    continue;
                }
                var personSetting = new PersonSetting()
                {
                    CreateBy = account.Name, DepartId = Convert.ToInt32(item), DepartName = job.Name, Discount = 100, Month = account.Month, Price = job.Price, TotalPrice = job.Price * account.Month
                };
                list.Add(personSetting);
            }


            info.IsSuccess = AccountDBOperate.AddAccount(new Dto.CustomerCompany()
            {
                CompanyId     = companyId,
                CompanyName   = companyName,
                Address       = account.CompanyAddress,
                City          = account.City,
                Infos         = account.CompanyInfo,
                Name          = account.CompanyName,
                Status        = CustomerCompanyStatusEnum.NotStart.ToString(),
                CreateBy      = account.Name,
                TeamDesc      = account.TeamDesc,
                CompanyStatus = account.CompanyStatus,
                PartInfo      = account.PartInfo
            }, new CustomerMember()
            {
                CompanyId   = companyId,
                CompanyName = companyName,
                Email       = account.Email,
                Mobile      = account.Telephone,
                Name        = account.Name,
                CreateBy    = account.Name,
                Address     = account.MemberAddress
            }, new Account()
            {
                AccountName = account.Name,
                Mobile      = account.Telephone,
                Password    = account.PassWord,
                Email       = account.Email,
                Role        = account.Role,
                CreateBy    = account.Name,
            }, new ProjectManage()
            {
                CompanyId      = companyId,
                FullName       = account.ProjectName,
                Name           = account.ProjectName,
                CusCompanyName = account.CompanyName,
                CusMemberName  = account.Name,
                //LastPayDate = account.EndTime,
                Infos     = account.Info,
                IsDeleted = 0,
                Money     = 0,
                PayWay    = ProjectPayWayEnum.UnKnown.ToString(),
                //RelStartTime = account.StartTime,
                //StartTime = account.StartTime,
                EndTime = account.EndTime,
                Source  = SourceEnum.PC.ToString(),
                //RelEndTime = account.EndTime,
                Status         = CustomerCompanyStatusEnum.NotStart.ToString(),
                OpereateType   = account.OpereateType,
                DevLanguate    = account.DevLanguate,
                DevType        = account.DevType,
                NowStatus      = account.NowStatus,
                MarketProspect = account.MarketProspect,
                Month          = account.Month
            }, new HardWare()
            {
                CreateBy = account.Name,
                Infos    = account.HardWare
            }, list);
            //AccountDBOperate.LoginByMobileOrEmail(account.Telephone);
            return(Json(info));
        }