Exemplo n.º 1
0
        private string ExamineStatImport(DataTable dt)
        {
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    //收报时间	电报号	岗位名称	培训班性质	班级名称	班主任
                    //开班日期	结束日期	参培人数	考试人数	安全补考人数
                    //理论补考人数	实作补考人数	一次通过人数	一次通过率	补考不合格人数
                    //培训合格率	优秀人数	优秀率	备注

                    var model = new ExamineStat();

                    model.ID = Guid.NewGuid();

                    model.TelegraphReceiveDate = ConvertUtil.ConvertObjToNullableDateTime(row["收报时间"]);
                    model.TelegraphNO = row["电报号"].ToString();
                    model.TrainPostion = row["岗位名称"].ToString();
                    model.TrainType = row["培训班性质"].ToString();
                    model.ClassName = row["班级名称"].ToString();
                    model.ClassTeacher = row["班主任"].ToString();
                    model.ClassBeginDate = ConvertUtil.ConvertObjToNullableDateTime(row["开班日期"]);
                    model.ClassEndDate = ConvertUtil.ConvertObjToNullableDateTime(row["结束日期"]);
                    model.TrainerNum = ConvertUtil.ConvertObjToNullableInt(row["参培人数"]);
                    model.ExamineNum = ConvertUtil.ConvertObjToNullableInt(row["考试人数"]);
                    model.SecurityMakeupNum = ConvertUtil.ConvertObjToNullableInt(row["安全补考人数"]);
                    model.TheoryMakeupNum = ConvertUtil.ConvertObjToNullableInt(row["理论补考人数"]);
                    model.ImpMakeupNum = ConvertUtil.ConvertObjToNullableInt(row["实作补考人数"]);
                    model.OneTimePassNum = ConvertUtil.ConvertObjToNullableInt(row["一次通过人数"]);
                    model.OneTimePassRate = row["一次通过率"].ToString();
                    model.MakeupFailNum = ConvertUtil.ConvertObjToNullableInt(row["补考不合格人数"]);
                    model.PassRate = row["培训合格率"].ToString();
                    model.ExcellentNum = ConvertUtil.ConvertObjToNullableInt(row["优秀人数"].ToString());
                    model.ExcellentRate = row["优秀率"].ToString();
                    model.Remark = row["备注"].ToString();

                    model.CreateTime = System.DateTime.Now;
                    model.CreateID = CurrentUser.UserId;
                    model.CreateName = CurrentUser.UserName;
                    model.IsValid = true;

                    unitOfWork.ExamineStatBLL.InsertEntity(model);

                }
                unitOfWork.Save();
            }

            return "";
        }
Exemplo n.º 2
0
        public string Add()
        {
            if (string.IsNullOrWhiteSpace(Request["ClassName"]))
            {
                return "班级名称不能为空!";
            }

            var telegraphReceiveDate = ConvertUtil.ConvertStringToNullableDateTime(Request["TelegraphReceiveDate"]);
            var telegraphNO = Request["TelegraphNO"];
            var trainPostion = Request["TrainPostion"];
            var trainType = Request["TrainType"];
            var className = Request["ClassName"];
            var classTeacher = Request["ClassTeacher"];
            var classBeginDate = ConvertUtil.ConvertStringToNullableDateTime(Request["ClassBeginDate"]);
            var classEndDate = ConvertUtil.ConvertStringToNullableDateTime(Request["ClassEndDate"]);
            var trainerNum = ConvertUtil.ConvertStringToNullableInt(Request["TrainerNum"]);
            var examineNum = ConvertUtil.ConvertStringToNullableInt(Request["ExamineNum"]);
            var securityMakeupNum = ConvertUtil.ConvertStringToNullableInt(Request["SecurityMakeupNum"]);
            var theoryMakeupNum = ConvertUtil.ConvertStringToNullableInt(Request["TheoryMakeupNum"]);
            var impMakeupNum = ConvertUtil.ConvertStringToNullableInt(Request["ImpMakeupNum"]);
            var oneTimePassNum = ConvertUtil.ConvertStringToNullableInt(Request["OneTimePassNum"]);
            var oneTimePassRate = ConvertUtil.ConvertStringToNullableDecimal(Request["OneTimePassRate"]) == null
                ? null
                : (Request["OneTimePassRate"] + "%");
            var makeupFailNum = ConvertUtil.ConvertStringToNullableInt(Request["MakeupFailNum"]);
            var passRate = ConvertUtil.ConvertStringToNullableDecimal(Request["PassRate"]) == null
                ? null
                : (Request["PassRate"] + "%");
            var excellentNum = ConvertUtil.ConvertStringToNullableInt(Request["ExcellentNum"]);
            var excellentRate = ConvertUtil.ConvertStringToNullableDecimal(Request["ExcellentRate"]) == null
                ? null
                : (Request["ExcellentRate"] + "%");
            var remark = Request["Remark"];

            var model = new ExamineStat();

            model.ID = Guid.NewGuid();
            model.TelegraphReceiveDate = telegraphReceiveDate;
            model.TelegraphNO = telegraphNO;
            model.TrainPostion = trainPostion;
            model.TrainType = trainType;
            model.ClassName = className;
            model.ClassTeacher = classTeacher;
            model.ClassBeginDate = classBeginDate;
            model.ClassEndDate = classEndDate;
            model.TrainerNum = trainerNum;
            model.ExamineNum = examineNum;
            model.SecurityMakeupNum = securityMakeupNum;
            model.TheoryMakeupNum = theoryMakeupNum;
            model.ImpMakeupNum = impMakeupNum;
            model.OneTimePassNum = oneTimePassNum;
            model.OneTimePassRate = oneTimePassRate;
            model.OneTimePassRate = oneTimePassRate;
            model.MakeupFailNum = makeupFailNum;
            model.PassRate = passRate;
            model.ExcellentNum = excellentNum;
            model.ExcellentRate = excellentRate;
            model.Remark = remark;

            model.CreateTime = System.DateTime.Now;
            model.CreateID = CurrentUser.UserId;
            model.CreateName = CurrentUser.UserName;
            model.IsValid = true;
            try
            {
                unitOfWork.ExamineStatBLL.InsertEntity(model);
                unitOfWork.Save();
                return "";
            }
            catch (Exception ex)
            {
                Log.Error("保存培训通过率报表信息异常:" + ex.Message, ex);
                return "系统异常,请联系管理员!";
            }
        }