Exemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            //cmnCde.showSQLNoPermsn(MarkupConverter.RtfToHtmlConverter.ConvertRtfToHtml(this.bodyTextBox.Rtf));
            if (this.grpComboBox.Text != "Everyone" &&
                this.grpComboBox.Text != "Single Person")
            {
                if (this.grpNmIDTextBox.Text == "-1" ||
                    this.grpNmTextBox.Text == "")
                {
                    cmnCde.showMsg("Please select a Group Name!", 0);
                    return;
                }
            }
            if (this.msgTypComboBox.Text == "")
            {
                cmnCde.showMsg("Please select a Message Type!", 0);
                return;
            }
            System.Windows.Forms.Application.DoEvents();

            string curid = cmnCde.getOrgFuncCurID(cmnCde.Org_id).ToString();

            if (this.grpComboBox.Text == "Companies/Institutions")
            {
                string[] spltChrs = { ";" };
                this.cstmrIDs = this.grpNmIDTextBox.Text.Split(spltChrs, StringSplitOptions.RemoveEmptyEntries);
                //int rwidx = 0;
                this.mailLabel.Text    = "Loading the Companies/Institutions involved (" + this.cstmrIDs.Length + ") and their Contacts...Please Wait...";
                this.mailLabel.Visible = true;
                this.toTextBox.Text    = "";
                for (int a = 0; a < this.cstmrIDs.Length; a++)
                {
                    //this.prsnID = this.prsnIDs[a];
                    if (this.msgTypComboBox.Text == "Email")
                    {
                        this.toTextBox.Text += cmnCde.getCstmrSpplrEmails(long.Parse(this.cstmrIDs[a])).Replace(",", ";") + ";";
                    }
                    else if (this.msgTypComboBox.Text == "SMS")
                    {
                        this.toTextBox.Text += cmnCde.getCstmrSpplrMobiles(long.Parse(this.cstmrIDs[a])).Replace(",", ";") + ";";
                    }
                    else
                    {
                        this.toTextBox.Text += this.cstmrIDs[a].Replace(",", ";") + ";";
                    }
                    this.mailLabel.Text = "Loading the Companies/Institutions involved (" + (a + 1).ToString() + "/" + this.cstmrIDs.Length + ") and their Contacts...Please Wait...";
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            else
            {
                this.prsnIDs = this.getPrsnsInvolved();
                //int rwidx = 0;
                this.mailLabel.Text    = "Loading the Persons involved (" + this.prsnIDs.Length + ") and their Contacts...Please Wait...";
                this.mailLabel.Visible = true;
                this.toTextBox.Text    = "";
                for (int a = 0; a < this.prsnIDs.Length; a++)
                {
                    this.prsnID = this.prsnIDs[a];
                    if (this.msgTypComboBox.Text == "Email")
                    {
                        this.toTextBox.Text += cmnCde.getPrsnEmail(this.prsnID).Replace(",", ";") + ";";
                    }
                    else if (this.msgTypComboBox.Text == "SMS")
                    {
                        this.toTextBox.Text += cmnCde.getPrsnMobile(this.prsnID).Replace(",", ";") + ";";
                    }
                    else
                    {
                        this.toTextBox.Text += this.prsnIDs[a] + ";";
                    }

                    this.mailLabel.Text = "Loading the Persons involved (" + (a + 1).ToString() + "/" + this.prsnIDs.Length + ") and their Contacts...Please Wait...";
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            this.mailLabel.Visible = false;
        }