protected void btnSave_Click(object sender, EventArgs e) { Page.Validate("AddEdit"); if (Page.IsValid) { try { ProspectService.AddOrUpdateProspect(RowID, Convert.ToInt32(hidBranchID.Value), txtFirstName.Text, txtLastName.Text, dtpDate.SelectedDate.GetValueOrDefault(DateTime.Today), txtIdentityNo.Text, txtPhone1.Text, txtPhone2.Text, txtEmail.Text, dtpDateOfBirth.SelectedDate, Convert.ToInt32(ddlConsultant.SelectedValue), ddlSource.SelectedItem.Text, txtSourceRef.Text, txtNotes.Text, chkEnableFreeTrial.Checked, dtpFreeTrialFrom.SelectedDate, dtpFreeTrialTo.SelectedDate); ReloadCurrentPage(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } } }
// CREATE PROSPECT SERVICE private ProspectService CreateProspectService() { var userID = Guid.Parse(User.Identity.GetUserId()); var service = new ProspectService(userID); return(service); }
private void FillDropDown() { var sources = ProspectService.GetProspectSources(); ddlSource.Items.Clear(); ddlSource.Items.Add(new DropDownListItem(String.Empty)); foreach (var source in sources) { ddlSource.Items.Add(new DropDownListItem(source, source)); } }
public ControllerImpl(PersonService personService, ClientService clientService, ProspectService prospectService, AccomodationService accomodationService, PersonQueryExtended personQuery, AccomodationQueryExtended accomodationQuery) { this.personService = personService; this.clientService = clientService; this.prospectService = prospectService; this.accomodationService = accomodationService; this.personQuery = personQuery; this.accomodationQuery = accomodationQuery; }
protected void lnbDelete_Click(object sender, EventArgs e) { try { int[] id = WebFormHelper.GetRowIdForDeletion(gvwMaster); Array.ForEach(id, prospectID => ProspectService.DeleteProspect(prospectID)); ReloadCurrentPage(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }
public ActionResult CompletareDate(Person ionel) { ContactService contactService = new ContactService(); Contact contact = new Contact() { email = ionel.Email, telephone = ionel.Telephone }; contactService.insert(contact); ProspectService prospectService = new ProspectService(); prospectService.insert(new Prospect() { name = ionel.FirstName + " " + ionel.LastName, details = "--" }); return(View("Index")); }
// GET : Prospect public ActionResult Index(string sortingOrder) { var userID = Guid.Parse(User.Identity.GetUserId()); var service = new ProspectService(userID); //var model = service.GetAllProspects().OrderBy(m => m.LastName); ViewBag.SortingFirstName = string.IsNullOrEmpty(sortingOrder) ? "FirstName" : ""; ViewBag.SortingLastName = string.IsNullOrEmpty(sortingOrder) ? "LastName" : ""; ViewBag.SortingPosition = string.IsNullOrEmpty(sortingOrder) ? "Position" : ""; ViewBag.SortingSchoolName = string.IsNullOrEmpty(sortingOrder) ? "SchoolName" : ""; ViewBag.SortingGrade = string.IsNullOrEmpty(sortingOrder) ? "Grade" : ""; var prospects = from prospect in service.GetAllProspects() select prospect; switch (sortingOrder) { case "FirstName": prospects = prospects.OrderBy(prospect => prospect.FirstName); break; case "LastName": prospects = prospects.OrderBy(prospect => prospect.LastName); break; case "Position": prospects = prospects.OrderBy(prospect => prospect.Position); break; case "SchoolName": prospects = prospects.OrderBy(prospect => prospect.School.SchoolName); break; case "Grade": prospects = prospects.OrderBy(prospect => prospect.Grade); break; } return(View(prospects.ToList())); //return View(model); }
protected void gvwMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { int id = Convert.ToInt32(e.CommandArgument); RowID = id; mvwForm.SetActiveView(viwAddEdit); var prospect = ProspectService.GetProspect(id); hidBranchID.Value = Convert.ToString(prospect.BranchID); ddlConsultant.DataSource = EmployeeService.GetAll(Convert.ToInt32(hidBranchID.Value)); ddlConsultant.DataTextField = "UserName"; ddlConsultant.DataValueField = "ID"; ddlConsultant.DataBind(); ddlConsultant.Items.Insert(0, new DropDownListItem(String.Empty)); lblBranch.Text = prospect.Branch.Name; txtFirstName.Text = prospect.FirstName; txtLastName.Text = prospect.LastName; dtpDate.SelectedDate = prospect.Date; txtPhone1.Text = prospect.Phone1; txtPhone2.Text = prospect.Phone2; txtEmail.Text = prospect.Email; txtIdentityNo.Text = prospect.IdentityNo; txtSourceRef.Text = prospect.ProspectRef; ddlConsultant.SelectedValue = Convert.ToString(prospect.ConsultantID); ddlSource.SelectedValue = prospect.ProspectSource; txtNotes.Text = prospect.Notes; chkEnableFreeTrial.Checked = prospect.FreeTrialValidFrom.HasValue && prospect.FreeTrialValidTo.HasValue; if (chkEnableFreeTrial.Checked) { dtpFreeTrialFrom.SelectedDate = prospect.FreeTrialValidFrom.GetValueOrDefault(DateTime.Today); dtpFreeTrialTo.SelectedDate = prospect.FreeTrialValidFrom.GetValueOrDefault(DateTime.Today); } txtFirstName.Focus(); } }
public void CheckInsertContact_Manual() { ContactService contactService = new ContactService(); Contact contactFromDb = contactService.GetByEmail("email"); if (contactFromDb != null) { cs.DeleteById(contactFromDb.id); } else { Contact contact = new Contact( ); contact.email = ionel.Email; contact.telephone = ionel.Telephone; contactService.insert(contact); contactFromDb = contactService.GetByEmail("email"); } Assert.NotNull(contactFromDb); ProspectService prospectService = new ProspectService(); var prospect = new Prospect( ); prospect.name = ionel.FirstName + " " + ionel.LastName; prospect.details = "--"; // referinta manuala prospect.contact_id = contactFromDb.id; prospectService.insert(prospect); var prospectFromDb = prospectService.GetByID(prospect.id); Assert.NotNull(prospectFromDb); Assert.Equal(contactFromDb.id, prospectFromDb.contact_id); }