public bool Insert(OrderClass o)
        {
            bool isSuccess = false;

            SqlConnection c1 = new SqlConnection(mylali);

            try
            {
                string s = "INSERT INTO Orders(CustomerID, PatternID, Quantity, OrderDate, ExpectedDate, NeededQty) VALUES(@CustomerID, @PatternID, @Quantity, @OrderDate, @ExpectedDate, @NeededQty)";

                SqlCommand c2 = new SqlCommand(s, c1);

                //   c2.Parameters.AddWithValue("@OrderID",o.OrderID);
                c2.Parameters.AddWithValue("@CustomerID", o.CustomerID);
                c2.Parameters.AddWithValue("@PatternID", o.PatternID);
                c2.Parameters.AddWithValue("@Quantity", o.Quantity);
                c2.Parameters.AddWithValue("@OrderDate", o.OrderDate);
                c2.Parameters.AddWithValue("@ExpectedDate", o.ExpectedDate);
                c2.Parameters.AddWithValue("@NeededQty", o.NeededQty);

                c1.Open();

                int rows = c2.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }

            catch (Exception)
            {
            }
            finally
            {
                c1.Close();
            }

            return(isSuccess);
        }
        public bool Update(OrderClass o)
        {
            bool isSuccess = false;

            SqlConnection c1 = new SqlConnection(mylali);

            try
            {
                string     s  = "UPDATE Orders SET CustomerID=@CustomerID , PatternID=@PatternID, Quantity=@Quantity, OrderDate=@OrderDate, ExpectedDate=@ExpectedDate WHERE OrderID=@OrderID";
                SqlCommand c2 = new SqlCommand(s, c1);

                c2.Parameters.AddWithValue("@CustomerID", o.CustomerID);
                c2.Parameters.AddWithValue("@PatternID", o.PatternID);
                c2.Parameters.AddWithValue("@Quantity", o.Quantity);
                c2.Parameters.AddWithValue("@OrderDate", o.OrderDate);
                c2.Parameters.AddWithValue("@ExpectedDate", o.ExpectedDate);
                c2.Parameters.AddWithValue("@OrderID", o.OrderID);

                c1.Open();

                int rows = c2.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception)
            {
                c1.Close();
            }
            return(isSuccess);
        }