Ejemplo n.º 1
0
        public void GetAllForApp_ValidApp_ReturnsAllConfigItemsForApp()
        {
            //  Arrange
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            //  Act
            var result = manager.GetAllForApp(new ConfigItem {
                Application = "SomeOtherApp"
            });

            //  Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(5, result.Count);
        }
Ejemplo n.º 2
0
        public ConfigResponse <ConfigItem> Set(ConfigItem request)
        {
            ConfigResponse <ConfigItem> retval = new ConfigResponse <ConfigItem>();

            using (var db = new CentralConfigDb())
            {
                ConfigDataManager manager = new ConfigDataManager(db);
                retval.Data    = manager.Set(request);
                retval.Status  = System.Net.HttpStatusCode.OK;
                retval.Message = "Config item updated";
            }

            return(retval);
        }
Ejemplo n.º 3
0
        public ConfigResponse <List <ConfigItem> > GetAll()
        {
            ConfigResponse <List <ConfigItem> > retval = new ConfigResponse <List <ConfigItem> >();

            using (var db = new CentralConfigDb())
            {
                ConfigDataManager manager = new ConfigDataManager(db);
                retval.Data    = manager.GetAll();
                retval.Status  = System.Net.HttpStatusCode.OK;
                retval.Message = "Config items found";
            }

            return(retval);
        }
Ejemplo n.º 4
0
    void Init()
    {
        InitGameSteps();
        currentStep = InitStep;
        ConfigDataManager.LoadData();
        SystemDatas = new SystemDataManager();
        SystemDatas.Init();
        SyncDataMgr = new SyncDataManager();
#if UNITY_EDITOR || UNITY_STANDALONE
        OpenFolder.SetActive(true);
#else
        OpenFolder.SetActive(false);
#endif
    }
