示例#1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckSpecial checkSpecial = new Model.Check_CheckSpecial
            {
                CheckSpecialCode = this.txtCheckSpecialCode.Text.Trim(),
                ProjectId        = this.ProjectId
            };

            ///组成员
            string partInPersonIds = string.Empty;
            string partInPersons   = string.Empty;

            foreach (var item in this.drpPartInPersons.SelectedValueArray)
            {
                var user = BLL.UserService.GetUserByUserId(item);
                if (user != null)
                {
                    partInPersonIds += user.UserId + ",";
                    partInPersons   += user.UserName + ",";
                }
            }
            if (!string.IsNullOrEmpty(partInPersonIds))
            {
                checkSpecial.PartInPersonIds = partInPersonIds.Substring(0, partInPersonIds.LastIndexOf(","));
                checkSpecial.PartInPersons   = partInPersons.Substring(0, partInPersons.LastIndexOf(","));
            }

            checkSpecial.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();
            checkSpecial.CheckTime         = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
            ////单据状态
            checkSpecial.States = Const.State_0;
            if (type == Const.BtnSubmit)
            {
                checkSpecial.States = Const.State_1;
            }
            if (!string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) && this.drpSupCheckItemSet.SelectedValue != Const._Null)
            {
                checkSpecial.CheckItemSetId = this.drpSupCheckItemSet.SelectedValue;
            }
            if (!string.IsNullOrEmpty(this.CheckSpecialId))
            {
                checkSpecial.CheckSpecialId = this.CheckSpecialId;
                Check_CheckSpecialService.UpdateCheckSpecial(checkSpecial);
                LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnModify);
                Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(this.CheckSpecialId);
            }
            else
            {
                checkSpecial.CheckSpecialId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecial));
                this.CheckSpecialId         = checkSpecial.CheckSpecialId;
                checkSpecial.CompileMan     = this.CurrUser.UserId;
                Check_CheckSpecialService.AddCheckSpecial(checkSpecial);
                LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnAdd);
            }
            this.SaveDetail(type, checkSpecial);
        }
示例#2
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnMenuDel_Click(object sender, EventArgs e)
 {
     if (Grid1.SelectedRowIndexArray.Length > 0)
     {
         foreach (int rowIndex in Grid1.SelectedRowIndexArray)
         {
             string rowID          = Grid1.DataKeys[rowIndex][0].ToString();
             var    RectifyNotices = BLL.RectifyNoticesService.GetRectifyNoticesById(rowID);
             if (RectifyNotices != null)
             {
                 LogService.AddSys_Log(this.CurrUser, RectifyNotices.RectifyNoticesCode, rowID, BLL.Const.ProjectRectifyNoticeMenuId, BLL.Const.BtnDelete);
                 RectifyNoticesService.DeleteRectifyNoticesById(rowID);
                 Model.Check_CheckDayDetail dayDetail = (from x in Funs.DB.Check_CheckDayDetail
                                                         where x.RectifyNoticeId == rowID
                                                         select x).FirstOrDefault();
                 Model.Check_CheckSpecialDetail specialDetail = (from x in Funs.DB.Check_CheckSpecialDetail
                                                                 where x.RectifyNoticeId == rowID
                                                                 select x).FirstOrDefault();
                 Model.Check_CheckColligationDetail colligationDetail = (from x in Funs.DB.Check_CheckColligationDetail
                                                                         where x.RectifyNoticeId == rowID
                                                                         select x).FirstOrDefault();
                 if (dayDetail != null)
                 {
                     dayDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
                 else if (specialDetail != null)
                 {
                     specialDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
                 else if (colligationDetail != null)
                 {
                     colligationDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
             }
         }
         BindGrid();
         ShowNotify("删除数据成功!(表格数据已重新绑定)");
     }
 }
示例#3
0
 /// <summary>
 /// 删除方法
 /// </summary>
 private void DeleteData()
 {
     if (Grid1.SelectedRowIndexArray.Length > 0)
     {
         foreach (int rowIndex in Grid1.SelectedRowIndexArray)
         {
             string rowID = Grid1.DataKeys[rowIndex][0].ToString();
             if (judgementDelete(rowID, false))
             {
                 var getD = SafetyMeasuresService.GetSafetyMeasuresBySafetyMeasuresId(rowID);
                 if (getD != null)
                 {
                     LogService.AddSys_Log(this.CurrUser, getD.SortIndex.ToString(), getD.SafetyMeasuresId, Const.SafetyMeasuresMenuId, BLL.Const.BtnDelete);
                     BLL.SafetyMeasuresService.DeleteSafetyMeasuresById(rowID);
                 }
             }
         }
         BindGrid();
         ShowNotify("删除数据成功!");
     }
 }
示例#4
0
        /// <summary>
        /// 删除方法
        /// </summary>
        private void DeleteData()
        {
            if (Grid1.SelectedRowIndexArray.Length > 0)
            {
                foreach (int rowIndex in Grid1.SelectedRowIndexArray)
                {
                    string rowID = Grid1.DataKeys[rowIndex][0].ToString();
                    if (this.judgementDelete(rowID, true))
                    {
                        var getV = PictureTypeService.GetPictureTypeById(hfFormID.Text);
                        if (getV != null)
                        {
                            LogService.AddSys_Log(this.CurrUser, getV.Code, getV.PictureTypeId, BLL.Const.PictureTypeMenuId, BLL.Const.BtnDelete);
                            PictureTypeService.DeletePictureTypeById(rowID);
                        }
                    }
                }

                BindGrid();
                PageContext.RegisterStartupScript("onNewButtonClick();");
            }
        }