public ActionResult EditCrossingsAndTimeManage(Epm_TimeLimitAndProcedure model)
        {
            if (model.ProjectId == 0)
            {
                ResultView <int> view = new ResultView <int>();
                view.Flag    = false;
                view.Message = "项目id不能为空";
                return(Json(view));
            }
            #region 工期和手续提交
            //上传附件
            List <Epm_TzAttachs> attachs = new List <Epm_TzAttachs>();
            string fileDataJson          = Request.Form["fileDataJson"];//获取上传文件json字符串--注意附件类型,手续没有类型,给一个默认的类型SHOUXU
            if (!string.IsNullOrEmpty(fileDataJson))
            {
                var attach = JsonConvert.DeserializeObject <List <Epm_TzAttachs> >(fileDataJson);//将文件信息json字符
                attachs.AddRange(attach);
                model.TzAttachs = attach;
            }

            Result <int> result = new Result <int>();
            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request)))
            {
                result = proxy.UpdateTimeLimitAndCrossings(model);
            }
            #endregion

            return(Json(result.ToResultView()));
        }
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddTimeLimitAndCrossings(Epm_TimeLimitAndProcedure model)
        {
            Result <int> result = new Result <int>();

            try
            {
                var rows = DataOperateBusiness <Epm_TimeLimitAndProcedure> .Get().Add(model);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                // WriteLog(AdminModule.TimeLimitAndCrossings.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddTimeLimitAndCrossings");
            }
            return(result);
        }
        ///<summary>
        ///修改:
        ///</summary>
        /// <param name="model">要修改的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> UpdateTimeLimitAndCrossings(Epm_TimeLimitAndProcedure model)
        {
            Result <int> result = new Result <int>();

            try
            {
                int  rows  = 0;
                bool isAdd = false;
                var  TimeLimitAndCrossings = DataOperateBusiness <Epm_TimeLimitAndProcedure> .Get().GetList(t => t.ProjectId == model.ProjectId).FirstOrDefault();//判断是否存在

                if (TimeLimitAndCrossings == null)
                {
                    isAdd = true;
                    TimeLimitAndCrossings = new Epm_TimeLimitAndProcedure();
                    //当前创建人
                    SetCreateUser(TimeLimitAndCrossings);
                }
                TimeLimitAndCrossings.ProjectId         = model.ProjectId;         //项目id
                TimeLimitAndCrossings.IsCrossings       = model.IsCrossings;       //
                TimeLimitAndCrossings.ShutdownTime      = model.ShutdownTime;      //
                TimeLimitAndCrossings.PlanWorkStartTime = model.PlanWorkStartTime; //
                TimeLimitAndCrossings.PlanWorkEndTime   = model.PlanWorkEndTime;   //
                TimeLimitAndCrossings.TimeLimit         = model.TimeLimit;         //
                TimeLimitAndCrossings.PlanOpeningTime   = model.PlanOpeningTime;   //
                TimeLimitAndCrossings.PlanShutdowLimit  = model.PlanShutdowLimit;  //

                if (model.typeSub == 2)                                            //提交审核,如果是提交审核,要修改开工申请的状态为已提交
                {
                    var ProjectStart = DataOperateBusiness <Epm_TzProjectStartApply> .Get().Single(p => p.ProjectId == model.ProjectId);

                    if (ProjectStart != null)
                    {
                        ProjectStart.State = (int)PreProjectState.Submitted;//修改状态为已提交

                        rows = DataOperateBusiness <Epm_TzProjectStartApply> .Get().Update(ProjectStart);
                    }
                }
                //当前操作人
                SetCurrentUser(TimeLimitAndCrossings);

                if (isAdd)
                {
                    rows = DataOperateBusiness <Epm_TimeLimitAndProcedure> .Get().Add(TimeLimitAndCrossings);
                }
                else
                {
                    rows = DataOperateBusiness <Epm_TimeLimitAndProcedure> .Get().Update(TimeLimitAndCrossings);
                }

                //上传附件
                AddFilesBytzTable(TimeLimitAndCrossings, model.TzAttachs);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                // WriteLog(AdminModule.TzConDrawing.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateTimeLimitAndCrossings");
            }
            return(result);
        }
 public TzStartTenderingAndSupplyView()
 {
     TzProjectStartApply = new Epm_TzProjectStartApply();
     timeAndCrossings    = new Epm_TimeLimitAndProcedure();
 }