Ejemplo n.º 5
0
        public void Remove_ValidConfigItem_Successful()
        {
            //  Arrange
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            //  Act
            manager.Remove(new ConfigItem {
                Application = "SomeOtherApp", Name = "SpecificConfig1"
            });

            //  Assert
            mockSet.Verify(m => m.Remove(It.IsAny <configitem>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Ejemplo n.º 6
0
        public void Get_ValidRequest_ReturnsExpectedConfigItem()
        {
            //  Arrange
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            //  Arrange
            Dictionary <ConfigItem, string> testRequestResponse = new Dictionary <ConfigItem, string>()
            {
                //  Request / Expected response value
                { new ConfigItem {
                      Name = "Environment"
                  }, "DEV" },                                       //  No app specified, so we get the default
                { new ConfigItem {
                      Name = "Environment", Application = "BogusApp"
                  }, "DEV" },                                                                 //  App doesn't match, so we get the default
                { new ConfigItem {
                      Application = "TestApp", Name = "Environment"
                  }, "UNITTEST" },                                                              //  Get the app specific match
                { new ConfigItem {
                      Application = "SomeOtherApp", Name = "SpecificConfig1"
                  }, "Something somewhat specific" },                                                                       //  No machine specified
                { new ConfigItem {
                      Application = "SomeOtherApp", Name = "SpecificConfig1", Machine = "BogusMachine"
                  }, "Something somewhat specific" },                                                                                                 //  Unrecognized machine gets the regular config
                { new ConfigItem {
                      Application = "SomeOtherApp", Name = "SpecificConfig1", Machine = "Machine1"
                  }, "Something very specific" },                                                                                             //  Machine specific

                { new ConfigItem {
                      Name = "MachineGlobalSetting"
                  }, "" },                                               //  Putting machine names on global settings is weird ... (don't do this)
                { new ConfigItem {
                      Name = "MachineGlobalSetting", Machine = "Machine1"
                  }, "" },                                                                    //  ... you can't just pass in a specific machine ...
                { new ConfigItem {
                      Application = "*", Name = "MachineGlobalSetting", Machine = "Machine1"
                  }, "Will never be found by default" },                                                                                       //  ... you also have to explicitly ask for the default (global) app.
            };

            //  For each item in the test table...
            foreach (var item in testRequestResponse)
            {
                //  Act
                var retval = manager.Get(item.Key);

                //  Assert
                Assert.AreEqual(item.Value, retval.Value);    //  Value should be what we expect
            }
        }
Ejemplo n.º 7
0
        public void Get_ItemDoesntExist_EmptyResults()
        {
            //  Arrange
            ConfigItem request = new ConfigItem {
                Application = "BogusApp", Name = "AnotherItem"
            };
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            //  Act
            var result = manager.Get(request);

            //  Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Id);      //  Should be 0 - we didn't find anything
            Assert.AreEqual("", result.Name);   //  This stuff is blank
            Assert.AreEqual("", result.Value);
        }
Ejemplo n.º 8
0
    public void Init()
    {
        foreach (var tacticConfig in ConfigData.BattleTacticDict.Values)
        {
            var randMonId = ConfigDataManager.GetRandMonsterId(tacticConfig.Group);
            itemList.Add(new MatchCellInfo {
                Id = tacticConfig.CellId, Side = (byte)tacticConfig.Side, IsHide = true, MonsterId = randMonId
            });
        }
        ArraysUtils.RandomShuffle(itemList);

        for (int i = 0; i < GameConst.RowCount; i++)
        {
            itemList[i].Pos = new NarlonLib.Math.Vector2(i % GameConst.ColumnCount, i / GameConst.ColumnCount);
            cellMap[itemList[i].Pos.X, itemList[i].Pos.Y] = itemList[i].Id;
        }
    }
Ejemplo n.º 9
0
        public void Set_NewConfigItem_SuccessfullyAdds()
        {
            //  Arrange
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            ConfigItem newItem = new ConfigItem
            {
                Application = "SomeOtherApp",
                Name        = "UnitTestItem",
                Value       = "UnitTestValue"
            };

            //  Act
            var retval = manager.Set(newItem);

            //  Assert
            mockSet.Verify(m => m.Add(It.IsAny <configitem>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Ejemplo n.º 10
0
        public void Set_ExistingConfigItem_SuccessfullyUpdates()
        {
            //  Arrange
            ConfigDataManager manager = new ConfigDataManager(mockContext.Object);

            ConfigItem newItem = new ConfigItem
            {
                Id          = 6,                 /* Pass the id to make an update */
                Application = "SomeOtherApp",    /* Optional.  Not used in an update. */
                Name        = "SpecificConfig1", /* Optional.  Not used in an update. */
                Value       = "Something somewhat specific and updated"
            };

            //  Act
            var retval = manager.Set(newItem);

            //  Assert
            mockSet.Verify(m => m.Add(It.IsAny <configitem>()), Times.Never());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
 /// <summary>
 /// 加载每日数据
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 private DailySalesData LoadDailyData(string date)
 {
     if (!allDailydataSaleDataDict.ContainsKey(date))
     {
         bool           isCreate       = false;
         DailySalesData dailySalesData = ConfigDataManager.LoadDailyData(date);
         if (dailySalesData == null)
         {
             dailySalesData      = new DailySalesData();
             dailySalesData.Date = date;
             isCreate            = true;
         }
         allDailydataSaleDataDict[date] = dailySalesData;
         if (isCreate)
         {
             CalculateData(date);
             SaveChange(date);
         }
     }
     return(allDailydataSaleDataDict[date]);
 }
Ejemplo n.º 12
0
    void DataCallBackHandler(AssetBundleInfo info)
    {
        TextAsset textAsset = info.mainObject as TextAsset;

        if (textAsset == null)
        {
            Debug.LogError("can not found this table:" + configType);
            return;
        }
        TyLogger.Log("ConfigCollect.CONFIG_ARRAY:" + configType);
        IFormatter formatter = new BinaryFormatter();

        formatter.Binder = new UBinder();
        MemoryStream stream = new MemoryStream(textAsset.bytes);

        object[]  dataArr    = formatter.Deserialize(stream) as object[];
        IConfig[] iConfigArr = Array.ConvertAll <object, IConfig>(dataArr, delegate(object s) { return(s as IConfig); });
        ConfigDataManager.addConfigData(configType, iConfigArr);
        stream.Close();
        _loadProgress = 1.0f;
        _loadState    = 3;
    }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     ConfigDataManager.CreateInstance(this.gameObject);
 }
Ejemplo n.º 14
0
        protected override void LoadForm(object sender, EventArgs e)
        {
            base.LoadForm(sender, e);

            EnableBtnSearch = true;
            SearchPopup     = new ShipmentPopup();

            try
            {
                using (var configDm = new ConfigDataManager())
                {
                    _fixedShippingInsuranceRate = decimal.Parse(configDm.Get("FixedShippingInsuranceRate"));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"The insurance rate setting must be correctly set in the config table (FixedShippingInsuranceRate)", @"Error!");
                throw new Exception("The insurance rate setting must be correctly set in the config table (FixedShippingInsuranceRate)", ex);
            }

            tbxNo.Leave += tbxShipmentNo_Leave;

            lkpDestination.LookupPopup                   = new CityPopup();
            lkpDestination.AutoCompleteDataManager       = new CityDataManager();
            lkpDestination.AutoCompleteDisplayFormater   = model => ((CityModel)model).Name;
            lkpDestination.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpDestination.FieldLabel      = "Destination City";
            lkpDestination.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            lkpConsignee.LookupPopup                   = new ConsigneePopup();
            lkpConsignee.AutoCompleteDataManager       = new ConsigneeDataManager();
            lkpConsignee.AutoCompleteDisplayFormater   = model => ((ConsigneeModel)model).Name;
            lkpConsignee.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(BaseControl.CorporateId, "corporate_id", EnumSqlOperator.Equals),
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpConsignee.Leave += AutoPopulateConsigneeDetail;

            lkpPackage.LookupPopup                   = new PackageTypePopup();
            lkpPackage.AutoCompleteDataManager       = new PackageTypeDataManager();
            lkpPackage.AutoCompleteDisplayFormater   = model => ((PackageTypeModel)model).Name;
            lkpPackage.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpPackage.FieldLabel      = "Package Type";
            lkpPackage.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            lkpService.LookupPopup                 = new ServiceTypePopup();
            lkpService.AutoCompleteDataManager     = new ServiceTypeDataManager();
            lkpService.AutoCompleteDisplayFormater = model => ((ServiceTypeModel)model).Name;
            lkpService.AutoCompleteWhereExpression = (s, p) =>
                                                     p.SetWhereExpression("name.StartsWith(@0)", s);
            lkpService.FieldLabel      = "Service Type";
            lkpService.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            lkpPayment.LookupPopup                 = new PaymentMethodPopup("name.Equals(@0) OR name.Equals(@1)", "COLLECT ", "CREDIT");
            lkpPayment.AutoCompleteDataManager     = new PaymentMethodDataManager();
            lkpPayment.AutoCompleteDisplayFormater = model => ((PaymentMethodModel)model).Name;
            lkpPayment.AutoCompleteWhereExpression = (s, p) =>
                                                     p.SetWhereExpression("name.StartsWith(@0) AND (name.Equals(@1) OR name.Equals(@2))", s, "COLLECT", "CREDIT");
            lkpPayment.FieldLabel      = "Payment Method";
            lkpPayment.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxConsigneeName.FieldLabel         = "Consignee Name";
            tbxConsigneeName.ValidationRules    = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxConsigneeAddress.FieldLabel      = "Consignee Address";
            tbxConsigneeAddress.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxConsigneePhone.FieldLabel        = "Consignee Phone";
            tbxConsigneePhone.ValidationRules   = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxTtlPiece.EditMask              = "###,##0";
            tbxTtlPiece.FieldLabel            = "Total Piece";
            tbxTtlPiece.ValidationRules       = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxTtlGrossWeight.EditMask        = "###,##0.0";
            tbxTtlGrossWeight.FieldLabel      = "Total Weight";
            tbxTtlGrossWeight.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxTtlChargeable.EditMask         = "###,##0.0";
            tbxTtlChargeable.FieldLabel       = "Chargeable Weight";
            tbxTtlChargeable.ValidationRules  = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxDiscount.EditMask   = "#0.0%%";
            tbxOther.EditMask      = "##,###,##0.00";
            tbxGoodsValue.EditMask = "##,###,##0.00";
            tbxInsurance.EditMask  = "##,###,##0.00";


            tbxConsigneeName.CharacterCasing    = CharacterCasing.Upper;
            tbxConsigneeAddress.CharacterCasing = CharacterCasing.Upper;
            tbxConsigneePhone.CharacterCasing   = CharacterCasing.Upper;
            tbxNote.CharacterCasing             = CharacterCasing.Upper;
            tbxNatureOfGood.CharacterCasing     = CharacterCasing.Upper;

            tbxConsigneeName.MaxLength    = 100;
            tbxConsigneeAddress.MaxLength = 254;
            tbxConsigneePhone.MaxLength   = 50;

            tbxNote.MaxLength         = 100;
            tbxNatureOfGood.MaxLength = 50;

            tbxTtlGrossWeight.TextChanged += TxtTotalWeightOnTextChanged;
            tbxDiscount.TextChanged       += (o, args) => RefreshTariff();

            FormTrackingStatus = EnumTrackingStatus.CorporateDateEntry;

            rbLayout_Print.ItemClick += (o, args) =>
            {
                var printout = new EConnotePrintout
                {
                    DataSource = GetPrintDataSource()
                };
                printout.PrintDialog();
            };
            rbLayout_PrintPreview.ItemClick += (o, args) =>
            {
                var printout = new EConnotePrintout
                {
                    DataSource = GetPrintDataSource()
                };
                printout.PrintPreview();
            };

            lkpDestination.EditValueChanged    += lkpDestination_EditValueChanged;
            lkpPackage.EditValueChanged        += lkpPackageType_EditValueChanged;
            lkpService.EditValueChanged        += lkpServiceType_EditValueChanged;
            tbxOther.EditValueChanged          += txtOtherFee_EditValueChanged;
            tbxGoodsValue.EditValueChanged     += txtGoodsValue_EditValueChanged;
            tbxTtlPiece.EditValueChanged       += txtTotalPiece_EditValueChanged;
            tbxTtlGrossWeight.EditValueChanged += txtTotalWeight_EditValueChanged;
            tbxTtlChargeable.EditValueChanged  += txtChargeable_EditValueChanged;
            tbxDiscount.EditValueChanged       += tbxDiscount_EditValueChanged;

            using (var branchDm = new BranchDataManager())
            {
                var branch = branchDm.GetFirst <BranchModel>(WhereTerm.Default(BaseControl.BranchId, "id"));
                MaximumBranchDiscount = branch.MaxDiscount > 0 ? branch.MaxDiscount : 0;
            }

            rbPod.Visible         = true;
            rbPod_Void.Enabled    = false;
            rbPod_Void.ItemClick += Void;
        }
Ejemplo n.º 15
0
    public void OnClickOpenFolder()
    {
        string path = Application.persistentDataPath + "/HistoryData";

        ConfigDataManager.OpenFolder(path);
    }
Ejemplo n.º 16
0
        protected override void LoadForm(object sender, EventArgs e)
        {
            base.LoadForm(sender, e);

            EnableBtnSearch = true;
            SearchPopup     = new ShipmentPopup();

            try
            {
                using (var configDm = new ConfigDataManager())
                {
                    _fixedShippingInsuranceRate = decimal.Parse(configDm.Get("FixedShippingInsuranceRate"));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"The insurance rate setting must be correctly set in the config table (FixedShippingInsuranceRate)", @"Error!");
                throw new Exception("The insurance rate setting must be correctly set in the config table (FixedShippingInsuranceRate)", ex);
            }

            lkpDestination.LookupPopup                   = new CityPopup();
            lkpDestination.AutoCompleteDataManager       = new CityServices();
            lkpDestination.AutoCompleteDisplayFormater   = model => ((CityModel)model).Name;
            lkpDestination.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpDestination.FieldLabel      = "Destination City";
            lkpDestination.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            lkpDestination.Leave          += (s, o) =>
            {
                var cityDataManager    = new CityDataManager();
                var countryDataManager = new CountryDataManager();

                var cityModel = cityDataManager.GetFirst <CityModel>(WhereTerm.Default(lkpDestination.Value ?? 0, "Id"));

                if (cityModel != null)
                {
                    var countryModel = countryDataManager.GetFirst <CountryModel>(WhereTerm.Default(cityModel.CountryId, "Id"));

                    if (countryModel != null)
                    {
                        ((ShipmentModel)CurrentModel).PricingPlanId = countryModel.PricingPlanId;
                    }
                }

                cityDataManager.Dispose();
                countryDataManager.Dispose();

                RefreshServiceType();
            };

            lkpConsignee.LookupPopup                   = new ConsigneePopup();
            lkpConsignee.AutoCompleteDataManager       = new ConsigneeDataManager();
            lkpConsignee.AutoCompleteDisplayFormater   = model => ((ConsigneeModel)model).Name;
            lkpConsignee.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(BaseControl.CorporateId, "corporate_id", EnumSqlOperator.Equals),
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpConsignee.Leave += AutoPopulateConsigneeDetail;

            lkpPackage.LookupPopup                   = new PackageTypePopup();
            lkpPackage.AutoCompleteDataManager       = new PackageTypeServices();
            lkpPackage.AutoCompleteDisplayFormater   = model => ((PackageTypeModel)model).Name;
            lkpPackage.AutoCompleteWheretermFormater = s => new IListParameter[]
            {
                WhereTerm.Default(s, "name", EnumSqlOperator.BeginWith)
            };
            lkpPackage.FieldLabel        = "Package Type";
            lkpPackage.ValidationRules   = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            lkpPackage.EditValueChanged += (s, o) => RefreshTariff();
            lkpPackage.Leave            += (s, o) => NoServiceMessage();

            lkpService.LookupPopup                 = new ServiceTypePopup("name.Equals(@0) OR name.Equals(@1) OR name.Equals(@2) OR name.Equals(@3) OR name.Equals(@4) OR name.Equals(@5)", "REGULAR", "ONS", "DARAT", "CITY COURIER", "SDS", "LAUT");
            lkpService.AutoCompleteDataManager     = new ServiceTypeServices();
            lkpService.AutoCompleteDisplayFormater = model => ((ServiceTypeModel)model).Name;
            lkpService.AutoCompleteWhereExpression = (s, p) =>
                                                     p.SetWhereExpression("name.StartsWith(@0) AND (name.Equals(@1) OR name.Equals(@2) OR name.Equals(@3) OR name.Equals(@4) OR name.Equals(@5) OR name.Equals(@6))", s, "REGULAR", "ONS", "DARAT", "CITY COURIER", "SDS", "LAUT");
            lkpService.FieldLabel        = "Service Type";
            lkpService.ValidationRules   = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            lkpService.EditValueChanged += (s, o) => RefreshTariff();
            lkpService.Leave            += (s, o) => NoServiceMessage();

            lkpPayment.LookupPopup                 = new PaymentMethodPopup("name.Equals(@0)", "CREDIT");
            lkpPayment.AutoCompleteDataManager     = new PaymentMethodServices();
            lkpPayment.AutoCompleteDisplayFormater = model => ((PaymentMethodModel)model).Name;
            lkpPayment.AutoCompleteWhereExpression = (s, p) =>
                                                     p.SetWhereExpression("name.StartsWith(@0) AND name.Equals(@1)", s, "CREDIT");
            lkpPayment.FieldLabel      = "Payment Method";
            lkpPayment.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxConsigneeName.FieldLabel         = "Consignee Name";
            tbxConsigneeName.ValidationRules    = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxConsigneeAddress.FieldLabel      = "Consignee Address";
            tbxConsigneeAddress.ValidationRules = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxConsigneePhone.FieldLabel        = "Consignee Phone";
            tbxConsigneePhone.ValidationRules   = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxTtlPiece.EditMask                = "###,##0";
            tbxTtlPiece.FieldLabel              = "Total Piece";
            tbxTtlPiece.ValidationRules         = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxTtlPiece.EditValueChanged       += (s, o) => RefreshGrandTotal();
            tbxTtlGrossWeight.EditMask          = "###,##0.0";
            tbxTtlGrossWeight.FieldLabel        = "Total Weight";
            tbxTtlGrossWeight.ValidationRules   = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };
            tbxTtlGrossWeight.EditValueChanged += (s, o) => RefreshGrandTotal();
            tbxTtlChargeable.EditMask           = "###,##0.0";
            tbxTtlChargeable.FieldLabel         = "Chargeable Weight";
            tbxTtlChargeable.ValidationRules    = new[] { new ComponentValidationRule(EnumComponentValidationRule.Mandatory) };

            tbxL.EditValueChanged += (s, o) => VolumeCalculation();
            tbxW.EditValueChanged += (s, o) => VolumeCalculation();
            tbxH.EditValueChanged += (s, o) => VolumeCalculation();

            tbxOther.EditMask               = "##,###,##0.00";
            tbxOther.EditValueChanged      += (s, o) => RefreshGrandTotal();
            tbxGoodsValue.EditMask          = "##,###,###,##0.00";
            tbxGoodsValue.EditValueChanged += (s, o) =>
            {
                var goodsvalue = tbxGoodsValue.Value;
                if (goodsvalue == 0)
                {
                    tbxInsurance.Value = 0;
                }
                else
                {
                    tbxInsurance.Value = Math.Round((goodsvalue * BaseControl.GoodValuesInsurance) + BaseControl.GoodValuesAdministration, 0, MidpointRounding.AwayFromZero);
                }
                RefreshGrandTotal();
            };
            tbxInsurance.EditMask          = "##,###,###,##0.00";
            tbxInsurance.EditValueChanged += (s, o) => RefreshGrandTotal();

            tbxConsigneeName.CharacterCasing    = CharacterCasing.Upper;
            tbxConsigneeAddress.CharacterCasing = CharacterCasing.Upper;
            tbxConsigneePhone.CharacterCasing   = CharacterCasing.Upper;
            tbxNote.CharacterCasing             = CharacterCasing.Upper;
            tbxNatureOfGood.CharacterCasing     = CharacterCasing.Upper;

            tbxConsigneeName.MaxLength    = 100;
            tbxConsigneeAddress.MaxLength = 254;
            tbxConsigneePhone.MaxLength   = 50;

            tbxNote.MaxLength         = 100;
            tbxNatureOfGood.MaxLength = 50;

            tbxTtlGrossWeight.TextChanged += TxtTotalWeightOnTextChanged;

            FormTrackingStatus = EnumTrackingStatus.CorporateDataEntry;

            rbLayout_Print.ItemClick += (o, args) =>
            {
                var printout = new EConnotePrintout
                {
                    DataSource = GetPrintDataSource()
                };
                printout.PrintDialog();
            };
            rbLayout_PrintPreview.ItemClick += (o, args) =>
            {
                var printout = new EConnotePrintout
                {
                    DataSource = GetPrintDataSource()
                };
                printout.PrintPreview();
            };

            lkpService.EditValueChanged += (s, args) =>
            {
                RefreshServiceType();

                if (lkpService.Text == "DARAT")
                {
                    MinWeight = 10;
                }
                if (lkpService.Text == "LAUT")
                {
                    MinWeight = 30;
                }

                if (tbxTtlGrossWeight.Value < MinWeight)
                {
                    tbxTtlGrossWeight.SetValue(MinWeight);
                }
            };

            using (var branchDm = new BranchDataManager())
            {
                var branch = branchDm.GetFirst <BranchModel>(WhereTerm.Default(BaseControl.BranchId, "id"));
                MaximumBranchDiscount = branch.MaxDiscount > 0 ? branch.MaxDiscount : 0;
            }

            cbxPacking.Click += (s, o) =>
            {
                var fee = ((tbxL.Value + tbxW.Value + tbxH.Value + 18) / 3) * 2000;
                if (cbxPacking.Checked)
                {
                    tbxPacking.Value = fee;
                }
                else
                {
                    tbxPacking.Value = 0;
                }

                RefreshGrandTotal();
            };

            rbPod.Visible         = true;
            rbPod_Void.Enabled    = false;
            rbPod_Void.ItemClick += Void;
        }
Ejemplo n.º 17
0
 public static int RandomBallTypeIndex()
 {
     return(Random.Range(0, ConfigDataManager.GetInstance().GetBallDataKindNumber()));
 }
 public void SaveChange(string date)
 {
     LoadDailyData(date);
     CalculateData(date);
     ConfigDataManager.SaveDailyData(date, allDailydataSaleDataDict[date]);
 }
Ejemplo n.º 19
0
    private static void ParseFile(Byte[] bytes, string filePath)
    {
        Assembly asm = Assembly.GetExecutingAssembly();

        ByteArray ba         = new ByteArray(bytes);
        int       sheetCount = ba.readInt();

        for (int i = 0; i != sheetCount; ++i)
        {
            string className = ba.readUTF();
            int    rowCount  = ba.readInt();
            int    colCount  = ba.readInt();

            // 2. read values
            for (int r = 0; r != rowCount; ++r)
            {
                object obj = asm.CreateInstance(className);
                if (obj == null)
                {
                    Debug.Log("Load data error: " + className + " in " + filePath + " has no data.");
                    break;
                }
                FieldInfo[] fis = obj.GetType().GetFields();

                int id = 0;
                for (int c = 0; c != colCount; ++c)
                {
                    //string val = ba.readUTF();
                    if (c < fis.Length)
                    {
                        if (fis[c].FieldType == typeof(int))
                        {
                            int nVal = ba.readInt();
                            if (c == 0)
                            {
                                id = nVal;
                            }
                            fis[c].SetValue(obj, nVal);
                        }
                        else if (fis[c].FieldType == typeof(string))
                        {
                            fis[c].SetValue(obj, ba.readUTF());
                        }
                        else if (fis[c].FieldType == typeof(float))
                        {
                            string val = ba.readUTF();
                            fis[c].SetValue(obj, float.Parse(val));
                        }
                        else if (fis[c].FieldType == typeof(double))
                        {
                            string val = ba.readUTF();
                            fis[c].SetValue(obj, double.Parse(val));
                        }
                        else if (fis[c].FieldType == typeof(long))
                        {
                            fis[c].SetValue(obj, ba.readLong());
                        }
                    }
                }
                try
                {
                    ConfigDataManager.GetInstance().AddToDictionary(id, obj, rowCount);
                }
                catch (System.Exception ex)
                {
                    Debug.LogError(ex.ToString() + " @Id=" + id + " of " + className + " in " + filePath);
                }
            }
        }
    }
    public void ExportData(string date)
    {
        DailySalesData dailydata = LoadDailyData(date);

        ConfigDataManager.ExportDailyData(date, dailydata);
    }
Ejemplo n.º 21
0
 public void SaveChange()
 {
     ConfigDataManager.SaveSalePersonInfo(allSalePersonInfos);
 }