コード例 #1
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            string       relation1   = Categories.Where(x => x.Selected).Select(a => a.Value).ToList().ToCharSeperatedString(Constants.DelimeterSinglePipe);
            WFComponents teamMasters = new WFComponents();

            teamMasters.Add(new WFComponent
            {
                ComponentType = Type,
                ComponentId   = TeamId,
                ComponentDesp = TeamName,
                Relation1     = relation1,
                Action        = Action,
                DataBaseInfo  = UserContext.DataBaseInfo,
            });
            WFComponentSubs wfComponentSubs = new WFComponentSubs();

            wfComponentSubs.AddRange(Users.Where(x => x.Selected).ToList().Select(row => new WFComponentSub
            {
                WFCSCode = row.Value
            }));
            var firstOrDefault = teamMasters.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.wfComponentSubs = wfComponentSubs;
            }

            if (_controlPanel.SetTeams(teamMasters))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TeamMasterSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TEAM MASTER SAVED",
                                  GlobalCustomResource.TeamMasterSaved, true);
                ClearForm();
                DivAction = false;
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TeamMasterFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TEAM MASTER UPDATE FAILED",
                                  GlobalCustomResource.TeamMasterFailed, true);
            }
        }