Пример #1
0
        public string Add(string Name, string IdNo, string Gender, string Education, string DeptId,
            string DeptName, string Position, string Remark, string Luju, string Department, string Professional)
        {
            ControllerContext.HttpContext.Request.ContentEncoding = Encoding.GetEncoding("UTF-8");
            ControllerContext.HttpContext.Response.ContentEncoding = Encoding.GetEncoding("UTF-8");
            ControllerContext.HttpContext.Response.Charset = "UTF-8";

            var model = new Teacher();
            model.Id = Guid.NewGuid();
            model.Gender = Gender;
            model.Education = Education;
            model.Name = Name;
            model.IdNo = IdNo;
            model.DeptName = DeptName;
            model.DeptId = DeptId;
            model.Position = Position;
            model.Remark = Remark;
            model.Ustatus = (int) EnumStatus.Valid;
            model.AllPath = DeptName;
            model.CreateTime = System.DateTime.Now;
            model.CreateId = CurrentUser.UserId;
            model.CreateName = CurrentUser.UserName;
            model.Luju = Luju;
            model.Department = Department;
            model.Professional = Professional;
            model.ProfessionalName = Request["ProfessionalName"];
            model.GenderName = Request["GenderName"];
            model.Tel = Request["Tel"];
            model.Title = Request["TitleName"];
            model.TitleName = Request["TitleName"];
            model.Other1 = Request["Other1"];
            model.Other2 = Request["Other2"];
            model.Remark = Request["Remark"];
            model.EducationName = Request["EducationName"];
            if (!string.IsNullOrEmpty(Request["BirthDay"]))
            {
                model.BirthDay = Convert.ToDateTime(Request["BirthDay"]);
            }
            unitOfWork.TeacherBLL.InsertEntity(model);
            unitOfWork.Save();
            return "";
        }
Пример #2
0
        private string TeacherImport(DataTable  dt, out string msg,string filename)
        {
            msg = "";
            if (dt != null)
            {

                foreach (DataRow row in dt.Rows)
                {
                    var model = new Teacher();
                    model.Id = Guid.NewGuid();
                    model.Gender = unitOfWork.SysCodeBLL.GetCodeFromName(row["性别"].ToString());
                    model.GenderName = row["性别"].ToString();
                    model.Education = unitOfWork.SysCodeBLL.GetCodeFromName(row["学历"].ToString());
                    model.EducationName = row["学历"].ToString();
                    model.Name = row["姓名"].ToString();
                    model.IdNo = row["身份证号"].ToString();
                    model.DeptName = row["教研室"].ToString();
                    model.DeptId = unitOfWork.SysCodeBLL.GetCodeFromName(row["教研室"].ToString());
                    model.Position = row["职务"].ToString();
                    model.Luju = row["路局"].ToString();
                    model.Department = row["单位"].ToString();
                    model.Professional = unitOfWork.SysCodeBLL.GetCodeFromName(row["专业"].ToString());
                    model.ProfessionalName = row["专业"].ToString();
                    model.Title = unitOfWork.SysCodeBLL.GetCodeFromName(row["职称"].ToString());
                    model.TitleName = row["职称"].ToString();
                    model.Tel = row["电话"].ToString();
                    if (!string.IsNullOrEmpty(row["出生年月"].ToString()))
                    {
                        model.BirthDay = Convert.ToDateTime(row["出生年月"].ToString());
                    }
                    model.Ustatus = (int)EnumStatus.Valid;
                    model.CreateTime = System.DateTime.Now;
                    model.CreateId = CurrentUser.UserId;
                    model.CreateName = CurrentUser.UserName;
                    unitOfWork.TeacherBLL.InsertEntity(model);
                    unitOfWork.Save();
                }
            }

            return "";
        }