public ActionResult Index() { ViewData["CityList"] = ListCommonHelper.GetCityGrouped(); CompanySetupVm compSetVm = CompanySetupHelper.GetCompanySetup(); return(View(compSetVm)); }
public static CompanySetupVm GetCompanySetup() { CompanySetupVm compSetVm = new CompanySetupVm(); EasyFreightEntities db = new EasyFreightEntities(); CompanySetup compSetupDb = db.CompanySetups.FirstOrDefault(); CompanySetupContact compSetupContactDb = db.CompanySetupContacts.FirstOrDefault(); // SystemSetup sysSetupDb = db.SystemSetups.FirstOrDefault(); if (compSetupDb != null) { Mapper.CreateMap <CompanySetup, CompanySetupVm>(); Mapper.Map(compSetupDb, compSetVm); } if (compSetupContactDb != null) { Mapper.CreateMap <CompanySetupContact, CompanySetupVm>(); Mapper.Map(compSetupContactDb, compSetVm); } //if (sysSetupDb != null) //{ // Mapper.CreateMap<SystemSetup, CompanySetupVm>(); // Mapper.Map(sysSetupDb, compSetVm); //} return(compSetVm); }
public ActionResult GetPrintFooter() { CompanySetupVm compSetVm = new CompanySetupVm(); if (Session["CompVm"] == null) { compSetVm = CompanySetupHelper.GetCompanySetup(); Session["CompVm"] = compSetVm; } else { compSetVm = (CompanySetupVm)Session["CompVm"]; } return(PartialView("~/Views/Shared/_PrintFooter.cshtml", compSetVm)); }
public ActionResult GetShippingDeclaration(int id) { EasyFreight.Models.QuotationView quoteView = QuotationHelper.GetOneQuote(id); ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList(); ViewBag.QuoteContainers = QuotationHelper.GetQuotationContainers(id); ViewData["StaticText"] = CommonHelper.GetStaticTextById(1); Session["quoteId"] = id; if (quoteView.IsCareOf) { CompanySetupVm company = CompanySetupHelper.GetCompanySetup(); ViewBag.ShipperAddress = company.CompanyAddressEn; ViewBag.ShipperTel = (!string.IsNullOrEmpty(company.PhoneNumber1) ? " Tel. " + company.PhoneNumber1 : "") + (!string.IsNullOrEmpty(company.FaxNumber) ? " Fax. " + company.FaxNumber : ""); } else { ViewBag.ShipperAddress = quoteView.ShipperAddressEn; ViewBag.ShipperTel = (!string.IsNullOrEmpty(quoteView.ShipperPhoneNumber) ? " Tel. " + quoteView.ShipperPhoneNumber : "") + (!string.IsNullOrEmpty(quoteView.ShipperFaxNumber) ? " Fax. " + quoteView.ShipperPhoneNumber : ""); } return(PartialView("~/Views/Quotation/_ShippingDecl.cshtml", quoteView)); }
public ActionResult PrintShippingDeclV(int id) { EasyFreight.Models.OperationView quoteView = OperationHelper.GetOne(id); ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList(); ViewBag.QuoteContainers = OperationHelper.GetOperationContainers(id); ViewData["StaticText"] = CommonHelper.GetStaticTextById(1); if (quoteView.IsCareOf) { CompanySetupVm company = CompanySetupHelper.GetCompanySetup(); ViewBag.ShipperAddress = company.CompanyAddressEn; ViewBag.ShipperTel = (!string.IsNullOrEmpty(company.PhoneNumber1) ? " Tel. " + company.PhoneNumber1 : "") + (!string.IsNullOrEmpty(company.FaxNumber) ? " Fax. " + company.FaxNumber : ""); } else { ViewBag.ShipperAddress = quoteView.ShipperAddressEn; ViewBag.ShipperTel = (!string.IsNullOrEmpty(quoteView.ShipperPhoneNumber) ? " Tel. " + quoteView.ShipperPhoneNumber : "") + (!string.IsNullOrEmpty(quoteView.ShipperFaxNumber) ? " Fax. " + quoteView.ShipperPhoneNumber : ""); } return(View(quoteView)); }
public ActionResult SaveTab(CompanySetupVm compSetVm) { string isSaved = CompanySetupHelper.AddEditCompSetup(compSetVm); return(Json(isSaved)); }
public static string AddEditCompSetup(CompanySetupVm compSetVm) { string isSaved = "true"; EasyFreightEntities db = new EasyFreightEntities(); if (compSetVm.TabIndex == 1) // First tab .. CompanySetup table { int rowsCount = db.CompanySetups.Count(); CompanySetup compSetupDb; if (rowsCount == 0) { compSetupDb = new CompanySetup(); } else { compSetupDb = db.CompanySetups.FirstOrDefault(); } Mapper.CreateMap <CompanySetupVm, CompanySetup>(); Mapper.Map(compSetVm, compSetupDb); compSetupDb.CompanyId = 1; //Add new if (rowsCount == 0) { db.CompanySetups.Add(compSetupDb); } db.SaveChanges(); } else if (compSetVm.TabIndex == 2) // Second tab .. CompanySetupContact table { int rowsCount = db.CompanySetupContacts.Count(); CompanySetupContact compSetupDb; if (rowsCount == 0) { compSetupDb = new CompanySetupContact(); } else { compSetupDb = db.CompanySetupContacts.FirstOrDefault(); } Mapper.CreateMap <CompanySetupVm, CompanySetupContact>(); Mapper.Map(compSetVm, compSetupDb); compSetupDb.CompanyId = 1; //Add new if (rowsCount == 0) { db.CompanySetupContacts.Add(compSetupDb); } db.SaveChanges(); } else if (compSetVm.TabIndex == 3) // last tab .. SystemSetup table { int rowsCount = db.SystemSetups.Count(); SystemSetup compSetupDb; if (rowsCount == 0) { compSetupDb = new SystemSetup(); } else { compSetupDb = db.SystemSetups.FirstOrDefault(); } Mapper.CreateMap <CompanySetupVm, SystemSetup>(); Mapper.Map(compSetVm, compSetupDb); compSetupDb.CompanyId = 1; //Add new if (rowsCount == 0) { db.SystemSetups.Add(compSetupDb); } db.SaveChanges(); } return(isSaved); }