示例#1
0
        public string Add()
        {
            var model = new Implementation();
            model.Id = Guid.NewGuid();

            model.ClassName = Request["ClassName"];
            model.Zhanduan = Request["Zhanduan"];
            model.Subjects = Request["Subjects"];
            model.IdNo = Request["IdNo"];
            model.ExaminePosition = Request["ExaminePosition"];
            model.StuName = Request["StuName"];
            model.StuId = new Guid(Request["StuId"]);
            //var entity = unitOfWork.StudentBLL.GetEntityByID(model.StuId);
            //if (entity != null)
            //{
            //    model.StuNo = entity.StuNo;
            //}
            model.StuNo = Request["StuNo"];

            model.IsValid = true;
            model.CreateId = CurrentUser.UserId;
            model.CreateName = CurrentUser.UserName;
            model.CreateTime = DateTime.Now;
            unitOfWork.ImplementationBLL.InsertEntity(model);
            unitOfWork.Save();
            return "";
        }
示例#2
0
        private string DistributionImport(DataTable dt, out string msg)
        {
            msg = "";
            try
            {
                if (dt != null)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        var model = new Implementation();
                        model.StuNo = row["学员编号"].ToString();
                        model.StuName = row["姓名"].ToString();
                        model.IdNo = row["身份证号"].ToString();
                        model.ExaminePosition = row["考评岗位"].ToString();
                        model.ClassName = row["班级名称"].ToString();
                        model.Subjects = row["抽考项目"].ToString();

                        var stu = unitOfWork.StudentBLL.GetEntitys(m => m.StuNo == model.StuNo && m.Name == model.StuName);
                        if (stu.Any())
                        {
                            model.StuId = stu.ToArray()[0].Id;
                        }

                        model.IsValid = true;
                        model.CreateTime = System.DateTime.Now;
                        model.CreateId = CurrentUser.UserId;
                        model.CreateName = CurrentUser.UserName;
                        model.Id = Guid.NewGuid();

                        //var entity = unitOfWork.StudentBLL.GetEntitys(m=>m.StuNo==model.StuNo&&m.IsValid);
                        //if (entity != null)
                        //{
                        //    model
                        //}

                        unitOfWork.ImplementationBLL.InsertEntity(model);
                        unitOfWork.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "导入异常:" + ex.Message;
                Log.Error("StudentImport 异常:", ex);
            }
            return msg;
        }
示例#3
0
        private string DistributionImpImport(DataTable dt, out string msg)
        {
            msg = "";
            try
            {

                if (dt != null)
                {
                    foreach (DataRow row in dt.Rows)
                    {

                        //学员编号	姓名	身份证号	考评岗位	班级名称	所在站段	抽考项目
                        //考评项目1-编号	考评项目1-成绩	考评项目2-编号	考评项目2-成绩	考评项目3-编号	考评项目3-成绩
                        //考评项目4-编号	考评项目4-成绩	考评项目5-编号	考评项目5-成绩	考评项目6-编号	考评项目6-成绩
                        //总用时	总成绩	考评结果	备注

                        Implementation model;

                        var stuno = row["学员编号"].ToString();
                        var entity = unitOfWork.ImplementationBLL.GetEntitys(m => m.StuNo == stuno);
                        if (entity.Any())
                        {
                            model = entity.ToArray()[0];
                        }
                        else
                        {
                            model = new Implementation();
                        }

                        model.StuNo = row["学员编号"].ToString();
                        model.StuName = row["姓名"].ToString();
                        var stu = unitOfWork.StudentBLL.GetEntitys(m => m.StuNo == model.StuNo && m.Name == model.StuName);
                        if (stu.Any())
                        {
                            model.StuId = stu.ToArray()[0].Id;
                        }
                        model.IdNo = row["身份证号"].ToString();

                        model.ExaminePosition = row["考评岗位"].ToString();
                        model.ClassName = row["班级名称"].ToString();
                        model.Zhanduan = row["所在站段"].ToString();
                        model.Subjects = row["抽考项目"].ToString();

                        var num = 0.0;
                        var time = 0.0;
                        model.Subject1No = row["考评项目1-编号"].ToString();
                        model.Subject1Score = row["考评项目1-成绩"].ToString();
                        model.Subject2No = row["考评项目2-编号"].ToString();
                        model.Subject2Score = row["考评项目2-成绩"].ToString();
                        model.Subject3No = row["考评项目3-编号"].ToString();
                        model.Subject3Score = row["考评项目3-成绩"].ToString();
                        model.Subject4No = row["考评项目4-编号"].ToString();
                        model.Subject4Score = row["考评项目4-成绩"].ToString();
                        model.Subject5No = row["考评项目5-编号"].ToString();
                        model.Subject5Score = row["考评项目5-成绩"].ToString();
                        model.Subject6No = row["考评项目6-编号"].ToString();
                        model.Subject6Score = row["考评项目6-成绩"].ToString();

                        //try
                        //{

                        //    if (!string.IsNullOrEmpty(model.YYJLScore))
                        //    {
                        //        num = num + float.Parse(model.YYJLScore);
                        //        time = time + float.Parse(model.YYJLTime);
                        //    }
                        //    if (!string.IsNullOrEmpty(model.WYBScore))
                        //    {
                        //        num = num + float.Parse(model.WYBScore);
                        //        time = time + float.Parse(model.WYBTime);
                        //    }
                        //    if (!string.IsNullOrEmpty(model.ZSDScore))
                        //    {
                        //        num = num + float.Parse(model.ZSDScore);
                        //        time = time + float.Parse(model.ZSDTime);
                        //    }
                        //    if (!string.IsNullOrEmpty(model.BJGHScore))
                        //    {
                        //        num = num + float.Parse(model.BJGHScore);
                        //        time = time + float.Parse(model.BJGHTime);
                        //    }
                        //    if (!string.IsNullOrEmpty(model.WYZZScroe))
                        //    {
                        //        num = num + float.Parse(model.WYZZScroe);
                        //        time = time + float.Parse(model.WYZZTime);
                        //    }
                        //    if (!string.IsNullOrEmpty(model.YJTXScroe))
                        //    {
                        //        num = num + float.Parse(model.YJTXScroe);
                        //        time = time + float.Parse(model.YJTXTime);
                        //    }
                        //}
                        //catch (Exception exception)
                        //{
                        //    Log.Error("DistributionImpImport 异常", exception);
                        //}
                        model.UseTime = row["总用时"].ToString();
                        model.Score = row["总成绩"].ToString();
                        model.ExamineResult = row["考评结果"].ToString();
                        model.Remark = row["备注"].ToString();

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

                        if (entity.Any())
                        {
                            unitOfWork.ImplementationBLL.UpdateEntity(model);
                        }
                        else   //新增
                        {
                            model.Id = Guid.NewGuid();
                            unitOfWork.ImplementationBLL.InsertEntity(model);
                        }
                        unitOfWork.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "导入异常:" + ex.Message;
                Log.Error("DistributionImpImport 异常:", ex);
            }
            return msg;
        }