public GeneralSettingModel GetSettings() { SqlCommand cmd = new SqlCommand(); cmd.CommandText = StoredProcedure; var result = SCObjects.ExecGetData(cmd, Properties.Settings.Default.UserConnectionString); if (result != null) { var item = new GeneralSettingModel { ParkingName = result.Rows[0]["ParkingName"].ToString(), TIN = result.Rows[0]["TIN"].ToString(), Company = result.Rows[0]["Company"].ToString(), Address1 = result.Rows[0]["Address1"].ToString(), Address2 = result.Rows[0]["Address2"].ToString(), Address3 = result.Rows[0]["Address3"].ToString(), PhoneNumber = result.Rows[0]["PhoneNumber"].ToString(), Address = result.Rows[0]["Address"].ToString(), }; return(item); } else { return(null); } }
public void SetSettingModel() { _Model = new GeneralSettingModel() { CostType = rdoCostTypeList.EditValue.ToString(), Remark = txtRemark.Text, Supplier = ddSupplier.SelectedItem.ToString(), Info = txtInfo.Text, Employee = txtEmployee.Text, CreateDate = dtCreate.DateTime.ToString("yyyy-MM-dd", new CultureInfo("en-US")), PriceScale = new GeneralPriceScale() { MarkUp = rdoAmountMarkupList.EditValue.ToString(), Scale = numPriceScale.Value, MinProfit = Convert.ToDecimal(txtMinProfit.Text), MaxProfit = Convert.ToDecimal(txtMaxProfit.Text) }, Unit = new GeneralUnit() { Mode = rdoUnitList.EditValue.ToString(), SaleUnit = txtSaleUnit.Text, ShopUnit = txtShopUnit.Text, UnitNumber = (int)Convert.ToDecimal(txtUnitNumber.Text) }, Currency = new GeneralCurrency() { Mode = rdoCurrencyList.EditValue.ToString(), Currency = txtConvertCurrency.Text, Rate = Convert.ToDecimal(txtExchangeRate.Text) }, Options = getSelectedOption(), TextLines = getSelectedTextLine() }; }
public void LoadProffixCalculation(GeneralSettingModel generalSettingModel, PriceCalculationSetting moduleSetting, string[] arguments) { //ProffixResult oResult = new ProffixResult(arguments); //if (arguments != null) //{ // if (arguments.Length == 2) // { // if (arguments[1].TrimStart().TrimEnd().Trim().StartsWith("opencal")) // { // //new or load // string[] sSubParam = arguments[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); // if (sSubParam.Length == 2) // { // //new // NewCalculation(generalSettingModel, moduleSetting, sSubParam[1]); // } // else if (sSubParam.Length > 2) // { // //load // } // } // } //} }
private void btnReset_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to reset calculation?", "Reset calculation", MessageBoxButtons.YesNo) == DialogResult.Yes) { _Model = null; btnNew.Enabled = true; btnReset.Enabled = false; } }
public void SetSettingModel() { _Model = new GeneralSettingModel() { CostType = rdoCostTypeList.EditValue.ToString(), Remark = txtRemark.Text, Supplier = ddSupplier.SelectedItem.ToString(), Info = txtInfo.Text, Employee = txtEmployee.Text, CreateDate = dtCreate.DateTime.ToString("yyyy-MM-dd", new CultureInfo("en-US")), PriceScale = new GeneralPriceScale() { MarkUp = rdoAmountMarkupList.EditValue.ToString(), Scale = numPriceScale.Value, MinProfit = Convert.ToDecimal(txtMinProfit.Text), MaxProfit = Convert.ToDecimal(txtMaxProfit.Text) }, Convert = new GeneralConvert() { Mode = rdoUnitList.EditValue.ToString(), SaleUnit = txtSaleUnit.Text, ShopUnit = txtShopUnit.Text, UnitNumber = Convert.ToDecimal(txtUnitNumber.Text) }, Currency = new GeneralCurrency() { Mode = rdoCurrencyList.EditValue.ToString(), Currency = rdoCurrencyList.EditValue.ToString() == "A" ? "CHF" : txtConvertCurrency.Text, Rate = Convert.ToDecimal(txtExchangeRate.Text) }, Options = getSelectedOption(), TextLines = getSelectedTextLine(), ProductDesc = getProductDesc(), ProffixModel = _ProffixModel }; try { _Model.Convert.EEUnitNumber = Convert.ToDecimal(new string(_Model.Convert.ShopUnit.Where(item => Char.IsDigit(item)).ToArray())); } catch { _Model.Convert.EEUnitNumber = 1; } try { _Model.Convert.VEUnitNumber = Convert.ToDecimal(new string(_Model.Convert.SaleUnit.Where(item => Char.IsDigit(item)).ToArray())); } catch { _Model.Convert.EEUnitNumber = 1; } }
public ActionResult Update([ModelBinder(typeof(DevExpressEditorsBinder))] GeneralSettingModel generalSettingModel) { generalSettingModel._UserId = (int)Session["userId"]; generalSettingService = new GeneralSettingService(); if (ModelState.IsValid) { generalSettingService.Update(generalSettingModel); generalSettingModel = generalSettingService.GetById(generalSettingModel.Id); } else { string message = GetErrorModel(); throw new Exception(string.Format("[VALIDATION] {0}", message)); } return(PartialView(VIEW_FORM_PARTIAL, generalSettingModel)); }
public void NewCalculation(GeneralSettingModel generalSettingModel, PriceCalculationSetting moduleSetting) { _Model = new CalculationModel() { //set new id is zero ID = 0, GeneralSetting = generalSettingModel, ProffixConnection = moduleSetting.ProffixConnection, CalculationNotes = new List <CalculationNoteModel>(), CalculationViewItems = new List <CalculationItemModel>(), ProffixModel = generalSettingModel.ProffixModel }; //setup new calculation _Model.SetBasicCalculationNote(); _Model.SetScaleCalculationNote(moduleSetting.PriceSetting, _Model.CalculationNotes.First().CalculationItems.Last().ItemOrder); _Model.SetMarginCalculationNote(); //setup everythings SetUpCalculation(); }