public object GetShowcaseDetails(GetShowcaseDetails showcase) { dynamic ShowcaseDetails; try { var Result = Gallery.GetShowcaseDetails(showcase); if (Result != null) { ShowcaseDetails = new { status = "0", message = "success", Result }; } else { ShowcaseDetails = new { status = "0", message = "Record not found", Result }; } } catch { ShowcaseDetails = new { status = "1", message = "failed" }; } return(new { ShowcaseDetails }); }
public static ClsGetShowcaseDetailsOutPut GetShowcaseDetails(GetShowcaseDetails clschowcase) { try { string sqlProc; sqlProc = "V1_1_USPGetShowcaseDetails"; MySqlParameter[] parameterList = new MySqlParameter[1]; parameterList[0] = new MySqlParameter("?DistrictID", clschowcase.DistrictID); //parameterList[1] = new MySqlParameter("?ProfileID", monthCal.profileId); //parameterList[2] = new MySqlParameter("?Curr_Date", monthCal.selectedDate); //parameterList[3] = new MySqlParameter("?UpdatedOn", monthCal.updatedOn); DataSet result = MySqlHelper.ExecuteDataset(GlobalVar.strAppConn, CommandType.StoredProcedure, sqlProc, parameterList); ClsGetShowcaseDetailsOutPut showcase = new ClsGetShowcaseDetailsOutPut(); if (clschowcase.DistrictID == "0") { //Inserted One row for ALL as per told rupesh DataTable dt_Category = new DataTable(); if (result.Tables[0].Rows.Count > 0) { //DataRow toInsert_Category = result.Tables[0].NewRow(); //result.Tables[0].Rows.Add("0", "All", ""); DataView dv_Category = result.Tables[0].DefaultView; dv_Category.Sort = "ID ASC"; dt_Category = dv_Category.ToTable(); DataRow toInsert_Category1 = dt_Category.NewRow(); dt_Category.Rows.Add("-1", "Others", ""); } //Inserted One row for ALL as per told rupesh DataTable dt_Club = new DataTable(); if (result.Tables[1].Rows.Count > 0) { DataRow toInsert_Club = result.Tables[1].NewRow(); result.Tables[1].Rows.Add("0", "All", ""); DataView dv_Club = result.Tables[1].DefaultView; dv_Club.Sort = "ID ASC"; dt_Club = dv_Club.ToTable(); } //Inserted One row for ALL as per told rupesh DataTable dt_District = new DataTable(); if (result.Tables[2].Rows.Count > 0) { DataRow toInsert_District = result.Tables[2].NewRow(); result.Tables[2].Rows.Add("0", "All", ""); DataView dv_District = result.Tables[2].DefaultView; dv_District.Sort = "ID ASC"; dt_District = dv_District.ToTable(); } DataTable dtCategory = dt_Category; DataTable dtClub = dt_Club; DataTable dtDistrict = dt_District; List <GetShowcaseDetails> CategoryList = new List <GetShowcaseDetails>(); if (dtCategory.Rows.Count > 0) { CategoryList = GlobalFuns.DataTableToList <GetShowcaseDetails>(dtCategory); } List <GetShowcaseDetails> ClubList = new List <GetShowcaseDetails>(); if (dtClub.Rows.Count > 0) { ClubList = GlobalFuns.DataTableToList <GetShowcaseDetails>(dtClub); } List <GetShowcaseDetails> DistrictList = new List <GetShowcaseDetails>(); if (dtDistrict.Rows.Count > 0) { DistrictList = GlobalFuns.DataTableToList <GetShowcaseDetails>(dtDistrict); } showcase.District = DistrictList; showcase.Club = ClubList; showcase.Categories = CategoryList; } else { //Inserted One row for ALL as per told rupesh DataTable dt_Club = new DataTable(); if (result.Tables[0].Rows.Count > 0) { DataRow toInsert_Club = result.Tables[0].NewRow(); result.Tables[0].Rows.Add("0", "All", ""); DataView dv_Club = result.Tables[0].DefaultView; dv_Club.Sort = "ID ASC"; dt_Club = dv_Club.ToTable(); } //DataTable dtClub = result.Tables[0]; List <GetShowcaseDetails> CategoryList = new List <GetShowcaseDetails>(); List <GetShowcaseDetails> ClubList = new List <GetShowcaseDetails>(); if (dt_Club.Rows.Count > 0) { ClubList = GlobalFuns.DataTableToList <GetShowcaseDetails>(dt_Club); } List <GetShowcaseDetails> DistrictList = new List <GetShowcaseDetails>(); showcase.District = DistrictList; showcase.Club = ClubList; showcase.Categories = CategoryList; } return(showcase); } catch { throw; } }