public ActionResult GetData() { ClientModel client = new ClientModel(); List <ClientModel> objClient = new List <ClientModel>(); objClient = client.GetAllClients(); return(Json(objClient, JsonRequestBehavior.AllowGet)); }
protected void btnsubmit_click(object sender, EventArgs e) { ZHUW15sqlserver1Entities db = new ZHUW15sqlserver1Entities(); ClientModel clientModel = new ClientModel(); List<Client> clients = clientModel.GetAllClients(); String clientId = ""; if (clients != null) { //Check if product in DB foreach (Client client in clients) { if (client.Name == txtName.Text.Trim() && client.Password == txtPassword.Text.Trim() && client.ActiveUser == true) { int Id = client.ID; Application["clientId"] = Id; Application["clientName"] = client.Name; //Redirect page to WebShop after lable showing HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; lblResult.Text = Application["clientName"].ToString() + ", your login is successful!"; meta.Content = "3; url = /ZHUW15/asp_practical/Pages/WebShop.aspx"; this.Page.Controls.Add(meta); } else if (client.Name == txtName.Text.Trim() && client.Password == txtPassword.Text.Trim() && client.ActiveUser == false) { lblResult.Text = ("Sorry, this account is disable, please contact us for further help."); } else { lblResult.Text = ("Invalid username or password!"); } } } }
protected void btnsubmit_click(object sender, EventArgs e) { ZHUW15sqlserver1Entities db = new ZHUW15sqlserver1Entities(); ClientModel clientModel = new ClientModel(); List <Client> clients = clientModel.GetAllClients(); String clientId = ""; if (clients != null) { //Check if product in DB foreach (Client client in clients) { if (client.Name == txtName.Text.Trim() && client.Password == txtPassword.Text.Trim() && client.ActiveUser == true) { int Id = client.ID; Application["clientId"] = Id; Application["clientName"] = client.Name; //Redirect page to WebShop after lable showing HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; lblResult.Text = Application["clientName"].ToString() + ", your login is successful!"; meta.Content = "3; url = /ZHUW15/asp_practical/Pages/WebShop.aspx"; this.Page.Controls.Add(meta); } else if (client.Name == txtName.Text.Trim() && client.Password == txtPassword.Text.Trim() && client.ActiveUser == false) { lblResult.Text = ("Sorry, this account is disable, please contact us for further help."); } else { lblResult.Text = ("Invalid username or password!"); } } } }
internal ObservableCollection <Client> GetAllClients(Func <Client, bool> filter = null) { return(model.GetAllClients()); }
public IActionResult ReservationList() { ReservationModel repositoryReservation = new ReservationModel(connectionString); IList <Reservation> reservation = repositoryReservation.GetAllReservation(); List <ReservationModel> reservationModel = new List <ReservationModel>(); ClientModel client = new ClientModel(connectionString); IList <Client> listclient = client.GetAllClients(); List <ClientModel> clientModel = new List <ClientModel>(); PaymentcardModel paymentcard = new PaymentcardModel(connectionString); IList <Paymentcard> listPaymentcard = paymentcard.GetAllPaymentcard(); List <PaymentcardModel> paymentcardModel = new List <PaymentcardModel>(); VoucherModel voucher = new VoucherModel(connectionString); IList <Voucher> listVoucher = voucher.GetAllVoucher(); List <VoucherModel> voucherModel = new List <VoucherModel>(); RoomModel room = new RoomModel(connectionString); IList <Room> listRoom = room.GetAllRoom(); TypeRoomModel typeroom = new TypeRoomModel(connectionString); IList <TypeRoom> listTyperoom = typeroom.GetAllTypeRooms(); List <TypeRoomModel> typeRoomModel = new List <TypeRoomModel>(); for (int i = 0; i < listVoucher.Count; i++) { VoucherModel voucherNew = new VoucherModel(); voucherNew.id = listVoucher[i].id; voucherNew.idpaymentcard = listVoucher[i].idpaymentcard; voucherNew.idreservation = listVoucher[i].idreservation; voucherNew.creationdate = listVoucher[i].creationdate; voucherModel.Add(voucherNew); for (int j = 0; j < reservation.Count; j++) { if (listVoucher[i].idreservation.Equals(reservation[j].id)) { ReservationModel reservationNew = new ReservationModel(); reservationNew.id = reservation[j].id; reservationNew.idroom = reservation[j].idroom; reservationNew.idclient = reservation[j].idclient; reservationNew.arrivaldate = reservation[j].arrivaldate; reservationNew.departuredate = reservation[j].departuredate; reservationModel.Add(reservationNew); for (int k = 0; k < listclient.Count; k++) { if (reservation[j].idclient.Equals(listclient[k].id)) { ClientModel clientNew = new ClientModel(); clientNew.id = listclient[k].id; clientNew.name = listclient[k].name; clientNew.lastname = listclient[k].lastname; clientNew.email = listclient[k].email; clientModel.Add(clientNew); } } for (int k = 0; k < listRoom.Count; k++) { if (reservation[j].idroom.Equals(listRoom[k].id)) { for (int f = 0; f < listTyperoom.Count; f++) { if (listRoom[k].idtyperoom.Equals(listTyperoom[f].id)) { TypeRoomModel typeRoomNew = new TypeRoomModel(); typeRoomNew.description = listTyperoom[f].description; typeRoomModel.Add(typeRoomNew); } } } } } } for (int k = 0; k < listPaymentcard.Count; k++) { if (listPaymentcard[k].id.Equals(listVoucher[i].idpaymentcard)) { PaymentcardModel paymentcardNew = new PaymentcardModel(); paymentcardNew.cardnumber = listPaymentcard[k].cardnumber; paymentcardModel.Add(paymentcardNew); } } } ViewBag.paymentcard = paymentcardModel; ViewBag.voucher = voucherModel; ViewBag.reservation = reservationModel; ViewBag.typeroom = typeRoomModel; ViewBag.client = clientModel; return(View()); }
// GET: Client/Edit/5 public ActionResult Edit(int id) { ClientModel Client = new ClientModel(); return(View(Client.GetAllClients().Find(Emp => Emp.ClientID == id))); }