protected void login_BTN_Click(object sender, EventArgs e) { CustomerUtility customer = new CustomerUtility(); customer.userName = userName_TB.Text; customer.password = password_TB.Text; if (customer.checkPassword()) { Session["user"] = userName_TB.Text; message_LBL.Enabled = true; message_LBL.Visible = true; message_LBL.Text = "Welcome back!"; message_LBL.ForeColor = System.Drawing.Color.Red; Response.AddHeader("refresh", "2; url=Home.aspx"); } else { message_LBL.Enabled = true; message_LBL.Visible = true; message_LBL.Text = "Username and password combination is not correct!"; message_LBL.ForeColor = System.Drawing.Color.Red; resetLink_BTN.Visible = true; resetLink_BTN.Enabled = true; } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { CustomerUtility customer = new CustomerUtility(); customer.userName = TextBoxUserName.Text; customer.fName = TextBoxFname.Text; customer.lName = TextBoxLname.Text; customer.email = TextBoxEmail.Text; customer.country = DropDownListCountry.SelectedItem.ToString(); customer.password = TextBoxPassword.Text; customer.age = Convert.ToInt32(TextBoxAge.Text); if (RadioButtonFemale.Checked) { customer.gender = 'F'; } else { customer.gender = 'M'; } if (!customer.checkUserExist()) { customer.insertData(); LabelWelcome.Text = "You have register with BSU pizaa sucsusfully"; LabelWelcome.ForeColor = Color.Red; Response.AddHeader("refresh", "3;url=Login.aspx"); } else { LabelWelcome.Text = "User already exist"; LabelWelcome.ForeColor = Color.Red; Response.AddHeader("refresh", "3;url=Login.aspx"); } }//close Buttonsubmit
public Form1() { InitializeComponent(); bankUtility = new BankUtility(); customerUtility = new CustomerUtility(); loadBanks(); //banks for tab #1 }
protected void ButtonSubmit_Click(object sender, EventArgs e) { CustomerUtility customer = new CustomerUtility(); customer.userName = TextBoxUName.Text; customer.fName = TextBoxFName.Text; customer.lName = TextBoxLName.Text; customer.email = TextBoxEmail.Text; customer.country = DDL_Coutnry.SelectedItem.ToString(); customer.password = TB_Password.Text; customer.age = TB_Age.Text; if (RB_Female.Checked) { customer.gender = 'F'; } else { customer.gender = 'M'; } if (customer.isRegistered()) { Label10.Text = "This user already exists, please log in"; Label10.ForeColor = System.Drawing.Color.Red; Response.AddHeader("refresh", "4;url=Login.aspx"); } else { customer.insertData(); Label10.Text = "You have registered with BSU Pizza successfully!"; Label10.ForeColor = System.Drawing.Color.Red; Response.AddHeader("refresh", "2; url=Login.aspx"); } }
public static void Main(string[] args) { Console.WriteLine("1.Add Customer"); Console.WriteLine("2.Display Customer"); Console.WriteLine("3.Search Customer"); Console.WriteLine("4.Delete Customer"); CustomerUtility cu = new CustomerUtility(); for (int i = 0; i <= 3; i++) { Console.WriteLine("enter your Choice"); int choice = int.Parse(Console.ReadLine()); if (choice == 1) { Console.WriteLine("Enter Customer id, name and city"); int id = int.Parse(Console.ReadLine()); string name = Console.ReadLine(); string city = Console.ReadLine(); Customer c = new Customer(id, name, city); cu.AddCustomer(c); } if (choice == 2) { if (cu.custList.Count != 0) { cu.DisplayAllCustomers(); } } if (choice == 3) { int idd = int.Parse(Console.ReadLine()); cu.DisplayAllCustomers(); Customer c = cu.SearchCustomerByID(idd); if (c != null) { Console.WriteLine("{0} {1} {2}", c.Id, c.Name, c.City); } } if (choice == 4) { int id = int.Parse(Console.ReadLine()); cu.DeleteCustomer(id); } } }
public static void Main(string[] args) //DO NOT change the 'Main' method signature { //code need to be written CustomerUtility cu = new CustomerUtility(); int ch = 0, id; List <Customer> l; while (ch != 5) { Console.WriteLine("1. Add Customer\n2. Display Customer\n3. Search Customer\n4.Delete Customer\n5.Exit\nEnter Your Choice"); ch = Convert.ToInt32(Console.ReadLine()); switch (ch) { case 1: { Customer obj = new Customer(); Console.WriteLine("Enter Customer id, name and city"); obj.Id = Convert.ToInt32(Console.ReadLine()); obj.Name = Console.ReadLine(); obj.City = Console.ReadLine(); l = cu.AddCustomer(obj); break; } case 2: { cu.DisplayAllCustomers(); break; } case 3: { Console.WriteLine("Enter Customer Id"); id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(cu.SearchCustomerByID(id)); break; } case 4: { id = Convert.ToInt32(Console.ReadLine()); cu.DeleteCustomer(id); break; } case 5: break; } } }
protected void Buttonrestpassord_Click(object sender, EventArgs e) { CustomerUtility c = new CustomerUtility().getUserInfo(TextBoxuserName.Text); if (c.email.Equals(TextBoxEmail.Text)) { int rand = new Random().Next(100000, 999999); string newPassword = "******" + rand; c.resetPassord(newPassword); LabelMessage.Visible = true; LabelMessage.Text = "Your Password has been reset,Please check your email"; LabelMessage.ForeColor = System.Drawing.Color.Red; sendNotification(c.email, newPassword); } else { LabelMessage.Visible = true; LabelMessage.Text = "Your username or email is not correct"; LabelMessage.ForeColor = System.Drawing.Color.Red; } }
protected void ButtonResetPassword_Click(object sender, EventArgs e) { CustomerUtility customer = new CustomerUtility().getUser(TextBoxUserName.Text); if (!String.IsNullOrEmpty(customer.email) && customer.email.Equals(TextBoxEmail.Text)) { int rand = new Random().Next(100000, 999999); string newpwd = "new" + rand; customer.resetPassword(newpwd); LabelMessage.Visible = true; LabelMessage.Text = "Your password has been reset as " + newpwd; LabelMessage.ForeColor = System.Drawing.Color.Red; sendNotification(customer.email, newpwd); } else { LabelMessage.Visible = true; LabelMessage.Text = "Your Email or UserName are not match!!"; LabelMessage.ForeColor = System.Drawing.Color.Red; } }
protected void ButtonLogin_Click(object sender, EventArgs e) { CustomerUtility c = new CustomerUtility(); c.userName = TextBoxuser.Text; c.password = TextBoxPassword.Text; if (c.checkPassword()) { Session["user"] = TextBoxuser.Text; LabelMessage.Visible = true; LabelMessage.Enabled = true; LabelMessage.Text = "Welcome back!!"; LabelMessage.ForeColor = System.Drawing.Color.Red; Response.AddHeader("refresh", "3;url=Home.aspx"); } else { LabelMessage.Visible = true; LabelMessage.Enabled = true; LabelMessage.Text = "User or Password is not correct"; LinkButtonForgotpaswword.Enabled = true; LinkButtonForgotpaswword.Visible = true; } }
public CustService(CustomerUtility custUtility, ItemsUtility itemUtility) { customerUtility = custUtility; itemsUtility = itemUtility; }
public CustomerListService(CustomerUtility _customerUtility, ItemsUtility _itemsUtility) { itemsUtility = _itemsUtility; customerUtility = _customerUtility; }