コード例 #1
0
 protected void btnPNSubmit_Click(object sender, EventArgs e)
 {
     if (lbxManufacturer.SelectedItem == null || lbxProdType.SelectedItem == null || tbNNameSize.Text == string.Empty)
     {
         lblMissing.Visible = true;
     }
     else
     {
         using (var context = new cathlabEntities())
         {
             int cost, par;
             int.TryParse(tbNCost.Text, out cost);
             int.TryParse(tbNPar.Text, out par);
             PartNumber pn = new PartNumber();
             pn.PartNum        = pnum;
             pn.NameSize       = tbNNameSize.Text;
             pn.ManufacturerID = int.Parse(lbxManufacturer.SelectedValue);   //
             pn.ProductTypeID  = int.Parse(lbxProdType.SelectedValue);       //
             pn.Cost           = cost;
             pn.Par            = par;
             context.PartNumbers.Add(pn);
             context.SaveChanges();
             pnlNewPartNumber.Visible = true;
             pnlNewPartNumber.Visible = false;
             lblMissing.Visible       = false;
             autopopulate();
         }
     }
 }
コード例 #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     using (var context = new cathlabEntities())
     {
         ProductType pt = new ProductType();
         pt.Type = tbType.Text;
         context.ProductTypes.Add(pt);
         context.SaveChanges();
     }
 }
コード例 #3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     using (var context = new cathlabEntities())
     {
         Manufacturer man = new Manufacturer();
         man.Name        = tbManufacturerName.Text;
         man.Email       = tbxEmail.Text;
         man.PhoneNumber = tbxPhoneNumber.Text;
         man.Address     = tbxAddress.Text;
         context.Manufacturers.Add(man);
         context.SaveChanges();
     }
 }
コード例 #4
0
 protected void btnPTSubmit_Click(object sender, EventArgs e)
 {
     using (var context = new cathlabEntities())
     {
         // Check for existing Prod Type?
         string      ptType = tbNProdType.Text;
         ProductType pt     = new ProductType();
         pt.Type = tbNProdType.Text;
         context.ProductTypes.Add(pt);
         context.SaveChanges();
         int ptID = (int)(from prodType in context.ProductTypes where prodType.Type == ptType select prodType.ID).First();
         loadProductTypes();
         pnlNewPartNumber.Visible = true;
         pnlNewProdType.Visible   = false;
         loadProductTypes();
         lbxProdType.SelectedValue = ptID.ToString();
     }
 }
コード例 #5
0
 protected void btnManSubmit_Click(object sender, EventArgs e)
 {
     using (var context = new cathlabEntities())
     {
         string       manName = tbManufacturerName.Text;
         Manufacturer man     = new Manufacturer();
         man.Name        = tbManufacturerName.Text;
         man.Email       = tbxEmail.Text;
         man.PhoneNumber = tbxPhoneNumber.Text;
         man.Address     = tbxAddress.Text;
         context.Manufacturers.Add(man);
         context.SaveChanges();
         int mmm = (int)(from mann in context.Manufacturers where mann.Name == manName select mann.ID).First();
         loadManufacturers();
         pnlNewPartNumber.Visible      = true;
         pnlNewManufacturer.Visible    = false;
         lbxManufacturer.SelectedValue = mmm.ToString();
     }
 }
コード例 #6
0
        protected void btnInsertProduct_Click(object sender, EventArgs e)
        {
            using (var context = new cathlabEntities())
            {
                int lotNum, locID;
                int.TryParse(lbxELocation.SelectedValue, out locID);
                int.TryParse(tbLotNumber.Text, out lotNum);

                Product p = new Product();
                p.PartNumber = pnum;
                //p.SerialNumber = ;
                p.ExpirationDate = rdpExpiration.SelectedDate.Value.Date;
                p.LocationID     = locID;
                p.LotNumber      = lotNum;
                p.StatusID       = 4;
                context.Products.Add(p);
                context.SaveChanges();
                pnlScan.Visible       = true;
                pnlNewProduct.Visible = false;
                lblStatus.Visible     = true;
                lblStatus.Text        = string.Format("Product '{0}' has been successfully entered.", pnum);
                tbPartNum.Text        = string.Empty;
            }
        }