コード例 #1
0
        public void InsertTest()
        {
            Employer employer = new Employer();

            Byte[] arrBYTE = new Byte[10000];

            employer.UserName = "******";
            employer.Password = "******";
            employer.RepresentativeFirstName = "Joe";
            employer.RepresentativeLastName  = "Joe";
            employer.Email            = "*****@*****.**";
            employer.Industry         = "Clowning";
            employer.OrganizationName = "Clown Store";
            employer.Phone            = "888-888-8888";
            employer.ProfilePicture   = arrBYTE;

            employer.EmployerInsert();

            ITIndeedEntities dc = new ITIndeedEntities();

            var users         = dc.tblUsers;
            int expectedUsers = 8;
            int actualUsers   = users.Count();


            var employers = dc.tblEmployers;

            int expectedEmployers = 5;

            int actualEmployers = employers.Count();

            Assert.AreEqual(expectedEmployers + expectedUsers, actualEmployers + actualUsers);
        }
コード例 #2
0
        public ActionResult Create(Employer e)
        {
            try
            {
                // TODO: Add insert logic here
                e.EmployerInsert();

                return(RedirectToAction("../Content/Theme/index.html"));
            }
            catch
            {
                return(View(e));
            }
        }
コード例 #3
0
        public ActionResult Create(Employer e)
        {
            try
            {
                if (e.UploadedImageFile != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        e.UploadedImageFile.InputStream.CopyTo(ms);
                        e.ProfilePicture = ms.GetBuffer();
                        ms.Close();
                    }
                }

                e.EmployerInsert();
                SendEmail(e.Email);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(e));
            }
        }
コード例 #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());
        }