예제 #1
0
        public ActionResult Edit()
        {
            Employer         employer         = GetEmployerDetailsByAccount();
            EmployerRegister employerRegister = employer.GetEmployerRegister();

            CreateDropDownList();   //各个DropDownList生成
            //设置各个ddl个默认选项
            ViewBag.CompanyNature   = new SelectList(ViewBag.CompanyNature, "Value", "Text", employer.CompanyNature);
            ViewBag.CompanyBusiness = new SelectList(ViewBag.CompanyBusiness, "Value", "Text", employer.CompanyBusiness);
            ViewBag.CompanySize     = new SelectList(ViewBag.CompanySize, "Value", "Text", employer.CompanySize);
            ViewBag.CityClass       = new SelectList(ViewBag.CityClass, "Value", "Text", employer.CityClass);
            ViewBag.IsTop500        = new SelectList(ViewBag.IsTop500, "Value", "Text", employer.IsTop500);
            //性别radio选择值
            ViewBag.ContactPersonSex = employerRegister.ContactPersonSex;
            //单位所在地select选择值
            ViewBag.CompanyAreaProvince = employerRegister.CompanyAreaProvince;
            ViewBag.CompanyAreaCity     = employerRegister.CompanyAreaCity;
            //给密码和确认密码解密再显示
            employerRegister.EmployerPwd        = Common.Text.DeCrypt(employerRegister.EmployerPwd);
            employerRegister.ConfirmEmployerPwd = employerRegister.EmployerPwd;
            if (employerRegister == null)
            {
                return(HttpNotFound());
            }
            return(View(employerRegister));
        }
예제 #2
0
        //
        // GET: /Employer/Register

        public ActionResult Register()
        {
            CreateDropDownList();
            EmployerRegister employerRegister = new EmployerRegister();

            return(View(employerRegister));
        }
예제 #3
0
 public ActionResult <EmployerModel> Create(EmployerRegister regEmployer)
 {
     try
     {
         Employer employer = _mapper.Map <Employer>(regEmployer);
         IEmployerDAO <Employer> EmployerDAO   = new EmployerDAO(_connection);
         EmployerModel           employerModel = _mapper.Map <EmployerModel>(EmployerDAO.Create(employer));
         return(Ok(employerModel));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ErrorMessageModel(ex.Message)));
     }
 }
예제 #4
0
        public ActionResult Register(FormCollection collection)
        {
            CreateDropDownList();
            EmployerRegister employerRegister = new EmployerRegister();

            if (ModelState.IsValid)
            {
                #region 得到Request过来的修改信息(22个)
                //账号信息
                employerRegister.EmployerAccount = Request["EmployerAccount"];
                employerRegister.EmployerPwd     = Request["EmployerPwd"]; //注意这里的密码是解密后的,原始密码是加密的
                //联系人信息
                employerRegister.ContactPersonName = Request["ContactPersonName"];
                employerRegister.ContactPersonSex  = Int16.Parse(Request["ContactPersonSex"]);
                employerRegister.FixedTelephone    = Request["FixedTelephone"];
                employerRegister.MobilePhone       = Request["MobilePhone"];
                employerRegister.Email             = Request["Email"];
                //单位基本信息
                employerRegister.CompanyName         = Request["CompanyName"];
                employerRegister.ParentCompanyName   = Request["ParentCompanyName"];
                employerRegister.CompanyIntroduction = Request["CompanyIntroduction"];
                employerRegister.CompanyPhone        = Request["CompanyPhone"];
                employerRegister.OrganizationCode    = Request["OrganizationCode"];

                employerRegister.ValidPeriod       = DateTime.Parse(Request["ValidPeriod"]);
                employerRegister.CompanyNature     = Request["CompanyNature"];
                employerRegister.CompanyBusiness   = Request["CompanyBusiness"];
                employerRegister.CompanySize       = Request["CompanySize"];
                employerRegister.RegisteredCapital = decimal.Parse(Request["RegisteredCapital"]);

                employerRegister.IsTop500            = Int32.Parse(Request["IsTop500"]);
                employerRegister.CompanyAreaProvince = Request["CompanyAreaProvince"];
                employerRegister.CompanyAreaCity     = Request["CompanyAreaCity"];
                employerRegister.CompanyAddress      = Request["CompanyAddress"];
                employerRegister.CityClass           = Request["CityClass"];

                employerRegister.Remark = Request["Remark"];
                //其他字段
                //注册时间。因为默认用datetime2,所以不能直接DateTime.Now
                employerRegister.RegisterTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
                employerRegister.IsDelete     = 2;


                #endregion
                if (FileUploads())
                {
                    //密码加密
                    employerRegister.EmployerPwd = Common.Text.EnCrypt(employerRegister.EmployerPwd);
                    //上传文件成功
                    HttpPostedFileBase uploadFile = Request.Files["file1"] as HttpPostedFileBase;
                    if (uploadFile != null && uploadFile.ContentLength > 0)
                    {
                        //组织机构代码证字段
                        employerRegister.CredentialsDir = fileName;
                        //得到Employer
                        Employer employer = employerRegister.GetEmployer();
                        if (Employer.EmployerInsert(employer))
                        {
                            //Notice _n = new Notice { Title = "注册成功", Details = "您已经成功注册,用户为:" + Request["CompanyName"] + " ,请牢记您的密码!", DwellTime = 5, NavigationName = "列表", NavigationUrl = Url.Action("Index", "Employer") };
                            //return RedirectToAction("Notice", "Prompt", _n);
                            return(RedirectToAction("WaitAudit", "Employer"));
                        }
                        else
                        {
                            Error _e = new Error {
                                Title = "注册失败", Details = "注册失败!请重新注册", Cause = Server.UrlEncode("<li>你注册时在注册页面停留的时间过久页已经超时</li><li>您绕开客户端验证向服务器提交数据</li>"), Solution = Server.UrlEncode("返回<a href='" + Url.Action("Register", "Employer") + "'>注册</a>页面,刷新后重新注册")
                            };
                            return(RedirectToAction("Error", "Prompt", _e));
                        }
                    }
                }
                else
                {
                    return(View(employerRegister));
                }
            }
            return(View());
        }