private DateTime?CalcLastActivity(int?bAccountId) { DateTime?res = null; if (bAccountId != null) { BqlCommand command = new Select5 <EPActivity, InnerJoin <SimpleCase, On <SimpleCase.noteID, Equal <EPActivity.refNoteID> >, InnerJoin <Contact, On <Contact.contactID, Equal <SimpleCase.contactID> > > >, Where <SimpleCase.customerID, Equal <Required <SimpleCase.customerID> >, And <Contact.userID, Equal <Current <AccessInfo.userID> > > >, Aggregate <Max <EPActivity.lastModifiedDateTime> > >(); command = AddCaseLimitations(command); var activities = new PXView(this, true, command).SelectMulti(bAccountId); if (activities != null && activities.Count > 0) { res = ((EPActivity)((PXResult)activities[0])[typeof(EPActivity)]).LastModifiedDateTime; } command = new Select5 <SimpleCase, InnerJoin <Contact, On <Contact.contactID, Equal <SimpleCase.contactID> > >, Where <SimpleCase.customerID, Equal <Required <SimpleCase.customerID> >, And <Contact.userID, Equal <Current <AccessInfo.userID> > > >, Aggregate <Max <SimpleCase.lastModifiedDateTime> > >(); command = AddCaseLimitations(command); var cases = new PXView(this, true, command).SelectMulti(bAccountId); if (cases != null && cases.Count > 0) { var casesLastModified = ((SimpleCase)((PXResult)cases[0])[typeof(SimpleCase)]).LastModifiedDateTime; if (casesLastModified != null && (res == null || res < casesLastModified)) { res = casesLastModified; } } } return(res); }
/// <summary> /// Gets the employees contact info separated by a coma. /// </summary> /// <param name="graph">Graph to use.</param> /// <param name="concatenateNames">Boolean that if true, returns the Staff name(s).</param> /// <param name="concatenateCells">Boolean that if true, returns the Staff cell phone(s).</param> /// <param name="appointmentID">Appointment ID.</param> private static StringBuilder GetsEmployeesContactInfo(PXGraph graph, bool concatenateNames, bool concatenateCells, int?appointmentID) { StringBuilder names = new StringBuilder(); int i = 0; // TODO SD-7612 this BQL is not currently retrieving contact info for vendors BqlCommand fsAppointmentEmployeeContactInfoBql = new Select5 <FSAppointmentEmployee, InnerJoin <BAccount, On < BAccount.bAccountID, Equal <FSAppointmentEmployee.employeeID> >, InnerJoin <Contact, On < BAccount.defContactID, Equal <Contact.contactID> > > >, Where < FSAppointmentEmployee.appointmentID, Equal <Required <FSAppointmentEmployee.appointmentID> > >, Aggregate < GroupBy <FSAppointmentEmployee.employeeID> >, OrderBy < Asc <FSAppointmentEmployee.employeeID> > >(); PXView fsAppointmentEmployeeContactInfoView = new PXView(graph, true, fsAppointmentEmployeeContactInfoBql); var fsAppointmentEmployeeSet = fsAppointmentEmployeeContactInfoView.SelectMulti(appointmentID); if (fsAppointmentEmployeeSet.Count > 0) { foreach (PXResult <FSAppointmentEmployee, BAccount, Contact> bqlResult in fsAppointmentEmployeeSet) { FSAppointmentEmployee fsAppointmentEmployeeRow = (FSAppointmentEmployee)bqlResult; BAccount bAccountRow = (BAccount)bqlResult; Contact contactRow = (Contact)bqlResult; i++; if (fsAppointmentEmployeeSet.Count > 1 && i == fsAppointmentEmployeeSet.Count) { names.Append(PXMessages.LocalizeFormatNoPrefix(TX.Messages.LIST_LAST_ITEM_PREFIX)); } else { if (names.Length != 0) { names.Append(", "); } } if (fsAppointmentEmployeeRow.Type == BAccountType.EmployeeType) { if (string.IsNullOrEmpty(contactRow.FirstName) == false && concatenateNames == true) { names.Append(contactRow.FirstName.Trim()); } if (string.IsNullOrEmpty(contactRow.LastName) == false && concatenateNames == true) { names.Append(' '); names.Append(contactRow.LastName.Trim()); } } else if (fsAppointmentEmployeeRow.Type == BAccountType.VendorType) { if (string.IsNullOrEmpty(contactRow.FullName) == false && concatenateNames == true) { names.Append(contactRow.FullName.Trim()); } } if (string.IsNullOrEmpty(contactRow.Phone1) == false && concatenateCells == true) { names.Append(contactRow.Phone1.Trim()); } else if (concatenateCells == true) { names.Append(TX.Messages.NO_CONTACT_CELL_FOR_THE_STAFF); } } } else { names.Append(TX.Messages.NO_STAFF_ASSIGNED_FOR_THE_APPOINTMENT); } return(names); }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection cn = new SqlConnection(@"Data Source=DESKTOP-GN1S5UA\SERVER;Initial Catalog=GestionCitas;Integrated Security=SSPI;")) { if (!this.IsPostBack) { { using (SqlCommand cmd = new SqlCommand("SELECT Id,Pais FROM Pais")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select4.DataSource = cmd.ExecuteReader(); Select4.DataTextField = "Pais"; Select4.DataValueField = "Id"; Select4.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Aficcion FROM Aficcion")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select1.DataSource = cmd.ExecuteReader(); Select1.DataTextField = "Aficcion"; Select1.DataValueField = "Id"; Select1.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Educacion FROM Educacion")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select5.DataSource = cmd.ExecuteReader(); Select5.DataTextField = "Educacion"; Select5.DataValueField = "Id"; Select5.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Contextura FROM Contextura")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); editprefixes.DataSource = cmd.ExecuteReader(); editprefixes.DataTextField = "Contextura"; editprefixes.DataValueField = "Id"; editprefixes.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Sexo FROM Sexo")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select3.DataSource = cmd.ExecuteReader(); Select3.DataTextField = "Sexo"; Select3.DataValueField = "Id"; Select3.DataBind(); cn.Close(); } } } } }