Exemplo n.º 1
0
        /// <summary>
        /// 保存按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtCheckContent.Text))
            {
                Model.Check_ProjectCheckItemDetail checkItemDetail = new Model.Check_ProjectCheckItemDetail
                {
                    CheckItemSetId = this.CheckItemSetId,
                    CheckContent   = this.txtCheckContent.Text.Trim(),
                    SortIndex      = Funs.GetNewIntOrZero(this.txtSortIndex.Text.Trim())
                };


                if (string.IsNullOrEmpty(this.CheckItemDetailId))
                {
                    checkItemDetail.CheckItemDetailId = SQLHelper.GetNewID(typeof(Model.Check_ProjectCheckItemDetail));
                    BLL.Check_ProjectCheckItemDetailService.AddCheckItemDetail(checkItemDetail);
                    BLL.LogService.AddSys_Log(this.CurrUser, checkItemDetail.SortIndex.ToString(), checkItemDetail.CheckItemDetailId, BLL.Const.ProjectCheckItemSetMenuId, BLL.Const.BtnAdd);
                }
                else
                {
                    checkItemDetail.CheckItemDetailId = this.CheckItemDetailId;
                    BLL.Check_ProjectCheckItemDetailService.UpdateCheckItemDetail(checkItemDetail);
                    BLL.LogService.AddSys_Log(this.CurrUser, checkItemDetail.SortIndex.ToString(), checkItemDetail.CheckItemDetailId, BLL.Const.ProjectCheckItemSetMenuId, BLL.Const.BtnModify);
                }

                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                Alert.ShowInParent("检查项内容不能为空!");
            }
        }
 /// <summary>
 /// 根据主键删除项目检查项明细
 /// </summary>
 /// <param name="checkItemDetailId"></param>
 public static void DeleteCheckItemDetail(string checkItemDetailId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Check_ProjectCheckItemDetail checkItemDetail = db.Check_ProjectCheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetailId);
     if (checkItemDetail != null)
     {
         db.Check_ProjectCheckItemDetail.DeleteOnSubmit(checkItemDetail);
         db.SubmitChanges();
     }
 }
 /// <summary>
 /// 修改项目检查项明细
 /// </summary>
 /// <param name="checkItemDetail"></param>
 public static void UpdateCheckItemDetail(Model.Check_ProjectCheckItemDetail checkItemDetail)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Check_ProjectCheckItemDetail newCheckItemDetail = db.Check_ProjectCheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetail.CheckItemDetailId);
     if (newCheckItemDetail != null)
     {
         newCheckItemDetail.CheckContent = checkItemDetail.CheckContent;
         newCheckItemDetail.SortIndex    = checkItemDetail.SortIndex;
         newCheckItemDetail.IsBuiltIn    = checkItemDetail.IsBuiltIn;
         db.SubmitChanges();
     }
 }
 /// <summary>
 /// 添加项目检查项明细
 /// </summary>
 /// <param name="checkItemDetail"></param>
 public static void AddCheckItemDetail(Model.Check_ProjectCheckItemDetail checkItemDetail)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Check_ProjectCheckItemDetail newCheckItemDetail = new Model.Check_ProjectCheckItemDetail
     {
         CheckItemDetailId = checkItemDetail.CheckItemDetailId,
         CheckItemSetId    = checkItemDetail.CheckItemSetId,
         CheckContent      = checkItemDetail.CheckContent,
         SortIndex         = checkItemDetail.SortIndex,
         IsBuiltIn         = checkItemDetail.IsBuiltIn
     };
     db.Check_ProjectCheckItemDetail.InsertOnSubmit(newCheckItemDetail);
     db.SubmitChanges();
 }
        /// <summary>
        /// 获取一级节点检查类型
        /// </summary>
        /// <param name="CheckItem"></param>
        /// <returns></returns>
        public static string ConvertCheckItemType(object CheckItem)
        {
            string type = string.Empty;

            if (CheckItem != null)
            {
                Model.Check_ProjectCheckItemDetail detail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(CheckItem.ToString());
                if (detail != null)
                {
                    Model.Check_ProjectCheckItemSet item = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(detail.CheckItemSetId);
                    if (item != null)
                    {
                        if (item.SupCheckItem == "0")
                        {
                            type = item.CheckItemName;
                        }
                        else
                        {
                            type = BLL.Check_ProjectCheckItemSetService.GetCheckItemNameBySupCheckItem(item.SupCheckItem);
                        }
                    }
                }
                else
                {
                    Model.Check_ProjectCheckItemSet item = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(CheckItem.ToString());
                    if (item != null)
                    {
                        if (item.SupCheckItem == "0")
                        {
                            type = item.CheckItemName;
                        }
                        else
                        {
                            type = BLL.Check_ProjectCheckItemSetService.GetCheckItemNameBySupCheckItem(item.SupCheckItem);
                        }
                    }
                }
            }
            return(type);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 确认按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <string> newParentIds = new List <string>();

            TreeNode[] nodes = this.tvCheckItemSet.GetCheckedNodes();
            foreach (var item in nodes)
            {
                if (item.Nodes.Count == 0)
                {
                    parentIds.Add(item.NodeID);   //集合中增加末级节点
                    if (item.ParentNode != null)
                    {
                        newParentIds.Add(item.ParentNode.NodeID);    //记录已增加的末级节点的父级节点集合
                    }
                }
            }
            foreach (var item in nodes)
            {
                if (item.Nodes.Count > 0)
                {
                    if (!newParentIds.Contains(item.NodeID))
                    {
                        parentIds.Add(item.NodeID);
                    }
                }
            }
            if (parentIds.Count == 0 && list.Count == 0)
            {
                ShowNotify("请至少选择一项!", MessageBoxIcon.Warning);
                return;
            }
            if (!string.IsNullOrEmpty(Request.Params["CheckDayId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckDayDetail detail = new Model.Check_CheckDayDetail
                    {
                        CheckDayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckDayDetail)),
                        CheckDayId       = Request.Params["CheckDayId"],
                        CheckItem        = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckDayDetailService.AddCheckDayDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckSpecialId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckSpecialDetail detail = new Model.Check_CheckSpecialDetail
                    {
                        CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecialDetail)),
                        CheckSpecialId       = Request.Params["CheckSpecialId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckColligationId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckColligationDetail detail = new Model.Check_CheckColligationDetail
                    {
                        CheckColligationDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckColligationDetail)),
                        CheckColligationId       = Request.Params["CheckColligationId"],
                        CheckItem = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckColligationDetailService.AddCheckColligationDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckWorkId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                    {
                        CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                        CheckWorkId       = Request.Params["CheckWorkId"],
                        CheckItem         = item,
                        CheckResult       = "合格",
                    };

                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                        detail.SortIndex    = checkItemDetail.SortIndex;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                            detail.SortIndex    = projectCheckItemDetail.SortIndex;
                        }
                    }
                    BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckHolidayId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckHolidayDetail detail = new Model.Check_CheckHolidayDetail
                    {
                        CheckHolidayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckHolidayDetail)),
                        CheckHolidayId       = Request.Params["CheckHolidayId"],
                        CheckItem            = item,
                        CheckResult          = "合格",
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }

                    BLL.Check_CheckHolidayDetailService.AddCheckHolidayDetail(detail);
                }
            }

            if (!string.IsNullOrEmpty(Request.Params["CheckDayId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckDayDetail detail = new Model.Check_CheckDayDetail
                    {
                        CheckDayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckDayDetail)),
                        CheckDayId       = Request.Params["CheckDayId"],
                        CheckItem        = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckDayDetailService.AddCheckDayDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckSpecialId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckSpecialDetail detail = new Model.Check_CheckSpecialDetail
                    {
                        CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecialDetail)),
                        CheckSpecialId       = Request.Params["CheckSpecialId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckColligationId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckColligationDetail detail = new Model.Check_CheckColligationDetail
                    {
                        CheckColligationDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckColligationDetail)),
                        CheckColligationId       = Request.Params["CheckColligationId"],
                        CheckItem = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckColligationDetailService.AddCheckColligationDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckWorkId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                    {
                        CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                        CheckWorkId       = Request.Params["CheckWorkId"],
                        CheckItem         = item
                    };
                    var checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.CheckResult  = "合格";
                    detail.CheckOpinion = "整改";
                    BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckHolidayId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckHolidayDetail detail = new Model.Check_CheckHolidayDetail
                    {
                        CheckHolidayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckHolidayDetail)),
                        CheckHolidayId       = Request.Params["CheckHolidayId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    detail.CheckResult  = "合格";
                    detail.CheckOpinion = "整改";
                    BLL.Check_CheckHolidayDetailService.AddCheckHolidayDetail(detail);
                }
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Exemplo n.º 7
0
        /// <summary>
        ///   提取方法
        /// </summary>
        /// <param name="supCheckItem"></param>
        private void InsertProjectCheckItemSet(string supCheckItem, string checkType)
        {
            var checkItems = from x in Funs.DB.Technique_CheckItemSet where x.SupCheckItem == supCheckItem && x.CheckType == checkType orderby x.SortIndex select x;

            if (checkItems.Count() > 0)
            {
                foreach (var item in checkItems)
                {
                    Model.Check_ProjectCheckItemSet checkItemSet = new Model.Check_ProjectCheckItemSet
                    {
                        CheckItemSetId = SQLHelper.GetNewID(typeof(Model.Check_ProjectCheckItemSet)),
                        ProjectId      = this.ProjectId,
                        CheckItemName  = item.CheckItemName
                    };

                    //获取项目表中对应上级检查项的Id
                    if (item.SupCheckItem != "0")
                    {
                        var cpItemSet = Funs.DB.Check_ProjectCheckItemSet.FirstOrDefault(x => x.OldCheckItemSetId == item.SupCheckItem && x.ProjectId == this.ProjectId);
                        if (cpItemSet != null)
                        {
                            checkItemSet.SupCheckItem = cpItemSet.CheckItemSetId;
                        }
                        else
                        {
                            checkItemSet.SupCheckItem = null;
                        }
                    }
                    else   //根级检查项
                    {
                        checkItemSet.SupCheckItem = "0";
                    }

                    checkItemSet.CheckType         = item.CheckType;
                    checkItemSet.MapCode           = item.MapCode;
                    checkItemSet.IsEndLever        = item.IsEndLever;
                    checkItemSet.SortIndex         = item.SortIndex;
                    checkItemSet.IsBuiltIn         = item.IsBuiltIn;
                    checkItemSet.OldCheckItemSetId = item.CheckItemSetId;
                    Funs.DB.Check_ProjectCheckItemSet.InsertOnSubmit(checkItemSet);
                    Funs.DB.SubmitChanges();

                    ///如果是末级菜单则查找明细表
                    if (checkItemSet.IsEndLever == true)
                    {
                        var details = from x in Funs.DB.Technique_CheckItemDetail where x.CheckItemSetId == item.CheckItemSetId select x;
                        foreach (var d in details)
                        {
                            Model.Check_ProjectCheckItemDetail detail = new Model.Check_ProjectCheckItemDetail
                            {
                                CheckItemDetailId = SQLHelper.GetNewID(typeof(Model.Check_ProjectCheckItemDetail)),
                                CheckItemSetId    = checkItemSet.CheckItemSetId,
                                CheckContent      = d.CheckContent,
                                SortIndex         = d.SortIndex,
                                IsBuiltIn         = d.IsBuiltIn
                            };
                            Funs.DB.Check_ProjectCheckItemDetail.InsertOnSubmit(detail);
                            Funs.DB.SubmitChanges();
                        }
                    }
                    else
                    {
                        InsertProjectCheckItemSet(checkItemSet.OldCheckItemSetId, checkType);
                    }
                }
            }
        }