protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         string receipient = ddlReceipient.SelectedValue;
         string list_code  = ddllists.SelectedValue.ToString();
         string phone      = txtPhoneNumber.Text.Trim();
         if (list_code.Equals("0"))
         {
             ShowMessage("Select List To add Numbers to", true);
         }
         else
         if (receipient.Equals("0") && phone == "")
         {
             ShowMessage("Please Enter Phone Number", true);
         }
         else
         if (receipient.Equals("0") && !phone_validity.NumberFormatIsValid(phone))
         {
             ShowMessage("Please Provide a valid Phone number", true);
         }
         else if (receipient.Equals("1") && FileUpload1.FileName.Trim().Equals(""))
         {
             ShowMessage("Browse file to Upload or Enter Phone Number", true);
         }
         else
         {
             UploadNumbers(phone);
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message, true);
     }
 }
    private void LoadSmslogs()
    {
        MultiView2.ActiveViewIndex = 0;
        string   vendorCode = ddlAreas.SelectedValue.ToString();
        string   phone      = phone_validity.Format(ddlPhone.Text);
        string   status     = ddlStatus.SelectedValue;
        DateTime from       = Process_file.ReturnDate(txtstartdate.Text.Trim(), 1);
        DateTime end        = Process_file.ReturnDate(txtenddate.Text.Trim(), 2);

        if (phone != "" && !phone_validity.NumberFormatIsValid(phone))
        {
            ShowMessage("Please Enter A valid Phone Number", true);
            txtstartdate.Focus();
        }
        else if (txtstartdate.Text.Equals(""))
        {
            ShowMessage("Please Enter Start Date for your Search", true);
            txtstartdate.Focus();
        }
        else
        {
            //get the SMS Report from SMS Client
            data_table           = data_file.GetSmsReportFromSMSClientDb(vendorCode, phone, status, from, end);
            DataGrid1.DataSource = data_table;
            DataGrid1.DataBind();

            Session["ResultTable"] = data_table;

            ShowMessage("Found [" + data_table.Rows.Count + "] Records", false);


            //old logic for getting vendor SMSs

            /*
             * data_table = data_file.GetArea(vendorCode);
             * if (data_table.Rows[0]["VendorType"].ToString().ToUpper() == "POSTPAID")
             * {
             *  data_table = data_file.GetPostPaidSMS(vendorCode, phone,status, from, end);
             *  DataGrid1.DataSource = data_table;
             *  DataGrid1.DataBind();
             *  ShowMessage("Found ["+data_table.Rows.Count+"] Records", false);
             * }
             * else if (data_table.Rows[0]["VendorType"].ToString().ToUpper() == "PREPAID")
             * {
             *  data_table = data_file.GetPrePaidSMS(vendorCode, phone,status, from, end);
             *  DataGrid1.DataSource = data_table;
             *  DataGrid1.DataBind();
             *  ShowMessage("Please Enter Start Date for your Search", true);
             *  ShowMessage("Found [" + data_table.Rows.Count + "] Records", false);
             * }
             * else
             * {
             *  ShowMessage("Vendor Details Not Found", true);
             * }
             */
        }
    }
Ejemplo n.º 3
0
    public string LogSMSCommaSeparatedList(string[] phonesArr, string message, string VendorCode, string mask)
    {
        var output = "";

        _phoneValidator = new PhoneValidator();

        var arrayPhones = phonesArr;

        //List has phone numbers
        if (arrayPhones.Length > 0)
        {
            var user = HttpContext.Current.Session["Username"].ToString();
            //var mask = HttpContext.Current.Session["Mask"].ToString();
            var mail      = HttpContext.Current.Session["Email"].ToString();
            int smscredit = GetUserCredit(VendorCode, user);
            if (arrayPhones.Length < smscredit)
            {
                string reduce = Reduct_credit(arrayPhones.Length);
                if (reduce == "SAVED")
                {
                    for (var i = 0; i < arrayPhones.Length; i++)
                    {
                        if (_phoneValidator.NumberFormatIsValid(arrayPhones[i].Trim()))
                        {
                            var phone = _phoneValidator.Format(arrayPhones[i].Trim());
                            _db.InsertSmsToSend(phone, message, mask, user, VendorCode);
                            output += "SMS to Phone Number" + arrayPhones[i].Trim() + " logged Successfully <br/>";
                        }
                        else
                        {
                            output += "Invalid Number " + arrayPhones[i].Trim() + " Was Provided and not processed <br/>";
                        }
                    }
                }
            }
            else
            {
                output = "Dear customer, Your Current SMS Limit is too low to send these SMS(s)";
            }
        }
        else
        {
            output = "No Active Phone number(s) Entered";
        }

        return(output);
    }
Ejemplo n.º 4
0
    private string validate_input(string fname, string lname, string phone, string vendor, string role)
    {
        string output = "";

        if (fname.Equals(""))
        {
            output = "First Name Required";
            txtfname.Focus();
        }
        else if (lname.Equals(""))
        {
            output = "Last Name Required";
            txtlname.Focus();
        }
        else if (phone.Equals(""))
        {
            output = "Mobile Phone Number Required";
            txtphone.Focus();
        }
        else if (!phone_validity.NumberFormatIsValid(phone))
        {
            output = "Enter Valid Mobile Phone Number Required";
            txtphone.Focus();
        }
        else if (vendor.Equals("0"))
        {
            output = "Select a vendor";
        }
        else if (role.Equals("0"))
        {
            output = "Select User Role";
        }
        else
        {
            output = "OK";
        }
        return(output);
    }