public void BindChildList() { DayCareBAL.ChildSchoolYearService proxyChildSchoolYear = new DayCareBAL.ChildSchoolYearService(); divErrorMsg.Style.Add("display", "none"); btnImportChild.Visible = true; btnImportChildBottom.Visible = true; DayCareBAL.ChildSchoolYearService proxyChild = new DayCareBAL.ChildSchoolYearService(); if (ddlPrevSchoolyearOfSelectedCurrentSchoolYear.SelectedIndex == -1) { divErrorMsg.Style.Add("display", "block"); lblSchoolYear.Visible = false; ddlPrevSchoolyearOfSelectedCurrentSchoolYear.Visible = false; btnImportChild.Visible = false; lblErrorMsg.Text = "No previous year found"; btnImportChildBottom.Visible = false; } else { divErrorMsg.Style.Add("display", "none"); lblSchoolYear.Visible = true; ddlPrevSchoolyearOfSelectedCurrentSchoolYear.Visible = true; btnImportChild.Visible = true; btnImportChildBottom.Visible = true; List <DayCarePL.ChildDataProperties> lstChildData = proxyChild.GetAllChildListForImport(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ddlPrevSchoolyearOfSelectedCurrentSchoolYear.SelectedValue), new Guid(Session["SchoolId"].ToString())); if (lstChildData != null) { rgChildList.DataSource = lstChildData.OrderBy(i => i.FamilyName); //rgChildList.DataBind(); } } }
protected void btnImportChild_Click(object sender, EventArgs e) { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); return; } //List<DayCarePL.Child_Family> lstLeger = new List<DayCarePL.Child_Family>(); //DayCarePL.Child_Family objChild_Family; DayCareBAL.ChildSchoolYearService proxyChildSchoolyear = new DayCareBAL.ChildSchoolYearService(); foreach (GridDataItem e1 in rgChildList.MasterTableView.Items) { CheckBox chkChildItem = e1.FindControl("chkChildItem") as CheckBox; HiddenField ChildFamilyId = e1.FindControl("ChildFamilyId") as HiddenField; if (chkChildItem != null) { if (chkChildItem.Checked && chkChildItem.Enabled == true) { //objChild_Family = new DayCarePL.Child_Family(); //objChild_Family.ChildDataId = new Guid(e1.GetDataKeyValue("ChildDataId").ToString()); //objChild_Family.ChildFamilyId = new Guid(ChildFamilyId.Value); //lstLeger.Add(objChild_Family); bool result = proxyChildSchoolyear.ImportAllSelectedChild(new Guid(e1.GetDataKeyValue("ChildDataId").ToString()), new Guid(ChildFamilyId.Value), new Guid(Session["CurrentSchoolYearId"].ToString())); } } } rgChildList.Rebind(); }