public BizResponseClass AddZipCode(AddZipCodeReq Request, long UserID)//long ZipCode, string AreaName, long CityID, short Status { BizResponseClass Resp = new BizResponseClass(); try { ZipCodeMaster obj = new ZipCodeMaster(); obj.ZipCode = Request.ZipCode; obj.ZipAreaName = Request.AreaName; obj.CityID = Request.CityID; obj.Status = Request.Status; obj.CreatedBy = UserID; obj.CreatedDate = UTC_To_IST(); _commonRepoZipCode.Add(obj); Resp.ErrorCode = enErrorCode.Success; Resp.ReturnCode = enResponseCode.Success; Resp.ReturnMsg = EnResponseMessage.RecordAdded; return(Resp); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public static ZipCodeMaster GetByZipCode(string zipCode) { ZipCodeMaster zipCodeMaster = null; zipCodeMaster = (from x in DbContextHelper.DbContext.ZipCodeMaster where x.ZipCode == zipCode select x).FirstOrDefault(); return(zipCodeMaster); }
public static ZipCodeMaster Get(string id) { ZipCodeMaster zipCodeMaster = null; int zipCodeID = 0; int.TryParse(id, out zipCodeID); zipCodeMaster = (from x in DbContextHelper.DbContext.ZipCodeMaster where x.ZipCodeID == zipCodeID select x).FirstOrDefault(); return(zipCodeMaster); }
static public List <InvoiceView> GetInvoiceForReport(int invoiceID) { InvoiceView invoice = null; List <InvoiceView> invoices = new List <InvoiceView>(); ZipCodeMaster zipCodeMaster = null; LeadInvoice leadInvoice = (from x in DbContextHelper.DbContext .LeadInvoice .Include("LeadInvoiceDetail") .Include("LeadInvoiceDetail.InvoiceServiceType") .Include("LeadInvoiceDetail.InvoiceServiceType.InvoiceServiceUnit") .Include("Leads") .Include("Leads.Client") .Include("Leads.Client.StateMaster") .Include("Leads.Client.CityMaster") .Include("Leads.LeadPolicy") .Include("Leads.LeadPolicy.LeadPolicyType") where x.InvoiceID == invoiceID select x ).FirstOrDefault <LeadInvoice>(); if (leadInvoice != null) { invoice = new InvoiceView(); invoice.invoiceID = leadInvoice.InvoiceID; invoice.invoiceDate = (DateTime)leadInvoice.InvoiceDate; invoice.dueDate = leadInvoice.DueDate == null ? DateTime.Now : (DateTime)leadInvoice.DueDate; invoice.invoiceNumber = (int)(leadInvoice.InvoiceNumber ?? 0); invoice.billTo = leadInvoice.BillToName; invoice.billToAddress1 = leadInvoice.BillToAddress1; invoice.billToAddress2 = leadInvoice.BillToAddress2; invoice.billToAddress3 = leadInvoice.BillToAddress3; invoice.totalAmount = leadInvoice.TotalAmount ?? 0; invoice.adjusterInvoiceNumber = leadInvoice.AdjusterInvoiceNumber; // get policy type associated with invoice leadInvoice.Leads.LeadPolicy.FirstOrDefault(x => x.PolicyType == leadInvoice.PolicyTypeID); //if (leadInvoice.Leads.LeadPolicy != null && leadInvoice.Leads.LeadPolicy.LeadPolicyType != null) // invoice.policyType = leadInvoice.Leads.LeadPolicy.Description; //invoice.policyNumber = leadInvoice.Leads.LeadPolicy; //invoice.claimNumber = leadInvoice.Leads.LeadPolicy.ClaimNumber; //invoice.insurerFileNo = leadInvoice.Leads.LeadPolicy.InsurerFileNo; if (leadInvoice.Leads.LeadPolicy != null && leadInvoice.Leads.LeadPolicy.FirstOrDefault().LeadPolicyType != null) { invoice.policyType = leadInvoice.Leads.LeadPolicy.FirstOrDefault().LeadPolicyType.Description; } invoice.policyNumber = leadInvoice.Leads.LeadPolicy.FirstOrDefault().PolicyNumber; invoice.claimNumber = leadInvoice.Leads.LeadPolicy.FirstOrDefault().ClaimNumber; invoice.insurerFileNo = leadInvoice.Leads.LeadPolicy.FirstOrDefault().InsurerFileNo; invoice.claimantName = leadInvoice.Leads.ClaimantFirstName + " " + leadInvoice.Leads.ClaimantLastName; invoice.claimantAddress1 = leadInvoice.Leads.LossAddress; invoice.claimantAddress2 = leadInvoice.Leads.LossAddress2; invoice.claimantAddress3 = string.Format("{0}, {1} {2}", leadInvoice.Leads.CityName ?? "", leadInvoice.Leads.StateName ?? "", leadInvoice.Leads.Zip ?? ""); invoice.taxRate = leadInvoice.TaxRate ?? 0; if (leadInvoice.Leads.DateSubmitted != null) { invoice.claimDate = (DateTime)leadInvoice.Leads.DateSubmitted; } invoice.legacyInvoiceLines = leadInvoice.LeadInvoiceDetail.ToList(); // add sales tax if (invoice.taxRate > 0) { LeadInvoiceDetail invoiceTaxLine = new LeadInvoiceDetail(); invoiceTaxLine.InvoiceID = invoice.invoiceID; invoiceTaxLine.LineDescription = "Sales Tax"; invoiceTaxLine.isBillable = true; invoiceTaxLine.LineAmount = invoice.totalAmount * (invoice.taxRate / 100); invoice.legacyInvoiceLines.Add(invoiceTaxLine); } if (leadInvoice.Leads.Client != null) { invoice.adjusterInvoiceNumber = leadInvoice.AdjusterInvoiceNumber; invoice.clientName = leadInvoice.Leads.Client.BusinessName; invoice.clientAddress1 = leadInvoice.Leads.Client.StreetAddress1; invoice.clientAddress2 = leadInvoice.Leads.Client.StreetAddress2; string stateName = leadInvoice.Leads.Client.StateMaster != null ? leadInvoice.Leads.Client.StateMaster.StateCode : ""; string cityName = leadInvoice.Leads.Client.CityMaster != null ? leadInvoice.Leads.Client.CityMaster.CityName : ""; string zipCode = leadInvoice.Leads.Client.ZipCode ?? ""; // this is badly designed. if (!string.IsNullOrEmpty(zipCode)) { zipCodeMaster = ZipCode.Get(zipCode); if (zipCodeMaster != null) { zipCode = zipCodeMaster.ZipCode; } } invoice.clientAddress3 = cityName + ", " + stateName + " " + zipCode; invoice.clientPhone = leadInvoice.Leads.Client.PrimaryPhoneNo; invoice.clientFax = leadInvoice.Leads.Client.SecondaryPhoneNo; invoice.clientEmail = leadInvoice.Leads.Client.PrimaryEmailId; invoice.logoPath = string.Format("{0}/ClientLogo/{1}.jpg", ConfigurationManager.AppSettings["appURL"].ToString(), leadInvoice.Leads.ClientID); } else { invoice.logoPath = ConfigurationManager.AppSettings["appURL"].ToString() + "/images/claim_ruler_logo.jpg"; invoice.clientName = "Claim Ruler Demo"; invoice.clientAddress1 = "400 East Las Olas Blvd"; invoice.clientAddress2 = "Suite 404"; invoice.clientAddress3 = "Ft. Lauderdale, FL 33301"; invoice.clientPhone = "999-999-9999"; invoice.clientFax = "999-999-9999"; invoice.clientEmail = "*****@*****.**"; invoice.federalIDNo = "99999999"; } invoices.Add(invoice); } return(invoices); }
static string getZipCode(string zipID) { ZipCodeMaster zipMaster = Data.Account.ZipCode.Get(zipID); return(zipMaster == null ? "" : zipMaster.ZipCode); }