private int GetMessageCost(string phone) { int intCost = 0; string code = ""; phone_validity = new PhoneValidator(); if (phone_validity.PhoneNumbersOk(phone)) { if (phone.StartsWith("0")) { code = phone.Substring(1, 3); } else if (phone.StartsWith("256")) { code = phone.Substring(3, 3); } string ntwk = nCodes[code].ToString(); string cost = rates[ntwk].ToString(); intCost = int.Parse(cost); intCost = int.Parse(cost); } return(intCost); }
private void LoadListDetails() { MultiView2.ActiveViewIndex = 0; string list_code = ddllists.SelectedValue.ToString(); string phone = txtPhone.Text.Trim(); string name = txtSearch.Text.Trim(); string VendorCode = ddlAreas.SelectedValue;; if (!phone.Equals("")) { if (phone_validity.PhoneNumbersOk(phone)) { data_table = Process_file.GetListContent(VendorCode, list_code, phone, name); DataGrid1.DataSource = data_table; DataGrid1.CurrentPageIndex = 0; DataGrid1.DataBind(); ShowMessage(".", true); } else { DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage("Please Enter valid Phone Number", true); txtPhone.Focus(); } } else { data_table = Process_file.GetListContent(VendorCode, list_code, phone, name); DataGrid1.DataSource = data_table; DataGrid1.DataBind(); ShowMessage(".", true); } }
public string SaveErrorSub(string name, string phone, string email) { string ret = ""; PhoneValidator pv = new PhoneValidator(); phone = bll.FormatPhoneNumber(phone); if (!pv.PhoneNumbersOk(phone)) { ret = "Please Enter a valid Phone Number"; } else if (!bll.IsValidEmailAddress(email)) { ret = "Please Enter a valid Email Address"; } else if (bll.IsSubEmail(email)) { ret = "Email is already subscribed"; } else if (bll.IsSubPhone(phone)) { ret = "Phone is already subscribed"; } else { datafile.SaveErrorSub(name, phone, email); ret = "Subscriber Saved Successfully"; } return(ret); }
private void UploadNumbers(string phone) { if (!FileUpload1.FileName.Trim().Equals("")) { ReadFile(); } else { string name = txtName.Text.Trim(); string list_code = ddllists.SelectedValue.ToString(); if (phone_validity.PhoneNumbersOk(phone)) { Process_file.SavePhoneNumber(phone, name, list_code); txtName.Text = ""; txtPhoneNumber.Text = ""; ShowMessage(phone + " Add to lists Successfully", false); } else { ShowMessage(phone + " is not a valid Phone Number", true); } } }
public string SaveInvoiceDetails(string fname, string mname, string lname, string phone, string email, string amount) { string ret = ""; PhoneValidator ph = new PhoneValidator(); if (!bll.IsValidEmailAddressOptional(email)) { ret = "Please Provide a valid email address"; } else if (!ph.PhoneNumbersOk(phone) && !phone.Equals("")) { ret = phone + " is not a valid phone number"; } else { } return(ret); }
private int GetTotalCost(string[] phones) { int messageCost = 0; phone_validity = new PhoneValidator(); foreach (string phone in phones) { string s = phone; if (phone != null) { s = process_file.formatPhone(s); if (phone_validity.PhoneNumbersOk(s)) { messageCost = messageCost + GetMessageCost(s); } } } return(messageCost); }
private string validate_input(string fname, string lname, string phone, string area, string type) { 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.PhoneNumbersOk(phone)) { output = "Enter Valid Mobile Phone Number Required"; txtphone.Focus(); } else if (area.Equals("0")) { output = "Select Operating Area"; } else if (type.Equals("0")) { output = "Select User Type"; } else { output = "OK"; } return(output); }
public InvoiceTran SaveInvoiceDetails(InvoiceTran inv) { InvoiceTran resp = new InvoiceTran(); PhoneValidator ph = new PhoneValidator(); if (!bll.IsValidEmailAddress(inv.Email) && !inv.Email.Equals("")) { resp.ErrorCode = "1"; resp.Error = "Please Provide a valid email address"; } else if (!ph.PhoneNumbersOk(inv.Phone) && !inv.Phone.Equals("")) { resp.ErrorCode = "1"; resp.Error = inv.Phone + " is not a valid phone number"; } else { inv.PayTypeCode = datafile.GetPayTypeCodeByShortName(inv.ShortName); inv.User = HttpContext.Current.Session["Username"].ToString(); inv.RegionCode = HttpContext.Current.Session["AreaCode"].ToString(); inv.DistrictCode = HttpContext.Current.Session["DistrictCode"].ToString(); inv.Vat = GetVatAmount(inv); resp.InvoiceSerial = datapay.SaveInvoiceDetails(inv); if (resp.InvoiceSerial.Equals("")) { resp.ErrorCode = "1"; resp.Error = "Failed to create Invoice serial number"; } else { resp.ErrorCode = "0"; resp.Error = "Invoice created successfully[" + resp.InvoiceSerial + "]"; } } return(resp); }
private void LoadCustomerContacts() { string accountno = txtaccountno.Text.Trim(); string phone = txtPhone.Text.Trim(); PhoneValidator phonevalid = new PhoneValidator(); if (phonevalid.PhoneNumbersOk(phone)) { phone = GetPhoneNumber(phone); DateTime fromDate = bll.ReturnDate(txtfromdate.Text.Trim(), 1); DateTime toDate = bll.ReturnDate(txttodate.Text.Trim(), 2); dataTable = datapay.GetCustomercontacts(accountno, phone, fromDate, toDate); if (dataTable.Rows.Count > 0) { DataGrid1.CurrentPageIndex = 0; DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); DataGrid1.Visible = true; MultiView1.ActiveViewIndex = 0; ShowMessage(".", true); } else { DataGrid1.Visible = false; MultiView1.ActiveViewIndex = -1; ShowMessage("No Record found", true); } } else { DataGrid1.Visible = false; MultiView1.ActiveViewIndex = -1; ShowMessage("Please Enter a valid phone number", true); txtPhone.Focus(); } }
private void PostTransaction() { string custref = txtcode.Text.Trim(); string custname = txtname.Text.Trim(); string phone = txtPhone.Text.Trim(); string amount = txtAmount.Text.Trim(); string bal = txtbal.Text.Trim(); string custtype = txtCustType.Text.Trim(); string paymode = GetPayTypeSelected(); string payType = cboPayType.SelectedValue.ToString(); string teller = Session["Username"].ToString(); string vendorcode = cboVendor.SelectedValue.ToString(); string agentref = txtagentRef.Text.Trim(); bool sms = chkSendSms.Checked; if (custref.Equals("")) { ShowMessage("Customer Ref is Required", true); } else if (custname.Equals("")) { ShowMessage("Customer Name is Required", true); } else if (vendorcode.Equals("0")) { ShowMessage("Please Select Agent", true); } else if (agentref.Equals("")) { ShowMessage("Agent Ref is Required", true); txtagentRef.Focus(); } else if (payType.Equals("0")) { ShowMessage("Please Select Payment Type", true); } else if (amount.Equals("")) { ShowMessage("Please Enter Amount to pay", true); txtAmount.Focus(); } else if (amount.Equals("0")) { ShowMessage("Amount to post cannot be zero", true); txtAmount.Focus(); } else if (bal.Equals("")) { ShowMessage("Customer Balance is Required", true); } else if (phone.Equals("") && sms) { ShowMessage("Please Provide Phone Number or Uncheck Send SMS", true); txtPhone.Focus(); } else if (paymode.Equals("NONE")) { ShowMessage("Please Select Payment Mode, Cash or Cheque", true); } else { PhoneValidator pv = new PhoneValidator(); if (pv.PhoneNumbersOk(phone)) { Responseobj res = new Responseobj(); Transaction t = new Transaction(); t.TranAmount = amount.Replace(",", ""); t.CustomerRef = custref; t.CustomerType = custtype; t.CustomerName = custname; t.TranType = paymode; t.PaymentType = payType; t.CustomerTel = phone; t.Reversal = "0"; t.Teller = teller; t.VendorCode = vendorcode; t.VendorTranId = agentref; t.PaymentDate = DateTime.Now.ToString("dd/MM/yyyy"); res = bll.PostInternalPayment(t, sms); if (res.Errorcode.Equals("0")) { //DisplayReceipt(res); ShowMessage(res.Message, false); ClearContrls(); } else { ShowMessage(res.Message, true); } } else { ShowMessage("Please Enter a valid phone number", true); txtPhone.Focus(); } } }
public void ProcessSMS(string message, ArrayList csv) { string user = HttpContext.Current.Session["Username"].ToString(); string mask = HttpContext.Current.Session["Mask"].ToString(); string Areaid = HttpContext.Current.Session["AreaID"].ToString(); Hashtable smsToSend = new Hashtable(); string[] smsWords = Regex.Split(message, "%S"); int p = 0; int noOfCol = smsWords.Length; char[] delimiter = new char[] { ',' }; foreach (string line in csv) { try { string[] words = line.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); if (noOfCol >= words.Length) { string phone = words[0].ToString(); if (phone != null) { phone = formatPhone(phone); string sms = ""; phone_validator = new PhoneValidator(); if (phone_validator.PhoneNumbersOk(phone)) { if (words.Length == 1) { sms = sms = sms + smsWords[0].Trim(); } else { for (int i = 1; i < words.Length; i++) { sms = sms + smsWords[i - 1].Trim() + " " + words[i].Trim() + " "; if (i == words.Length - 1) { sms = sms = sms + smsWords[i].Trim(); } } } smsToSend.Add(phone, sms); } } } } catch (Exception ex) { } } if (smsToSend.Count > 0) { ArrayList tels = new ArrayList(smsToSend.Keys); foreach (string tel in tels) { string telephone = tel; telephone = formatPhone(telephone); if ((telephone.StartsWith("07") || telephone.StartsWith("03")) && telephone.Trim().Length == 10) { telephone = telephone.Remove(0, 1); telephone = "256" + telephone; } data_file.InsertSmsToSend(telephone, smsToSend[tel].ToString(), mask, user, Areaid); //SendSms(telephone, smsToSend[tel].ToString(), "UMEME", username); } } }