public override void Load()
        {
            Assembly cAssembly = Assembly.GetExecutingAssembly();

            __cRuleItems = RulePropertyAttribute.GetRules(cAssembly);

            string sLocation   = cAssembly.Location;
            string sPath       = Path.GetDirectoryName(sLocation);
            string sTargetName = Path.GetFileNameWithoutExtension(sLocation) + ".set";
            string sFileName   = Path.Combine(sPath, sTargetName);

            string[] sDatas = File.ReadAllLines(sFileName, Encoding.UTF8);

            JObject cExchange = JsonConvert.DeserializeObject <JObject>(sDatas[0]);

            this.FullName   = cExchange["FullName"].Value <string>();
            this.ShortName  = cExchange["ShortName"].Value <string>();
            this.UpdateTime = cExchange["UpdateTime"].Value <DateTime>();

            this.Products = JsonConvert.DeserializeObject <Dictionary <string, Product> >(sDatas[1]);

            //讀取基礎商品屬性表
            this.BasePropertys = CreateProductPropertyList(sDatas[2]);

            //讀取使用者自訂商品屬性表
            this.CustomPropertys = new Dictionary <string, ProductPropertyList>(16);
            Dictionary <string, JToken> sCustoms = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sDatas[3]);

            foreach (string sDataSource in sCustoms.Keys)
            {
                JToken cToken = sCustoms[sDataSource];
                ProductPropertyList cPropertyList = CreateProductPropertyList(cToken.ToString(Formatting.None));
                this.CustomPropertys.Add(sDataSource, cPropertyList);
            }
        }
Beispiel #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int iIndex = comboRules.SelectedIndex;
            RulePropertyAttribute cAttrib = __cRules[iIndex];
            string sClassName             = cAttrib.ClassName;
            bool   bSetting = cAttrib.IsNeedSetting;

            RuleBase cRule = null;

            switch (__cRuleType)
            {
            case ERuleType.Contract:
                cRule = __cProperty.ContractRule;
                if (SetRule(ref cRule, sClassName, bSetting))
                {
                    __cProperty.ContractRule = cRule;
                }
                break;

            case ERuleType.PriceScale:
                cRule = __cProperty.PriceScaleRule;
                if (SetRule(ref cRule, sClassName, bSetting))
                {
                    __cProperty.PriceScaleRule = cRule;
                }
                break;

            case ERuleType.Tax:
                cRule = __cProperty.TaxRule;
                if (SetRule(ref cRule, sClassName, bSetting))
                {
                    __cProperty.TaxRule = cRule;
                }
                break;
            }
            this.DialogResult = DialogResult.OK;
        }
Beispiel #3
0
		/// <summary>
		///   讀取下單服務的參數
		/// </summary>
		public override void Load() {
			if (__cRuleItems == null) {
				Assembly cAssembly = Assembly.GetExecutingAssembly();
				__cRuleItems = RulePropertyAttribute.GetRules(cAssembly);
			}
		}