Ejemplo n.º 1
0
        public static Customers UpdateUser(int userID, string fname, string lname, int dob, int ssn, string address)
        {
            CustomersDAL dal     = new CustomersDAL();
            var          account = dal.UpdateUser(userID, fname, lname, dob, ssn, address);

            return(account);
        }
Ejemplo n.º 2
0
        public static List <Customers> GetAll()
        {
            CustomersDAL dal       = new CustomersDAL();
            var          customers = dal.GetAll();

            return(customers);
        }
Ejemplo n.º 3
0
        public static Customers Get(int Issn, string Iflname, string Ilname)
        {
            CustomersDAL dal      = new CustomersDAL();
            var          customer = dal.Get(Issn, Iflname, Ilname);

            return(customer);
        }
Ejemplo n.º 4
0
        public static Customers Get(int userID)
        {
            CustomersDAL dal      = new CustomersDAL();
            var          customer = dal.Get(userID);

            return(customer);
        }
Ejemplo n.º 5
0
        public JsonResult SubmitReservation(string ho_ten = "", string sdt = "", string service = "")
        {
            CustomersDAL cus = new CustomersDAL("Customers");
            var          stt = false;
            var          msg = "";

            try
            {
                var CreatedAt = Clibs.DatetimeToTimestamp(DateTime.Now);
                cus.InsertCustomer(ho_ten, sdt, service, CreatedAt);
                //https://www.google.com/recaptcha/api/siteverify

                /* {
                 *    "success": true|false,
                 *    "challenge_ts": timestamp,  // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
                 *    "hostname": string,         // the hostname of the site where the reCAPTCHA was solved
                 *    "error-codes": [...]        // optional
                 *  }
                 */
                stt = true;
                msg = "Đăng ký thành công!";
            }
            catch (Exception ex)
            {
                stt = false;
                msg = ex.Message;
                // var e = ex.Message;
            }

            return(Json(new
            {
                status = stt,
                message = msg
            }));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Configuring the customer.
        /// </summary>
        private void GetInfoAboutCustomer()
        {
            WriteLineWithSpecColor("What is your name?");
            string name = Console.ReadLine();

            while (!ValidateName(name))
            {
                WriteLineWithSpecColor("What is your name?");
                name = Console.ReadLine();
            }
            _customer.FirstName = name;

            WriteLineWithSpecColor("What is your surname?");
            string surname = Console.ReadLine();

            while (!ValidateName(surname))
            {
                WriteLineWithSpecColor("What is your surname?");
                surname = Console.ReadLine();
            }
            _customer.Surname = surname;

            CustomersDAL cDAL = new CustomersDAL();
            int          id   = new int();

            cDAL.TryGetID(_customer.FirstName, _customer.Surname, out id);
            _customer.ID = id;

            GetInfoAboutEmail();
        }
Ejemplo n.º 7
0
 public async Task <Customer> GetCustomer(int id)
 {
     using (CustomersDAL dal = new CustomersDAL())
     {
         return(await dal.GetCustomer(id));
     }
 }
Ejemplo n.º 8
0
        public List <CustomerEntity> GetCustomerList()
        {
            ICustomersDAL         customerDAL = new CustomersDAL();
            List <CustomerEntity> result      = customerDAL.GetCustomerList();

            return(result);
        }
Ejemplo n.º 9
0
        public void Create(Customers newCustomer)
        {
            // Call the DAL to create a new record.
            CustomersDAL customerDAL = new CustomersDAL();

            customerDAL.Create(newCustomer);
        }
Ejemplo n.º 10
0
        public List <CatagoryType> GetCustomerType()
        {
            ICustomersDAL       customerDAL = new CustomersDAL();
            List <CatagoryType> result      = customerDAL.GetCustomerType();

            return(result);
        }
Ejemplo n.º 11
0
 public IQueryable <Customer> GetCustomers()
 {
     using (CustomersDAL dal = new CustomersDAL())
     {
         return(dal.GetCustomers());
     }
 }
Ejemplo n.º 12
0
        public List <CatagoryType> GetCategoryType(string filter)
        {
            ICustomersDAL       customerDAL = new CustomersDAL();
            List <CatagoryType> result      = customerDAL.GetCategoryType(filter);

            return(result);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets all customer.
        /// </summary>
        /// <returns>Get All Customer</returns>
        public List <Customer> GetAllCustomer()
        {
            ICustomersDAL   customerDAL = new CustomersDAL();
            List <Customer> result      = customerDAL.GetAllCustomer();

            return(result);
        }
Ejemplo n.º 14
0
 public bool CustomerExists(int id)
 {
     using (CustomersDAL dal = new CustomersDAL())
     {
         return(dal.CustomerExists(id));
     }
 }
Ejemplo n.º 15
0
        public List <CatagoryType> GetCategoryType(string filter)
        {
            ICustomersDAL       customerDAL = new CustomersDAL();
            List <CatagoryType> result      = customerDAL.GetCategoryType(filter);

            //foreach(var item in result)
            //{
            //  item.Cat_Contents_Display =   Convert.ToDecimal(item.Cat_Contents).ToString("N", new CultureInfo(SharedValues.CurrencyName));
            //}

            return(result);
        }
Ejemplo n.º 16
0
 public int UpdateCustomer(Customers cus)
 {
     if (Session["user"] == null)
     {
         return(-1000);
     }
     if (!PowerDAL.HasPower((Session["user"] as Users).RoleID.Value, 8))
     {
         return(-1001);
     }
     return(CustomersDAL.Update(cus));
 }
Ejemplo n.º 17
0
 public V_Customers LoadCustomerByID(int cusID)
 {
     if (Session["user"] == null)
     {
         return(null);
     }
     if (!PowerDAL.HasPower((Session["user"] as Users).RoleID.Value, 8))
     {
         return(null);
     }
     return(CustomersDAL.LoadCustomerByID(cusID));
 }
Ejemplo n.º 18
0
 public PagingList <V_Customers> LoadCustomerPage(int pageSize, int pageIndex, string cusID, string cusName)
 {
     if (Session["user"] == null)
     {
         return(null);
     }
     if (!PowerDAL.HasPower((Session["user"] as Users).RoleID.Value, 8))
     {
         return(null);
     }
     return(CustomersDAL.LoadPaging(pageSize, pageIndex, cusID, cusName));
 }
Ejemplo n.º 19
0
        public bool Register(string Name, string Username, string Password)
        {
            Boolean      isRegistered = false;
            CustomersDAL objdal       = new CustomersDAL();

            if (!objdal.checkExistCust(Username))
            {
                if (objdal.Register(Name, Username, Password) > 0)
                {
                    isRegistered = true;
                }
            }
            return(isRegistered);
        }
Ejemplo n.º 20
0
 public async Task <int> DeleteCustomer(int id)
 {
     if (CustomerExists(id))
     {
         using (CustomersDAL dal = new CustomersDAL())
         {
             return(await dal.DeleteCustomer(id));
         }
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 21
0
 public async Task <int> PostCustomer(Customer customer)
 {
     if (CustomerExists(customer.Id))
     {
         using (CustomersDAL dal = new CustomersDAL())
         {
             return(await dal.PostCustomer(customer));
         }
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 22
0
        public Customer Verify_Login(string Username, string Password)
        {
            CustomersDAL objdal = new CustomersDAL();
            DataTable    dt     = objdal.Login(Username, Password);
            Customer     customer;

            if (dt.Rows.Count > 0)
            {
                customer = new Customer(dt.Rows[0][1].ToString(), dt.Rows[0][2].ToString(),
                                        dt.Rows[0][3].ToString(), Convert.ToChar(dt.Rows[0][4].ToString()) /*[0]*/, (int)dt.Rows[0][5]);
                return(customer);
            }
            return(null);
        }
Ejemplo n.º 23
0
 public async Task <int> PutCustomer(int id, Customer customer)
 {
     if (!CustomerExists(id))
     {
         using (CustomersDAL dal = new CustomersDAL())
         {
             return(await dal.PutCustomer(id, customer));
         }
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 24
0
        public int AddAdmin(string Username)
        {
            CustomersDAL objdal = new CustomersDAL();

            if (!objdal.checkExistCust(Username))
            {
                return(1); //not exist
            }
            else
            {
                if (objdal.AddAdmin(Username))
                {
                    return(0);
                }
                else
                {
                    return(2);
                }
            }
        }
Ejemplo n.º 25
0
        public List <UI.Entities.Country> AutoFillCountry()
        {
            int autoId = 1;

            List <UI.Entities.Country> countryList;
            ICustomersDAL customerDAL = new CustomersDAL();
            List <string> strlist     = customerDAL.GetAutoFillData("country");

            countryList = new List <UI.Entities.Country>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    UI.Entities.Country lst = new UI.Entities.Country();
                    lst.CountryID = autoId;
                    lst.Name      = name;
                    countryList.Add(lst);
                    autoId++;
                }
            }
            return(countryList);
        }
Ejemplo n.º 26
0
        public List <City> AutoFillCity()
        {
            int autoId = 1;

            List <City>   cityList;
            ICustomersDAL customerDAL = new CustomersDAL();
            List <string> strlist     = customerDAL.GetAutoFillData("city");

            cityList = new List <City>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    City lst = new City();
                    lst.CityID = autoId;
                    lst.Name   = name;
                    cityList.Add(lst);
                    autoId++;
                }
            }
            return(cityList);
        }
Ejemplo n.º 27
0
        public List <PostalCode> AutoFillPostalCode()
        {
            int autoId = 1;

            List <PostalCode> postalcodeList;
            ICustomersDAL     customerDAL = new CustomersDAL();
            List <string>     strlist     = customerDAL.GetAutoFillData("postalcode");

            postalcodeList = new List <PostalCode>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    PostalCode lst = new PostalCode();
                    lst.PostalCodeID = autoId;
                    lst.Name         = name;
                    postalcodeList.Add(lst);
                    autoId++;
                }
            }
            return(postalcodeList);
        }
Ejemplo n.º 28
0
        public List <UI.Entities.State> AutoFillState()
        {
            int autoId = 1;

            List <UI.Entities.State> stateList;
            ICustomersDAL            customerDAL = new CustomersDAL();
            List <string>            strlist     = customerDAL.GetAutoFillData("state");

            stateList = new List <UI.Entities.State>();
            if (strlist != null)
            {
                foreach (string name in strlist)
                {
                    UI.Entities.State lst = new UI.Entities.State();
                    lst.StateID = autoId;
                    lst.Name    = name;
                    stateList.Add(lst);
                    autoId++;
                }
            }
            return(stateList);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Cofiguring info about e-Mail.
        /// </summary>
        private void GetInfoAboutEmail()
        {
            string       eMail = string.Empty;
            CustomersDAL cDAL  = new CustomersDAL();

            WriteLineWithSpecColor("Do you have e-Mail?");
            if (GetSimpleUserAnswer())
            {
                WriteLineWithSpecColor(@"You may subscribe on our notifications such as: 
pick order, successfully pay for the order and deliver order, 
but we need your email address. 
What your email address?");

                eMail = Console.ReadLine();
                while (!IsValidEmail(eMail))
                {
                    _botMoodState++;
                    WriteLineWithSpecColor("Wrong e-Mail format");
                    eMail = Console.ReadLine();
                }
                _customer.Email = eMail;
                cDAL.ReWriteEmail(_customer.FirstName, _customer.Surname, _customer.Email);
                _notificator = SendEmail;
            }
            else
            {
                if (cDAL.IsMailFilled(_customer.FirstName, _customer.Surname, out eMail) && eMail != string.Empty)
                {
                    WriteLineWithSpecColor($"Oh we found your email in DB. That means you were here before. We will use this e-Mail: {eMail}");
                    _notificator = SendEmail;
                }
                else
                {
                    WriteLineWithSpecColor("Unfortunately you can't receive notifications.");
                }
            }
            _customer.Email = eMail;
        }
Ejemplo n.º 30
0
 public ActionResult GetCustomersSearch(string searchKey)
 {
     List<CustomersViewModel> models = CustomersDAL.GetDataSearch(searchKey);
     return PartialView("_ListCustomers", models);
 }