コード例 #1
0
        public ActionResult Index()
        {
            ViewData["CityList"] = ListCommonHelper.GetCityGrouped();
            CompanySetupVm compSetVm = CompanySetupHelper.GetCompanySetup();

            return(View(compSetVm));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: amorsi/EasyFreight
        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));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        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));
        }
コード例 #6
0
        public ActionResult SaveTab(CompanySetupVm compSetVm)
        {
            string isSaved = CompanySetupHelper.AddEditCompSetup(compSetVm);

            return(Json(isSaved));
        }
コード例 #7
0
        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);
        }