コード例 #1
0
        protected void uxSubmit_Click(object sender, EventArgs e)
        {
            if (IsUpdate)
            {
                if (Session["StudentID"] != null)
                {
                    var id   = Convert.ToInt32(Session["StudentID"]);
                    var cust = CustomersManager.Find(id);
                    cust.FirstName = uxFirstName.Text;
                    cust.LastName  = uxLastName.Text;
                    cust.City      = uxCity.Text;
                    cust.Phone     = uxPhone.Text;

                    CustomersManager.Update(cust);
                    FormsAuthentication.SignOut();
                    Session.Clear();
                    Response.Redirect("/Login");
                }
            }
            else
            {
                var cust = new Customer
                {
                    FirstName = uxFirstName.Text,
                    LastName  = uxLastName.Text,
                    City      = uxCity.Text,
                    Phone     = uxPhone.Text
                };
                CustomersManager.Add(cust);
                Response.Redirect("/Login");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: yilmaziyigun/rentacar
        private static void CustomerAdd()
        {
            CustomersManager customerManager = new CustomersManager(new EfCustomerDal());

            customerManager.Add(new Customer {
                CompanyName = "SoganSoft1", CustomerName = "Yilmaz1"
            });
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: EsmaNKilic/ReCapProject
        static void Main(string[] args)
        {
            //CarTest();

            //ColorsTest();

            //BrandTest();

            CustomersManager customerManager = new CustomersManager(new EfCustomersDal());

            customerManager.Add(new Customers {
                CustomersId = 1, UsersId = 4, CompanyName = "Kılıç Yazılım"
            });
        }
コード例 #4
0
 public ActionResult Create(Customer customer)
 {
     if (ModelState.IsValid)
     {
         if (customersManager.Add(customer))
         {
             ViewBag.Message = "Saved Successful";
         }
         else
         {
             ViewBag.Message = "Save Failled";
         }
     }
     return(View(customer));
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: salihbenli/ReCapProject
        private static void CustomerAddition(CustomersManager customersManager)
        {
            Console.WriteLine("User Id: ");
            int userIdForAdd = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Customer Name: ");
            string customerNameForAdd = Console.ReadLine();

            Customer customerForAdd = new Customer
            {
                UsersMId    = userIdForAdd,
                CompanyName = customerNameForAdd
            };

            customersManager.Add(customerForAdd);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: emrebegit/FinalProjects
        private static void AddCustomer()
        {
            CustomersManager customermanager = new CustomersManager(new EfCustomersDAL());

            Console.WriteLine("(int)CustomerId:");
            int CustomerId1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("(int)UserId:");
            int UserId1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("(String)CompanyName:");
            string    CompanyName1 = Console.ReadLine();
            Customers customer1    = new Customers();

            customer1 = new Customers()
            {
                CustomerId  = CustomerId1,
                UserId      = UserId1,
                CompanyName = CompanyName1
            };
            customermanager.Add(customer1);
        }
コード例 #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var db       = new MarinaEntities();
            var customer = CustomersManager.Authenticate(uxFirstName.Text, uxLastName.Text);

            if (customer == null)  // if new customer, add the customer to the DB
            {
                Customer cust = new Customer
                {
                    FirstName = uxFirstName.Text,
                    LastName  = uxLastName.Text,
                    Phone     = uxPhone.Text,
                    City      = uxCity.Text
                };
                CustomersManager.Add(cust);
                // Response.Redirect("~/");
            }
            //at this point, student is not null meaning we have a valid authentication
            //so add student id to session
            Session.Add("CustomerID", customer.ID);
            // redirect - false means no persistent cookie
            FormsAuthentication.RedirectFromLoginPage(customer.FullName, false);
            Response.Redirect("~/MyLease");
        }