public ActionResult ServiceStatusUpdate(int?id) { int ab = Convert.ToInt32(Session["id"]); int bc = Convert.ToInt32(Session["Designation"]); if (ab != 0 && bc == 2) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClientServiceList ServiceStatusUpdate = db.ClientServiceLists.Find(id); if (ServiceStatusUpdate == null) { return(HttpNotFound()); } return(View(ServiceStatusUpdate)); } else { FormsAuthentication.SignOut(); return(RedirectToAction("Login", "Login")); } }
public ActionResult ClientServiceListUpdate(int?id) { int ab = Convert.ToInt32(Session["id"]); int bc = Convert.ToInt32(Session["Designation"]); if (ab != 0 && bc == 2) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //Client ClientUpdate = db.Clients.Find(id); ClientServiceList ServiceUpdate = db.ClientServiceLists.Find(id); if (ServiceUpdate == null) { return(HttpNotFound()); } ViewBag.ServiceId = new SelectList(db.Servicesses, "ServiceId", "ServiceName", ServiceUpdate.ServiceId); return(View(ServiceUpdate)); } else { FormsAuthentication.SignOut(); return(RedirectToAction("Login", "Login")); } }
public ActionResult NewServiceAdd(Client client, int?ServiceId, int?ScheduleTimeId, int?EmployeeId) { int er = 0; if (ServiceId == null) { er++; ViewBag.Service = "Select One Item"; } if (ScheduleTimeId == null) { er++; ViewBag.ScheduleTime = "Select One Item"; } if (EmployeeId == null) { er++; ViewBag.Employee = "Select One Item"; } if (er > 0) { ViewBag.ServiceId = new SelectList(db.Servicesses, "ServiceId", "ServiceName"); ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "EmployeeName"); ViewBag.ScheduleTimeId = new SelectList(db.ScheduleTimes, "ScheduleTimeId", "ScheduleName"); return(View(client)); } else { ClientServiceList list = new ClientServiceList(); list.ClientId = client.ClientId; list.ServiceId = Convert.ToInt32(ServiceId); list.Service_Status = true; db.ClientServiceLists.Add(list); ClientBill bill = new ClientBill(); bill.ClientId = client.ClientId; bill.BillMonth = client.ClientGymStart; bill.BillStatus = false; var serviceprice = db.Servicesses.Where(x => x.ServiceId == ServiceId).FirstOrDefault().ServieAmount; bill.BillAmount = Convert.ToInt16(serviceprice); bill.DueStatus = 0; db.ClientBills.Add(bill); Schedule schedule = new Schedule(); schedule.ClientId = client.ClientId; schedule.EmployeeId = Convert.ToInt32(EmployeeId); schedule.ScheduleTimeId = Convert.ToInt32(ScheduleTimeId); db.Schedules.Add(schedule); db.SaveChanges(); ViewBag.Message = "Service Add Sucessful"; return(RedirectToAction("ClientInformation")); } }
public ActionResult ServiceStatusUpdate([Bind(Include = "ClientServiceListId,ClientId,ServiceId,Service_Status")] ClientServiceList clientServiceList) { if (ModelState.IsValid) { db.Entry(clientServiceList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ClientServiceList")); } return(View()); }
public ActionResult ClientServiceListUpdate([Bind(Include = "ClientServiceListId,ClientId,ServiceId,Service_Status")] ClientServiceList clientServiceList, int?ServiceId) { int er = 0; if (ServiceId == null) { er++; ViewBag.Message = "Select One Item"; } if (er > 0) { clientServiceList.Client = db.Clients.FirstOrDefault(a => a.ClientId == clientServiceList.ClientId); ViewBag.ServiceId = new SelectList(db.Servicesses, "ServiceId", "ServiceName"); return(View(clientServiceList)); } if (ModelState.IsValid) { db.Entry(clientServiceList).State = EntityState.Modified; //db.SaveChanges(); //ClientBill bill = new ClientBill(); //int ClientId = clientServiceList.ClientId; //bill.ClientId = ClientId; //int serviceid = clientServiceList.ServiceId; //int amount = db.Servicesses.Where(x => x.ServiceId == serviceid).FirstOrDefault().ServieAmount; //int billid = db.ClientBills.Where(x => x.ClientId == ClientId).FirstOrDefault().ClientBillId; //bill.ClientBillId = billid; //bill.BillAmount = amount; //db.Entry(bill).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ClientServiceList")); } return(View()); }
public ActionResult ClientRegistration(Client client, int?ServiceId, int?ClientIdNumber, string ClientPassword, int?EmployeeId, int?ScheduleTimeId) { int er = 0; if (ServiceId == null) { ViewBag.ename = "Select Service Name"; er++; } if (ClientPassword == "") { er++; ViewBag.password = "******"; } if (EmployeeId == null) { er++; ViewBag.Employee = "Select Employee Name "; } if (ScheduleTimeId == null) { er++; ViewBag.ScheduleTime = "Select Schedule Name "; } bool isThisIdExist = db.Clients.ToList().Exists(a => a.ClientIdNumber == client.ClientIdNumber); //int a = Convert.ToInt32(ClientIdNumber); //var idnumber = db.Clients.Where(x => x.ClientId == a).FirstOrDefault(); if (isThisIdExist) { er++; ViewBag.idnumber = "This id is already here"; } bool isThisUsenameExist = db.Clients.ToList().Exists(a => a.ClientUserName == client.ClientUserName); if (isThisUsenameExist) { er++; ViewBag.username = "******"; } if (er > 0) { //idnumber = 0; ViewBag.ServiceId = new SelectList(db.Servicesses, "ServiceId", "ServiceName"); ViewBag.ScheduleTimeId = new SelectList(db.ScheduleTimes, "ScheduleTimeId", "ScheduleName"); ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "EmployeeName"); return(View()); } else { if (ModelState.IsValid) { var id = db.Clients.Max(p => p.ClientIdNumber); client.ClientIdNumber = id + 1; db.Clients.Add(client); ClientServiceList list = new ClientServiceList(); list.ClientId = client.ClientId; list.ServiceId = Convert.ToInt32(ServiceId); list.Service_Status = true; db.ClientServiceLists.Add(list); ClientBill bill = new ClientBill(); bill.ClientId = client.ClientId; bill.BillMonth = client.ClientGymStart; bill.BillStatus = false; var serviceprice = db.Servicesses.Where(x => x.ServiceId == ServiceId).FirstOrDefault().ServieAmount; bill.BillAmount = Convert.ToInt16(serviceprice); bill.DueStatus = 0; db.ClientBills.Add(bill); Schedule schedule = new Schedule(); schedule.EmployeeId = Convert.ToInt32(EmployeeId); schedule.ScheduleTimeId = Convert.ToInt32(ScheduleTimeId); schedule.ClientId = client.ClientId; db.Schedules.Add(schedule); db.SaveChanges(); //ViewBag.Message = "Registration Sucessful"; TempData["Success"] = "Registration Successfully!"; // ViewBag.clientid = client.ClientId; return(RedirectToAction(actionName: "ClientRegistrationprint", routeValues: new { id = client.ClientId })); // return RedirectToAction("ClientInformation"); } } ViewBag.ServiceId = new SelectList(db.Servicesses, "ServiceId", "ServiceName"); return(View()); }