Exemplo n.º 1
0
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            frmManageInventory invMng = new frmManageInventory();

            Hide();
            invMng.ShowDialog();
            Close();
        }
Exemplo n.º 2
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     this.Close();
     Form frmManageInventory = new frmManageInventory();
 }
Exemplo n.º 3
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            #region ErrorHandling
            bool validName = nameCheck();
            bool validDesc;
            bool validCat;
            bool validPrice;
            bool validCur;
            bool validMax;
            bool validMin;
            bool goodToGo;

            if (validName)
            {
                validDesc = descCheck();
            }
            else
            {
                return;
            }
            if (validDesc)
            {
                validCat = catCheck();
            }
            else
            {
                return;
            }
            if (validCat)
            {
                validPrice = priceCheck();
            }
            else
            {
                return;
            }
            if (validPrice)
            {
                validCur = curStockCheck();
            }
            else
            {
                return;
            }
            if (validCur)
            {
                validMax = maxStockCheck();
            }
            else
            {
                return;
            }
            if (validMax)
            {
                validMin = reorderAmtStockCheck();
            }
            else
            {
                return;
            }
            if (validMin)
            {
                goodToGo = reAmtStockCheck();
            }
            else
            {
                return;
            }
            #endregion
            if (goodToGo)
            {
                string hazard;
                string date;
                if (checkBoxExpDate.Checked)
                {
                    date = textBoxExpYear.Text + "-" + comboBoxMonth.Text + "-" + comboBoxDay.Text;
                }
                else
                {
                    date = "0001-01-01";
                }
                if (checkBoxHazard.Checked)
                {
                    hazard = "Yes";
                }
                else
                {
                    hazard = "No";
                }

                try
                {
                    using (SqlConnection cn = new SqlConnection(_cnDB))
                    {
                        using (SqlCommand cmd = new SqlCommand("usp_EditProduct", cn))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.Add("@productID", SqlDbType.Int, 100).Value              = editedProd.productID;
                            cmd.Parameters.Add("@productName", SqlDbType.VarChar, 100).Value        = textBoxName.Text;
                            cmd.Parameters.Add("@productDescription", SqlDbType.VarChar, 255).Value = textBoxDesc.Text;
                            cmd.Parameters.Add("@productCategory", SqlDbType.VarChar, 50).Value     = textBoxCategory.Text;
                            cmd.Parameters.Add("@price", SqlDbType.VarChar, 20).Value       = textBoxPrice.Text;
                            cmd.Parameters.Add("@expirationDate", SqlDbType.Date, 25).Value = date;
                            cmd.Parameters.Add("@isHazardous", SqlDbType.VarChar, 3).Value  = hazard;
                            cmd.Parameters.Add("@numberInStock", SqlDbType.Int, 7).Value    = textBoxNumStock.Text;
                            cmd.Parameters.Add("@maxStock", SqlDbType.Int, 30).Value        = textBoxMaxStock.Text;
                            cmd.Parameters.Add("@reorderPoint", SqlDbType.Int, 50).Value    = textBoxReorder.Text;
                            cmd.Parameters.Add("@reorderAmount", SqlDbType.Int, 50).Value   = textBoxReorderAmount.Text;



                            cn.Open();
                            cmd.ExecuteNonQuery();
                            cn.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Exception : " + ex.Message.ToString());
                }
                frmManageInventory invMng = new frmManageInventory();
                Hide();
                invMng.ShowDialog();
                Close();
            }
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmManageInventory manageInv = new frmManageInventory();

            manageInv.ShowDialog();
        }