コード例 #1
0
        protected override List <CDMAS> RetrieveOrderInfoByCIDDAL()
        {
            var list = new List <CDMAS>();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("RetrieveOrderInfoByCID", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var orderinfo = new CDMAS();
                                orderinfo.oID      = int.Parse(reader["oID"].ToString());
                                orderinfo.iID      = int.Parse(reader["iID"].ToString());
                                orderinfo.iName    = reader["iName"].ToString();
                                orderinfo.Qty      = int.Parse(reader["Qty"].ToString());
                                orderinfo.Subtotal = float.Parse(reader["Subtotal"].ToString());
                                orderinfo.Total    = decimal.Parse(reader["Total"].ToString());
                                list.Add(orderinfo);
                            }
                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
コード例 #2
0
        protected override bool CreateCustomerInfoDAL(CDMAS cdmas)
        {
            var result = 0;

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("CreateCustomerInfo", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        cmd.Parameters.AddWithValue("@FIRSTNAME", cdmas.FirstName);
                        cmd.Parameters.AddWithValue("@LASTNAME", cdmas.LastName);
                        cmd.Parameters.AddWithValue("@ADDRESS", cdmas.Address);
                        cmd.Parameters.AddWithValue("@CONTACTNO", cdmas.ContactNo);
                        cmd.Parameters.AddWithValue("@EMAIL", cdmas.Email);
                        cmd.Parameters.AddWithValue("@DELIVOPTION", cdmas.DelivOption);
                        result = cmd.ExecuteNonQuery();
                        cmd.Dispose();
                    }
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("CREATE CUSTOMER INFORMATION FAILED");
            }
            return(result == 1 ? true : false);
        }
コード例 #3
0
        protected override bool UpdateOrderInfoDAL(CDMAS cdmas)
        {
            var result = 0;

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("UpdateOrderInfo", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        cmd.Parameters.AddWithValue("@oID", cdmas.oID);
                        cmd.Parameters.AddWithValue("@Qty", cdmas.Qty);
                        result = cmd.ExecuteNonQuery();
                        cmd.Dispose();
                    }
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("UPDATE ORDER INFORMATION FAILED");
            }
            return(result == 1 ? true : false);
        }
コード例 #4
0
        protected override CDMAS ShowSalesDAL()
        {
            var Sales = new CDMAS();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("ShowSales", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Sales.GrossSales = decimal.Parse(reader["GrossSales"].ToString());
                                Sales.NetSales   = decimal.Parse(reader["NetSales"].ToString());
                            }

                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }

            return(Sales);
        }
コード例 #5
0
        protected override bool UpdateItemDAL(CDMAS cdmas)
        {
            var result = 0;

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("UpdateItem", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        cmd.Parameters.AddWithValue("@IID", cdmas.iID);
                        cmd.Parameters.AddWithValue("@NAME", cdmas.iName);
                        cmd.Parameters.AddWithValue("@DESCRIPTION", cdmas.iDescription);
                        cmd.Parameters.AddWithValue("@SRP", cdmas.iSRP);
                        cmd.Parameters.AddWithValue("@NETPRICE", cdmas.iNetPrice);
                        cmd.Parameters.AddWithValue("@AQty", cdmas.iAQty);
                        cmd.Parameters.AddWithValue("@CATEGORY", cdmas.iCategory);
                        result = cmd.ExecuteNonQuery();
                        cmd.Dispose();
                    }
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("UPDATE ITEM FAILED");
            }
            return(result == 1 ? true : false);
        }
コード例 #6
0
        protected override bool UpdateStatusDAL(CDMAS cdmas)
        {
            var result = 0;

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("UpdateStatus", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        cmd.Parameters.AddWithValue("@CID", cdmas.cID);
                        cmd.Parameters.AddWithValue("@STATUS", cdmas.Status);
                        result = cmd.ExecuteNonQuery();
                        cmd.Dispose();
                    }
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("UPDATE STATUS FAILED");
            }
            return(result == 1 ? true : false);
        }
コード例 #7
0
 internal bool UpdateStatus(CDMAS cdmas)
 {
     try
     {
         return(UpdateStatusDAL(cdmas));
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
コード例 #8
0
 internal bool CreateCustomerInfo(CDMAS cdmas)
 {
     try
     {
         return(CreateCustomerInfoDAL(cdmas));
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
コード例 #9
0
 public bool CreateOrderInfo(CDMAS cdmas)
 {
     try
     {
         return(orderinfobll.CreateOrderInfo(cdmas));
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
コード例 #10
0
 public bool UpdateItem(CDMAS cdmas)
 {
     try
     {
         return(itembll.UpdateItem(cdmas));
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
コード例 #11
0
 public bool UpdateStatus(CDMAS cdmas)
 {
     try
     {
         return(customerinfobll.UpdateStatus(cdmas));
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
コード例 #12
0
 public ActionResult Edit(int iID, CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.UpdateItem(cdmas);
             ModelState.Clear();
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
     } return(View());
 }
コード例 #13
0
 public ActionResult Index(CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.CreateOrderInfo(cdmas);
             ModelState.Clear();
         }
     }
     catch
     {
     }
     return(View());
 }
コード例 #14
0
 public ActionResult Edit(int oID, CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.UpdateOrderInfo(cdmas);
             ModelState.Clear();
             return(RedirectToAction("Cart"));
         }
     }
     catch
     {
     }
     return(View());
 }
コード例 #15
0
 public ActionResult Create(CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.CreateOrderInfo(cdmas);
             ModelState.Clear();
             return(RedirectToAction("Cart", "OrderInfo"));
         }
     }
     catch
     {
     }
     return(View());
 }
コード例 #16
0
 public ActionResult Delete(int oID, CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.DeleteOrderInfo(oID);
             ModelState.Clear();
             return(RedirectToAction("Cart", "OrderInfo"));
         }
     }
     catch
     {
     }
     return(View());
 }
コード例 #17
0
 public ActionResult Customer(CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.CreateCustomerInfo(cdmas);
             ModelState.Clear();
             return(RedirectToAction("CheckOutMsg"));
         }
     }
     catch
     {
     }
     return(View());
 }
