Ejemplo n.º 1
0
        private HerbStock CreateHerbStock()
        {
            HerbStock     hs  = new HerbStock();
            AllHerbsModel ahm = new AllHerbsModel();
            AllHerb       ah  = ahm.GetHerbByName(tbxHerb.Text);

            hs.HerbRefNum         = ah.RefNum.ToString();
            hs.BatchNum           = tbxBatchNumber.Text;
            hs.BuyPrice           = Convert.ToDecimal(tbxSupplierPrice.Text);
            hs.ExpiryDate         = Convert.ToDateTime(tbxExpiaryDate.Text);
            hs.Quantity           = Convert.ToDecimal(tbxQuantity.Text);
            hs.SupplierID         = Convert.ToInt32(ddlSupplier.SelectedValue);
            hs.HerbRawToGranRatio = Convert.ToDecimal(tbxRatio.Text);
            hs.DateReceived       = Convert.ToDateTime(tbxDateReceived.Text);
            if (tbxDateToDispensery.Text == "")
            {
                hs.DateToDispensery = null;
            }
            else
            {
                hs.DateToDispensery = Convert.ToDateTime(tbxDateToDispensery.Text);
            }
            hs.HerbForm = ddlHerbForm.SelectedItem.Text;
            return(hs);
        }
Ejemplo n.º 2
0
        private void FillPage(int id)
        {
            HerbStockModel herbStock = new HerbStockModel();
            HerbStock      hs        = herbStock.GetHerbStock(id);
            AllHerbsModel  ahm       = new AllHerbsModel();
            AllHerb        ah        = ahm.GetAllHerb(hs.HerbRefNum.ToString());

            tbxHerb.Text              = ah.HerbName;
            tbxQuantity.Text          = hs.Quantity.ToString();
            tbxBatchNumber.Text       = hs.BatchNum;
            tbxExpiaryDate.Text       = String.Format("{0:dd/MM/yyyy}", hs.ExpiryDate);
            ddlSupplier.SelectedValue = hs.SupplierID.ToString();
            tbxSupplierPrice.Text     = String.Format("{0:0.0000}", hs.BuyPrice);
            ddlHerbForm.SelectedValue = hs.HerbForm.ToString();
            tbxRatio.Text             = hs.HerbRawToGranRatio.ToString();
            tbxDateReceived.Text      = String.Format("{0:dd/MM/yyyy}", hs.DateReceived);

            tbxDateToDispensery.Text = String.Format("{0:dd/MM/yyyy}", hs.DateToDispensery);
        }