Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerDM customer = serviceCustomers.GetCustomer(Convert.ToInt32(id));

            serviceCustomers.DeleteCustomer(customer);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public void AddCustomer(CustomerDM customer)
        {
            DBUtilities utility = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_InsertCustomer";

            utility.cmd.Parameters.Add("Name", customer.Name);
            utility.cmd.Parameters.Add("Surname", customer.Surname);
            utility.cmd.Parameters.Add("Title", customer.Title);
            utility.cmd.Parameters.Add("Gender", customer.Gender);
            utility.cmd.Parameters.Add("DateOfBirth", customer.DateOfBirth);
            utility.cmd.Parameters.Add("TCNo", customer.TCNo);
            utility.cmd.Parameters.Add("TaxNo", customer.TaxNo);
            utility.cmd.Parameters.Add("TaxAdministration", customer.TaxAdministration);
            utility.cmd.Parameters.Add("City", customer.City);
            utility.cmd.Parameters.Add("Town", customer.Town);
            utility.cmd.Parameters.Add("Address", customer.Address);
            utility.cmd.Parameters.Add("HomePhone", customer.HomePhone);
            utility.cmd.Parameters.Add("BusinessPhone", customer.BusinessPhone);
            utility.cmd.Parameters.Add("CepPhone", customer.CepPhone);
            utility.cmd.ExecuteScalar();

            utility.endC();
        }
Ejemplo n.º 3
0
        public void UpdateCustomer(CustomerDM customerDM)
        {
            try
            {
                UOW.Customers.Update(customerDM.ToCustomer());

                UOW.Save();
            }
            catch (Exception ex)
            {
                throw new DataException(ex.Message, "Error in updating Customer");
            }
        }
        private async Task Register()
        {
            var customer = new CustomerDM
            {
                FirstName   = Name.Value,
                LastName    = Name.Value,
                PhoneNumber = Phone.Value
            };

            Model.Customer  = customer;
            Model.OrderTime = DateTime.Now;

            await OrdersService.Create(Model, RequestPriority.UserInitiated);
        }
Ejemplo n.º 5
0
        public CustomerView(CustomerDM customer)
        {
            CustomerID = customer.CustomerID;
            FirstName  = customer.FirstName;
            LastName   = customer.LastName;

            List <SaleView> sales = new List <SaleView>();

            if (customer.Sales != null)
            {
                foreach (SaleDM s in customer.Sales)
                {
                    sales.Add(new SaleView(s));
                }
            }
            Sales = sales;
        }
Ejemplo n.º 6
0
        public void DeleteCustomer(CustomerDM customerDM)
        {
            try
            {
                Customer customer = UOW.Customers.Get(customerDM.CustomerID);

                foreach (Sale s in UOW.Sales
                         .Find(s => s.CustomerID == customer.CustomerID))
                {
                    UOW.Supplies.Delete(s.SaleID);
                }
                UOW.Save();

                UOW.Customers.Delete(customer.CustomerID);
                UOW.Save();
            }
            catch (Exception ex)
            {
                throw new DataException(ex.Message, "Error in deleting Customer");
            }
        }
Ejemplo n.º 7
0
        public List <CustomerDM> getCustomerList()
        {
            List <CustomerDM> customerList = new List <CustomerDM>();
            DBUtilities       utility      = new DBUtilities();

            utility.cn.Open();
            utility.cmd.CommandText = "sp_getCustomer";
            utility.cmd.ExecuteScalar();
            SqlDataReader dr = utility.cmd.ExecuteReader();

            while (dr.Read())
            {
                CustomerDM cdm = new CustomerDM();
                cdm.ID      = Convert.ToInt32(dr["ID"]);
                cdm.Name    = dr["Name"].ToString();
                cdm.Surname = dr["Surname"].ToString();
                customerList.Add(cdm);
            }

            dr.Close();
            utility.endC();
            return(customerList);
        }
Ejemplo n.º 8
0
        public void AddCustomer(CustomerDM customerDM)
        {
            UOW.Customers.Create(customerDM.ToCustomerNoID());

            UOW.Save();
        }