コード例 #18
0
 public ActionResult Edit(int cID, CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.UpdateStatus(cdmas);
             ModelState.Clear();
         }
         return(RedirectToAction("Customers"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #19
0
 public ActionResult Delete(int cID, CDMAS cdmas)
 {
     try
     {
         if (ModelState.IsValid)
         {
             cdmasm.DeleteCustomerInfo(cID);
             ModelState.Clear();
             //return RedirectToAction("Category");
         }
         return(RedirectToAction("Customers"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #20
0
        protected override CDMAS ShowCustomerInfoByCIDDAL(int cID)
        {
            var customerinfo = new CDMAS();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("ShowCustomerInfoByCID", con))
                    {
                        cmd.Parameters.Add("@cID", SqlDbType.Int).Value = cID;
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                customerinfo.cID         = int.Parse(reader["cID"].ToString());
                                customerinfo.FirstName   = reader["FirstName"].ToString();
                                customerinfo.LastName    = reader["LastName"].ToString();
                                customerinfo.Address     = reader["Address"].ToString();
                                customerinfo.ContactNo   = reader["ContactNo"].ToString();
                                customerinfo.Email       = reader["Email"].ToString();
                                customerinfo.DelivOption = reader["DelivOption"].ToString();
                                customerinfo.Status      = reader["Status"].ToString();
                                customerinfo.tTotal      = decimal.Parse(reader["tTotal"].ToString());
                            }

                            con.Close();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("SHOW CUSTOMER INFORMATION FAILED");
            }

            return(customerinfo);
        }
コード例 #21
0
        protected override CDMAS ShowOrderInfoByOIDDAL(int oID)
        {
            var orderinfo = new CDMAS();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("ShowOrderInfoByOID", con))
                    {
                        cmd.Parameters.Add("@oID", SqlDbType.Int).Value = oID;
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                orderinfo.oID           = int.Parse(reader["oID"].ToString());
                                orderinfo.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString());
                                orderinfo.Qty           = int.Parse(reader["Qty"].ToString());
                                orderinfo.Subtotal      = float.Parse(reader["Subtotal"].ToString());
                                orderinfo.NetTotal      = float.Parse(reader["NetTotal"].ToString());
                                orderinfo.iName         = reader["iName"].ToString();
                                orderinfo.iID           = int.Parse(reader["iID"].ToString());
                                orderinfo.FirstName     = reader["FirstName"].ToString();
                                orderinfo.LastName      = reader["LastName"].ToString();
                            }

                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }

            return(orderinfo);
        }
コード例 #22
0
        protected override List <CDMAS> RetrieveAllOrderInfoDAL()
        {
            var list = new List <CDMAS>();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("RetrieveAllOrderInfo", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var orderinfo = new CDMAS();
                                orderinfo.oID           = int.Parse(reader["oID"].ToString());
                                orderinfo.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString());
                                orderinfo.Qty           = int.Parse(reader["Qty"].ToString());
                                orderinfo.Subtotal      = float.Parse(reader["Subtotal"].ToString());
                                orderinfo.NetTotal      = float.Parse(reader["NetTotal"].ToString());
                                orderinfo.iName         = reader["iName"].ToString();
                                orderinfo.iID           = int.Parse(reader["iID"].ToString());
                                orderinfo.FirstName     = reader["FirstName"].ToString();
                                orderinfo.LastName      = reader["LastName"].ToString();
                                orderinfo.iCategory     = reader["iCategory"].ToString();
                                list.Add(orderinfo);
                            }
                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
コード例 #23
0
        protected override List <CDMAS> CreateSalesforthedayDAL()
        {
            var list = new List <CDMAS>();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("CreateSalesfortheday", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var sales = new CDMAS();
                                sales.iName         = reader["iName"].ToString();
                                sales.Qty           = int.Parse(reader["Qty"].ToString());
                                sales.iSRP          = float.Parse(reader["iSRP"].ToString());
                                sales.Subtotal      = float.Parse(reader["Subtotal"].ToString());
                                sales.iNetPrice     = float.Parse(reader["iNetPrice"].ToString());
                                sales.NetTotal      = float.Parse(reader["NetTotal"].ToString());
                                sales.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString());
                                sales.GrossSales    = decimal.Parse(reader["GrossSales"].ToString());
                                sales.NetSales      = decimal.Parse(reader["NetSales"].ToString());
                                list.Add(sales);
                            }
                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
コード例 #24
0
        protected override List <CDMAS> RetrieveAllCustomerInfoDAL()
        {
            var list = new List <CDMAS>();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("RetrieveAllCustomerInfo", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var customerinfo = new CDMAS();
                                customerinfo.cID         = int.Parse(reader["cID"].ToString());
                                customerinfo.FirstName   = reader["FirstName"].ToString();
                                customerinfo.LastName    = reader["LastName"].ToString();
                                customerinfo.Address     = reader["Address"].ToString();
                                customerinfo.ContactNo   = reader["ContactNo"].ToString();
                                customerinfo.Email       = reader["Email"].ToString();
                                customerinfo.DelivOption = reader["DelivOption"].ToString();
                                customerinfo.Status      = reader["Status"].ToString();
                                customerinfo.tTotal      = decimal.Parse(reader["tTotal"].ToString());
                                list.Add(customerinfo);
                            }
                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
コード例 #25
0
        protected override List <CDMAS> RetrieveAllItemDAL()
        {
            var list = new List <CDMAS>();

            try
            {
                using (var con = new SqlConnection(_conStr))
                {
                    using (var cmd = new SqlCommand("RetrieveAllItem", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        con.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var item = new CDMAS();
                                item.iID          = int.Parse(reader["iID"].ToString());
                                item.iName        = reader["iName"].ToString();
                                item.iDescription = reader["iDescription"].ToString();
                                item.iSRP         = float.Parse(reader["iSRP"].ToString());
                                item.iNetPrice    = float.Parse(reader["iNetPrice"].ToString());
                                item.iAQty        = int.Parse(reader["iAQty"].ToString());
                                item.iSQty        = int.Parse(reader["iSQty"].ToString());
                                item.iCategory    = reader["iCategory"].ToString();
                                list.Add(item);
                            }
                            con.Close();
                        }
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
コード例 #26
0
 protected abstract bool UpdateOrderInfoDAL(CDMAS cdmas);
コード例 #27
0
 protected abstract bool UpdateItemDAL(CDMAS cdmas);
コード例 #28
0
 protected abstract bool CreateCustomerInfoDAL(CDMAS cdmas);
コード例 #29
0
 protected abstract bool UpdateStatusDAL(CDMAS cdmas);