Example #1
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbname, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbname.Text
                }));
                this.tbname.Focus();
                return;
            }
            string text = this.tbname.Text;

            if (!GroupInfo.CheckGroupName(this.m_groupID, text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[]
                {
                    text
                }));
                this.tbname.Focus();
                return;
            }
            System.Text.StringBuilder stringBuilder     = new System.Text.StringBuilder();
            System.Collections.Generic.List <long> list = new System.Collections.Generic.List <long>();
            string text2;

            foreach (DataRow dataRow in this.member_tb.Rows)
            {
                text2 = (string)dataRow[0];
                stringBuilder.Append(text2 + ",");
                list.Add((long)System.Convert.ToInt32(text2));
            }
            text2 = stringBuilder.ToString();
            if (text2.Length == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
                return;
            }
            if (this.m_groupID >= 0L)
            {
                GroupInfo groupByID = GroupInfo.GetGroupByID(this.m_groupID);
                groupByID.GroupName = text;
                groupByID.Members   = text2;
                switch (groupByID.Update())
                {
                case -2:
                case -1:
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                    return;

                case 0:
                    break;

                case 1:
                    LogAPI.writeEventLog("0430032", new string[]
                    {
                        groupByID.GroupName,
                        groupByID.GroupType,
                        EcoGlobalVar.gl_LoginUser.UserName
                    });
                    EcoGlobalVar.setDashBoardFlg(520uL, "", 64);
                    EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                    base.DialogResult = DialogResult.OK;
                    base.Close();
                    return;

                default:
                    return;
                }
            }
            else
            {
                int num = GroupInfo.CreateNewGroup(text, this.m_groupType, "", list);
                if (num == -2)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[]
                    {
                        text
                    }));
                    return;
                }
                if (num < 0)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                    return;
                }
                LogAPI.writeEventLog("0430030", new string[]
                {
                    text,
                    this.m_groupType,
                    EcoGlobalVar.gl_LoginUser.UserName
                });
                EcoGlobalVar.setDashBoardFlg(512uL, "", 64);
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
        }