示例#1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            var updateCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId);

            if (updateCost != null)
            {
                updateCost.CostA1      = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim());
                updateCost.CostA2      = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim());
                updateCost.CostA3      = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim());
                updateCost.CostA4      = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim());
                updateCost.CostA5      = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim());
                updateCost.CostA6      = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim());
                updateCost.CostA7      = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim());
                updateCost.CostA8      = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim());
                updateCost.CostB1      = Funs.GetNewDecimalOrZero(this.txtB1.Text.Trim());
                updateCost.CostB2      = Funs.GetNewDecimalOrZero(this.txtB2.Text.Trim());
                updateCost.CostC1      = Funs.GetNewDecimalOrZero(this.txtC1.Text.Trim());
                updateCost.CostD1      = Funs.GetNewDecimalOrZero(this.txtD1.Text.Trim());
                updateCost.CostD2      = Funs.GetNewDecimalOrZero(this.txtD2.Text.Trim());
                updateCost.CostD3      = Funs.GetNewDecimalOrZero(this.txtD3.Text.Trim());
                updateCost.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text);

                updateCost.AuditCostA1 = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim());
                updateCost.AuditCostA2 = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim());
                updateCost.AuditCostA3 = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim());
                updateCost.AuditCostA4 = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim());
                updateCost.AuditCostA5 = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim());
                updateCost.AuditCostA6 = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim());
                updateCost.AuditCostA7 = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim());
                updateCost.AuditCostA8 = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim());

                updateCost.AuditedSubUnitCost = (updateCost.CostA1 + updateCost.CostA2 + updateCost.CostA3 + updateCost.CostA4 + updateCost.CostA5
                                                 + updateCost.CostA6 + updateCost.CostA7 + updateCost.CostA8) / 10000;

                updateCost.SubUnitCost = updateCost.AuditedSubUnitCost;
                if (this.drpAuditManId.SelectedValue != BLL.Const._Null)
                {
                    updateCost.AuditManId = this.drpAuditManId.SelectedValue;
                }

                ////单据状态
                updateCost.States = BLL.Const.State_0;
                if (type == BLL.Const.BtnSubmit)
                {
                    updateCost.States    = BLL.Const.State_2;
                    updateCost.StateType = "2";

                    Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate
                    {
                        FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)),
                        MenuId        = BLL.Const.ProjectHSSECostUnitManageAuditMenuId,
                        DataId        = this.HSSECostUnitManageId + "#2",
                        ProjectId     = this.ProjectId,
                        Url           = "../CostGoods/HSSECostUnitManageAuditView.aspx?HSSECostUnitManageId={0}",
                        SortIndex     = 1,
                        OperaterTime  = System.DateTime.Now,
                        OperaterId    = this.drpAuditManId.SelectedValue,
                        AuditFlowName = "安全工程师审核",
                        IsClosed      = false,
                        State         = BLL.Const.State_1,
                    };
                    Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate);
                    Funs.DB.SubmitChanges();
                }
                BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateCost);

                ////保存流程审核数据
                this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostUnitManageMenuId, this.HSSECostUnitManageId, (type == BLL.Const.BtnSubmit ? true : false),
                                              BLL.UnitService.GetUnitNameByUnitId(updateCost.UnitId) + "费用上报", "../CostGoods/HSSECostUnitManageView.aspx?HSSECostUnitManageId={0}");

                if (type == BLL.Const.BtnSubmit)
                {
                    var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                    where x.DataId == this.HSSECostUnitManageId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                    select x;
                    if (updateNoClosedFlowOperate.Count() > 0)
                    {
                        foreach (var itemClosed in updateNoClosedFlowOperate)
                        {
                            itemClosed.OperaterId = this.CurrUser.UserId;
                            itemClosed.IsClosed   = true;
                            Funs.DB.SubmitChanges();
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="menuId">菜单id</param>
        /// <param name="dataId">主键id</param>
        /// <param name="isClosed">是否关闭这步流程</param>
        /// <param name="content">单据内容</param>
        /// <param name="url">路径</param>
        public void btnSaveData(string projectId, string menuId, string dataId, bool isClosed, string content, string url)
        {
            Model.Sys_FlowOperate newFlowOperate = new Model.Sys_FlowOperate
            {
                MenuId     = this.getMenuId,
                DataId     = dataId,
                OperaterId = ((Model.Sys_User)Session["CurrUser"]).UserId,
                State      = this.rblFlowOperate.SelectedValue,
                IsClosed   = isClosed,
                Opinion    = this.txtOpinions.Text.Trim(),
                ProjectId  = projectId,
                Url        = url
            };
            var user = BLL.UserService.GetUserByUserId(newFlowOperate.OperaterId);

            if (user != null)
            {
                var roles = BLL.RoleService.GetRoleByRoleId(user.RoleId);
                if (roles != null && !string.IsNullOrEmpty(roles.RoleName))
                {
                    newFlowOperate.AuditFlowName = "[" + roles.RoleName + "]";
                }
                else
                {
                    newFlowOperate.AuditFlowName = "[" + user.UserName + "]";
                }

                newFlowOperate.AuditFlowName += this.txtAuditFlowName.Text;
            }

            var updateFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                    where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                    select x;

            if (updateFlowOperate.Count() > 0)
            {
                foreach (var item in updateFlowOperate)
                {
                    item.OperaterId    = newFlowOperate.OperaterId;
                    item.OperaterTime  = System.DateTime.Now;
                    item.State         = newFlowOperate.State;
                    item.Opinion       = newFlowOperate.Opinion;
                    item.AuditFlowName = this.txtAuditFlowName.Text;
                    item.IsClosed      = newFlowOperate.IsClosed;
                    Funs.DB.SubmitChanges();
                }
            }
            else
            {
                int maxSortIndex = 1;
                var flowSet      = Funs.DB.Sys_FlowOperate.Where(x => x.DataId == newFlowOperate.DataId);
                var sortIndex    = flowSet.Select(x => x.SortIndex).Max();
                if (sortIndex.HasValue)
                {
                    maxSortIndex = sortIndex.Value + 1;
                }
                newFlowOperate.FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate));
                newFlowOperate.SortIndex     = maxSortIndex;
                newFlowOperate.OperaterTime  = System.DateTime.Now;
                newFlowOperate.AuditFlowName = this.txtAuditFlowName.Text;
                Funs.DB.Sys_FlowOperate.InsertOnSubmit(newFlowOperate);
                Funs.DB.SubmitChanges();
            }

            if (newFlowOperate.IsClosed == true)
            {
                var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                select x;
                if (updateNoClosedFlowOperate.Count() > 0)
                {
                    foreach (var itemClosed in updateNoClosedFlowOperate)
                    {
                        itemClosed.IsClosed = true;
                        Funs.DB.SubmitChanges();
                    }
                }

                if (newFlowOperate.State != BLL.Const.State_2) ///未审核完成的时 增加下一步办理
                {
                    int maxSortIndex = 1;
                    var flowSet      = Funs.DB.Sys_FlowOperate.Where(x => x.DataId == newFlowOperate.DataId);
                    var sortIndex    = flowSet.Select(x => x.SortIndex).Max();
                    if (sortIndex.HasValue)
                    {
                        maxSortIndex = sortIndex.Value + 1;
                    }

                    Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate
                    {
                        FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)),
                        MenuId        = newFlowOperate.MenuId,
                        DataId        = newFlowOperate.DataId,
                        ProjectId     = newFlowOperate.ProjectId,
                        Url           = newFlowOperate.Url,
                        SortIndex     = maxSortIndex,
                        OperaterTime  = System.DateTime.Now
                    };
                    if (this.drpPerson.SelectedValue != BLL.Const._Null)
                    {
                        newNextFlowOperate.OperaterId = this.drpPerson.SelectedValue;
                    }
                    else
                    {
                        newNextFlowOperate.OperaterId = newFlowOperate.OperaterId;
                    }
                    var operaterUsers = BLL.UserService.GetUserByUserId(newNextFlowOperate.OperaterId);
                    if (operaterUsers != null)
                    {
                        var operaterRoles = BLL.RoleService.GetRoleByRoleId(operaterUsers.RoleId);
                        if (operaterRoles != null && !string.IsNullOrEmpty(operaterRoles.RoleName))
                        {
                            newNextFlowOperate.AuditFlowName = "[" + operaterRoles.RoleName + "]";
                        }
                        else
                        {
                            newNextFlowOperate.AuditFlowName = "[" + operaterUsers.UserName + "]";
                        }

                        newNextFlowOperate.AuditFlowName += this.txtAuditFlowName.Text;
                    }
                    newNextFlowOperate.IsClosed = false;
                    newNextFlowOperate.State    = BLL.Const.State_1;
                    Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate);
                    Funs.DB.SubmitChanges();
                }
                else  ///单据审核完成
                {
                    if (this.IsFileCabinetA.Checked) /// 选择归档【文件柜A(检查类)】
                    {
                        BLL.FileCabinetAService.AddFileCabinetA(menuId, dataId, content, url, projectId);
                    }

                    ////判断单据是否 加入到企业管理资料
                    var safeData = Funs.DB.SafetyData_SafetyData.FirstOrDefault(x => x.MenuId == menuId);
                    if (safeData != null)
                    {
                        BLL.SafetyDataService.AddSafetyData(menuId, dataId, content, url, projectId);
                    }

                    /// 在单据审核完成后 收集工程师日志 在单据中取值
                    CommonService.CollectHSSELogByData(newFlowOperate.ProjectId, newFlowOperate.MenuId, newFlowOperate.DataId);
                }
                ///单据审核时 收集工程师日志 审核流程中取值
                CommonService.CollectHSSELog(newFlowOperate.ProjectId, newFlowOperate.MenuId, newFlowOperate.DataId, newFlowOperate.OperaterId, newFlowOperate.OperaterTime);
            }
        }
