// // GET: /Admin/ public ActionResult Index() { if (!HasAdminPrivilege()) { return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery }); } var model = new AdminViewModel { IsUseBuyBack = objBaseMainConfigAdmin.IwebBuyBackConfig.Enabled, IsShowIsbnTr = objBaseMainConfigAdmin.IwebConfigAdmin.ShowTradeISBN, IsAsGuest = objBaseMainConfigAdmin.IwebConfigAdmin.ShopAsGuest, IsShowIsbn = objBaseMainConfigAdmin.IwebConfigAdmin.ShowISBN, IsShowIsbnIntegration = objBaseMainConfigAdmin.IwebConfigAdmin.ShowISBNIntegration, IsLiveRates = objBaseMainConfigAdmin.IwebConfigAdmin.UseLiveShippingRates, IsShowSubs = objBaseMainConfigAdmin.IwebConfigAdmin.ShowSubstitutionOption, IsUseCats = objBaseMainConfigAdmin.IwebConfigAdmin.UseCatalogs, IsUseQuickLinks = objBaseMainConfigAdmin.IwebConfigAdmin.UseQuickLinks, IsEmailAdmins = objBaseMainConfigAdmin.IwebConfigAdmin.EmailOrdersToAdmin }; //LoadWizardValues(); model.IsBuyBackEnable = objBaseMainConfigAdmin.IwebBuyBackConfig.Enabled; model.IsBuyBackShowNeed = objBaseMainConfigAdmin.IwebBuyBackConfig.ShowBuyBackNeed; model.IsBuyBackShowRetail= objBaseMainConfigAdmin.IwebBuyBackConfig.RetailBooks; model.IsBuyBackShowSholeSale = objBaseMainConfigAdmin.IwebBuyBackConfig.WholesaleBooks; model.IsBuyBackUseStoreCredit = objBaseMainConfigAdmin.IwebBuyBackConfig.StoreCredit; model.IsBuyBackDisplayPrices = objBaseMainConfigAdmin.IwebBuyBackConfig.DisplayPrices; var sr = new StreamReader(Server.MapPath("~/contentfiles/SellBackDisclaimer.txt")); model.BuyBackDisclaimer = sr.ReadToEnd(); sr.Close(); var objAdminModel = AdminSettingsService.GetSettings(StoreNumber, UvUsername, UvPassword, DbType, UvAddress, UvAccount, CacheTime, CacheTime, Strd3PortNumber, UseEncryption, Strd3PortNumber); if (objAdminModel !=null) { model.IsPickupValid = objAdminModel.IsPickupValid; model.IsoosGm = objAdminModel.IsoosGm; model.IsoosTr = objAdminModel.IsoosTr; model.IsoosTx = objAdminModel.IsoosTx; model.GmImagePath = objAdminModel.GmImagePath; model.TrImagePath = objAdminModel.TrImagePath; model.TxImagePath = objAdminModel.TxImagePath; model.NewTxLowQty = objAdminModel.NewTxLowQty; model.NewTXoosQty = objAdminModel.NewTXoosQty; model.GmLowQty = objAdminModel.GmLowQty; model.GMoosmsg = objAdminModel.GMoosmsg; model.TrLowQty = objAdminModel.TrLowQty; model.TRoosQTY = objAdminModel.TRoosQTY; model.UsedTXoosQty = objAdminModel.UsedTXoosQty; model.UsedTxLowQty = objAdminModel.UsedTxLowQty; model.NewLowStockMsg = objAdminModel.NewLowStockMsg; model.NewOosMsg = objAdminModel.NewOosMsg; model.UsedLowStockMsg = objAdminModel.UsedLowStockMsg; model.UsedOosMsg = objAdminModel.UsedOosMsg; model.TRoosmsg = objAdminModel.TRoosmsg; model.TRlowstockmsg = objAdminModel.TRlowstockmsg; model.GMlowstockmsg = objAdminModel.GMlowstockmsg; model.GMoosmsg = objAdminModel.GMoosmsg; model.IsTrUseQoo = objAdminModel.IsTrUseQoo; model.IsGmUseQoo = objAdminModel.IsGmUseQoo; model.BuyBackStoreCredit = objAdminModel.BuyBackStoreCredit; model.BuyBackRetailPrice = objAdminModel.BuyBackRetailPrice; model.BuyBackRetailRounding = objAdminModel.BuyBackRetailRounding; model.BuyBackRetailCoin = objAdminModel.BuyBackRetailCoin; model.BuyBackWholesalePrice = objAdminModel.BuyBackWholesalePrice; model.BuyBackWholeSaleRounding = objAdminModel.BuyBackWholeSaleRounding; model.BuyBackWholeSaleCoin = objAdminModel.BuyBackWholeSaleCoin; model.BuyBackRetailRounding = objAdminModel.BuyBackRetailRounding; model.BuyBackWholesalePriceWording = objAdminModel.BuyBackWholesalePriceWording; model.BuyBackNeedWording = objAdminModel.BuyBackNeedWording; model.BuyBackBuyingWording = objAdminModel.BuyBackBuyingWording; model.BuyBackNotBuyingWording = objAdminModel.BuyBackNotBuyingWording; } return View(model); }
public ActionResult JsonSaveSettings(AdminViewModel model) { if (!HasAdminPrivilege()) { return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery }); } //Set IWEB Settings values in XML.. objBaseMainConfigAdmin.IwebBuyBackConfig.Enabled = model.IsBuyBackEnable; objBaseMainConfigAdmin.IwebConfigAdmin.ShowTradeISBN = model.IsShowIsbnTr; objBaseMainConfigAdmin.IwebConfigAdmin.ShowISBN = model.IsShowIsbn; objBaseMainConfigAdmin.IwebConfigAdmin.ShowISBNIntegration = model.IsShowIsbnIntegration; objBaseMainConfigAdmin.IwebConfigAdmin.UseLiveShippingRates = model.IsLiveRates; objBaseMainConfigAdmin.IwebConfigAdmin.ShowSubstitutionOption = model.IsShowSubs; objBaseMainConfigAdmin.IwebConfigAdmin.UseCatalogs = model.IsUseCats; objBaseMainConfigAdmin.IwebConfigAdmin.UseQuickLinks = model.IsUseQuickLinks; objBaseMainConfigAdmin.IwebConfigAdmin.EmailOrdersToAdmin = model.IsEmailAdmins; objBaseMainConfigAdmin.IwebConfigAdmin.ShopAsGuest = model.IsAsGuest; objBaseMainConfigAdmin.IwebBuyBackConfig.DisplayPrices = model.IsBuyBackDisplayPrices; objBaseMainConfigAdmin.IwebBuyBackConfig.RetailBooks = model.IsBuyBackShowRetail; objBaseMainConfigAdmin.IwebBuyBackConfig.ShowBuyBackNeed = model.IsBuyBackShowNeed; objBaseMainConfigAdmin.IwebBuyBackConfig.StoreCredit = model.IsBuyBackUseStoreCredit; objBaseMainConfigAdmin.IwebBuyBackConfig.WholesaleBooks = model.IsBuyBackShowSholeSale; //Save sellbackdisclaimer text... var tr = new StreamWriter(Server.MapPath("~/contentfiles/sellbackdisclaimer.txt"), false); tr.Write(model.BuyBackDisclaimer); tr.Close(); //Save in the settings.xml config file objBaseMainConfigAdmin.SaveValues(); //set values in pick var truseqoo = Convert.ToBoolean(model.IsTrUseQoo) ? "Y" : "N"; var gmuseqoo = Convert.ToBoolean(model.IsGmUseQoo) ? "Y" : "N"; var ispickupvalid = Convert.ToBoolean(model.IsPickupValid) ? "Y" : "N"; var showoosgm = Convert.ToBoolean(model.IsoosGm) ? "Y" : "N"; var showoostr = Convert.ToBoolean(model.IsoosTr) ? "Y" : "N"; var showoostx = Convert.ToBoolean(model.IsoosTx) ? "Y" : "N"; AdminSettingsService.SaveSettings(StoreNumber, model.BuyBackNotBuyingWording, model.BuyBackBuyingWording, model.BuyBackNeedWording, model.BuyBackWholesalePriceWording, model.BuyBackRetailPriceWording, model.BuyBackWholeSaleCoin, model.BuyBackWholeSaleRounding, model.BuyBackWholesalePrice, model.BuyBackRetailCoin, model.BuyBackRetailRounding, model.BuyBackRetailPrice, model.BuyBackStoreCredit, gmuseqoo, truseqoo, model.GMoosmsg, model.GMlowstockmsg, model.TRlowstockmsg, model.TRoosmsg, model.UsedOosMsg, model.UsedLowStockMsg, model.NewLowStockMsg, model.NewOosMsg, model.UsedTxLowQty, model.UsedTXoosQty, model.GmLowQty, model.GMoosmsg, model.TrLowQty, model.TRoosQTY, model.NewTXoosQty, model.NewTxLowQty, model.TxImagePath, model.TrImagePath, model.GmImagePath, showoostx, showoostr, showoosgm, ispickupvalid, UvUsername, UvPassword, DbType, UvAddress, UvAccount, CacheTime, CacheTime, Strd3PortNumber, UseEncryption, Strd3PortNumber); return Json(new {success = true}); }