Пример #1
0
        public ActionResult Verify(string Username, string Password)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

                    BusinessModelLayer.Tbl_LoginSingle tbl_login = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FirstOrDefault(x => x.Username == Username && x.Password == Password);

                    if (tbl_login != null)
                    {
                        UpdateModel <Tbl_LoginSingle>(tbl_login);
                        if (ModelState.IsValid)
                        {
                            FormsAuthentication.SetAuthCookie(tbl_login.Username, false);
                            return(RedirectToAction("List", "Orders"));
                        }
                    }
                    return(View("Error"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public IHttpActionResult Get(string Username)
        {
            try // handle exogenous exceptions
            {
                try // log all exceptions
                {

                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();
                    List<BusinessModelLayer.Tbl_LoginSingle> tbl_logins = tbl_loginBusinessModelLayers.GetAllTbl_Logins().FindAll(x => x.Username == Username);

                    //BusinessModelLayer.Tbl_LoginSingle tbl_logins = tbl_loginBusinessModelLayers.GetTbl_LoginData(Username);
                    return Ok(tbl_logins);
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public ActionResult Details(string TerritoryID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    RegionBusinessModelLayers regionLUBusinessModelLayers = new RegionBusinessModelLayers();
                    ViewBag.Regions = new SelectList(regionLUBusinessModelLayers.RegionSelect, "RegionID", "RegionDescription");

                    TerritoriesBusinessModelLayers territoriesBusinessModelLayers = new TerritoriesBusinessModelLayers();

                    BusinessModelLayer.TerritoriesSingle territories = territoriesBusinessModelLayers.GetAllTerritoriess().FirstOrDefault(x => x.TerritoryID == TerritoryID);

                    return(View(territories));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #4
0
        public ActionResult Delete_Post(int EmployeeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers();

                    //mm
                    employeesBusinessModelLayers.DeleteEmployees(EmployeeID);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #5
0
        public ActionResult Create_Post()
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
                    ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");

                    EmployeesBusinessModelLayers       employeesBusinessModelLayers = new EmployeesBusinessModelLayers();
                    BusinessModelLayer.EmployeesSingle employees = new BusinessModelLayer.EmployeesSingle();
                    TryUpdateModel(employees);
                    if (ModelState.IsValid)
                    {
                        //mm
                        employeesBusinessModelLayers.AddEmployees(employees);
                        return(RedirectToAction("List"));
                    }
                    else
                    {
                        return(View());
                    }
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Delete_Post(int EmployeeID, string TerritoryID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeeterritoriesBusinessModelLayers employeeterritoriesBusinessModelLayers = new EmployeeterritoriesBusinessModelLayers();

                    if (TerritoryID == null)
                    {
                        //mm
                        employeeterritoriesBusinessModelLayers.DeleteEmployeeterritories(EmployeeID);
                    }
                    else
                    {
                        //mm
                        employeeterritoriesBusinessModelLayers.EXE_sql("DELETE FROM [EmployeeTerritories] WHERE (EmployeeID = " + "N'" + EmployeeID.ToString() + "'" + ") AND (TerritoryID = " + "N'" + TerritoryID.ToString() + "'" + ")");
                    }


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IHttpActionResult Get(int EmployeeID, string TerritoryID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeeterritoriesBusinessModelLayers employeeterritoriesBusinessModelLayers = new EmployeeterritoriesBusinessModelLayers();

                    BusinessModelLayer.EmployeeterritoriesSingle employeeterritoriess = new EmployeeterritoriesSingle();

                    if (TerritoryID == null)
                    {
                        employeeterritoriess = employeeterritoriesBusinessModelLayers.GetAllEmployeeterritoriess().FirstOrDefault(x => x.EmployeeID == EmployeeID);
                    }
                    else
                    {
                        employeeterritoriess = employeeterritoriesBusinessModelLayers.GetAllEmployeeterritoriess().FirstOrDefault(x => x.EmployeeID == EmployeeID && x.TerritoryID == TerritoryID);
                    }

                    return(Ok(employeeterritoriess));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #8
0
        //END - read



        //BEGIN - sql view
        public List <Vwcategories> GetAllVwcategoriess()
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    List <Vwcategories> Vwcategoriess = new List <Vwcategories>();

                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        SqlCommand cmd = new SqlCommand("SELECT * FROM Vwcategories", con);

                        con.Open();

                        SqlDataReader rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            Vwcategories vwcategories = new Vwcategories
                            {
                                // EXAMPLES:
                                //EmployeeId = Convert.ToInt32(rdr["EmployeeId"]),
                                //Name = rdr["Name"].ToString(),
                                //IsPermanent = (bool)rdr["IsPermanent"],
                                //Salary = Convert.ToDecimal(rdr["Salary"]),
                                //DateOfBirth = Convert.ToDateTime(rdr["DateOfBirth"])

                                //CategoryID = (int)rdr["CategoryID"]
                                CategoryID = rdr["CategoryID"] == DBNull.Value ? default(int) : (int)rdr["CategoryID"]
                                             //,CategoryName = (string)rdr["CategoryName"]
                                ,
                                CategoryName = rdr["CategoryName"] == DBNull.Value ? "" : (string)rdr["CategoryName"]
                                               //,Description = (string)rdr["Description"]
                                ,
                                Description = rdr["Description"] == DBNull.Value ? "" : (string)rdr["Description"]
                                              //,Picture = (byte[])rdr["Picture"]
                                ,
                                Picture = rdr["Picture"] == DBNull.Value ? default(byte[]) : (byte[])rdr["Picture"]
                            };
                            Vwcategoriess.Add(vwcategories);
                        }
                        con.Close();
                        cmd.Dispose();
                    }
                    return(Vwcategoriess);
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    //errResult = "A Technical Error occurred, Please visit after some time.";
                    throw;
                }
            }
            catch (Exception fx)
            {
                errResult = fx.Message.ToString();
                throw;
            }
        }
Пример #9
0
        public IHttpActionResult Get(int OrderID, int?ProductID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Order_DetailsBusinessModelLayers order_detailsBusinessModelLayers = new Order_DetailsBusinessModelLayers();

                    BusinessModelLayer.Order_DetailsSingle order_detailss = new Order_DetailsSingle();

                    if (ProductID == null)
                    {
                        order_detailss = order_detailsBusinessModelLayers.GetAllOrder_Detailss().FirstOrDefault(x => x.OrderID == OrderID);
                    }
                    else
                    {
                        order_detailss = order_detailsBusinessModelLayers.GetAllOrder_Detailss().FirstOrDefault(x => x.OrderID == OrderID && x.ProductID == ProductID);
                    }

                    return(Ok(order_detailss));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #10
0
 public ActionResult Create_Get()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers();
             ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName");
             EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
             ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");
             CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers();
             ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName");
             return(View());
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #11
0
        public ActionResult Details(int OrderID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers();
                    ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName");
                    EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
                    ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");
                    CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers();
                    ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName");

                    OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers();

                    BusinessModelLayer.OrdersSingle orders = ordersBusinessModelLayers.GetAllOrderss().FirstOrDefault(x => x.OrderID == OrderID);

                    return(View(orders));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #12
0
        //END - delete


        //BEGIN - read
        public List <ShippersSingle> GetAllShipperss()
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    List <ShippersSingle> shipperss = new List <ShippersSingle>();

                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        SqlCommand cmd = new SqlCommand("spGetAllShippers", con)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        con.Open();

                        SqlDataReader rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            ShippersSingle shippers = new ShippersSingle
                            {
                                // EXAMPLES:
                                //EmployeeId = Convert.ToInt32(rdr["EmployeeId"]),
                                //Name = rdr["Name"].ToString(),
                                //IsPermanent = (bool)rdr["IsPermanent"],
                                //Salary = Convert.ToDecimal(rdr["Salary"]),
                                //DateOfBirth = Convert.ToDateTime(rdr["DateOfBirth"])

                                //ShipperID = (int)rdr["ShipperID"]
                                ShipperID = rdr["ShipperID"] == DBNull.Value ? default(int) : (int)rdr["ShipperID"]
                                            //,CompanyName = (string)rdr["CompanyName"]
                                ,
                                CompanyName = rdr["CompanyName"] == DBNull.Value ? "" : (string)rdr["CompanyName"]
                                              //,Phone = (string)rdr["Phone"]
                                ,
                                Phone = rdr["Phone"] == DBNull.Value ? "" : (string)rdr["Phone"]
                            };
                            shipperss.Add(shippers);
                        }
                        con.Close();
                        cmd.Dispose();
                    }
                    return(shipperss);
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    //errResult = "A Technical Error occurred, Please visit after some time.";
                    throw;
                }
            }
            catch (Exception fx)
            {
                errResult = fx.Message.ToString();
                throw;
            }
        }
Пример #13
0
        public ActionResult Details(int ProductID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers();
                    ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName");
                    SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers();
                    ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName");

                    ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers();

                    BusinessModelLayer.ProductsSingle products = productsBusinessModelLayers.GetAllProductss().FirstOrDefault(x => x.ProductID == ProductID);

                    return(View(products));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #14
0
        public ActionResult Delete_Post(int ProductID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers();

                    //mm
                    productsBusinessModelLayers.DeleteProducts(ProductID);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #15
0
        //END - read



        //BEGIN - sql view
        public List <Vwtbl_login> GetAllVwtbl_logins()
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    List <Vwtbl_login> Vwtbl_Logins = new List <Vwtbl_login>();

                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        SqlCommand cmd = new SqlCommand("SELECT * FROM Vwtbl_Login", con);

                        con.Open();

                        SqlDataReader rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            Vwtbl_login vwtbl_login = new Vwtbl_login
                            {
                                // EXAMPLES:
                                //EmployeeId = Convert.ToInt32(rdr["EmployeeId"]),
                                //Name = rdr["Name"].ToString(),
                                //IsPermanent = (bool)rdr["IsPermanent"],
                                //Salary = Convert.ToDecimal(rdr["Salary"]),
                                //DateOfBirth = Convert.ToDateTime(rdr["DateOfBirth"])

                                //Username = (string)rdr["Username"]
                                Username = rdr["Username"] == DBNull.Value ? "" : (string)rdr["Username"]
                                           //,Password = (string)rdr["Password"]
                                ,
                                Password = rdr["Password"] == DBNull.Value ? "" : (string)rdr["Password"]
                                           //,Roles = (string)rdr["Roles"]
                                ,
                                Roles = rdr["Roles"] == DBNull.Value ? "" : (string)rdr["Roles"]
                                        //,ActiveStatus = (bool)rdr["ActiveStatus"]
                                ,
                                ActiveStatus = rdr["ActiveStatus"] == DBNull.Value ? false : (bool)rdr["ActiveStatus"]
                            };
                            Vwtbl_Logins.Add(vwtbl_login);
                        }
                        con.Close();
                        cmd.Dispose();
                    }
                    return(Vwtbl_Logins);
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    //errResult = "A Technical Error occurred, Please visit after some time.";
                    throw;
                }
            }
            catch (Exception fx)
            {
                errResult = fx.Message.ToString();
                throw;
            }
        }
Пример #16
0
        public ActionResult Delete_Post(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();

                    //mm
                    customerdemographicsBusinessModelLayers.DeleteCustomerdemographics(CustomerTypeID);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IHttpActionResult Get(string CustomerID, string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemos = new CustomercustomerdemoSingle();

                    if (CustomerTypeID == null)
                    {
                        customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID);
                    }
                    else
                    {
                        customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID);
                    }

                    return(Ok(customercustomerdemos));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #18
0
 public ActionResult Create_Post()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             CustomerdemographicsBusinessModelLayers       customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
             BusinessModelLayer.CustomerdemographicsSingle customerdemographics = new BusinessModelLayer.CustomerdemographicsSingle();
             TryUpdateModel(customerdemographics);
             if (ModelState.IsValid)
             {
                 //mm
                 customerdemographicsBusinessModelLayers.AddCustomerdemographics(customerdemographics);
                 return(RedirectToAction("List"));
             }
             else
             {
                 return(View());
             }
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #19
0
        public ActionResult Delete_Post(int OrderID, int?ProductID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Order_DetailsBusinessModelLayers order_detailsBusinessModelLayers = new Order_DetailsBusinessModelLayers();

                    if (ProductID == null)
                    {
                        //mm
                        order_detailsBusinessModelLayers.DeleteOrder_Details(OrderID);
                    }
                    else
                    {
                        //mm
                        order_detailsBusinessModelLayers.EXE_sql("DELETE FROM [Order Details] WHERE (OrderID = " + "N'" + OrderID.ToString() + "'" + ") AND (ProductID = " + "N'" + ProductID.ToString() + "'" + ")");
                    }


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #20
0
 public ActionResult Create_Post()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             RegionBusinessModelLayers       regionBusinessModelLayers = new RegionBusinessModelLayers();
             BusinessModelLayer.RegionSingle region = new BusinessModelLayer.RegionSingle();
             TryUpdateModel(region);
             if (ModelState.IsValid)
             {
                 //mm
                 regionBusinessModelLayers.AddRegion(region);
                 return(RedirectToAction("List"));
             }
             else
             {
                 return(View());
             }
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        //END - create

        //BEGIN - update
        public void UpdateEmployeeterritories(EmployeeterritoriesSingle employeeterritories)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        using (SqlCommand cmd = new SqlCommand("spUpdateEmployeeterritories", con)
                        {
                            CommandType = CommandType.StoredProcedure
                        })
                        {
                            cmd.Parameters.AddWithValue("@EmployeeID", employeeterritories.EmployeeID);
                            cmd.Parameters.AddWithValue("@TerritoryID", employeeterritories.TerritoryID);
                            con.Open();
                            cmd.ExecuteNonQuery();
                        }
                        con.Close();
                    }
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    //errResult = "A Technical Error occurred, Please visit after some time.";
                    throw;
                }
            }
            catch (Exception fx)
            {
                errResult = fx.Message.ToString();
                throw;
            }
        }
Пример #22
0
        public ActionResult Delete_Post(string CustomerID, string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    if (CustomerTypeID == null)
                    {
                        //mm
                        customercustomerdemoBusinessModelLayers.DeleteCustomercustomerdemo(CustomerID);
                    }
                    else
                    {
                        //mm
                        customercustomerdemoBusinessModelLayers.EXE_sql("DELETE FROM [CustomerCustomerDemo] WHERE (CustomerID = " + "N'" + CustomerID.ToString() + "'" + ") AND (CustomerTypeID = " + "N'" + CustomerTypeID.ToString() + "'" + ")");
                    }


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #23
0
        public ActionResult Details(int EmployeeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
                    ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");

                    EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers();

                    BusinessModelLayer.EmployeesSingle employees = employeesBusinessModelLayers.GetAllEmployeess().FirstOrDefault(x => x.EmployeeID == EmployeeID);

                    return(View(employees));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Edit_Post(long Logid)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_ExceptionloggingtodatabaseBusinessModelLayers tbl_exceptionloggingtodatabaseBusinessModelLayers = new Tbl_ExceptionloggingtodatabaseBusinessModelLayers();

                    BusinessModelLayer.Tbl_ExceptionloggingtodatabaseSingle tbl_exceptionloggingtodatabase = tbl_exceptionloggingtodatabaseBusinessModelLayers.GetAllTbl_Exceptionloggingtodatabases().Single(x => x.Logid == Logid);


                    UpdateModel <Tbl_ExceptionloggingtodatabaseSingle>(tbl_exceptionloggingtodatabase);
                    if (ModelState.IsValid)
                    {
                        //mm
                        tbl_exceptionloggingtodatabaseBusinessModelLayers.UpdateTbl_Exceptionloggingtodatabase(tbl_exceptionloggingtodatabase);
                        return(RedirectToAction("List"));
                    }

                    return(View(tbl_exceptionloggingtodatabase));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #25
0
        //END - update

        //BEGIN  - delete
        public void DeleteCustomerdemographics(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    using (SqlConnection con = new SqlConnection(connectionString))
                    {
                        using (SqlCommand cmd = new SqlCommand("spDeleteCustomerdemographics", con)
                        {
                            CommandType = CommandType.StoredProcedure
                        })
                        {
                            cmd.Parameters.AddWithValue("@CustomerTypeID", CustomerTypeID);
                            con.Open();
                            cmd.ExecuteNonQuery();
                        }
                        con.Close();
                    }
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    //errResult = "A Technical Error occurred, Please visit after some time.";
                    throw;
                }
            }
            catch (Exception fx)
            {
                errResult = fx.Message.ToString();
                throw;
            }
        }
        public ActionResult Delete_Post(long Logid)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_ExceptionloggingtodatabaseBusinessModelLayers tbl_exceptionloggingtodatabaseBusinessModelLayers = new Tbl_ExceptionloggingtodatabaseBusinessModelLayers();

                    //mm
                    tbl_exceptionloggingtodatabaseBusinessModelLayers.DeleteTbl_Exceptionloggingtodatabase(Logid);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #27
0
        public ActionResult Delete_Post(string TerritoryID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    TerritoriesBusinessModelLayers territoriesBusinessModelLayers = new TerritoriesBusinessModelLayers();

                    //mm
                    territoriesBusinessModelLayers.DeleteTerritories(TerritoryID);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public ActionResult Create_Post()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             Tbl_ExceptionloggingtodatabaseBusinessModelLayers       tbl_exceptionloggingtodatabaseBusinessModelLayers = new Tbl_ExceptionloggingtodatabaseBusinessModelLayers();
             BusinessModelLayer.Tbl_ExceptionloggingtodatabaseSingle tbl_exceptionloggingtodatabase = new BusinessModelLayer.Tbl_ExceptionloggingtodatabaseSingle();
             TryUpdateModel(tbl_exceptionloggingtodatabase);
             if (ModelState.IsValid)
             {
                 //mm
                 tbl_exceptionloggingtodatabaseBusinessModelLayers.AddTbl_Exceptionloggingtodatabase(tbl_exceptionloggingtodatabase);
                 return(RedirectToAction("List"));
             }
             else
             {
                 return(View());
             }
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #29
0
        public ActionResult Create_Post()
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    RegionBusinessModelLayers regionLUBusinessModelLayers = new RegionBusinessModelLayers();
                    ViewBag.Regions = new SelectList(regionLUBusinessModelLayers.RegionSelect, "RegionID", "RegionDescription");

                    TerritoriesBusinessModelLayers       territoriesBusinessModelLayers = new TerritoriesBusinessModelLayers();
                    BusinessModelLayer.TerritoriesSingle territories = new BusinessModelLayer.TerritoriesSingle();
                    TryUpdateModel(territories);
                    if (ModelState.IsValid)
                    {
                        //mm
                        territoriesBusinessModelLayers.AddTerritories(territories);
                        return(RedirectToAction("List"));
                    }
                    else
                    {
                        return(View());
                    }
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #30
0
        public ActionResult Delete_Post(string Username)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    Tbl_LoginBusinessModelLayers tbl_loginBusinessModelLayers = new Tbl_LoginBusinessModelLayers();

                    //mm
                    tbl_loginBusinessModelLayers.DeleteTbl_Login(Username);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }