public ActionResult Sc2(HttpPostedFileBase file) { #region 获取从图片上传的数据 engage_resume_Model er = new engage_resume_Model(); er.human_name = Request["human_name"]; er.engage_type = Request["engage_type"]; er.human_address = Request["human_address"]; er.human_postcode = Request["human_postcode"]; er.human_major_kind_id = Request["human_major_kind_id"]; er.human_major_kind_name = Request["human_major_kind_name"]; er.human_major_id = Request["human_major_id"]; er.human_major_name = Request["human_major_name"]; er.human_telephone = Request["human_telephone"]; er.human_homephone = Request["human_homephone"]; er.human_mobilephone = Request["human_mobilephone"]; er.human_email = Request["human_email"]; er.human_hobby = Request["human_hobby"]; er.human_specility = Request["human_specility"]; er.human_sex = Request["human_sex"]; er.human_religion = Request["human_religion"]; er.human_party = Request["human_party"]; er.human_nationality = Request["human_nationality"]; er.human_race = Request["human_race"]; er.human_birthday = DateTime.Parse(Request["human_birthday"]); er.human_age = int.Parse(Request["human_age"]); er.human_educated_years = int.Parse(Request["human_educated_years"]); er.human_educated_major = Request["human_educated_major"]; er.human_college = Request["human_college"]; er.human_idcard = Request["human_idcard"]; er.human_birthplace = Request["human_birthplace"]; er.demand_salary_standard = double.Parse(Request["demand_salary_standard"]); er.human_history_records = Request["human_history_records"]; er.remark = Request["remark"]; er.regist_time = DateTime.Parse(Request["regist_time"]); er.human_educated_degree = Request["human_educated_degree"]; er.register = Request["register"]; er.check_status = 1; #endregion string name = Md5String.Md5CreateName(file.InputStream); //文件名 string ext = Path.GetExtension(file.FileName); //后缀名 //1 获得上传文件的完整路径 string path = $"~/Phone/{DateTime.Now.ToString("yyyy/MM/dd")}/" + name + ext; string fullPath = Server.MapPath(path); new FileInfo(fullPath).Directory.Create();//创建文件夹 //2 调用file.SaveAs(完整路径) file.SaveAs(fullPath); er.human_picture = $"/Phone/{ DateTime.Now.ToString("yyyy/MM/dd")}/" + name + ext; //根据uid做表的修改 if (r.engage_resumeAdd(er) > 0) { return(Content("<script>alert('登记成功');window.location.href ='/position_release_search/Index'</script>")); } else { return(View(er)); } }
public void RegsiterUser(string account, string username, string description, string password1, string password2) { if (password1 != password2) { throw new UserException("2次密码输入不一致"); } if (password1.Length < 6) { throw new UserException("密码最小长度为6位"); } if (AccountExist(account)) { throw new UserException("用户名已经存在"); } UserSimp userSimp = new UserSimp() { Account = account, UserName = username, DelFlag = DelFlag.Normal, //头像,我们给一个默认值 Head = @"E:\ShareYou\ShareYou\Content\Image\Head\2c8d94e6-3d6b-4b61-8150-c3d3790b9ab8.png", //第一级的会员 MemberId = 0, //进行md5加密操作 Password = Md5String.GetMd5String(password1), }; UserInfo userinfo = new UserInfo() { Description = description, Email = "", EmailValidateCode = "", DelFlag = DelFlag.Normal, IsValide = EmailValide.NotValide, Follower = 0, Follow = 0, Liked = 0, Number = "", }; //异常继续往上抛出 DbSession.UserDal.AddUser(userSimp, userinfo); }
private void RememeberMe(string account, string md5Password, bool state) { if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(md5Password)) { throw new ArgumentNullException("用户名或者密码为空", innerException: null); } HttpCookie cookie1 = new HttpCookie("ck1", account); HttpCookie cookie2 = new HttpCookie("ck2", Md5String.GetMd5String(md5Password)); if (state) { cookie1.Expires = DateTime.Now.AddDays(7); cookie2.Expires = DateTime.Now.AddDays(7); } else { cookie1.Expires = DateTime.Now.AddDays(-7); cookie2.Expires = DateTime.Now.AddDays(-7); } Response.Cookies.Add(cookie1); Response.Cookies.Add(cookie2); }
//如果需要另外的Service来解决,必须new 对象出来,不然存在一个循环引用的问题,但是还是有好处的,就是避免了创建过多的对象出来 public UserSimp Login(string account, string password) { if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(password)) { throw new UserException("密码或者账号为空,请重新输入"); } if (!AccountExist(account)) { throw new UserException("账户不存在,大兄弟!"); } DelFlag status = (DelFlag)Convert.ToInt32(DbSession.UserDal.GetUserStatus(account)); //可能存在异常,我们继续往上抛出 if (status == DelFlag.Deleted) //账户被删除 { throw new UserException("此用户已被删除,请申诉或者重新申请账户"); } if (status == DelFlag.Freeze) { throw new UserException("当前账户被冻结"); } //可以获取用户信息 UserSimp model = null; if (Md5String.GetMd5String(password) == DbSession.UserDal.GetPassword(account).ToString()) { //表示信息校验成功 //出现的异常继续往上抛出 model = DbSession.UserDal.GetUserSimp(account); } else { //密码错误,出现异常了 throw new UserException("用户密码错误"); } return(model); }
public ActionResult WJSC1(int uid, HttpPostedFileBase file) { string name = Md5String.Md5CreateName(file.InputStream); //文件名 string ext = Path.GetExtension(file.FileName); //后缀名 //1 获得上传文件的完整路径 string path = $"/Uploader/{DateTime.Now.ToString("yyyy/MM/dd")}/" + name + ext; string fullPath = Server.MapPath(path); new FileInfo(fullPath).Directory.Create();//创建文件夹 //2 调用file.SaveAs(完整路径) file.SaveAs(fullPath); //根据uid做表的修改 human_fileModel hm = new human_fileModel { human_id = uid.ToString() }; List <human_fileModel> list = hfb.SelectBy(hm); var MyDate = DateTime.Now; string year = MyDate.Year.ToString(); string month = (MyDate.Month + 1).ToString(); string Day = MyDate.Day.ToString(); string h = MyDate.Hour.ToString(); string m = MyDate.Minute.ToString(); string s = MyDate.Second.ToString(); string Number = "bt" + year + month + Day + h + m + s; human_fileModel hfm = new human_fileModel { Id = list[0].Id, human_id = Number, first_kind_id = list[0].first_kind_id, first_kind_name = list[0].first_kind_name, second_kind_id = list[0].second_kind_id, second_kind_name = list[0].second_kind_name, third_kind_id = list[0].third_kind_id, third_kind_name = list[0].third_kind_name, human_name = list[0].human_name, human_address = list[0].human_address, human_postcode = list[0].human_postcode, human_pro_designation = list[0].human_pro_designation, human_major_kind_id = list[0].human_major_kind_id, human_major_kind_name = list[0].human_major_kind_name, human_major_id = list[0].human_major_id, hunma_major_name = list[0].hunma_major_name, human_telephone = list[0].human_telephone, human_mobilephone = list[0].human_mobilephone, human_bank = list[0].human_bank, human_account = list[0].human_account, human_qq = list[0].human_qq, human_email = list[0].human_email, human_hobby = list[0].human_hobby, human_speciality = list[0].human_speciality, human_sex = list[0].human_sex, human_religion = list[0].human_religion, human_party = list[0].human_party, human_nationality = list[0].human_nationality, human_race = list[0].human_race, human_birthday = list[0].human_birthday, human_birthplace = list[0].human_birthplace, human_age = list[0].human_age, human_educated_degree = list[0].human_educated_degree, human_educated_years = list[0].human_educated_years, human_educated_major = list[0].human_educated_major, human_society_security_id = list[0].human_society_security_id, human_id_card = list[0].human_id_card, remark = list[0].remark, salary_standard_id = list[0].salary_standard_id, salary_standard_name = list[0].salary_standard_name, salary_sum = list[0].salary_sum, major_change_amount = list[0].major_change_amount, training_amount = list[0].training_amount, file_chang_amount = list[0].file_chang_amount, human_histroy_records = list[0].human_histroy_records, human_family_membership = list[0].human_family_membership, regist_time = list[0].regist_time, check_time = list[0].check_time, change_time = list[0].change_time, lastly_change_time = list[0].lastly_change_time, delete_time = list[0].delete_time, recovery_time = list[0].recovery_time, human_file_status = list[0].human_file_status, check_status = list[0].check_status, register = list[0].register, changer = list[0].changer, checker = list[0].checker, human_picture = path }; hfm.human_file_status = 1; if (hfb.Update(hfm) > 0) { return(Content("<script>alert('上传成功!')</script>")); } else { return(View(uid)); } }