protected void btnSave_Click(object sender, EventArgs e) { Groomer ObjGroomer = new Groomer(); int Count = ObjGroomer.AddGroomer(txtEmailID.Text.Trim(), txtPassword.Text.Trim(), txtName.Text.Trim(), txtAddress.Text.Trim(), txtHomePhone.Text.Trim(), txtPersonalCell.Text.Trim(), txtZipCode.Text, txtSheetName.Text, txtBaseCity.Text, txtState.Text, ddlTimeZone.SelectedValue.ToString()); if (Count == 2) { SuccesfullMessage("Groomer added successfully."); txtEmailID.Text = ""; txtPassword.Text = ""; txtName.Text = ""; txtAddress.Text = ""; txtHomePhone.Text = ""; txtPersonalCell.Text = ""; txtZipCode.Text = ""; txtSheetName.Text = ""; txtState.Text = ""; txtBaseCity.Text = ""; } if (Count == 0) { ErrMessage("Duplicate email id."); } if (Count == 1) { ErrMessage("Duplicate sheet name."); } }
public void GetGroomerMonthlyLogData() { Groomer objgroomer = new Groomer(); DataSet ds = new DataSet(); DataSet ds1 = new DataSet(); ds = objgroomer.GetGroomerMonthlyLogData(Convert.ToInt32(Request.QueryString["GID"].ToString()), txtStartDate.Text, txtEndDate.Text); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[1].Rows.Count > 0) { for (int count = 0; count < ds.Tables[1].Columns.Count; count++) { ds.Tables[0].Columns.Add(ds.Tables[1].Columns[count].ColumnName, ds.Tables[1].Columns[count].DataType); ds.Tables[0].Rows[0][ds.Tables[0].Columns.Count - 1] = ds.Tables[1].Rows[0][count]; } } dvgroomers.Visible = true; GrdGroomer.DataSource = ds.Tables[0]; GrdGroomer.DataBind(); dvgroomers.Visible = true; divError.Visible = false; } else { dvgroomers.Visible = false; divError.Visible = true; dvgroomers.Visible = false; ErrorMessage("Sorry, No records found."); } }
protected void txtDate_TextChanged(object sender, EventArgs e) { GetAdminConfirmDate(); if (DateReturn.ToString() != "") { Groomer objGroomer = new Groomer(); DataSet dsseq = new DataSet(); dsseq = objGroomer.GetMaxSequencenoOfGroomer(Convert.ToInt32(ddlGroomerlist.SelectedValue), DateReturn.ToString()); if (dsseq.Tables[0].Rows.Count > 0) { if (dsseq.Tables[0].Rows[0]["sequence"].ToString() != "") { lblDoubleBook.Visible = true; txtSequence.Text = dsseq.Tables[0].Rows[0]["sequence"].ToString(); } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } txtOthers.Focus(); } }
public void GetMaxSequencenoOfGroomer() { Groomer objGroomer = new Groomer(); DataSet dsseq = new DataSet(); dsseq = objGroomer.GetMaxSequencenoOfGroomer(Convert.ToInt32(ddlGroomerlist.SelectedValue), DateReturn.ToString()); if (dsseq.Tables[0].Rows.Count > 0) { if (dsseq.Tables[0].Rows[0]["sequence"].ToString() != "") { lblDoubleBook.Visible = true; txtOthers.Focus(); txtSequence.Text = dsseq.Tables[0].Rows[0]["sequence"].ToString(); } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } }
public async Task <IActionResult> Edit(int id, [Bind("GroomerId,GroomerName")] Groomer groomer) { if (id != groomer.GroomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(groomer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroomerExists(groomer.GroomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(groomer)); }
protected void btnDeleteAppointment_Click(object sender, EventArgs e) { List <string> appointmentIds = new List <string>(); foreach (string key in Request.Form.Keys) { if (key.StartsWith("chkDelete")) { appointmentIds.Add(key.Substring(9)); } } if (appointmentIds.Count > 0) { Groomer g = new Groomer(); foreach (string apptId in appointmentIds) { g.DeleteGroomerAppointment(int.Parse(apptId)); } SuccessMessage("Selected Appointment Deleted Successfully.."); if (Session["CalenderDateSelected"] == null) { BindGroomersAppointment(); } else { BindGroomersAppointmentByDate(Convert.ToDateTime(Session["CalenderDateSelected"].ToString())); } } else { ErrorMessage("Please Select Appointment To Delete."); } }
public void GetGroomerDailyLogData() { Groomer objgroomer = new Groomer(); DataSet ds = new DataSet(); ds = objgroomer.GetGroomerDailyLogData(Convert.ToInt32(Request.QueryString["GID"].ToString()), ddlLastweek.SelectedItem.Value.ToString()); if (ds.Tables[0].Rows.Count > 0) { GrdGroomer.DataSource = ds; GrdGroomer.DataBind(); lblName.Text = ds.Tables[0].Rows[0]["CustomerName"].ToString(); lblBeginningMileage.Text = ds.Tables[0].Rows[0]["BeginningMileage"].ToString(); lblEndingMileage.Text = ds.Tables[0].Rows[0]["EndingMileage"].ToString(); lblDate.Text = ds.Tables[0].Rows[0]["addedon"].ToString(); Session["SheetName"] = ds.Tables[1].Rows[0]["SheetName"].ToString(); dvgroomers.Visible = true; divError.Visible = false; } else { divError.Visible = true; dvgroomers.Visible = false; ErrorMessage("Sorry, No records found."); } }
protected void txtCustEmail_Chenged(object sender, EventArgs e) { if (txtCustEmail.Text != "") { Groomer objGroomer = new Groomer(); DataSet ds = new DataSet(); ds = objGroomer.GetUserInfoUsingEmail(txtCustEmail.Text); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Name"].ToString() != "") { txtCustomerName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); txtTotalRevnueExpected.Focus(); divError.Visible = false; } } else { ErrorMessage("Incorrect User Email...Please Try Again"); txtCustEmail.Focus(); } } else { ErrorMessage("Please Fill Custumer Email To Connect To Member Profile"); txtCustEmail.Focus(); } this.ModalPopupExtender1.Show(); pnlpopup.Attributes.Add("onkeydown", "return (event.keyCode!=13);"); }
protected void btnUpdate_Click(object sender, EventArgs e) { Groomer objGroomer = new Groomer(); DataSet ds2 = new DataSet(); ds2 = objGroomer.GetGroomersSequence(Session["SelectedDate"].ToString(), Convert.ToInt32(Request.QueryString["AppointmentId"]), Convert.ToInt32(ddlGroomerlist.SelectedValue)); bool SquenceNo = false; if (ds2.Tables[0].Rows.Count > 0) { for (int j = 0; j < ds2.Tables[0].Rows.Count; j++) { if (txtSequence.Text == ds2.Tables[0].Rows[j]["SequenceNo"].ToString()) { SquenceNo = true; } } if (SquenceNo == true) { ErrorMessage("Sequence Number already exist."); } else { SuccessMessage("Groomer appointment updated sucessfully"); } } else { SuccessMessage("Groomer appointment updated sucessfully"); } }
protected void txtCustEmail_Chenged(object sender, EventArgs e) { if (txtCustEmail.Text != "") { Groomer objGroomer = new Groomer(); DataSet ds = new DataSet(); ds = objGroomer.GetUserInfoUsingEmail(txtCustEmail.Text); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Name"].ToString() != "") { txtCustomerName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); btnSave.Enabled = true; txtTotalRevnueExpected.Focus(); divError.Visible = false; } } else { txtCustomerName.Text = string.Empty; ErrorMessage("Incorrect Member Email...Please Try Again"); txtCustEmail.Focus(); } } else { txtCustomerName.Text = string.Empty; ErrorMessage("Please Fill Member Email to connect to Member Profile"); txtCustEmail.Focus(); } }
protected void txtDate_TextChanged(object sender, EventArgs e) { GetAdminConfirmDate(); if (DateReturn.ToString() != "") { Groomer objGroomer = new Groomer(); DataSet dsseq = new DataSet(); dsseq = objGroomer.GetMaxSequencenoOfGroomer(Convert.ToInt32(ddlGroomerlist.SelectedValue), DateReturn.ToString()); if (dsseq.Tables[0].Rows.Count > 0) { if (dsseq.Tables[0].Rows[0]["sequence"].ToString() != "") { lblDoubleBook.Visible = true; txtSequence.Text = dsseq.Tables[0].Rows[0]["sequence"].ToString(); } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } } else { lblDoubleBook.Visible = false; txtSequence.Text = "1"; } txtOthers.Focus(); } this.ModalPopupExtender1.Show(); pnlpopup.Attributes.Add("onkeydown", "return (event.keyCode!=13);"); }
protected void btnSignin_Click(object sender, EventArgs e) { try { if (txtUsername.Text == "" || txtPassword.Text == "") { ErrMessage("Please Enter UserName/Password."); } else { Groomer ObjUser = new Groomer(); DataSet ds = ObjUser.GetGroomerUser(txtUsername.Text, txtPassword.Text); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { Session["GroomerUserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["GId"] = ds.Tables[0].Rows[0]["GId"].ToString(); Session["UserTimeZone"] = ds.Tables[0].Rows[0]["GTimeZone"].ToString(); Session["PageFrom"] = "Default.aspx"; Response.Redirect("Dashboard.aspx", false); } else { ErrMessage("Please verify your username and password"); } } } } catch { Response.Redirect("Default.aspx", false); } }
public ActionResult Update(string id) { //select * from groomers where groomerid = @id Groomer SelectedGroomer = db.Groomers.Find(id); return(View(SelectedGroomer)); }
public static bool IsAppointmentPossible(Appointment appointment) { /// if datetime and length of appointment is in groomer working interval /// && is not overlapping with a booked period bool isPosible = true; TimeSpan appointmentStart = appointment.DateTime.TimeOfDay; TimeSpan appointmentLength = TimeSpan.FromMinutes(appointment.Service.DurationInMinutes); Groomer groomer = appointment.Groomer; GroomerCalendarService groomerService = new GroomerCalendarService(groomer); List <CalendarModel> calendar = groomerService.GetCalendar(appointment.DateTime.Date); //CalendarModel = if (appointmentStart < calendar.Select(x => x.Time).FirstOrDefault()) { return(false); } if (appointmentStart + appointmentLength > calendar.Select(x => x.Time).LastOrDefault() + GroomerCalendarService.getTimeStep()) { return(false); } foreach (CalendarModel calendarItem in calendar .Where(x => x.Time >= appointmentStart && x.Time < appointmentStart + appointmentLength)) { if (calendarItem.Appointment != null) { isPosible = false; return(isPosible); } } return(isPosible); }
protected void btnDelete_Click(object sender, EventArgs e) { string month = ddlMonth.SelectedValue + "/" + "1" + "/" + ddlYear.SelectedValue; DateTime dtSelectedDate = new DateTime(); string.Format("{0:HH:mm:ss tt}", DateTime.Now); dtSelectedDate = Convert.ToDateTime(month); DateTime todaysdate = new DateTime(); todaysdate = System.DateTime.Today.AddMonths(-2); if (dtSelectedDate < todaysdate) { DateTime enddate; enddate = dtSelectedDate.Date.AddMonths(1); Groomer objGroomer = new Groomer(); string stDate = dtSelectedDate.ToString().Replace("12:00:00 AM", string.Format("{0:HH:mm:ss tt}", DateTime.Now)); string endDate = enddate.AddDays(-1).ToString().Replace("12:00:00 AM", string.Format("{0:HH:mm:ss tt}", DateTime.Now)); objGroomer.DeleteOldGroomerAppointment(stDate, endDate); if (Session["CalenderDateSelected"] == null) { BindGroomersAppointment(); } else { BindGroomersAppointmentByDate(Convert.ToDateTime(Session["CalenderDateSelected"].ToString())); } SuccessMessage("Groomer(s) appointment deleted successfully."); } else { ErrorMessage("Select month should be two months less than current Month."); } }
public ActionResult Show(string id) { //sql equivalent : select * from groomers where groomerid = @id Groomer SelectedGroomer = db.Groomers.Find(id); //need a list of bookings associated with that groomer //sql equivalent : //select * from groombookings where groombookings.groomerid = @id //[db.GroomBookings] => Database context groombookings table //[.Where()] => maps to the where clause in SQL //[booking => booking.GroomerID == id] => where groomerid = @id //[.ToList()] => select * from groombookings List<GroomBooking> Bookings = db.GroomBookings .Include(booking=>booking.GroomServices) .Where(booking => booking.GroomerID == id) .ToList(); ShowGroomer ViewModel = new ShowGroomer(); ViewModel.groomer = SelectedGroomer; ViewModel.bookings = Bookings; return View(ViewModel); }
public ActionResult DeleteConfirmed(int id) { Groomer groomer = db.Groomers.Find(id); db.Groomers.Remove(groomer); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Register(GroomerRegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Name, Email = model.Email }; model.Password = RandomPasswordService.GenerateRandomPassword(); // random password var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await UserManager.AddToRoleAsync(user.Id, "staff"); //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); //create groomer Groomer groomer = new Groomer(); UpdateModel(groomer); groomer.UserId = user.Id; repository.Insert(groomer); repository.Save(); // send email to groomer with user & password string subject = "Pet Grooming credentials"; ViewBag.UserName = model.Name; ViewBag.Password = model.Password; string message = RenderRazorViewToString("RegisterEmail", null); string emailResult; try { PetGroomingApplication.Services.Email.Send(model.Email, subject, message); emailResult = "The message was sent sussessfully"; } catch (Exception ex) { emailResult = ex.Message; } // log on disk string fileName = Path.GetFullPath(Server.MapPath(@"~/Data/Sent_credentials.txt")); using (StreamWriter file = new StreamWriter(fileName, true)) { file.WriteLine($"{DateTime.Now}\nUser name: {model.Name} \nPassword: {model.Password}\n-------------------"); } ViewBag.EmailResult = emailResult; return(RedirectToAction("SuccessRegister")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Edit([Bind(Include = "groomerID,petOwnerID,description,price")] Groomer groomer) { if (ModelState.IsValid) { db.Entry(groomer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(groomer)); }
public ActionResult Edit([Bind(Include = "GroomerID,FirstName,LastName,GroomerDOB,GroomerRate")] Groomer groomer) { if (ModelState.IsValid) { db.Entry(groomer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(groomer)); }
public ActionResult Create([Bind(Include = "groomerID,petOwnerID,description,price")] Groomer groomer) { if (ModelState.IsValid) { db.Groomers.Add(groomer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(groomer)); }
public ActionResult Create([Bind(Include = "GroomerID,FirstName,LastName,GroomerDOB,GroomerRate")] Groomer groomer) { if (ModelState.IsValid) { db.Groomers.Add(groomer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(groomer)); }
public async Task <IActionResult> Create([Bind("GroomerId,GroomerName")] Groomer groomer) { if (ModelState.IsValid) { _context.Add(groomer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(groomer)); }
protected void btnStatus_Click(object sender, EventArgs e) { string FId = Utility.GetCheckedRow(GrdDownload, "chkSelect"); if (FId != "") { Groomer objgr = new Groomer(); objgr.UpdateExcelFileStatus(FId); BindGrid(); } }
//Button delete event protected void btnDelete_Click(object sender, EventArgs e) { string GID = Utility.GetCheckedRow(GrdUsers, "chkSelect"); if (GID != "") { Groomer ObjGroomer = new Groomer(); ObjGroomer.DeleteGroomer(GID); BindGroomers(); SuccessMessage("Groomer(s) deleted Successfully."); } }
public void GetGroomerAppointmentDetails() { Groomer objgroomer = new Groomer(); DataSet ds = new DataSet(); ds = objgroomer.GetGroomerAppointmentDetails(Convert.ToInt32(Request.QueryString["DailyLogID"].ToString())); if (ds.Tables[0].Rows.Count > 0) { GrdGroomer.DataSource = ds; GrdGroomer.DataBind(); } }
protected void MakeRecConfirmAppointment(int GAppId, string AppString) { List <DateTime> dtToSetRecAppointment = new List <DateTime>(); try { if (!(string.IsNullOrEmpty(AppString))) { string AppointmentsSpan = ""; string[] apptstr = AppString.Split(','); if (apptstr.Length > 0) { #region Get Rec Number Irespective Of Position for (int i = 0; i < apptstr.Length; i++) { if (!(null == apptstr[i])) { if (apptstr[i].ToLower().ToString().Trim().StartsWith("rec") && apptstr[i].ToString().Trim().Length <= 5) { AppointmentsSpan = apptstr[i].ToString().Trim().Substring(3).ToString(); break; } } } #endregion Get Rec Number Irespective Of Position } int number = AppointmentsSpan != "" ? Convert.ToInt32(AppointmentsSpan) : 0; if (number > 0) { dtToSetRecAppointment = SetAppointmentAfterWeekRecurrence(number, Convert.ToDateTime(DateReturn.ToString())); } #region Insert/Update Rec Appointment in Appointment Table to view Member Groomer objGroomer = new Groomer(); if (dtToSetRecAppointment.Count > 0) { foreach (DateTime dt in (List <DateTime>)dtToSetRecAppointment) { string MilitaryDateTime = ConvertToMilitaryDatatime(dt); objGroomer.MakeRecConfirmAppointmentByGroomer(GAppId, dt, txtCustEmail.Text, MilitaryDateTime); } } #endregion Insert/Update Rec Appointment in Appointment Table to view Member } } catch (Exception ex) { throw ex; } }
// GET: Groomers/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Groomer groomer = db.Groomers.Find(id); if (groomer == null) { return(HttpNotFound()); } return(View(groomer)); }
public void BindGroomers() { Groomer objGroomer = new Groomer(); DataSet ds = new DataSet(); ds = objGroomer.BindGroomers(); if (ds.Tables[0].Rows.Count > 0) { ddlGroomerlist.DataTextField = "Name"; ddlGroomerlist.DataValueField = "Gid"; ddlGroomerlist.DataSource = ds.Tables[0]; ddlGroomerlist.DataBind(); } }
public ActionResult Delete(string id) { //find the groomer Groomer SelectedGroomer = db.Groomers.Find(id); //sql equivalent : delete from groomers where groomerid=@id db.Groomers.Remove(SelectedGroomer); ApplicationUser User = db.Users.Find(id); //also remove the account db.Users.Remove(User); db.SaveChanges(); return RedirectToAction("List"); }