Esempio n. 1
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (Prompt.ShowDialog("Password", "Credits") == "19780411" || rememberedPassword)
            {
                rememberedPassword = true;
                int colCount = dgCredits.ColumnCount;
                int amtCol   = 3; // colCount - 2;
                int noteCol  = 4; // colCount - 1;
                int accCol   = 5;
                for (int i = 1; i < dgCredits.Rows.Count; i++)
                {
                    DataGridViewRow gvr         = dgCredits.Rows[i];
                    String          accNumber   = gvr.Cells[0].Value.ToString();
                    double          amt         = 0;
                    String          customerAcc = gvr.Cells[0].Value.ToString();
                    String          amount      = gvr.Cells[amtCol].Value.ToString();
                    String          note        = gvr.Cells[noteCol].Value.ToString();
                    String          acc         = gvr.Cells[accCol].Value.ToString();
                    if (double.TryParse(amount, out amt) && note != "" && amt != 0)
                    {
                        acc = acc.Replace("/", "");
                        if (acc.Length != 7)
                        {
                            MessageBox.Show("Please enter a valid account number. " + acc + " is invalid", "Credits", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            continue;
                        }
                        if (amt > 0)
                        {
                            amt = amt * -1;
                        }
                        String pastelString = "";

                        String returner = Controller.pastel.PostCredit2(DateTime.Now, building.Period, centrec, building.DataPath, 5, building.Journal, building.Centrec_Account, customerAcc, building.Cash_Book, building.Centrec_Building, note, note, amt.ToString("#0.00"), acc, customerAcc, out pastelString);
                    }
                    else
                    {
                        continue;
                    }
                    gvr.Cells[amtCol].Value  = 0;
                    gvr.Cells[noteCol].Value = "";
                }
            }
            else
            {
                MessageBox.Show("Please enter the correct password to process", "Process", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 2
0
 private void chkMarketing_CheckedChanged(object sender, EventArgs e)
 {
     if (chkMarketing.Checked)
     {
         if (Prompt.ShowDialog("Password", "SMS") == "sheldonpwd")
         {
             validSMS = true;
             chkBillCustomer.Checked = false;
             chkBillBuilding.Checked = false;
         }
         else
         {
             validSMS = false;
             chkBillCustomer.Checked = false;
             chkBillBuilding.Checked = false;
             chkMarketing.Checked    = false;
         }
     }
 }
Esempio n. 3
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            if (validSMS)
            {
                String            sendTo   = String.Empty;
                String            sendName = String.Empty;
                String            status;
                bool              success  = false;
                int               entries  = 0;
                List <SMSMessage> messages = new List <SMSMessage>();

                if (!String.IsNullOrEmpty(txtMessage.Text) && txtMessage.Text.Length <= 160)
                {
                    var builder = new System.Text.StringBuilder();
                    builder.Append(sendTo);
                    var builder1 = new System.Text.StringBuilder();
                    builder1.Append(sendName);
                    foreach (SMSCustomer smsc in smsCustomers.customers)
                    {
                        if (smsc.include && !chkBillCustomer.Checked)
                        {
                            builder.Append(smsc.customerNumber + ";");
                            builder1.Append(smsc.customerName + ";");
                            entries++;
                        }
                        else if (smsc.include)
                        {
                            SMSMessage m = AddSMS(smsc.customerAccount, smsc.customerNumber);
                            messages.Add(m);
                        }
                    }
                    sendName = builder1.ToString();
                    sendTo   = builder.ToString();
                }
                else
                {
                    MessageBox.Show("Please enter a valid message", "SMS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtMessage.Focus();
                    return;
                }
                if (!String.IsNullOrEmpty(sendName) && !String.IsNullOrEmpty(sendTo))
                {
                    SMSMessage m   = AddSMS(sendName, sendTo);
                    String     msg = "";

                    if (!String.IsNullOrEmpty(m.message))
                    {
                        success = sms.SendBulkMessage(m, chkImmediate.Checked, out status);
                        if (success)
                        {
                            msg = "Message sent";
                            if (m.bulkbillable)
                            {
                                PostPastel(m.message, entries, out status);
                            }
                        }
                        else
                        {
                            msg = status;
                        }
                    }
                    else
                    {
                        msg = "Cannot send SMS";
                    }
                    MessageBox.Show(msg, "SMS", MessageBoxButtons.OK, (success ? MessageBoxIcon.Information : MessageBoxIcon.Error));
                }
                else
                {
                    int mCount = 0;
                    foreach (SMSMessage m in messages)
                    {
                        if (sms.SendMessage(m, chkImmediate.Checked, out status))
                        {
                            mCount++;
                        }
                    }
                    MessageBox.Show(mCount.ToString() + " SMS Sent", "SMS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (Prompt.ShowDialog("Password", "SMS") == "sheldonpwd")
                {
                    validSMS = true;
                    btnSend_Click(sender, e);
                }
            }
        }