private static List <ATTOrganization> GetOrganizationList(DataTable tbl, int OrgDV) { List <ATTOrganization> lst = new List <ATTOrganization>(); List <ATTEmail> lstOrgEMail = BLLEmail.GetEmail(null); List <ATTPhone> lstOrgPhone = BLLPhone.GetPhone(null); try { foreach (DataRow row in tbl.Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), (string)row["org_name"], ((row["org_type"] == System.DBNull.Value) ? "" : (string)row["org_type"]), ((row["org_sub_type"] == System.DBNull.Value) ? "" : (string)row["org_sub_type"]), ((row["parent_id"] == System.DBNull.Value) ? 0 : int.Parse(row["parent_id"].ToString())), ((row["org_address"] == System.DBNull.Value) ? "" : (string)row["org_address"]), ((row["org_street_name"] == System.DBNull.Value) ? "" : (string)row["org_street_name"]), ((row["org_vdc_muni"] == System.DBNull.Value) ? 0 : int.Parse(row["org_vdc_muni"].ToString())), ((row["org_url"] == System.DBNull.Value) ? "" : (string)row["org_url"]), ((row["org_ward_no"] == System.DBNull.Value) ? 0 : int.Parse(row["org_ward_no"].ToString())), ((row["org_dist"] == System.DBNull.Value) ? 0 : int.Parse(row["org_dist"].ToString())), ((row["org_equ_code"] == System.DBNull.Value) ? 0 : int.Parse(row["org_equ_code"].ToString())), ((row["zone_id"] == System.DBNull.Value) ? 0 : int.Parse(row["zone_id"].ToString())) ); OrgObj.LstEmail = lstOrgEMail.FindAll(delegate(ATTEmail email) { return(email.OrgId == OrgObj.OrgID); }); OrgObj.LstPhone = lstOrgPhone.FindAll(delegate(ATTPhone phone) { return(phone.OrgId == OrgObj.OrgID); }); lst.Add(OrgObj); } if (OrgDV != 0) { lst.Insert(0, new ATTOrganization(0, "छान्नहोस")); } return(lst); } catch (Exception ex) { throw ex; } }
private static List <ATTOrganization> GetOrganizationList(DataTable tbl) { List <ATTOrganization> lst = new List <ATTOrganization>(); List <ATTEmail> lstOrgEMail = BLLEmail.GetEmail(null); List <ATTPhone> lstOrgPhone = BLLPhone.GetPhone(null); try { foreach (DataRow row in tbl.Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), (string)row["org_name"], ((row["org_type"] == System.DBNull.Value) ? "" : (string)row["org_type"]), ((row["org_sub_type"] == System.DBNull.Value) ? "" : (string)row["org_sub_type"]), ((row["parent_id"] == System.DBNull.Value) ? 0 : int.Parse(row["parent_id"].ToString())), ((row["org_address"] == System.DBNull.Value) ? "" : (string)row["org_address"]), ((row["org_street_name"] == System.DBNull.Value) ? "" : (string)row["org_street_name"]), ((row["org_vdc_muni"] == System.DBNull.Value) ? 0 : int.Parse(row["org_vdc_muni"].ToString())), ((row["org_url"] == System.DBNull.Value) ? "" : (string)row["org_url"]), ((row["org_ward_no"] == System.DBNull.Value) ? 0 : int.Parse(row["org_ward_no"].ToString())), ((row["org_dist"] == System.DBNull.Value) ? 0 : int.Parse(row["org_dist"].ToString())), ((row["org_equ_code"] == System.DBNull.Value) ? 0 : int.Parse(row["org_equ_code"].ToString())), ((row["zone_id"] == System.DBNull.Value) ? 0 : int.Parse(row["zone_id"].ToString())) ); OrgObj.LstEmail = lstOrgEMail.FindAll(delegate(ATTEmail email) { return(email.OrgId == OrgObj.OrgID); }); OrgObj.LstPhone = lstOrgPhone.FindAll(delegate(ATTPhone phone) { return(phone.OrgId == OrgObj.OrgID); }); // In GetOrganizationList(DataTable tbl) below code is added by shanjeev Sah OrgObj.NepDistname = row["DIST_UCODE"].ToString(); OrgObj.NepVdcname = row["VDC_UCODE"].ToString(); //OrgObj.ZoneName = row["zone_name"].ToString(); lst.Add(OrgObj); } return(lst); } catch (Exception ex) { throw ex; } }