private int CalcAccountCases(int?bAccountId, bool isOpen) { if (bAccountId != null) { BqlCommand command = new Select4 <SimpleCase, Where <SimpleCase.customerID, Equal <Required <SimpleCase.customerID> > >, Aggregate <Count <SimpleCase.caseID> > >(); if (isOpen) { command = command.WhereAnd( typeof(Where2 <Where <SimpleCase.closed, Equal <False>, Or <SimpleCase.closed, IsNull> >, And <Where <SimpleCase.released, Equal <False>, Or <SimpleCase.released, IsNull> > > >)); } else { command = command.WhereAnd( typeof(Where <SimpleCase.closed, Equal <True>, Or <SimpleCase.released, Equal <True> > >)); } var res = new PXView(this, true, command).SelectMulti(bAccountId); if (res != null && res.Count > 0) { var count = ((PXResult)res[0]).RowCount; if (count != null) { return((int)count); } } } return(0); }
private int CalcCountOfCases(int?bAccountId) { if (bAccountId != null) { BqlCommand command = new Select4 <SimpleCase, Where <SimpleCase.customerID, Equal <Required <SimpleCase.customerID> > >, Aggregate <Count <SimpleCase.caseID> > >(); command = AddCaseLimitations(command); var res = new PXView(this, true, command).SelectMulti(bAccountId); if (res != null && res.Count > 0) { var count = ((PXResult)res[0]).RowCount; if (count != null) { return((int)count); } } } return(0); }
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(); } } } } }