protected void chkLstSelectVessel_DataBound(object sender, EventArgs e) { Dictionary <string, bool> VesselSelectedStates = (Dictionary <string, bool>)ViewState["VesselSelectedStates"]; int lVessel_ID = 0; for (int i = 0; i < chkLstSelectVessel.Items.Count; i++) { chkLstSelectVessel.Items[i].Selected = VesselSelectedStates[chkLstSelectVessel.Items[i].Value]; if (lVessel_ID == 0) { if (VesselSelectedStates[chkLstSelectVessel.Items[i].Value]) { lVessel_ID = Convert.ToInt32(chkLstSelectVessel.Items[i].Value); } } } if (lVessel_ID != 0) { DataTable dtMonths = BLL_LMS_Training.GET_EVALUATIONMONTHS(Convert.ToInt32(ViewState["Program_Id"]), lVessel_ID); DataTable dtRules = BLL_LMS_Training.GET_EVALUATIONRULES(Convert.ToInt32(ViewState["Program_Id"]), lVessel_ID); foreach (ListItem li in lstSelectedMonth.Items) { li.Selected = false; } //foreach (ListItem li in lstSelectedRules.Items) //{ // li.Selected = false; //} foreach (DataRow dr in dtMonths.Rows) { foreach (ListItem li in lstSelectedMonth.Items) { if (li.Value == dr["monthno"].ToString() && dr["active_status"].ToString() == "1") { li.Selected = true; } } } ddlDays.SelectedIndex = -1; foreach (DataRow dr in dtRules.Rows) { //foreach (ListItem li in lstSelectedRules.Items) //{ // if (li.Value == dr["Days"].ToString() && dr["active_status"].ToString() == "1") // li.Selected = true; //} if (UDFLib.ConvertIntegerToNull(dr["Days"].ToString()) <= 92 && dr["active_status"].ToString() == "1") { ddlDays.SelectedValue = dr["Days"].ToString(); } } } }
protected void Load_MonthsAndRules_ForVessel(int Program_Id, int Vessel_Id) { try { DataTable dtMonths = BLL_LMS_Training.GET_EVALUATIONMONTHS(Convert.ToInt32(ViewState["Program_Id"]), Vessel_Id); DataTable dtRules = BLL_LMS_Training.GET_EVALUATIONRULES(Convert.ToInt32(ViewState["Program_Id"]), Vessel_Id); foreach (ListItem li in lstSelectedMonth.Items) { li.Selected = false; } //foreach (ListItem li in lstSelectedRules.Items) //{ // li.Selected = false; //} foreach (DataRow dr in dtMonths.Rows) { foreach (ListItem li in lstSelectedMonth.Items) { if (li.Value == dr["monthno"].ToString() && dr["active_status"].ToString() == "1") { li.Selected = true; } } } foreach (DataRow dr in dtRules.Rows) { //foreach (ListItem li in lstSelectedRules.Items) //{ // if (li.Value == dr["Days"].ToString() && dr["active_status"].ToString() == "1") // li.Selected = true; //} if (UDFLib.ConvertIntegerToNull(dr["Days"].ToString()) <= 92) { ddlDays.SelectedValue = dr["Days"].ToString(); } } if (dtRules.Rows.Count == 0) { ddlDays.SelectedIndex = -1; } } catch { } }