示例#3
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="menuId">菜单id</param>
        /// <param name="dataId">主键id</param>
        /// <param name="isClosed">是否关闭这步流程</param>
        /// <param name="content">单据内容</param>
        /// <param name="url">路径</param>
        public static void btnSaveData(string projectId, string menuId, string dataId, string userId, bool isClosed, string content, string url)
        {
            Model.Sys_FlowOperate newFlowOperate = new Model.Sys_FlowOperate
            {
                MenuId     = menuId,
                DataId     = dataId,
                OperaterId = userId,
                State      = Const.State_2,
                IsClosed   = isClosed,
                Opinion    = "系统自动关闭流程",
                ProjectId  = projectId,
                Url        = url
            };
            var user = BLL.UserService.GetUserByUserId(newFlowOperate.OperaterId);

            if (user != null)
            {
                var roles = BLL.RoleService.GetRoleByRoleId(user.RoleId);
                if (roles != null && !string.IsNullOrEmpty(roles.RoleName))
                {
                    newFlowOperate.AuditFlowName = "[" + roles.RoleName + "]";
                }
                else
                {
                    newFlowOperate.AuditFlowName = "[" + user.UserName + "]";
                }

                newFlowOperate.AuditFlowName += "系统审核完成";
            }

            var updateFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                    where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                    select x;

            if (updateFlowOperate.Count() > 0)
            {
                foreach (var item in updateFlowOperate)
                {
                    item.OperaterId    = newFlowOperate.OperaterId;
                    item.OperaterTime  = System.DateTime.Now;
                    item.State         = newFlowOperate.State;
                    item.Opinion       = newFlowOperate.Opinion;
                    item.AuditFlowName = "系统审核完成";
                    item.IsClosed      = newFlowOperate.IsClosed;
                    Funs.DB.SubmitChanges();
                }
            }
            else
            {
                int maxSortIndex = 1;
                var flowSet      = Funs.DB.Sys_FlowOperate.Where(x => x.DataId == newFlowOperate.DataId);
                var sortIndex    = flowSet.Select(x => x.SortIndex).Max();
                if (sortIndex.HasValue)
                {
                    maxSortIndex = sortIndex.Value + 1;
                }
                newFlowOperate.FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate));
                newFlowOperate.SortIndex     = maxSortIndex;
                newFlowOperate.OperaterTime  = System.DateTime.Now;
                newFlowOperate.AuditFlowName = "系统审核完成";
                Funs.DB.Sys_FlowOperate.InsertOnSubmit(newFlowOperate);
                Funs.DB.SubmitChanges();
            }

            if (newFlowOperate.IsClosed == true)
            {
                var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                select x;
                if (updateNoClosedFlowOperate.Count() > 0)
                {
                    foreach (var itemClosed in updateNoClosedFlowOperate)
                    {
                        itemClosed.IsClosed = true;
                        Funs.DB.SubmitChanges();
                    }
                }

                ////判断单据是否 加入到企业管理资料
                var safeData = Funs.DB.SafetyData_SafetyData.FirstOrDefault(x => x.MenuId == menuId);
                if (safeData != null)
                {
                    BLL.SafetyDataService.AddSafetyData(menuId, dataId, content, url, projectId);
                }

                /// 在单据审核完成后 收集工程师日志 在单据中取值
                CollectHSSELogByData(newFlowOperate.ProjectId, newFlowOperate.MenuId, newFlowOperate.DataId);
                ///单据审核时 收集工程师日志 审核流程中取值
                CollectHSSELog(newFlowOperate.ProjectId, newFlowOperate.MenuId, newFlowOperate.DataId, newFlowOperate.OperaterId, newFlowOperate.OperaterTime);
            }
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            var updateCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId);

            if (updateCost != null)
            {
                updateCost.AuditedSubUnitCost = (updateCost.RatifiedCostA1 + updateCost.RatifiedCostA2 + updateCost.RatifiedCostA3 + updateCost.RatifiedCostA4 + updateCost.RatifiedCostA5
                                                 + updateCost.RatifiedCostA6 + updateCost.RatifiedCostA7 + updateCost.RatifiedCostA8) / 10000;
            }
            updateCost.SubUnitCost = updateCost.AuditedSubUnitCost;
            ////单据状态
            updateCost.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                updateCost.States    = BLL.Const.State_2;
                updateCost.StateType = "4";
            }
            BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateCost);

            var hSSECostManage = BLL.HSSECostManageService.GetHSSECostManageByHSSECostManageId(updateCost.HSSECostManageId);

            if (hSSECostManage != null && string.IsNullOrEmpty(hSSECostManage.States))
            {
                ////单据状态
                hSSECostManage.States = BLL.Const.State_0;
                if (type == BLL.Const.BtnSubmit)
                {
                    Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate
                    {
                        FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)),
                        MenuId        = BLL.Const.ProjectHSSECostManageMenuId,
                        DataId        = hSSECostManage.HSSECostManageId,
                        ProjectId     = this.ProjectId,
                        Url           = "../CostGoods/HSSECostManageView.aspx?HSSECostManageId={0}",
                        SortIndex     = 1,
                        OperaterTime  = System.DateTime.Now,
                        OperaterId    = this.drpAuditManId.SelectedValue,
                        AuditFlowName = "总包财务经理",
                        IsClosed      = false,
                        State         = BLL.Const.State_1,
                    };
                    Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate);
                    Funs.DB.SubmitChanges();
                }

                if (this.drpAuditManId.SelectedValue != BLL.Const._Null)
                {
                    hSSECostManage.AuditManId = this.drpAuditManId.SelectedValue;
                }

                BLL.HSSECostManageService.UpdateHSSECostManage(hSSECostManage);
            }

            ////保存流程核定数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostUnitManageRatifiedMenuId, this.HSSECostUnitManageId + "#3", (type == BLL.Const.BtnSubmit ? true : false),
                                          BLL.UnitService.GetUnitNameByUnitId(updateCost.UnitId) + "费用核定", "../CostGoods/HSSECostUnitManageRatifiedView.aspx?HSSECostUnitManageId={0}");

            if (type == BLL.Const.BtnSubmit)
            {
                var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                where x.DataId == this.HSSECostUnitManageId + "#3" && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                select x;
                if (updateNoClosedFlowOperate.Count() > 0)
                {
                    foreach (var itemClosed in updateNoClosedFlowOperate)
                    {
                        itemClosed.OperaterId = this.CurrUser.UserId;
                        itemClosed.IsClosed   = true;
                        Funs.DB.SubmitChanges();
                    }
                }
            }
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            var updateCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId);

            if (updateCost != null)
            {
                updateCost.RatifiedCostA1 = updateCost.AuditCostA1;
                updateCost.RatifiedCostA2 = updateCost.AuditCostA2;
                updateCost.RatifiedCostA3 = updateCost.AuditCostA3;
                updateCost.RatifiedCostA4 = updateCost.AuditCostA4;
                updateCost.RatifiedCostA5 = updateCost.AuditCostA5;
                updateCost.RatifiedCostA6 = updateCost.AuditCostA6;
                updateCost.RatifiedCostA7 = updateCost.AuditCostA7;
                updateCost.RatifiedCostA8 = updateCost.AuditCostA8;

                updateCost.AuditedSubUnitCost = (updateCost.AuditCostA1 + updateCost.AuditCostA2 + updateCost.AuditCostA3 + updateCost.AuditCostA4 + updateCost.AuditCostA5
                                                 + updateCost.AuditCostA6 + updateCost.AuditCostA7 + updateCost.AuditCostA8) / 10000;
                updateCost.SubUnitCost = updateCost.AuditedSubUnitCost;
                if (this.drpRatifiedManId.SelectedValue != BLL.Const._Null)
                {
                    updateCost.RatifiedManId = this.drpRatifiedManId.SelectedValue;
                }

                ////单据状态
                updateCost.States = BLL.Const.State_0;
                if (type == BLL.Const.BtnSubmit)
                {
                    updateCost.States    = BLL.Const.State_2;
                    updateCost.StateType = "3";

                    Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate
                    {
                        FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)),
                        MenuId        = BLL.Const.ProjectHSSECostUnitManageAuditMenuId,
                        DataId        = this.HSSECostUnitManageId + "#3",
                        ProjectId     = this.ProjectId,
                        Url           = "../CostGoods/HSSECostUnitManageRatifiedView.aspx?HSSECostUnitManageId={0}",
                        SortIndex     = 1,
                        OperaterTime  = System.DateTime.Now,
                        OperaterId    = this.drpRatifiedManId.SelectedValue,
                        AuditFlowName = "费控工程师审核",
                        IsClosed      = false,
                        State         = BLL.Const.State_1,
                    };
                    Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate);
                    Funs.DB.SubmitChanges();
                }
                BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateCost);

                ////保存流程审核数据
                this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostUnitManageAuditMenuId, this.HSSECostUnitManageId + "#2", (type == BLL.Const.BtnSubmit ? true : false),
                                              BLL.UnitService.GetUnitNameByUnitId(updateCost.UnitId) + "费用审核", "../CostGoods/HSSECostUnitManageAuditView.aspx?HSSECostUnitManageId={0}");

                if (type == BLL.Const.BtnSubmit)
                {
                    var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                    where x.DataId == this.HSSECostUnitManageId + "#2" && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                    select x;
                    if (updateNoClosedFlowOperate.Count() > 0)
                    {
                        foreach (var item in updateNoClosedFlowOperate)
                        {
                            item.OperaterId = this.CurrUser.UserId;
                            item.IsClosed   = true;
                            Funs.DB.SubmitChanges();
                        }
                    }
                }
            }
        }