protected void AllComboBoxBind() { RadComboBoxItem Status;//Telerik��״̬�ؼ� vUTPCompany vUTPCompanyObj; this.OrderBy = " it.CompName desc "; string whereStr; whereStr = ""; BLL_vUTPCustomer = new vUTPCustomerBLL(); vUTPCompanyObjs = BLL_vUTPCustomer.GetUTPCompanys(whereStr, this.OrderBy); if (vUTPCompanyObjs.Count() > 0) { rctxtCompany.DataSource = vUTPCompanyObjs; rctxtCompany.DataValueField = "CompanyID"; rctxtCompany.DataTextField = "Comp"; rctxtCompany.DataBind(); } vUTPCompanyObj = vUTPCompanyObjs.ToList().First(); CycleComboBoxBind(vUTPCompanyObj.CompanyID); whereStr = " and it.Billable=true"; this.OrderBy = " it.StatType desc "; vUTPCustomerStateObjs = BLL_vUTPCustomer.GetUTPCustomerStates(whereStr, this.OrderBy); if (vUTPCustomerStateObjs.Count() > 0) { try { rctxtStatusCode.DataSource = vUTPCustomerStateObjs; rctxtStatusCode.DataValueField = "CustomerStateID"; rctxtStatusCode.DataTextField = "StatCode"; rctxtStatusCode.DataBind(); Status = new RadComboBoxItem("All", "All"); rctxtStatusCode.Items.Add(Status); rctxtStatusCode.SelectedValue = "All"; } catch (Exception) { rctxtStatusCode.Items.Clear(); Status = new RadComboBoxItem("All", "All"); rctxtStatusCode.Items.Add(Status); rctxtStatusCode.SelectedValue = "All"; } } }
protected void rctxtStartingCycle_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { string whereStr; vUTPCycle endingCycle;//��ֹ���� if (rctxtCompany.SelectedValue != "N/A") { whereStr = " and it.CompanyID='" + rctxtCompany.SelectedValue + "'"; this.OrderBy = " it.Cycle asc "; BLL_vUTPCustomer = new vUTPCustomerBLL(); endingCycle = BLL_vUTPCustomer.FindLastCycleByCompanyId(rctxtCompany.SelectedValue, this.OrderBy); whereStr = " and it.CompanyID='" + rctxtCompany.SelectedValue + "' and it.Cycle >= " + rctxtStartingCycle.SelectedValue + " and it.Cycle <= " + endingCycle.Cycle + ""; vUTPCycleObjs = BLL_vUTPCustomer.GetUTPCycles(whereStr, this.OrderBy); if (vUTPCycleObjs.Count()>0) { rctxtEndingCycle.DataSource = vUTPCycleObjs; rctxtEndingCycle.DataValueField = "Cycle"; rctxtEndingCycle.DataTextField = "Cycle"; rctxtEndingCycle.DataBind(); } } }
protected void CycleComboBoxBind(string UTPCompanyId) { RadComboBoxItem startingCycle;//��ʼ����Telerik�ؼ� RadComboBoxItem endingCycle;//��������Telerik�ؼ� string whereStr; whereStr = " and it.CompanyID='" + UTPCompanyId + "'"; this.OrderBy = " it.Cycle asc "; try { vUTPCycleObjs = BLL_vUTPCustomer.GetUTPCycles(whereStr, this.OrderBy); } catch (NullReferenceException) { BLL_vUTPCustomer = new vUTPCustomerBLL(); vUTPCycleObjs = BLL_vUTPCustomer.GetUTPCycles(whereStr, this.OrderBy); } if (vUTPCycleObjs.Count() > 0) { try { //��ʼ���� rctxtStartingCycle.DataSource = vUTPCycleObjs; rctxtStartingCycle.DataValueField = "Cycle"; rctxtStartingCycle.DataTextField = "Cycle"; rctxtStartingCycle.DataBind(); //��ֹ���� rctxtEndingCycle.DataSource = vUTPCycleObjs; rctxtEndingCycle.DataValueField = "Cycle"; rctxtEndingCycle.DataTextField = "Cycle"; rctxtEndingCycle.DataBind(); } catch (Exception) { //�����ֹ���� rctxtEndingCycle.Items.Clear(); endingCycle = new RadComboBoxItem("N/A", "N/A"); rctxtEndingCycle.Items.Add(endingCycle); //�����ʼ���� rctxtStartingCycle.Items.Clear(); startingCycle = new RadComboBoxItem("N/A", "N/A"); rctxtStartingCycle.Items.Add(startingCycle); } } else { //�����ֹ���� rctxtEndingCycle.Items.Clear(); endingCycle = new RadComboBoxItem("N/A", "N/A"); rctxtEndingCycle.Items.Add(endingCycle); //�����ʼ���� rctxtStartingCycle.Items.Clear(); startingCycle = new RadComboBoxItem("N/A", "N/A"); rctxtStartingCycle.Items.Add(startingCycle); //������chkAllCycles�û� chkAllCycles.Checked = false; chkAllCycles.Enabled = false; } }
protected void FindValue() { vUTPCycle startingCycle;//��ʼ���� vUTPCycle endingCycle;//��ֹ���� Boolean startCycle=false;//�Ƿ�����ʼ���� Boolean endCycle=false;//�Ƿ��ǽ������� RadComboBoxItem endingCycleComboBox; RadComboBoxItem startingCycleComboBox; string[] cycle; if (this.KeyId != string.Empty) { if (SchedulerObj.Company != null) { rctxtCompany.SelectedValue = SchedulerObj.Company.Trim(); } if (SchedulerObj.Cycle!=null) { cycle = SchedulerObj.Cycle.Split(','); if (SchedulerObj.Cycle != null) { cycle = SchedulerObj.Cycle.Split(','); if (cycle!=null) { int i=0; foreach (var item in cycle) { if(i == 0) { if (item.Equals("N/A")) { //�����ʼ���� rctxtStartingCycle.Items.Clear(); startingCycleComboBox = new RadComboBoxItem("N/A", "N/A"); rctxtStartingCycle.Items.Add(startingCycleComboBox); } else { rctxtStartingCycle.SelectedValue = item.Trim(); } i++; //�Ƿ����ݼ���first if (!item.Equals("N/A")) { this.OrderBy = " it.Cycle asc"; BLL_vUTPCustomer = new vUTPCustomerBLL(); startingCycle = BLL_vUTPCustomer.FindFirstCycleByCompanyId(rctxtCompany.SelectedValue, this.OrderBy); if (item.Equals(startingCycle.Cycle.ToString())) { startCycle = true; } } }else if(i == 1) { if (item.Equals("N/A")) { //�����ֹ���� rctxtEndingCycle.Items.Clear(); endingCycleComboBox = new RadComboBoxItem("N/A", "N/A"); rctxtEndingCycle.Items.Add(endingCycleComboBox); } else { rctxtEndingCycle.SelectedValue = item.Trim(); } //�Ƿ����ݵ�Last if (!item.Equals("N/A")) { endingCycle = BLL_vUTPCustomer.FindLastCycleByCompanyId(rctxtCompany.SelectedValue, this.OrderBy); if (item.Equals(endingCycle.Cycle.ToString())) { endCycle = true; } } } } } } } if (SchedulerObj.Copy!=null&&SchedulerObj.Copy.Equals("True")) { chkCopy.Checked=true; } if (SchedulerObj.Calc != null && SchedulerObj.Calc.Equals("True")) { chkCalc.Checked = true; } if (SchedulerObj.Status != null) { if (SchedulerObj.Status.Trim().Equals("All")) { rctxtStatusCode.SelectedValue = "All"; }else { rctxtStatusCode.SelectedValue = SchedulerObj.Status.Trim(); } } //�����ʼ����ͽ������������ݵ�frist��last����AllCycleΪtrue if (startCycle == true && endCycle==true) { chkAllCycles.Checked = true; //����ؼ��û� rctxtEndingCycle.Enabled = false; rctxtStartingCycle.Enabled = false; } } }
protected void chkAllCycles_CheckedChanged(object sender, EventArgs e) { this.OrderBy = " it.Cycle asc"; vUTPCycle startingCycle;//��ʼ���� vUTPCycle endingCycle;//��ֹ���� string vUTPCompanyId; if (chkAllCycles.Checked==true) { vUTPCompanyId=rctxtCompany.SelectedValue; if (vUTPCompanyId != "N/A" && !rctxtEndingCycle.SelectedValue.Equals("N/A") && !rctxtStartingCycle.SelectedValue.Equals("N/A")) { BLL_vUTPCustomer = new vUTPCustomerBLL(); startingCycle = BLL_vUTPCustomer.FindFirstCycleByCompanyId(vUTPCompanyId, this.OrderBy); endingCycle = BLL_vUTPCustomer.FindLastCycleByCompanyId(vUTPCompanyId, this.OrderBy); //���ռ丳ֵ rctxtStartingCycle.SelectedValue = startingCycle.Cycle.ToString().Trim(); rctxtEndingCycle.SelectedValue = endingCycle.Cycle.ToString().Trim(); //����ؼ��û� rctxtEndingCycle.Enabled = false; rctxtStartingCycle.Enabled = false; } } else { rctxtEndingCycle.Enabled = true; rctxtStartingCycle.Enabled = true; } }