public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Htmls"; Tab1Settings1.Type = "html"; Tab1Settings1.Value = Htmls; Tab1Settings1.Title = "Html"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Css"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Css; Tab1Settings1.Title = "Css"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ten"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ten; Tab1Settings1.Title = "Tên"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Header_Url"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Header_Url; Tab1Settings1.Title = "Url header"; this.Tabs[0].Settings.Add(Tab1Settings1); }
public JsonResult SaveSetting(string value, int ctrId) { var msg = new JsonMessage(); try { var model = _dl.GetItemSetting(ctrId); if (model != null) { model.Value = value; model.AgencyID = Agencyid(); } else { var obj = new ModuleSetting { ModuleId = ctrId, Value = value, LanguageId = "vi", AgencyID = Agencyid() }; _dl.Add(obj); } _dl.Save(); msg.Erros = false; msg.Message = "Thêm mới thành công"; } catch (Exception) { msg.Erros = true; msg.Message = "Có lỗi xảy ra vui lòng thử lại."; } return(Json(msg)); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { AdminView view = ManagementContext.Current.FindView(AppId, ViewId); string prefix = String.Empty; ModuleSetting setting = FindModuleSetting(view.Module, "HelpPrefix"); if (setting != null) { prefix = setting.Value; } if (view.Attributes.ContainsKey("help")) { Response.Redirect(String.Format("http://docs.mediachase.com/doku.php?id=ecf:50:cmenduser:using:{0}:{1}", prefix, view.Attributes["help"])); } else { if (String.IsNullOrEmpty(prefix)) { Response.Redirect(String.Format("http://docs.mediachase.com/doku.php?id=ecf:50:cmenduser:using:intro")); } else { Response.Redirect(String.Format("http://docs.mediachase.com/doku.php?id=ecf:50:cmenduser:using:{0}:{1}", prefix, view.ViewId)); } } }
public static SettingEntry ToModel(this ModuleSetting moduleSetting, SettingEntity entity, string groupName) { var result = new SettingEntry(); result.InjectFrom(moduleSetting); result.Value = moduleSetting.DefaultValue; result.ValueType = ConvertToSettingValueType(moduleSetting.ValueType); result.GroupName = groupName; if (entity != null) { var existingValues = entity.SettingValues.Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray(); if (moduleSetting.IsArray) { result.ArrayValues = existingValues; } else { if (existingValues.Any()) { result.Value = existingValues.First(); } } } return(result); }
public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ma"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ma; Tab1Settings1.Title = "Mã danh mục"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Top"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Top; Tab1Settings1.Title = "Số lượng"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Css"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Css; Tab1Settings1.Title = "Css"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "ItemCss"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = ItemCss; Tab1Settings1.Title = "Class của hàng hóa"; this.Tabs[0].Settings.Add(Tab1Settings1); }
public JsonResult SaveSetting() { var msg = new JsonMessage(); var value = Request["value"]; var ctrId = Request["ctrId"]; try { var model = _moduleSetting.GetByKey(int.Parse(ctrId)); if (model != null) { model.Value = value; } else { var obj = new ModuleSetting { ModuleId = int.Parse(ctrId), Value = value, LanguageId = Fdisystem.LanguageId }; _moduleSetting.Add(obj); } _moduleSetting.Save(); msg.Erros = false; msg.Message = "Thêm mới thành công"; } catch (Exception) { msg.Erros = true; msg.Message = "Có lỗi xảy ra vui lòng thử lại."; } return(Json(msg)); }
public static List <ModuleSetting> LoadAllModuleSettings() { try { List <ModuleSetting> lms = new List <ModuleSetting>(); string json = (ModuleSetting.Load("AllModuleSetting")).SettingData; Newtonsoft.Json.Linq.JArray objs = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); foreach (Newtonsoft.Json.Linq.JObject obj in objs) { ModuleSetting ms = new ModuleSetting(); ms.SettingName = obj["SettingName"].ToString(); ms.SettingData = obj["SettingData"].ToString(); lms.Add(ms); } return((List <ModuleSetting>)(lms)); } catch (Exception ex) { return(null); } }
public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ma"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ma; Tab1Settings1.Title = "Mã danh mục"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ten"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ten; Tab1Settings1.Title = "Tên"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Css"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Css; Tab1Settings1.Title = "Css"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Header_Url"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Header_Url; Tab1Settings1.Title = "Url"; this.Tabs[0].Settings.Add(Tab1Settings1); }
private void fpSpread1_CellDoubleClick(object sender, CellClickEventArgs e) { ModuleSetting item = null; if (module != null) { if (module.ModuleSettings != null) { foreach (ModuleSetting ms in module.ModuleSettings) { if (ms.DocColumn == this.fpSpread1.ActiveSheet.Cells[e.Row, 2].Value.ToString() && ms.CellName == (this.fpSpread1.ActiveSheet.Cells[e.Row, 1].Value ?? "").ToString()) { item = ms; } } } } ModuleSettingDialog dlg = new ModuleSettingDialog(item, moduleID); if (DialogResult.OK == dlg.ShowDialog()) { BindModuleSetting(); } }
public static void SaveModuleSettings(List <ModuleSetting> settings) { foreach (ModuleSetting setting in settings) { ModuleSetting lms = new ModuleSetting(); lms.Save(); } }
public ActionResult Update(ModuleSetting moduleSetting) { if (SettingsService.UpdateModuleSetting(moduleSetting) != null) { return(RedirectToAction("Index")); } Logger.Error("Module Settings haven't been updated!"); return(HttpNotFound()); }
public static void SaveSettings(string settingName, string settingValue) { ModuleSetting lms = new ModuleSetting(); lms.DEFAULT_FILENAME = settingName; lms.SettingName = settingName; lms.SettingData = settingValue; lms.Save(); }
public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Htmls"; Tab1Settings1.Type = "html"; Tab1Settings1.Value = Htmls; Tab1Settings1.Title = "Html"; this.Tabs[0].Settings.Add(Tab1Settings1); }
/// <summary> /// Saves a single ModuleSetting to the registry. /// </summary> /// <param name="setting">ModuleSetting to save.</param> /// <param name="path">Path to the registry key.</param> private void SaveModuleSetting(ModuleSetting setting, string path = AD_GENERAL_REGISTRY_PATH) { RegistryKey key = Registry.CurrentUser.OpenSubKey(path, true); if (key == null) { Registry.CurrentUser.CreateSubKey(path); key = Registry.CurrentUser.OpenSubKey(path, true); } key.SetValue(setting.Name, setting.Value, setting.DataType); }
public ModuleSetting GetModelConfiguration(string modelNamespace) { Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.StartedFunctionMessage); IEnumerable <ResourceType> resourceTypes = Utilities.GetResourceTypes(modelNamespace); if (resourceTypes != null) { ModuleSetting moduleSetting = new ModuleSetting { Name = modelNamespace }; if (resourceTypes.Count() > 0) { List <ResourceTypeSetting> resourceTypeSettings = new List <ResourceTypeSetting>(); foreach (ResourceType resourceType in resourceTypes) { if (resourceType.ConfigurationXml != null && !string.IsNullOrWhiteSpace(resourceType.ConfigurationXml.ToString())) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(ResourceTypeSetting)); XmlReader configXmlReader = resourceType.ConfigurationXml.CreateReader(); if (xmlSerializer.CanDeserialize(configXmlReader)) { Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.ConfigXmlDB); resourceTypeSettings.Add((ResourceTypeSetting)xmlSerializer.Deserialize(configXmlReader)); } else { Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.ConfigXmlCreation); resourceTypeSettings.Add(resourceType.ToResourceTypeSetting()); } } else { Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.ConfigXmlCreation); resourceTypeSettings.Add(resourceType.ToResourceTypeSetting()); } } moduleSetting.ResourceTypeSettings = resourceTypeSettings.ToArray(); } Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.FinishedFunctionMessage); return(moduleSetting); } Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.NullEmptyStringMessage); return(null); }
public void PropertiesTest3() { var actual = new ModuleSetting { Id = 0, Name = "", Visible = false }; actual.Id.Should() .Be(0); actual.Name.Should() .BeEmpty("because set empty"); actual.Visible.Should() .BeFalse("because is set false"); }
public void PropertiesTest2() { var actual = new ModuleSetting { Id = -12, Name = "the awesome other", Visible = false }; actual.Id.Should() .Be(-12); actual.Name.Should() .Be("the awesome other"); actual.Visible.Should() .BeFalse("because is set false"); }
public void PropertiesTest1() { var actual = new ModuleSetting { Id = 666, Name = "the awesome one", Visible = true }; actual.Id.Should() .Be(666); actual.Name.Should() .Be("the awesome one"); actual.Visible.Should() .BeTrue("because is set true"); }
public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ma"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ma; Tab1Settings1.Title = "Mã danh mục"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ten"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ten; Tab1Settings1.Title = "Tên"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Top"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Top; Tab1Settings1.Title = "Số lượng"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Css"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Css; Tab1Settings1.Title = "Css"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Header_Url"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Header_Url; Tab1Settings1.Title = "Url"; this.Tabs[0].Settings.Add(Tab1Settings1); Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "ItemCss"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = ItemCss; Tab1Settings1.Title = "Css Item:"; this.Tabs[0].Settings.Add(Tab1Settings1); }
public void SetModelConfiguration(string modelNamespace, ModuleSetting modelConfiguration) { Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.StartedFunctionMessage); if (modelConfiguration != null) { IEnumerable <ResourceType> resourceTypes = Utilities.GetResourceTypes(modelNamespace); IEnumerable <ResourceTypeSetting> resourceTypeSettings = modelConfiguration.ResourceTypeSettings.AsEnumerable(); if (resourceTypes != null) { using (ZentityContext context = Utilities.CreateZentityContext()) { if (modelConfiguration.ResourceTypeSettings == null) { foreach (ResourceType resourceType in resourceTypes) { resourceType.ConfigurationXml = null; resourceType.Update(context.StoreConnectionString); } } else { foreach (ResourceTypeSetting resourceTypeSetting in resourceTypeSettings) { ResourceType specificResourceType = resourceTypes.Where(res => res.Name.Equals(resourceTypeSetting.Name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (specificResourceType != null) { specificResourceType.ValidateResourceTypeSetting(resourceTypeSetting); specificResourceType.ConfigurationXml = resourceTypeSetting.SerializeToXElement(); specificResourceType.Update(context.StoreConnectionString); Globals.TraceMessage(TraceEventType.Verbose, string.Empty, Properties.Messages.FinishedFunctionMessage); } } } } } else { throw new FaultException <ArgumentException>(new ArgumentException(Properties.Messages.ModelNamespaceParameter), Properties.Messages.NullModelNamespaceMessage); } } else { throw new FaultException <ArgumentNullException>(new ArgumentNullException(Properties.Messages.ModelConfigurationParameter), Properties.Messages.NullModelConfigurationMessage); } }
public SettingDataSource() { try { string json = (ModuleSetting.Load("AllModuleSetting")).SettingData; Newtonsoft.Json.Linq.JArray objs = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); foreach (Newtonsoft.Json.Linq.JObject obj in objs) { ActivationModule SchoolAccountActivationModule = new ActivationModule(); SchoolAccountActivationModule.ModuleName = obj["ModuleName"].ToString(); SchoolAccountActivationModule.ModuleList_Setting = Helpers.LoadModuleSettings(SchoolAccountActivationModule.ModuleName); this.ActivationModules.Add(SchoolAccountActivationModule); } } catch (Exception ex) { } }
private void bt_OK_Click(object sender, EventArgs e) { if (comboBox1.Text == "" || tb_cell.Text == "" || tb_description.Text == "") { MessageBox.Show("缺少有效输入"); return; } if (Item == null) { Item = new ModuleSetting(); } Item.CellName = tb_cell.Text; Item.Description = tb_description.Text; Item.DocColumn = comboBox1.Text; Item.SheetID = sheetID; Item.IsShow = cb_show.Checked; this.DialogResult = DialogResult.OK; Close(); }
public static string SectionSetting(this HtmlHelper htmlHelper, ModuleSetting moduleSetting, string name, object value, bool fixedTextBoxWidth) { Type settingType = moduleSetting.GetRealType(); switch (settingType.FullName) { case "System.String": return(fixedTextBoxWidth ? CreateSettingTextBox(htmlHelper, name, value, 300) : CreateSettingTextBox(htmlHelper, name, value, null)); case "System.Int16": case "System.Int32": return(fixedTextBoxWidth ? CreateSettingTextBox(htmlHelper, name, value, 50) : CreateSettingTextBox(htmlHelper, name, value, null)); case "System.Boolean": return(CreateSettingCheckBox(name, value)); default: return(CreateCustomControl(name, settingType, value)); } }
public static SettingEntry ToSettingEntry(this ModuleSetting moduleSetting) { var result = AbstractTypeFactory <SettingEntry> .TryCreateInstance(); result.Name = moduleSetting.Name; result.DefaultValue = moduleSetting.DefaultValue; result.RawDefaultValue = moduleSetting.RawDefaultValue(); result.Value = result.DefaultValue; result.RawValue = result.RawDefaultValue; result.AllowedValues = moduleSetting.AllowedValues; result.IsArray = moduleSetting.IsArray; result.RestartRequired = moduleSetting.RestartRequired; result.ArrayValues = moduleSetting.ArrayValues; if (moduleSetting.ArrayValues != null) { result.RawArrayValues = moduleSetting.ArrayValues.Select(x => moduleSetting.RawValue(x)).ToArray(); } result.ValueType = ToSettingValueType(moduleSetting.ValueType); return(result); }
public static bool Init(ModuleSetting Setting, ref LanguageManager Manager, bool AddByAssembly = true) { //string json_file = SettingsHSSever.Settings.GetPath("WebRouter.json"); bool Load; Controller.Init(ref Manager); Load = Controller.AddByAssembly(Setting.Load.Controller); if (Load) { //Logger.LogSYSTEM(LogLevel.INFO, LanguageManager.Language["STR_LOG_WEB_ROUTER_INITING"]); Middleware.Init(ref Manager); if (AddByAssembly) { Load = Middleware.AddByAssembly(Setting.Load.MiddleWare); } } if (Load) { Router.Init(ref Manager); if (AddByAssembly) { Load = Router.AddByAssembly(Setting.Load.Module); } //Logger.LogSYSTEM(LogLevel.INFO, LanguageManager.Language["STR_LOG_WEB_ROUTER_INITED"]); } if (Load) { WebSocketRouter.Init(ref Manager); if (AddByAssembly) { Load = WebSocketRouter.AddByAssembly(Setting.Load.Module); } } return(Load); }
public async Task <string> UpdateSetting(string value) { if (_httpClient == null) { return(string.Empty); } var model = new ModuleSetting { Value = value }; var json = JsonConvert.SerializeObject(model); var jsonContent = new StringContent(json, Encoding.UTF8, "application/json"); var respnse = await _httpClient.PostAsync(Constants.SettingUpdate, jsonContent); if (respnse.IsSuccessStatusCode) { return(await respnse.Content.ReadAsStringAsync()); } return(string.Empty); }
public override void AddTabs() { base.AddTabs(); ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "Ma_Trang_Chu"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = Ma_Trang_Chu; Tab1Settings1.Title = "Mã trang chủ"; this.Tabs[0].Settings.Add(Tab1Settings1); ModuleSetting Tab1Settings2 = new ModuleSetting(); Tab1Settings2.Key = "Css"; Tab1Settings2.Type = "String"; Tab1Settings2.Value = Css; Tab1Settings2.Title = "Css"; this.Tabs[0].Settings.Add(Tab1Settings2); ModuleSetting Tab1Settings3 = new ModuleSetting(); Tab1Settings3.Key = "Ma_Sub"; Tab1Settings3.Type = "String"; Tab1Settings3.Value = Ma_Sub; Tab1Settings3.Title = "Danh mục phụ"; this.Tabs[0].Settings.Add(Tab1Settings3); }
public virtual void AddTabs() { ModuleSetingTabCollection TabList = new ModuleSetingTabCollection(); #region Tab1: TargetPage ModuleSetingTab Tab1 = new ModuleSetingTab(); #region Thuộc tính cơ bản của Tab Tab1.Name = "Khác"; Tab1.Index = 1; Tab1.TabId = Guid.NewGuid().ToString(); #endregion #region Cài đặt bên trong Tab1 ModuleSettingCollection Tab1Settings = new ModuleSettingCollection(); #region Cài đặt về Tên ModuleSetting Tab1Settings1 = new ModuleSetting(); Tab1Settings1.Key = "TargetPage"; Tab1Settings1.Type = "String"; Tab1Settings1.Value = TargetPage; Tab1Settings1.Title = "Class"; Tab1Settings.Add(Tab1Settings1); #endregion Tab1.Settings = Tab1Settings; #endregion TabList.Add(Tab1); #endregion this.Tabs = TabList; }
public virtual void AddTabsSetting(ModuleSetting Item) { this.Tabs[0].Settings.Add(Item); }
public override ModuleSetting GetModuleSettings(int moduleId) { DataSet ds = SqlHelper.ExecuteDataset(this.ConnectionString, "Portal_Modules_GetModuleSettings", moduleId); ModuleSetting setting = new ModuleSetting(); if (ds != null && ds.Tables.Count > 0) { DataTable dtSettings = ds.Tables[0]; foreach (DataRow row in dtSettings.Rows) { setting[row["SettingName"].ToString()] = row["SettingValue"].ToString(); } } return setting; }
public void Add(ModuleSetting htmlSetting) { FDIDB.ModuleSettings.Add(htmlSetting); }
/// <summary> /// Updates the visibility for the module /// </summary> /// <param name="moduleSetting">The ModuleSettings</param> public Module UpdateModuleSetting(ModuleSetting moduleSetting) => SettingsBll.UpdateModuleVisability(moduleSetting.Id, moduleSetting.Visible);
/// <summary> /// Gets the package lst. /// </summary> /// <returns>The package lst.</returns> /// <param name="rq">Rq.</param> //取得套餐列表 public static PackageModel GetPkgLst(QueryProductModel rq) { PackageModel pkg = new PackageModel(); List <PkgDetailModel> pkgLst = new List <PkgDetailModel>(); DataModel.Discount.DiscountRuleModel disc = null; PkgPriceModel pkg_price = new PkgPriceModel(); try { //商品黑名單過濾 //抓商品是否為黑名單 bool isBlack = DiscountRepository.GetProdBlackWhite(rq.prod_no); if (isBlack) { pkg.result = "10"; pkg.result_msg = $"Bad Request:Product-{rq.prod_no} is not available"; return(pkg); } JObject obj = PackageProxy.getPkgLst(rq); JObject objProd = ProdProxy.getProd(rq); if (obj["content"]["result"].ToString() != "0000") { pkg.result = obj["content"]["result"].ToString(); pkg.result_msg = $"kkday package api response msg is not correct! {obj["content"]["msg"].ToString()}"; throw new Exception($"kkday package api response msg is not correct! {obj["content"]["msg"].ToString()}"); } if (objProd["content"]["result"].ToString() != "0000") { pkg.result = obj["content"]["result"].ToString(); pkg.result_msg = $"kkday product api response msg is not correct! {objProd["content"]["msg"].ToString()}"; throw new Exception($"kkday product api response msg is not correct! {objProd["content"]["msg"].ToString()}"); } #region --1.取回傳資料是否成功的訊息、一般資訊-- pkg.result = obj["content"]["result"].ToString(); pkg.result_msg = obj["content"]["msg"].ToString(); pkg.cost_calc_type = obj["content"]["costCalcMethod"].ToString(); #endregion #region --2.從傑森物件取『套餐列表』-- JArray jPkglst = (JArray)obj["content"]["packageList"]; pkg_price.pkgs = new List <pkgs>(); // 初始化陣列 pkg_price.currency = rq.current_currency; for (int i = 0; i < jPkglst.Count; i++) { var model = new PkgDetailModel(); var price_model = new pkgs(); // pkg_price 用 model.pkg_no = jPkglst[i]["productPkg"]["pkgOid"].ToString(); model.pkg_name = jPkglst[i]["productPkg"]["pkgName"].ToString(); model.online_s_date = jPkglst[i]["productPkg"]["begValidDt"].ToString(); model.online_e_date = jPkglst[i]["productPkg"]["endValidDt"].ToString(); model.weekDays = jPkglst[i]["productPkg"]["weekDays"].ToString(); model.is_unit_pirce = jPkglst[i]["productPkg"]["priceType"].ToString(); model.price1 = DiscountRepository.GetCompanyDiscPrice(Int64.Parse(rq.company_xid), (double)jPkglst[i]["productPkg"]["price1"], rq.prod_no, objProd["content"]["product"]["mainCat"].ToString(), ref disc);//分銷價 model.price1_org = (double?)jPkglst[i]["productPkg"]["price1Org"] ?? 0; model.price1_org_net = (double?)jPkglst[i]["productPkg"]["price1NetOrg"] ?? 0; model.price1_profit_rate = (double?)jPkglst[i]["productPkg"]["price1GrossRate"] ?? 0; model.price1_comm_rate = (double?)jPkglst[i]["productPkg"]["price1CommRate"] ?? 0; model.price1_age_range = jPkglst[i]["productPkg"]["price1BegOld"].ToString() + "~" + jPkglst[i]["productPkg"]["price1EndOld"].ToString(); model.price1_b2c = (double?)jPkglst[i]["productPkg"]["price1Sale"] ?? 0; // model.price1_net = (double)jPkglst[i]["productPkg"][""]; // model.price1_list = (double)jPkglst[i]["productPkg"][""]; model.price2 = (double?)jPkglst[i]["productPkg"]["price2"] == null ? 0 : DiscountRepository.GetCompanyDiscPrice(Int64.Parse(rq.company_xid), (double)jPkglst[i]["productPkg"]["price2"], rq.prod_no, objProd["content"]["product"]["mainCat"].ToString(), ref disc);//分銷價 model.price2_org = (double?)jPkglst[i]["productPkg"]["price2Org"] ?? 0; model.price2_org_net = (double?)jPkglst[i]["productPkg"]["price2NetOrg"] ?? 0; model.price2_profit_rate = (double?)jPkglst[i]["productPkg"]["price2GrossRate"] ?? 0; model.price2_comm_rate = (double?)jPkglst[i]["productPkg"]["price2CommRate"] ?? 0; model.price2_age_range = jPkglst[i]["productPkg"]["price2BegOld"].ToString() + "~" + jPkglst[i]["productPkg"]["price2EndOld"].ToString(); model.price2_b2c = (double?)jPkglst[i]["productPkg"]["price2Sale"] ?? 0; // model.price2_net = (double)jPkglst[i]["productPkg"][""]; // model.price2_list = (double)jPkglst[i]["productPkg"][""]; model.price3 = (double?)jPkglst[i]["productPkg"]["price3"] == null ? 0 : DiscountRepository.GetCompanyDiscPrice(Int64.Parse(rq.company_xid), (double)jPkglst[i]["productPkg"]["price3"], rq.prod_no, objProd["content"]["product"]["mainCat"].ToString(), ref disc);//分銷價 model.price3_org = (double?)jPkglst[i]["productPkg"]["price3Org"] ?? 0; model.price3_org_net = (double?)jPkglst[i]["productPkg"]["price3NetOrg"] ?? 0; model.price3_profit_rate = (double?)jPkglst[i]["productPkg"]["price3GrossRate"] ?? 0; model.price3_comm_rate = (double?)jPkglst[i]["productPkg"]["price3CommRate"] ?? 0; model.price3_age_range = jPkglst[i]["productPkg"]["price3BegOld"].ToString() + "~" + jPkglst[i]["productPkg"]["price3EndOld"].ToString(); model.price3_b2c = (double?)jPkglst[i]["productPkg"]["price3Sale"] ?? 0; // model.price3_net = (double)jPkglst[i]["productPkg"][""]; // model.price3_list = (double)jPkglst[i]["productPkg"][""]; model.price4 = (double?)jPkglst[i]["productPkg"]["price4"] == null ? 0 : DiscountRepository.GetCompanyDiscPrice(Int64.Parse(rq.company_xid), (double)jPkglst[i]["productPkg"]["price4"], rq.prod_no, objProd["content"]["product"]["mainCat"].ToString(), ref disc);//分銷價 model.price4_org = (double?)jPkglst[i]["productPkg"]["price4Org"] ?? 0; model.price4_org_net = (double?)jPkglst[i]["productPkg"]["price4NetOrg"] ?? 0; model.price4_profit_rate = (double?)jPkglst[i]["productPkg"]["price4GrossRate"] ?? 0; model.price4_comm_rate = (double?)jPkglst[i]["productPkg"]["price4CommRate"] ?? 0; model.price4_age_range = jPkglst[i]["productPkg"]["price4BegOld"].ToString() + "~" + jPkglst[i]["productPkg"]["price4EndOld"].ToString(); model.price4_b2c = (double?)jPkglst[i]["productPkg"]["price4Sale"] ?? 0; // model.price4_net = (double)jPkglst[i]["productPkg"][""]; // model.price4_list = (double)jPkglst[i]["productPkg"][""]; model.status = jPkglst[i]["productPkg"]["status"].ToString(); model.norank_min_book_qty = (int)jPkglst[i]["productPkg"]["minOrderNum"]; model.norank_max_book_qty = (int)jPkglst[i]["productPkg"]["maxOrderNum"]; model.rank_min_book_qty = (int)jPkglst[i]["productPkg"]["minOrderQty"]; model.min_orverage_qty = (int)jPkglst[i]["productPkg"]["minOrderAdultQty"]; model.isMultiple = jPkglst[i]["productPkg"]["isMultiple"].ToString(); model.book_qty = jPkglst[i]["productPkg"]["orderQty"].ToString(); model.unit = jPkglst[i]["productPkg"]["unit"].ToString(); model.unit_txt = jPkglst[i]["productPkg"]["unitTxt"].ToString(); model.unit_qty = (int)jPkglst[i]["productPkg"]["unitQty"]; model.pickupTp = jPkglst[i]["productPkg"]["pickupTp"].ToString(); model.pickupTpTxt = jPkglst[i]["productPkg"]["pickupTpTxt"].ToString(); model.is_hl = jPkglst[i]["productPkg"]["isBackUp"].ToString(); model.is_event = jPkglst[i]["productPkg"]["hasEvent"].ToString(); var d = jPkglst[i]["productPkg"]["pkgDesc"]; if (d.FirstOrDefault() != null) { //取各套餐內的各個敘述 List <DescItem> desc = (d["descItems"][0]["content"]) .Select(x => new DescItem { id = (string)x["id"], desc = (string)x["desc"] }).ToList(); model.desc_items = desc; } //組moduleSetting var moduleSet = jPkglst[i]["productPkg"]["moduleSetting"]; if (moduleSet.FirstOrDefault() != null) { FlightInfoType fit = new FlightInfoType() { value = moduleSet["flightInfoType"]["value"].ToString() }; SendInfoType sit = new SendInfoType() { value = moduleSet["sendInfoType"]["value"].ToString(), country_code = moduleSet["sendInfoType"]["countryCode"].ToString() }; VoucherValidInfo vi = new VoucherValidInfo(); if (moduleSet["voucherValidInfo"] != null && moduleSet["voucherValidInfo"].Any()) { vi.valid_period_type = moduleSet["voucherValidInfo"]["validPeriodType"].ToString(); vi.before_specific_date = moduleSet["voucherValidInfo"]["beforeSpecificDate"].ToString(); if (moduleSet["voucherValidInfo"]["afterOrderDate"] != null && moduleSet["voucherValidInfo"]["afterOrderDate"].Any()) { AfterOrderDate aod = new AfterOrderDate() { qty = (int?)moduleSet["voucherValidInfo"]["afterOrderDate"]["qty"], unit = moduleSet["voucherValidInfo"]["afterOrderDate"]["unit"].ToString() }; vi.after_order_date = aod; } } ModuleSetting ms = new ModuleSetting() { flight_info_type = fit, send_info_type = sit, voucher_valid_info = vi }; model.module_setting = ms; } pkgLst.Add(model); price_model.pkg_no = model.pkg_no; price_model.price1 = model.price1; price_model.price1_b2c = model.price1_b2c; price_model.price2 = model.price2; price_model.price2_b2c = model.price2_b2c; price_model.price3 = model.price3; price_model.price3_b2c = model.price3_b2c; price_model.price4 = model.price4; price_model.price4_b2c = model.price4_b2c; pkg_price.pkgs.Add(price_model); } pkg.pkgs = pkgLst; pkg.discount_rule = disc; pkg.guid = Guid.NewGuid().ToString(); rds.SetProdInfotoRedis(JsonConvert.SerializeObject(pkg_price), "b2d:pkgsPrice:" + pkg.guid, 1440); // 將 pkg_price 存入redis //依套餐取回『可售日期』 pkg.sale_dates = (PkgSaleDateModel)GetPkgSaleDate(rq);; #endregion } catch (Exception ex) { pkg.result = "10001"; pkg.result_msg = $"Package ERROR :{ex.Message},{ex.StackTrace}"; Website.Instance.logger.FatalFormat($"Package ERROR :{ex.Message},{ex.StackTrace}"); } return(pkg); }
public static bool Init(ModuleSetting Setting, LanguageManager Manager, bool AddByAssembly = true) { return(Init(Setting, ref Manager, AddByAssembly)); }
public object this[string moduleName, string name] { get { Log.Trace("Getting module setting " + name + " for module " + moduleName); object ret = null; bool search = true; Monitor.Enter(Lock); if (_cache.ContainsKey(moduleName)) { if (((Dictionary <string, object>)_cache[moduleName].Value).ContainsKey(name)) { ret = ((Dictionary <string, object>)_cache[moduleName].Value)[name]; search = false; } } Monitor.Exit(Lock); if (search) { Monitor.Enter(_lock); List <Org.Reddragonit.Dbpro.Structure.Table> tmp = _conn.Select(typeof(ModuleSetting), new SelectParameter[] { new EqualParameter("Name", name), new EqualParameter("ModuleName", moduleName) }); _conn.Close(); Monitor.Exit(_lock); if (tmp.Count > 0) { if (((ModuleSetting)tmp[0]).Value != null) { ret = Utility.ConvertObjectFromXML(((ModuleSetting)tmp[0]).Value); } } Monitor.Enter(Lock); if (!_cache.ContainsKey(moduleName)) { _cache.Add(moduleName, new CachedItemContainer(new Dictionary <string, object>())); } Dictionary <string, object> tmpd = (Dictionary <string, object>)_cache[moduleName].Value; _cache.Remove(moduleName); if (tmpd.ContainsKey(name)) { tmpd.Remove(name); } tmpd.Add(name, ret); _cache.Add(moduleName, new CachedItemContainer(tmpd)); Monitor.Exit(Lock); } return(ret); } set { Log.Trace("Setting module setting " + name + " for module " + moduleName); Monitor.Enter(_lock); List <Org.Reddragonit.Dbpro.Structure.Table> tmp = _conn.Select(typeof(ModuleSetting), new SelectParameter[] { new EqualParameter("Name", name), new EqualParameter("ModuleName", moduleName) }); _conn.Close(); if ((tmp.Count > 0) && (value == null)) { _conn.Delete(tmp[0]); } else if (value != null) { string val = Utility.ConvertObjectToXML(value); if (tmp.Count > 0) { ((ModuleSetting)tmp[0]).Value = val; ((ModuleSetting)tmp[0]).ValueType = value.GetType().FullName; tmp[0].Update(); } else { ModuleSetting ss = new ModuleSetting(); ss.Name = name; ss.Value = val; ss.ValueType = value.GetType().FullName; ss.ModuleName = moduleName; _conn.Save(ss); } } _conn.Commit(); Monitor.Enter(Lock); if (!_cache.ContainsKey(moduleName)) { _cache.Add(moduleName, new CachedItemContainer(new Dictionary <string, object>())); } Dictionary <string, object> tmpd = (Dictionary <string, object>)_cache[moduleName].Value; _cache.Remove(moduleName); if (tmpd.ContainsKey(name)) { tmpd.Remove(name); } tmpd.Add(name, value); _cache.Add(moduleName, new CachedItemContainer(tmpd)); Monitor.Exit(Lock); Monitor.Exit(_lock); } }
public static String LoadJSONSettings(string settingName) { string json = (ModuleSetting.Load(settingName)).SettingData; return(json); }
public static string SectionSetting(this HtmlHelper htmlHelper, ModuleSetting moduleSetting, string name, object value) { return(SectionSetting(htmlHelper, moduleSetting, name, value, false)); }
public RecentSelectionSetting(string className, string customName, string assemblyName, string xapFileName) { ClassName = className; CustomName = customName; Module = new ModuleSetting(assemblyName, xapFileName); }