示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Datalayer.ShowQuestMsg("Are you sure? Do you want to Send SMS? "))
            {
                int iSend = 0, iNotSend = 0;

                for (int i = 0; i < dgDisplayData.Rows.Count; i++)
                {
                    if (Convert.ToString(dgDisplayData.Rows[i].Cells[0].Value) == "True")
                    {
                        string sMobileNo = dgDisplayData.Rows[i].Cells["MobileNo"].Value.ToString();
                        string sMSG      = dgDisplayData.Rows[i].Cells["Msg"].Value.ToString();
                        string SMSID     = dgDisplayData.Rows[i].Cells["SMSID"].Value.ToString();

                        int iD = 0;
                        int.TryParse(SMSID, out iD);
                        bool IsSend = SendSMS(sMobileNo, sMSG);
                        if (IsSend)
                        {
                            iSend = iSend + 1;
                        }
                        else
                        {
                            iNotSend = iNotSend + 1;
                        }

                        int?Iout = 0;
                        MyDa = new MyDabaseDataContext(Properties.Settings.Default.Style_King_Dev);
                        MyDa.USP_VP_ADDSMS(iD, DateTime.Now, sMobileNo, sMSG, IsSend, Datalayer.iT001_COMPANYID, ref Iout);
                    }
                }

                Datalayer.InformationMessageBox("SMS Send successfully.");
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (dgDisplayData.Rows.Count == 0)
            {
                Datalayer.InformationMessageBox("Please select customer ");
                return;
            }
            if (Datalayer.ShowQuestMsg("Are you sure? Do you want to Send SMS? "))
            {
                int iSend = 0, iNotSend = 0;

                for (int i = 0; i < dgDisplayData.Rows.Count; i++)
                {
                    if (Convert.ToString(dgDisplayData.Rows[i].Cells[0].Value) == "True")
                    {
                        string sMobileNo    = dgDisplayData.Rows[i].Cells["T001_MOBILE1"].Value.ToString();
                        string sName        = dgDisplayData.Rows[i].Cells["T001_NAME"].Value.ToString();
                        string sAmount      = dgDisplayData.Rows[i].Cells["TOTALPENDING"].Value.ToString();
                        string sCompanyName = dgDisplayData.Rows[i].Cells["TM_NAME"].Value.ToString();
                        string sPhoneNo     = dgDisplayData.Rows[i].Cells["TM_PHONENO"].Value.ToString();

                        string sMSG   = "Dear, " + sName + " your pending amount payable to " + sCompanyName + " is Rs." + sAmount + " and it is now overdue. Please Contact us on " + sPhoneNo + " urgently to discuss our policy.";
                        bool   IsSend = SendSMS(sMobileNo, sMSG);
                        if (IsSend)
                        {
                            iSend = iSend + 1;
                        }
                        else
                        {
                            iNotSend = iNotSend + 1;
                        }

                        int?Iout = 0;
                        MyDa = new MyDabaseDataContext(Properties.Settings.Default.Style_King_Dev);
                        MyDa.USP_VP_ADDSMS(0, DateTime.Now, sMobileNo, sMSG, IsSend, Datalayer.iT001_COMPANYID, ref Iout);
                    }
                }

                Datalayer.InformationMessageBox("SMS Send successfully.");
                lblTotalSend.Text = "Total Send SMS:" + iSend.ToString();
                lblNotSend.Text   = "Total Not Send SMS:" + iNotSend.ToString();
            }
        }