Ejemplo n.º 1
0
        /// <summary>
        /// 添加安全季节性/节假日检查
        /// </summary>
        /// <param name="checkHoliday"></param>
        public static void AddCheckHoliday(Model.Check_CheckHoliday checkHoliday)
        {
            Model.SUBHSSEDB          db = Funs.DB;
            Model.Check_CheckHoliday newCheckHoliday = new Model.Check_CheckHoliday
            {
                CheckHolidayId     = checkHoliday.CheckHolidayId,
                CheckHolidayCode   = checkHoliday.CheckHolidayCode,
                ProjectId          = checkHoliday.ProjectId,
                Area               = checkHoliday.Area,
                CheckTime          = checkHoliday.CheckTime,
                ThisUnitId         = checkHoliday.ThisUnitId,
                MainUnitPerson     = checkHoliday.MainUnitPerson,
                SubUnits           = checkHoliday.SubUnits,
                SubUnitPerson      = checkHoliday.SubUnitPerson,
                PartInPersonNames  = checkHoliday.PartInPersonNames,
                MainUnitDeputy     = checkHoliday.MainUnitDeputy,
                SubUnitDeputy      = checkHoliday.SubUnitDeputy,
                MainUnitDeputyDate = checkHoliday.MainUnitDeputyDate,
                SubUnitDeputyDate  = checkHoliday.SubUnitDeputyDate,
                AttachUrl          = checkHoliday.AttachUrl,
                IsCompleted        = checkHoliday.IsCompleted,
                States             = checkHoliday.States,
                CompileMan         = checkHoliday.CompileMan
            };

            db.Check_CheckHoliday.InsertOnSubmit(newCheckHoliday);
            db.SubmitChanges();
            ////增加一条编码记录
            BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckHolidayMenuId, checkHoliday.ProjectId, null, checkHoliday.CheckHolidayId, checkHoliday.CheckTime);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindGrid()
        {
            string strSql = @"SELECT CheckHoliday.CheckHolidayId,CheckHoliday.ProjectId,CodeRecords.Code AS CheckHolidayCode,Unit.UnitId,CheckHoliday.Area,CheckHoliday.CheckTime,CheckHoliday.Evaluate"
                            + @" ,(CASE WHEN CheckHoliday.States = " + BLL.Const.State_0 + " OR CheckHoliday.States IS NULL THEN '待['+OperateUser.UserName+']提交' WHEN CheckHoliday.States =  " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.UserName+']办理' END) AS  FlowOperateName"
                            + @" FROM Check_CheckHoliday AS CheckHoliday "
                            + @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON CheckHoliday.CheckHolidayId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1"
                            + @" LEFT JOIN Sys_User AS OperateUser ON FlowOperate.OperaterId=OperateUser.UserId "
                            + @" LEFT JOIN Sys_User AS Users ON CheckHoliday.CompileMan=Users.UserId "
                            + @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=Users.UnitId  "
                            + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckHoliday.CheckHolidayId=CodeRecords.DataId WHERE 1=1 ";
            List <SqlParameter> listStr = new List <SqlParameter>();

            strSql += " AND CheckHoliday.ProjectId = @ProjectId";
            listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));

            if (!string.IsNullOrEmpty(this.txtCheckHolidayCode.Text.Trim()))
            {
                strSql += " AND CheckHolidayCode LIKE @CheckHolidayCode";
                listStr.Add(new SqlParameter("@CheckHolidayCode", "%" + this.txtCheckHolidayCode.Text.Trim() + "%"));
            }
            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                strSql += " AND Unit.UnitId = @UnitId";
                listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue.Trim()));
            }
            if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
            {
                strSql += " AND Area LIKE @HolidayAreaName";
                listStr.Add(new SqlParameter("@HolidayAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
            }
            SqlParameter[] parameter = listStr.ToArray();
            DataTable      tb        = SQLHelper.GetDataTableRunText(strSql, parameter);

            // 2.获取当前分页数据
            //var table = this.GetPagedDataTable(Grid1, tb1);

            Grid1.RecordCount = tb.Rows.Count;
            tb = GetFilteredTable(Grid1.FilteredData, tb);
            var table = this.GetPagedDataTable(Grid1, tb);

            Grid1.DataSource = table;
            Grid1.DataBind();
            for (int i = 0; i < Grid1.Rows.Count; i++)
            {
                Model.Check_CheckHoliday checkHoliday = BLL.Check_CheckHolidayService.GetCheckHolidayByCheckHolidayId(this.Grid1.DataKeys[i][0].ToString());
                if (checkHoliday != null)
                {
                    if (checkHoliday.IsCompleted != true)
                    {
                        Grid1.Rows[i].RowCssClass = "yellow";
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 修改安全季节性/节假日检查
 /// </summary>
 /// <param name="checkHoliday"></param>
 public static void UpdateCheckHoliday(Model.Check_CheckHoliday checkHoliday)
 {
     Model.SUBHSSEDB          db = Funs.DB;
     Model.Check_CheckHoliday newCheckHoliday = db.Check_CheckHoliday.FirstOrDefault(e => e.CheckHolidayId == checkHoliday.CheckHolidayId);
     if (newCheckHoliday != null)
     {
         newCheckHoliday.Area               = checkHoliday.Area;
         newCheckHoliday.CheckTime          = checkHoliday.CheckTime;
         newCheckHoliday.ThisUnitId         = checkHoliday.ThisUnitId;
         newCheckHoliday.MainUnitPerson     = checkHoliday.MainUnitPerson;
         newCheckHoliday.SubUnits           = checkHoliday.SubUnits;
         newCheckHoliday.SubUnitPerson      = checkHoliday.SubUnitPerson;
         newCheckHoliday.PartInPersonNames  = checkHoliday.PartInPersonNames;
         newCheckHoliday.MainUnitDeputy     = checkHoliday.MainUnitDeputy;
         newCheckHoliday.SubUnitDeputy      = checkHoliday.SubUnitDeputy;
         newCheckHoliday.MainUnitDeputyDate = checkHoliday.MainUnitDeputyDate;
         newCheckHoliday.SubUnitDeputyDate  = checkHoliday.SubUnitDeputyDate;
         newCheckHoliday.AttachUrl          = checkHoliday.AttachUrl;
         newCheckHoliday.IsCompleted        = checkHoliday.IsCompleted;
         newCheckHoliday.States             = checkHoliday.States;
         db.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckHoliday checkHoliday = new Model.Check_CheckHoliday
            {
                CheckHolidayCode = this.txtCheckHolidayCode.Text.Trim(),
                CheckTime        = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
                ProjectId        = this.ProjectId,
                Area             = this.txtArea.Text.Trim(),
                Evaluate         = this.drpEvaluate.SelectedValue
            };
            if (!string.IsNullOrEmpty(this.drpThisUnit.SelectedValue))
            {
                checkHoliday.ThisUnitId = this.drpThisUnit.SelectedValue;
            }
            //本单位人员
            string mainUnitPerson = string.Empty;

            foreach (var item in this.drpMainUnitPerson.SelectedValueArray)
            {
                mainUnitPerson += item + ",";
            }
            if (!string.IsNullOrEmpty(mainUnitPerson))
            {
                mainUnitPerson = mainUnitPerson.Substring(0, mainUnitPerson.LastIndexOf(","));
            }
            checkHoliday.MainUnitPerson = mainUnitPerson;
            //参与单位
            string subUnits = string.Empty;

            foreach (var item in this.drpSubUnits.SelectedValueArray)
            {
                subUnits += item + ",";
            }
            if (!string.IsNullOrEmpty(subUnits))
            {
                checkHoliday.SubUnits = subUnits.Substring(0, subUnits.LastIndexOf(","));
            }
            //参与用户
            string subUnitPerson = string.Empty;

            foreach (var item in this.drpSubUnitPerson.SelectedValueArray)
            {
                if (item != BLL.Const._Null)
                {
                    subUnitPerson += item + ",";
                }
            }
            if (!string.IsNullOrEmpty(subUnitPerson))
            {
                checkHoliday.SubUnitPerson = subUnitPerson.Substring(0, subUnitPerson.LastIndexOf(","));
            }
            checkHoliday.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();
            //if (this.ckbIsCompleted.Checked)
            //{
            //    checkHoliday.IsCompleted = true;
            //}
            checkHoliday.MainUnitDeputy     = this.txtMainUnitDeputy.Text.Trim();
            checkHoliday.MainUnitDeputyDate = Funs.GetNewDateTime(this.txtMainUnitDeputyDate.Text.Trim());
            checkHoliday.SubUnitDeputy      = this.txtSubUnitDeputy.Text.Trim();
            checkHoliday.SubUnitDeputyDate  = Funs.GetNewDateTime(this.txtSubUnitDeputyDate.Text.Trim());
            ////单据状态
            checkHoliday.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                checkHoliday.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CheckHolidayId))
            {
                checkHoliday.CheckHolidayId = this.CheckHolidayId;
                BLL.Check_CheckHolidayService.UpdateCheckHoliday(checkHoliday);
                BLL.LogService.AddSys_Log(this.CurrUser, checkHoliday.CheckHolidayCode, checkHoliday.CheckHolidayId, BLL.Const.ProjectCheckHolidayMenuId, BLL.Const.BtnModify);
            }
            else
            {
                checkHoliday.CheckHolidayId = SQLHelper.GetNewID(typeof(Model.Check_CheckHoliday));
                this.CheckHolidayId         = checkHoliday.CheckHolidayId;
                checkHoliday.CompileMan     = this.CurrUser.UserId;
                BLL.Check_CheckHolidayService.AddCheckHoliday(checkHoliday);
                BLL.LogService.AddSys_Log(this.CurrUser, checkHoliday.CheckHolidayCode, checkHoliday.CheckHolidayId, BLL.Const.ProjectCheckHolidayMenuId, BLL.Const.BtnAdd);
            }

            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCheckHolidayMenuId, this.CheckHolidayId, (type == BLL.Const.BtnSubmit ? true : false), checkHoliday.Area, "../Check/CheckHolidayView.aspx?CheckHolidayId={0}");
        }