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); }