예제 #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckDayXA checkDay = new Model.Check_CheckDayXA
            {
                CheckDayCode = this.txtCheckDayCode.Text.Trim(),
                ProjectId    = this.ProjectId,
                NotOKNum     = Funs.GetNewIntOrZero(this.txtNotOKNum.Text.Trim()),
                CheckDate    = Funs.GetNewDateTimeOrNow(this.txtCheckDate.Text.Trim())
            };
            if (this.trUnit.Hidden == false)
            {
                //受检单位
                string unitIds = string.Empty;
                foreach (var item in this.drpDutyUnitIds.SelectedValueArray)
                {
                    unitIds += item + ",";
                }
                if (!string.IsNullOrEmpty(unitIds))
                {
                    unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
                }
                checkDay.DutyUnitIds = unitIds;
            }
            if (this.trTeamGroup.Hidden == false)
            {
                //受检班组
                string teamGroupIds = string.Empty;
                foreach (var item in this.drpDutyTeamGroupIds.SelectedValueArray)
                {
                    teamGroupIds += item + ",";
                }
                if (!string.IsNullOrEmpty(teamGroupIds))
                {
                    teamGroupIds = teamGroupIds.Substring(0, teamGroupIds.LastIndexOf(","));
                }
                checkDay.DutyTeamGroupIds = teamGroupIds;
            }
            //检查区域
            string workAreaIds = string.Empty;

            foreach (var item in this.drpWorkAreaIds.SelectedValueArray)
            {
                workAreaIds += item + ",";
            }
            if (!string.IsNullOrEmpty(workAreaIds))
            {
                workAreaIds = workAreaIds.Substring(0, workAreaIds.LastIndexOf(","));
            }
            checkDay.WorkAreaIds = workAreaIds;
            checkDay.Unqualified = this.txtUnqualified.Text.Trim();
            if (this.drpCheckMan.SelectedValue != BLL.Const._Null)
            {
                checkDay.CompileMan = this.drpCheckMan.SelectedValue;
            }
            else
            {
                checkDay.CompileMan = this.CurrUser.UserId;
            }
            ////单据状态
            //checkDay.States = BLL.Const.State_0;
            //if (type == BLL.Const.BtnSubmit)
            //{
            //    checkDay.States = this.ctlAuditFlow.NextStep;
            //}
            if (!string.IsNullOrEmpty(this.CheckDayId))
            {
                checkDay.CheckDayId = this.CheckDayId;
                BLL.Check_CheckDayXAService.UpdateCheckDay(checkDay);
                BLL.LogService.AddSys_Log(this.CurrUser, checkDay.CheckDayCode, checkDay.CheckDayId, BLL.Const.ProjectCheckDayXAMenuId, BLL.Const.BtnModify);
            }
            else
            {
                checkDay.CheckDayId  = SQLHelper.GetNewID(typeof(Model.Check_CheckDayXA));
                this.CheckDayId      = checkDay.CheckDayId;
                checkDay.CompileUnit = this.CurrUser.UnitId;
                BLL.Check_CheckDayXAService.AddCheckDay(checkDay);
                BLL.LogService.AddSys_Log(this.CurrUser, checkDay.CheckDayCode, checkDay.CheckDayId, BLL.Const.ProjectCheckDayXAMenuId, BLL.Const.BtnAdd);
            }
        }