コード例 #1
0
        private string TeacherEvaluateScoreStatImport(DataTable dt)
        {
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    //培训开始时间	培训结束时间	应到人数	实到人数	考核人数
                    //合格	不合格	优秀	优秀比例	备注
                    TeacherEvaluateScoreStat model=new TeacherEvaluateScoreStat();

                    model.ID = Guid.NewGuid();

                    model.TrainBeginDate = ConvertUtil.ConvertObjToNullableDateTime(row["培训开始时间"]);
                    model.TrainEndDate = ConvertUtil.ConvertObjToNullableDateTime(row["培训结束时间"]);
                    model.PlanNum = ConvertUtil.ConvertObjToNullableInt(row["应到人数"]);
                    model.ActualNum = ConvertUtil.ConvertObjToNullableInt(row["实到人数"]);
                    model.ExamineNum = ConvertUtil.ConvertObjToNullableInt(row["考核人数"]);
                    model.PassNum = ConvertUtil.ConvertObjToNullableInt(row["合格"]);
                    model.FailNum = ConvertUtil.ConvertObjToNullableInt(row["不合格"]);
                    model.ExcellentNum = ConvertUtil.ConvertObjToNullableInt(row["优秀"]);
                    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.TeacherEvaluateScoreStatBLL.InsertEntity(model);

                }
                unitOfWork.Save();
            }

            return "";
        }
コード例 #2
0
        public string Add()
        {
            if (string.IsNullOrWhiteSpace(Request["TrainBeginDate"]))
            {
                return "培训开始日期不能为空!";
            }
            DateTime trainBeginDate;
            if (DateTime.TryParse(Request["TrainBeginDate"], out trainBeginDate) == false)
            {
                return "培训开始日期的格式不正确!";
            }

            if (string.IsNullOrWhiteSpace(Request["TrainEndDate"]))
            {
                return "培训结束日期不能为空!";
            }
            DateTime trainEndDate;

            if (DateTime.TryParse(Request["TrainEndDate"], out trainEndDate) == false)
            {
                return "培训结束日期的格式不正确!";
            }

            var planNum = ConvertUtil.ConvertStringToNullableInt(Request["PlanNum"]);
            var actualNum = ConvertUtil.ConvertStringToNullableInt(Request["ActualNum"]);
            var examineNum = ConvertUtil.ConvertStringToNullableInt(Request["ExamineNum"]);
            var passNum = ConvertUtil.ConvertStringToNullableInt(Request["PassNum"]);
            var failNum = ConvertUtil.ConvertStringToNullableInt(Request["FailNum"]);
            var excellentNum = ConvertUtil.ConvertStringToNullableInt(Request["ExcellentNum"]);
            var excellentRate = ConvertUtil.ConvertStringToNullableDecimal(Request["ExcellentRate"]) == null
                ? null
                : (Request["ExcellentRate"] + "%");
            var remark = Request["Remark"];

            var model = new TeacherEvaluateScoreStat();

            model.ID = Guid.NewGuid();
            model.TrainBeginDate = trainBeginDate;
            model.TrainEndDate = trainEndDate;
            model.PlanNum = planNum;
            model.ActualNum = actualNum;
            model.ExamineNum = examineNum;
            model.PassNum = passNum;
            model.FailNum = failNum;
            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.TeacherEvaluateScoreStatBLL.InsertEntity(model);
                unitOfWork.Save();
                return "";
            }
            catch (Exception ex)
            {
                Log.Error("保存师资考评成绩统计表信息异常:" + ex.Message, ex);
                return "系统异常,请联系管理员!";
            }
        }