예제 #1
0
        public IActionResult GetPlanDetail(string id = null)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "id不允许为空!"));
            }
            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Biz_Contract_PlanAuditor plan = db.Queryable <Biz_Contract_PlanAuditor>().First(m => m.ID == id);
                if (plan == null)
                {
                    return(toResponse(StatusCodeType.Error, "查询不到相关项目信息,请核对!"));
                }

                //已编制的任务信息
                AuditorDrawUpdateDto plandata = Api.Common.Helpers.ComHelper.Mapper <AuditorDrawUpdateDto, Biz_Contract_PlanAuditor>(plan);
                //审核员项目列表
                plandata.ContractsubitemList = db.Queryable <Biz_Contract_PlanAuditor_Item>().Where(m => m.PlanAuditorID == plandata.ID).ToList();
                //编制计划列表信息
                plandata.PlanAuditorDrawList = db.Queryable <Biz_Contract_PlanAuditor_Draw>().Where(m => m.PlanAuditorID == plandata.ID).ToList();
                //附件信息
                plandata.ContractsubitemFileList = db.Queryable <Biz_ContractItem_Sub_File>().Where(m => m.PlanAuditorID == plandata.ID).ToList();
                return(toResponse(plandata));
            }
        }
예제 #2
0
        public IActionResult RegisterPlan([FromBody] AuditorDrawUpdateDto parm)
        {
            var userinfo = _tokenManager.GetSessionInfo();

            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Core.DbContext.BeginTran();
                try
                {
                    List <SugarParameter> parameters = new List <SugarParameter>();
                    parameters.Add(new SugarParameter("UserID", userinfo.UserID));
                    parameters.Add(new SugarParameter("UserName", userinfo.UserName));

                    //if (db.Ado.GetScalar("select 1 from Biz_Contract_PlanAuditor_Item where status > 40000 and PlanAuditorItemID = @id", new { id = parm.ID }) != null)
                    //{
                    //    throw new Exception("当前计划已经提交编制,请核对!");
                    //}

                    //修改计划任务信息
                    List <Biz_Contract_PlanAuditor_Draw> PlanDrawList_update = parm.PlanAuditorDrawList_update; //更新
                    List <Biz_Contract_PlanAuditor_Draw> PlanDrawList_insert = parm.PlanAuditorDrawList_insert; //插入
                    List <Biz_Contract_PlanAuditor_Draw> PlanDrawList_delete = parm.PlanAuditorDrawList_delete; //删除
                    //删除计划任务
                    string[] drawids = PlanDrawList_delete.Where(x => !string.IsNullOrEmpty(x.ID)).Select(x => x.ID).ToArray();
                    db.Deleteable <Biz_Contract_PlanAuditor_Draw>().Where(m => drawids.Contains(m.ID)).ExecuteCommand();
                    if (PlanDrawList_update != null) //更新数据
                    {
                        foreach (var draw in PlanDrawList_update)
                        {
                            db.Updateable <Biz_Contract_PlanAuditor_Draw>().SetColumns(m => new Biz_Contract_PlanAuditor_Draw()
                            {
                                DrawStartTime = draw.DrawStartTime,
                                DrawEndTime   = draw.DrawEndTime,
                                Department    = draw.Department,
                                DrawContent   = draw.DrawContent,
                                DrawClause    = draw.DrawClause,
                            }).Where(m => m.ID == draw.ID).ExecuteCommand();
                        }
                    }
                    if (PlanDrawList_insert != null)
                    {
                        foreach (var draw in PlanDrawList_insert)
                        {
                            var ret = draw.ToCreate <Biz_Contract_PlanAuditor_Draw>(userinfo);
                            db.Insertable <Biz_Contract_PlanAuditor_Draw>(ret).ExecuteCommand();
                        }
                    }


                    Core.DbContext.CommitTran();

                    return(toResponse(parm.ID));
                }
                catch (Exception ex)
                {
                    Core.DbContext.RollbackTran();
                    return(toResponse(StatusCodeType.Error, ex.Message));
                }
            }
        }
예제 #3
0
        public IActionResult SaveProblem([FromBody] AuditorDrawUpdateDto parm)
        {
            var userinfo = _tokenManager.GetSessionInfo();

            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Core.DbContext.BeginTran();
                try
                {
                    List <SugarParameter> parameters = new List <SugarParameter>();
                    parameters.Add(new SugarParameter("UserID", userinfo.UserID));
                    parameters.Add(new SugarParameter("UserName", userinfo.UserName));

                    //修改评定问题信息
                    List <Biz_Contract_Plan_EvaluationProblem> ProblemList = parm.EvaluationProblemList; //更新

                    if (ProblemList != null)                                                             //更新数据
                    {
                        foreach (var problem in ProblemList)
                        {
                            db.Updateable <Biz_Contract_Plan_EvaluationProblem>().SetColumns(m => new Biz_Contract_Plan_EvaluationProblem()
                            {
                                ProblemRespond = problem.ProblemRespond,
                                UpdateTime     = DateTime.Now
                            }).Where(m => m.ID == problem.ID).ExecuteCommand();
                        }
                    }

                    Core.DbContext.CommitTran();

                    return(toResponse(parm.ID));
                }
                catch (Exception ex)
                {
                    Core.DbContext.RollbackTran();
                    return(toResponse(StatusCodeType.Error, ex.Message));
                }
            }
        }