Exemplo n.º 1
0
 public void addTransactionDetails(
     int Cust_ID,
     DateTime TransactionDate,
     double billAmount
     )
 {
     try
     {
         SqlConnection conn = DBClass.getsqlcon();
         conn.Open();
         SqlCommand cmd = new SqlCommand("strpdAddUpdateTransactionDetails", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@Cust_ID", Cust_ID);
         cmd.Parameters.AddWithValue("@billAmount", billAmount);
         cmd.Parameters.AddWithValue("@TransactionDate", TransactionDate.ToShortDateString());
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 public void addTransactionProductDetails(
     double Quantity,
     double Amount,
     string poductName
     )
 {
     try
     {
         SqlConnection conn = DBClass.getsqlcon();
         conn.Open();
         SqlCommand cmd = new SqlCommand("strpdAddUpdateTransactionProductDetails", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@Quantity", Quantity);
         cmd.Parameters.AddWithValue("@Amount", Amount);
         cmd.Parameters.AddWithValue("@poductName", poductName);
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
        public void addUpdateUnitMeasure(
            string unitMeasure,
            int IDToUpdate,
            int flag
            )
        {
            try
            {
                SqlConnection conn = DBClass.getsqlcon();
                conn.Open();
                SqlCommand cmd = new SqlCommand("strpdAddUpdateUnitMeasure", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@unitMeasure", unitMeasure);
                cmd.Parameters.AddWithValue("@IDToUpdate", IDToUpdate);
                cmd.Parameters.AddWithValue("@flag", flag);

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        public void addUpdateCategories(string categoryName, string categoryDesc, int IDToUpdate, int flag)
        {
            try
            {
                int           id   = 0;
                SqlConnection conn = DBClass.getsqlcon();
                conn.Open();
                SqlCommand cmd = new SqlCommand("strpdAddUpdateCategories", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@categoryName", categoryName);
                cmd.Parameters.AddWithValue("@categoryDesc", categoryDesc);
                cmd.Parameters.AddWithValue("@IDToUpdate", IDToUpdate);
                cmd.Parameters.AddWithValue("@flag", flag);

                id = Convert.ToInt32(cmd.ExecuteScalar());
                switch (id)
                {
                case -1:
                    System.Windows.Forms.MessageBox.Show("Category exists for ' " + categoryName + " ' ..");
                    break;

                case 2:
                    System.Windows.Forms.MessageBox.Show("Category Deatils Updated for ' " + categoryName + " ' ..");
                    break;

                default:
                {
                    System.Windows.Forms.MessageBox.Show("Category Added");
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }