Exemplo n.º 1
0
        public bool DeleteCustomer(int custId)
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.DeleteCustomer(custId));
            //return false;
        }
        /// <summary>
        /// This is Customers.
        /// </summary>
        /// <param name="sender">sender obj.</param>
        /// <param name="e">envt argument.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            CustomersBL customerObject = new CustomersBL();

            this.CustomersGv.DataSource = customerObject.GridViewBind();
            this.CustomersGv.DataBind();
        }
Exemplo n.º 3
0
        public void BornInAMonthBeforeThisMonth()
        {
            TestClock   tstCl  = new TestClock(01, 10, 2017);
            CustomersBL blayer = new CustomersBL();
            DateTime    dob    = new DateTime(1969, 7, 9);

            Assert.AreEqual(blayer.calculateAge(dob, tstCl), 48);
        }
Exemplo n.º 4
0
        // GET: Customers
        public ActionResult Index()
        {
            // return View(db.Customer.ToList());
            CustomersBL custBl = new CustomersBL();
            var         model  = custBl.returnAll();

            return(View(model));
        }
Exemplo n.º 5
0
        public IEnumerable <CatagoryType> GetCustomerType()
        {
            ICustomersBL _customerBL = new CustomersBL();

            var ctype = _customerBL.GetCustomerType();

            return(ctype);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets all customers.
        /// </summary>
        /// <returns>Get All Customers</returns>
        public IEnumerable <Customer> GetAllCustomers()
        {
            IList <Customer> CustomersList = new List <Customer>();
            ICustomersBL     _customerBL   = new CustomersBL();

            CustomersList = _customerBL.GetAllCustomer();
            return(CustomersList);
        }
Exemplo n.º 7
0
        public IEnumerable <CatagoryType> GetCatagoryType(string cat_type)
        {
            ICustomersBL _customerBL = new CustomersBL();

            var ctype = _customerBL.GetCategoryType(cat_type);

            return(ctype);
        }
Exemplo n.º 8
0
        public IEnumerable <CustomerEntity> GetCustomerList()
        {
            IList <CustomerEntity> CustomersList = new List <CustomerEntity>();
            ICustomersBL           _customerBL   = new CustomersBL();

            CustomersList = _customerBL.GetCustomerList();
            return(CustomersList);
        }
Exemplo n.º 9
0
        public void ViewInfo(string userName, string Password)
        {
            while (true)
            {
                string      row  = ("==================================================================");
                Customers   cus  = new Customers();
                CustomersBL cuBL = new CustomersBL();

                try
                {
                    cus = cuBL.Login(userName, Password);
                }
                catch (System.Exception)
                {
                    Console.WriteLine("Disconnect from datebase !");
                    break;
                }

                Console.WriteLine(row);
                Console.WriteLine("CUSTOMER INFOMATION");
                Console.WriteLine(row);
                Console.WriteLine("Customer Id : {0}", cus.CusID);
                Console.WriteLine("Customer Username : {0}", cus.UserName);
                Console.WriteLine("Customer Name : {0}", cus.CusName);
                Console.WriteLine("Customer Address : {0}", cus.Address);
                Console.WriteLine("Customer Phone Number: {0}", cus.PhoneNumber);
                string choice = null;
                Console.WriteLine("\n" + row + "\n");
                Console.WriteLine("1. Go to menu");
                Console.WriteLine("2. Back");
                Console.Write("Please enter your selection: ");
                choice = Console.ReadLine();
                if (validateChoice(choice) == false)
                {
                    Console.Write("You are only entered in the number existing!");
                }

                switch (choice)
                {
                case "1":
                    showItems();
                    break;

                case "2":


                    break;

                default:
                    Console.WriteLine("You are only entered in the number of existing ids !");
                    continue;
                }
                if (choice == "2")
                {
                    break;
                }
            }
        }
Exemplo n.º 10
0
 // GET: Customer
 public ActionResult ListView()
 {
     using (var session = CustomersDAL.sessionFactory.OpenSession())
     {
         ICriteria            criteria      = session.CreateCriteria(typeof(Customers));
         var                  customersList = criteria.List <Customers>();
         List <CustomerModel> cmList        = CustomersBL.TransferModel(customersList.ToList());
         ViewData["cusList"] = cmList;
         return(View());
     }
 }
Exemplo n.º 11
0
        public List <TaxModel> GetTaxCodeAndRatesList()
        {
            ICustomersBL _customerBL = new CustomersBL();

            var cTaxRateList = _customerBL.GetTaxCodeAndRate();

            if (cTaxRateList != null)
            {
                cTaxRateList = cTaxRateList.FindAll(x => x.IsInActive != "Y");
            }
            return(cTaxRateList);
        }
Exemplo n.º 12
0
        public ActionResult EditView()
        {
            string customerId = Request.QueryString["customerId"] == null ? string.Empty : Request.QueryString["customerId"].ToString();

            if (!string.IsNullOrEmpty(customerId))
            {
                using (var session = CustomersDAL.sessionFactory.OpenSession())
                {
                    //ICriteria criteria = session.CreateCriteria(typeof(Customers));
                    IList <Customers> list  = session.QueryOver <Customers>().Where(o => o.CustomerID == customerId).List();
                    CustomerModel     model = CustomersBL.TransferModel(list.ToList()).FirstOrDefault();
                    //ViewData["cusItem"] = model;
                    return(View(model));
                }
            }
            else
            {
                return(View(new CustomerModel()));
            }
        }
Exemplo n.º 13
0
        public void AddToCart(Items item)
        {
            Customers   cust  = new Customers();
            CustomersBL cusBl = new CustomersBL();

            items.Add(item);
            string sJSONResponse = JsonConvert.SerializeObject(items);
            // Console.WriteLine(sJSONResponse);
            BinaryWriter bw;
            string       fileName = "shoppingcart" + cusAll.UserName + ".dat";

            try
            {
                FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                bw = new BinaryWriter(fs);
                bw.Write((string)(object)sJSONResponse);
                fs.Close();
            }
            catch (System.Exception)
            {
                Console.WriteLine("Disconnect from database !");
            }
            Console.WriteLine("Add to cart success !");
        }
Exemplo n.º 14
0
        public List <PostalCode> AutoFillPostalCode()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.AutoFillPostalCode());
        }
Exemplo n.º 15
0
        public bool?IsCompanyRegisteredForGST()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.IsCompanyRegisteredForGST());
        }
Exemplo n.º 16
0
        public void showItemDetail()
        {
            while (true)
            {
                string row = ("==================================================================");


                ItemsBL      itBL    = new ItemsBL();
                Items        it      = new Items();
                List <Items> li      = new List <Items>();
                Customers    custom  = new Customers();
                CustomersBL  cutomBL = new CustomersBL();

                string choice;
                int    itID;
                try
                {
                    li = itBL.getItemsByItemID(1);
                    Console.Write("Enter item id: ");
                    itID = int.Parse(Console.ReadLine());
                }
                catch (System.Exception)
                {
                    Console.WriteLine("Item id must be integer and in the options !");
                    continue;
                }

                if (itID > li.Count || validateChoice(itID.ToString()) == false)
                {
                    Console.Write("You are only entered in the number of existing ids !");

                    while (true)
                    {
                        Console.Write("Do  you want re-enter ? (Y/N): ");
                        choice = Console.ReadLine().ToUpper();
                        if (choice != "Y" && choice != "N")
                        {
                            Console.Write("You can only enter  (Y/N): ");
                            choice = Console.ReadLine().ToUpper();
                            continue;
                        }
                        break;
                    }

                    switch (choice)
                    {
                    case "Y":
                        continue;

                    case "N":
                        showItems();
                        break;

                    default:
                        continue;
                    }
                }


                try
                {
                    it = itBL.GetItemByItemID(itID);
                }
                catch (System.Exception)
                {
                    Console.WriteLine("Disconnect from database !");
                }
                if (it == null)
                {
                    Console.WriteLine("The item does not exist !");
                }
                else
                {
                    Console.WriteLine(row);
                    Console.WriteLine("DETAIL OF ITEM");
                    Console.WriteLine(row);
                    var table = new ConsoleTable("ID", "ITEM NAME", "ITEM PRICE", "SIZE");

                    table.AddRow(it.ItemID, it.ItemName, it.ItemPrice, it.Size);

                    table.Write();
                    Console.WriteLine("DESCRIPTION : ");
                    Console.WriteLine(it.ItemDescription);
                }
                string select;
                Console.WriteLine("\n" + row + "\n");
                Console.WriteLine("1. Add to cart");
                Console.WriteLine("2. Back to Menu");
                Console.Write("Enter your selection: ");
                select = Console.ReadLine();

                switch (select)
                {
                case "1":
                    AddToCart(it);
                    break;

                case "2":
                    showItems();
                    break;

                default:
                    Console.WriteLine("You are only entered in the number existing !");
                    continue;
                }
                string conti;
                Console.Write("Do you continue ? (Y/N): ");
                conti = checkYN();
                if (conti == "Y")
                {
                    showItems();
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 17
0
        public int CreateCustomer(Customer entity)
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.CreateCustomer(entity));
        }
Exemplo n.º 18
0
        public void LoginMenu()
        {
            Console.Clear();
            CustomersBL cuBL     = new CustomersBL();
            Customers   cu       = new Customers();
            Items       it       = new Items();
            string      userName = null;
            string      password = null;
            string      choice;

            while (true)
            {
                string row = ("==================================================================");
                Console.WriteLine(row);
                Console.WriteLine();
                Console.WriteLine("LOGIN MENU \n");
                Console.WriteLine(row);
                Console.Write("Enter user name: ");
                userName = Console.ReadLine().Trim();
                // if (userName == null)
                // {
                //   Console.WriteLine("The username cannot be empty !");
                //   continue;
                // }
                Console.Write("Enter password: "******"Disconnect from database!");
                    LoginMenu();
                }
                if ((validate(userName) == false) || (validate(password) == false))
                {
                    Console.Write("User name / Password cannot contain special characters, do you want re-enter ? (Y/N)");
                    choice = checkYN();
                    switch (choice)
                    {
                    case "Y":
                        continue;

                    case "N":
                        showItems();
                        break;

                    default:
                        continue;
                    }
                }
                if (cu == null)
                {
                    Console.WriteLine("Username or password is incorrect!");
                }
                else
                {
                    while (true)
                    {
                        Console.WriteLine(row);
                        Console.WriteLine("WELCOME BACK ! {0}", cu.CusName.ToUpper());
                        string chose;
                        Console.WriteLine(row);
                        Console.WriteLine("1. View Infomation");
                        Console.WriteLine("2. Go to menu");
                        Console.WriteLine("3. Show Cart");
                        Console.WriteLine("4. log out");
                        Console.Write("Enter your selction: ");
                        chose = Console.ReadLine();


                        switch (chose)
                        {
                        case "1":
                            ViewInfo(userName, password);
                            break;

                        case "2":
                            showItems();
                            break;

                        case "3":

                            ShowCart();
                            break;

                        case "4":
                            LoginMenu();
                            break;

                        default:
                            Console.WriteLine("Input invalid !");
                            continue;
                        }
                    }
                }
            }
        }
Exemplo n.º 19
0
        public IEnumerable <ShippingAddress> GetShippingAddress(int customerId)
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.GetShippingAddress(customerId));
        }
Exemplo n.º 20
0
        public TaxModel GetDefaultTaxes()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.GetDefaultTaxes());
        }
Exemplo n.º 21
0
        public int GetCustomersCount(string isInActive)
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.GetCustomersCount(isInActive));
        }
Exemplo n.º 22
0
        public bool RefreshCustomer(int custId)
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.RefreshCustomer(custId));
        }
Exemplo n.º 23
0
        public bool?AllowedToChangeLimit()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.IsAllowedToChangeLimit());
        }
Exemplo n.º 24
0
        public List <State> AutoFillState()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.AutoFillState());
        }
Exemplo n.º 25
0
        public OptionsEntity GetOptionSettings()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.GetOptionSettings());
        }
Exemplo n.º 26
0
        public List <City> AutoFillCity()
        {
            ICustomersBL _customerBL = new CustomersBL();

            return(_customerBL.AutoFillCity());
        }