private void txtNetWght_Validated(object sender, EventArgs e) { if (!string.IsNullOrEmpty(cmbPackType.Text)) this.pack = Builders.PackageDetailsBuilder.GetPackage(cmbPackType.Text); if (string.IsNullOrEmpty(txtNetWght.Text)) return; txtGrossWght.Text = (int.Parse(txtNetWght.Text) + (this.pack != null ? this.pack.Weight : 0)).ToString(); }
public Winform_ItemSKUDetails(int index, int revisionID, ItemPricing itemsku = null) { InitializeComponent(); this.Index = index; this.revisionID = revisionID; //set combobox is set to default. if (revisionID != 0) { cmbVATPercent.DataSource = Builders.VATRevisionBuilder.GetVATRevisionPercentageList(revisionID); //cmbVATPercent.DisplayMember = "Percent"; } cmbPackType.DataSource = Builders.PurchaseBillBuilder.GetPackageTypes(); //load controls this.item = itemsku.Item; UpdateItemDetailControls(this.item); if (itemsku.ManufacturedDate != DateTime.MinValue) { chkDOM.Checked = true; dtpDOM.Enabled = true; dtpDOM.Value = itemsku.ManufacturedDate; } if (itemsku.ExpiredDate != DateTime.MinValue) { chkDOE.Checked = true; dtpDOE.Enabled = true; dtpDOE.Value = itemsku.ExpiredDate; } this.pack = itemsku.Package; if (this.pack != null) cmbPackType.SelectedIndex = cmbPackType.Items.IndexOf(this.pack.Name); nudNoPacks.Value = itemsku.PackageQuantity; nudItemsPerPack.Value = itemsku.QuantityPerPack; txtNetWght.Text = itemsku.NetWeight.ToString(); txtGrossWght.Text = itemsku.GrossWeight.ToString(); txtBasic.Text = itemsku.Basic.ToString(); this.Basic = itemsku.Basic; txtTotalBasic.Text = (this.Basic * (nudNoPacks.Value * nudItemsPerPack.Value)).ToString("#.##"); txtTransPercent.Text = itemsku.TransportPercent.ToString(); //txtTrans.Text = itemsku.Transport.ToString(); UpdateTransSet(itemsku.TransportPercent, 0, 0); txtMiscPercent.Text = itemsku.MiscPercent.ToString(); //txtMisc.Text = itemsku.Misc.ToString(); UpdateMiscSet(itemsku.MiscPercent, 0, 0); txtDiscPercent.Text = itemsku.DiscountPercent.ToString(); ///txtDisc.Text = itemsku.Discount.ToString(); UpdateDiscSet(itemsku.DiscountPercent, 0, 0); cmbVATPercent.SelectedIndex = cmbVATPercent.Items.IndexOf(itemsku.VATPercent); txtVAT.Text = itemsku.VAT.ToString("#.##"); txtTotalVAT.Text = (itemsku.VAT * nudItemsPerPack.Value * nudNoPacks.Value).ToString("#.##"); //this.VATPercent = itemsku.VATPercent; //this.MiscPercent = itemsku.MiscPercent; //this.DiscountPercent = itemsku.DiscountPercent; //this.TransPercent = itemsku.TransportPercent; //this.VAT = itemsku.VAT; //this.Misc = itemsku.Misc; //this.Discount = itemsku.Discount; //this.Trans = itemsku.Transport; //UpdateRates(); UpdateRates(); this.PurchaseRate = itemsku.PurchaseValue; this.WRatePercent = itemsku.WholesaleMargin; this.WRate = itemsku.Wholesale; this.RRatePercent = itemsku.RetailMargin; this.RRate = itemsku.Retail; txtPurchaseRate.Text = itemsku.PurchaseValue.ToString(); //PurchaseRate = itemsku.PurchaseValue; txtWholePercent.Text = itemsku.WholesaleMargin.ToString(); txtWholeMarginPrice.Text = ((WRatePercent != 0 ? (PurchaseRate * (WRatePercent / 100)) : 0) + PurchaseRate).ToString("#.##"); txtWholeRate.Text = itemsku.Wholesale.ToString(); UpdateWSaleSet(); txtRetailPercent.Text = itemsku.RetailMargin.ToString(); txtRetailMarginPrice.Text = ((RRatePercent != 0 ? (WRate * (RRatePercent / 100)) : 0) + WRate).ToString("#.##"); txtRetailRate.Text = itemsku.Retail.ToString(); UpdateRSaleSet(); }
public static int SavePackage(Package _pack) { using (var session = NHibernateHelper.OpenSession()) { using (var tx = session.BeginTransaction()) { try { session.SaveOrUpdate(_pack); tx.Commit(); log.Info("Package type Saved"); return _pack.ID; } catch (Exception ex) { tx.Rollback(); log.Error(ex); return 0; } } } }