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); }
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 ValidateInputs() { string email = txtemail.Text.Trim(); if (txtCode.Text.Equals("")) { ShowMessage("Please Enter Utility Code", true); txtCode.Focus(); } else if (txtName.Text.Equals("")) { ShowMessage("Please Enter Utility Name", true); txtName.Focus(); } else if (txtemail.Equals("")) { ShowMessage("Please Enter Utility Email", true); txtemail.Focus(); } else if (txtconfirmemail.Text.Equals("")) { ShowMessage("Please Confirm Email", true); txtconfirmemail.Focus(); } else if (!email.Equals(txtconfirmemail.Text.Trim())) { ShowMessage("Please Emails Provided do not match", true); } else if (!bll.IsValidEmailAddress(email)) { ShowMessage("Please Provide valid Emails ", true); txtemail.Focus(); } else { //string pre_res = bll.IsPerpaymentVendorDetails(merchant); //if (pre_res.Equals("OK")) { UtilityDetails utility = new UtilityDetails(); utility.Active = chkIsActive.Checked; utility.CreationDate = DateTime.Now; utility.Email = email; utility.Utility = txtName.Text.Trim(); utility.UtilityCode = txtCode.Text.Trim(); utility.UtilityContact = txtcontact.Text.Trim(); string ret = Process.SaveUtility(utility); //UploadCert(vendor.VendorCode); ShowMessage(ret, false); ClearControls(); } //else //{ // if (pre_res.Contains("Client")) // { // txtClientId.Focus(); // } // else if (pre_res.Contains("Terminal")) // { // txtTerminalId.Focus(); // } // else if (pre_res.Contains("Operator")) // { // txtOperatorId.Focus(); // } // else // { // txtVPassword.Focus(); // } // ShowMessage(pre_res, true); //} } }
private void ValidateInputs() { SystemUser user = new SystemUser(); user.Userid = int.Parse(lblCode.Text.Trim()); user.Fname = TxtFname.Text.Trim(); user.Sname = txtLname.Text.Trim(); user.Oname = txtMiddleName.Text.Trim(); user.Uname = lblusername.Text.Trim(); user.Phone = txtphone.Text.Trim(); user.Email = txtemail.Text.Trim(); user.Area = int.Parse(cboAreas.SelectedValue.ToString()); user.Branch = cboBranches.SelectedValue.ToString(); user.Title = txtDesignation.Text.Trim(); user.Role = cboAccessLevel.SelectedValue.ToString(); user.Active = chkIsActive.Checked; user.LoggedOn = chkIsLoggedon.Checked; user.Reset = chkResetPassword.Checked; user.UserName = txtUserName.Text.Trim(); if (user.Fname.Equals("")) { ShowMessage("Please Enter User First Name", true); TxtFname.Focus(); } else if (user.Sname.Equals("")) { ShowMessage("Please Enter User SurName", true); txtLname.Focus(); } else if (!bll.IsValidEmailAddress(user.Email)) { ShowMessage("Please Enter User Valid Email Address", true); txtemail.Focus(); } else if (user.Area.Equals(0)) { ShowMessage("Please Select Company Type", true); } else if (user.Role.Equals("0")) { ShowMessage("Please Select User System role", true); } else { if (user.Branch.Equals(0) && bll.AreaHasBranches(user.Area)) { ShowMessage("Please Select Company", true); } else { string returned = Process.SaveSystemUser(user); if (returned.Contains("Successfully")) { ShowMessage(returned, false); MultiView2.ActiveViewIndex = -1; ClearControls(); } else if (returned.Contains("System generated username")) { ShowMessage(returned, true); MultiView2.ActiveViewIndex = 0; txtUserName.Focus(); // USERNAME PROVIDED ALREADY EXISTS } else if (returned.Contains("UserName Provided already Exists")) { ShowMessage(returned, true); MultiView2.ActiveViewIndex = 0; txtUserName.Focus(); // USERNAME PROVIDED ALREADY EXISTS } else { ShowMessage(returned, true); MultiView2.ActiveViewIndex = -1; } } } }
private void ValidateInputs() { vendor.Vendorid = int.Parse(lblCode.Text.Trim()); vendor.VendorCode = txtCode.Text.Trim(); vendor.BillSysCode = txtBillSystemCode.Text.Trim(); vendor.VendorName = txtName.Text.Trim().ToUpper(); vendor.Email = txtemail.Text.Trim(); vendor.Active = chkIsActive.Checked; vendor.Sendemail = chkResend.Checked; vendor.Reset = chkResetPassword.Checked; vendor.Contract = txtcontact.Text.Trim(); ////// //merchant.Active = true; //merchant.ClientId = ""; //merchant.TerminalId = ""; //merchant.OperatorId = ""; //merchant.Password = ""; if (vendor.VendorCode.Equals("")) { ShowMessage("Please Enter Vendor Code", true); txtCode.Focus(); } else if (vendor.BillSysCode.Equals("")) { ShowMessage("Please Enter Vendor Billing System Code", true); txtBillSystemCode.Focus(); } else if (vendor.VendorName.Equals("")) { ShowMessage("Please Enter Vendor Name", true); txtName.Focus(); } else if (vendor.Email.Equals("")) { ShowMessage("Please Enter Vendor Email", true); txtemail.Focus(); } else if (txtconfirmemail.Text.Equals("")) { ShowMessage("Please Confirm Email", true); txtconfirmemail.Focus(); } else if (!vendor.Email.Equals(txtconfirmemail.Text.Trim())) { ShowMessage("Please Emails Provided do not match", true); } else if (!bll.IsValidEmailAddress(vendor.Email)) { ShowMessage("Please Provide valid Emails ", true); txtemail.Focus(); } else { //string pre_res = bll.IsPerpaymentVendorDetails(merchant); //if (pre_res.Equals("OK")) { string ret = Process.SaveVendor(vendor, merchant); UploadCert(vendor.VendorCode); ShowMessage(ret, false); ClearControls(); } //else //{ // if (pre_res.Contains("Client")) // { // txtClientId.Focus(); // } // else if (pre_res.Contains("Terminal")) // { // txtTerminalId.Focus(); // } // else if (pre_res.Contains("Operator")) // { // txtOperatorId.Focus(); // } // else // { // txtVPassword.Focus(); // } // ShowMessage(pre_res, true); //} } }