Example #1
0
        public ActionResult index(human_file hf)
        {
            config_file_first_kind  s   = ifkb.selectWhere(e => e.first_kind_id == hf.first_kind_id).FirstOrDefault();
            config_file_second_kind s1  = iskb.SelectWhere(e => e.second_kind_id == hf.second_kind_id).FirstOrDefault();
            config_file_third_kind  s2  = itkb.SelectWhere(e => e.third_kind_id == hf.third_kind_id).FirstOrDefault();
            config_major            s3  = imb.SelectWhere(e => e.major_id == hf.human_major_id).FirstOrDefault();
            config_major_kind       s4  = imkb.SelectWhere(e => e.major_kind_id == hf.human_major_kind_id).FirstOrDefault();
            salary_standard         ssd = issdb.SelectWhere(e => e.standard_id == hf.salary_standard_id).FirstOrDefault();

            hf.salary_standard_name  = ssd.standard_name;
            hf.first_kind_name       = s.first_kind_name;
            hf.second_kind_name      = s1.second_kind_name;
            hf.third_kind_name       = s2.third_kind_name;
            hf.hunma_major_name      = s3.major_name;
            hf.human_major_kind_name = s4.major_kind_name;
            hf.check_status          = 0;
            hf.salary_sum            = ssd.salary_sum;
            hf.demand_salaray_sum    = ssd.salary_sum;
            hf.paid_salary_sum       = ssd.salary_sum;
            hf.file_chang_amount     = 0;
            hf.lastly_change_time    = DateTime.Now;
            if (ihdb.Update(hf) > 0)
            {
                return(Content("<script>location.href='/Human_file/Top_file/" + hf.huf_id + "'</script>"));
            }
            else
            {
                return(Content("<script>alert('登记失败');location.href='/Human_file/index'</script>"));
            }
        }
        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));
            }
        }