Exemple #1
0
        protected override void Seed(MIS333K_Team11_FinalProjectV2.Models.AppUser.AppDbContext context)
        {
            //  This method will be called after migrating to the latest version.
            GenreData AddGenres = new GenreData();

            AddGenres.SeedGenres(context);

            MovieData AddMovies = new MovieData();

            AddMovies.SeedMovies(context);

            ManagerData md = new ManagerData();

            md.AddManager(context);

            CustomerData cd = new CustomerData();

            cd.AddCustomer(context);

            EmployeeData ed = new EmployeeData();

            ed.AddEmployee(context);
            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.
        }
 public ActionResult Create([Bind(Include = "CustomerId,FirstName,LastName,DateOfBirth")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         repo.AddCustomer(customer);
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Exemple #3
0
        protected void OnClickAddCustomer(object sender, EventArgs e)
        {
            if (!IsValidCustomer())
            {
                dvMessageCreate.Visible  = true;
                lblMessageCreate.Text    = "It was not possible to create a customer";
                dvMessageCreate.CssClass = "alert alert-error";
                return;
            }

            var customer = new Customer
            {
                Email        = Customer_Email.Text.Trim(),
                RowVersion   = new byte[] { },
                AccountCode  = Customer_AccountCode.Text.Trim(),
                FirstName    = Customer_FirstName.Text.Trim(),
                LastName     = Customer_LastName.Text.Trim(),
                FirstAddress = Customer_FirstAddress.Text.Trim(),
                City         = Customer_City.Text.Trim(),
                Country      = Customer_Country.Text.Trim(),
                ZipCode      = Customer_ZipCode.Text.Trim(),
                Website      = Customer_Website.Text.Trim(),
                Active       = true,
                Enrrolled    = EnrollmentStatusEnum.Uninitialized,
                PhoneNumber  = Customer_PhoneNumber.Text.Trim(),
                MobileNumber = Customer_MobileNumber.Text.Trim(),
                FaxNumber    = Customer_FaxNumber.Text.Trim()
            };

            try
            {
                CustomerData.AddCustomer(customer);

                dvMessageCreate.Visible  = true;
                lblMessageCreate.Text    = "Customer created successfully";
                dvMessageCreate.CssClass = "alert alert-success";
            }
            catch (Exception)
            {
                dvMessageCreate.Visible  = true;
                lblMessageCreate.Text    = "It was not possible to create a customer";
                dvMessageCreate.CssClass = "alert alert-error";
            }
        }
Exemple #4
0
        public int AddCustomer(Customer customer)
        {
            CustomerData data       = new CustomerData();
            int          customerid = 0;

            try
            {
                customerid = data.AddCustomer(customer);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddCustomer");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(customerid);
        }
        /// <summary>
        /// Handles request for adding a customer, prompting for a first and last name and validating
        /// the inputs.
        /// </summary>
        private static void HandleRequestAddCustomer()
        {
            Log.Information("Handling request adding customer");
            BusinessCustomer customer = new BusinessCustomer();

            Console.WriteLine("[?] What is the first name of the customer");
            string firstName = Console.ReadLine();

            Log.Information($"User entered '{firstName}' for the first name");
            customer.FirstName = firstName;

            Console.WriteLine("[?] What is the last name of the customer");
            string lastName = Console.ReadLine();

            Log.Information($"User entered '{lastName}' for the last name");
            customer.LastName = lastName;

            CustomerData.AddCustomer(customer);
            Console.WriteLine($"[+] The customer {customer.FirstName} {customer.LastName} has been added\n");
        }
            = new RentalData();                                 //대여조회 관리


        public void CustomerAccess()
        {
            while (true)
            {
                //고객 메뉴 출력
                Menu.CusMainMenu();
                //고객 메뉴 입력
                var num = int.Parse(Console.ReadLine());
                //1. 회원가입
                if (num == (int)CusMenu.CusAdd)
                {
                    customerData.AddCustomer();
                }
                //2. 회원정보
                else if (num == (int)CusMenu.CusInfoSearch)
                {
                    customerData.SearchCustomer();
                }
                //3. 회원수정 우선은 폰 번호만
                else if (num == (int)CusMenu.CusUpdate)
                {
                    customerData.UpdateCustomer();
                }
                //4. 회원삭제
                else if (num == (int)CusMenu.CusDelete)
                {
                    customerData.DeleteCustomer();
                }
                //5. 전체 회원 출력.
                else if (num == (int)CusMenu.CusPrintAll)
                {
                    customerData.PrintAllCusInfo();
                }
                //6. 메인 메뉴.
                else if (num == (int)CusMenu.MainMenu)
                {
                    break;
                }
            }
        }
Exemple #7
0
        public void AddCustomer(Model.VO.CustomerVO cust)
        {
            CustomerData customerData = new CustomerData();

            customerData.AddCustomer(Mapper.Map <CustomerVO, CustomerPO>(cust));
        }
 public int Create(Customer customer)
 {
     return(objcustomer.AddCustomer(customer));
 }
        static void CustomersMenu()
        {
            CustomerData custData = new CustomerData();

            int menuChoice;

            do
            {
                Console.Clear();
                Console.WriteLine("1. Add Customer");
                Console.WriteLine("2. View All Customers");
                Console.WriteLine("3. Search Customer By Name");
                Console.WriteLine("4+. Go Back");

                Console.WriteLine("\nEnter Your Choice: ");
                menuChoice = Int32.Parse(Console.ReadLine());
                Log.Information("Customer Menu Choice: {0}", menuChoice);

                switch (menuChoice)
                {
                case 1:

                    Console.Clear();
                    string fullName;
                    Console.WriteLine("Add Customer\n");
                    Console.WriteLine("Enter The Name: ");
                    fullName = Console.ReadLine();
                    Log.Information("Added Customer: {0}", fullName);

                    custData.AddCustomer(jsonFilePathCustomers, fullName); //SERIALIZED
                    custData.AddCustomerDB(fullName);                      //DATABASE

                    if (custData.nameHolder.Length == 2)
                    {
                        Console.WriteLine("Added Customer {0}", fullName);
                    }
                    else
                    {
                        Console.WriteLine("Invalid Name Entered");
                    }
                    Console.WriteLine("Press Any Key To Continue: ");
                    Console.ReadKey();
                    break;

                case 2:

                    Console.Clear();

                    #region Serialized Data Output

                    /*List<Customer> tempData = new List<Customer>();
                     * tempData = custData.DisplayCustomers(jsonFilePathCustomers);
                     *
                     * Console.Clear();
                     * Console.WriteLine("Customers");
                     * if (tempData.Count != 1)
                     * {
                     *  for (int i = 0; i < tempData.Count; i++)
                     *  {
                     *      Console.WriteLine(" {0}. {1} {2}", i + 1, tempData[i].FirstName, tempData[i].LastName);
                     *  }
                     * }
                     * else
                     * {
                     *  Console.WriteLine("No Data Present");
                     * }*/
                    #endregion

                    CustomerData cust = new CustomerData();
                    cust.DisplayCustomersDB();

                    Console.WriteLine("Press any key to continue");
                    Console.ReadKey();
                    break;

                case 3:

                    Console.Clear();
                    string searchName;
                    Console.WriteLine("Please Enter a First or a Last Name To Search");
                    searchName = Console.ReadLine();

                    #region SerializedSearching
                    //List<Customer> tempDisplay = new List<Customer>();

                    //tempDisplay = custData.DisplayCustomers(jsonFilePathCustomers);

                    //for (int i = 0; i < tempDisplay.Count; i++)
                    //{
                    //    if (tempDisplay[i].FirstName.Equals(searchName) || tempDisplay[i].LastName.Equals(searchName))
                    //    {
                    //        Console.WriteLine(" {0}. {1} {2}", i + 1, tempDisplay[i].FirstName, tempDisplay[i].LastName);
                    //    }
                    //    else
                    //    {
                    //        custData.searchCount++;
                    //    }
                    //}

                    //if (custData.searchCount == tempDisplay.Count)
                    //{
                    //    Console.Clear();
                    //    Console.WriteLine("No Such Record Present");
                    //}
                    #endregion

                    CustomerData customerData = new CustomerData();
                    customerData.SearchCustomersDB(searchName);

                    Console.WriteLine("Press Any Key To Continue");
                    Console.ReadKey();
                    break;
                }
            } while (menuChoice < 4);
        }
        public JsonResult CreateCustomer(Customer cust)
        {
            var customer = objcustomer.AddCustomer(cust);

            return(Json(customer, JsonRequestBehavior.AllowGet));
        }
 public bool AddCustomer(CustomerInfo ci)
 {
     return(customer.AddCustomer(ci));
 }