public HttpResponseMessage PostGetAgBranchDDL(mstAgencyBranch objmstAgencyBranch) { AgencyDAL _objAgencyDAL = new AgencyDAL(); Response objResponse = new Response(); mstAgencyBranch _objmstAgencyBranch = new mstAgencyBranch(); List <AgBranchDDL> _objAgBranchDDLList = new List <AgBranchDDL>(); try { DataSet dsResult = new DataSet(); string jsonData = string.Empty; dsResult = _objAgencyDAL.GetAgencyBranchDdlDAL(objmstAgencyBranch); if (dsResult != null) { if (dsResult.Tables[0] != null) { if (dsResult.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++) { _objAgBranchDDLList.Add(new AgBranchDDL { AgencyBranchID = dsResult.Tables[0].Rows[i]["AgencyBranchID"].ToString(), BranchName = dsResult.Tables[0].Rows[i]["BranchName"].ToString() }); } _objmstAgencyBranch.AgencyBranchList = _objAgBranchDDLList; objResponse.Data = _objmstAgencyBranch; objResponse.Success = true; return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } else { _objmstAgencyBranch.AgencyBranchList = _objAgBranchDDLList; objResponse.Data = _objmstAgencyBranch; objResponse.Success = true; } } } return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } catch (Exception ex) { #region set exception response string logMsg = Environment.NewLine + DateTime.Now + Environment.NewLine + "Method Name: GetAgBranchDDL | Contoller Name: Agency Controller" + Environment.NewLine; ErrorHandler.ErrorLog(logMsg); #endregion objResponse.Success = false; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, objResponse); return(response); } }
public DataSet GetAgencyBranchDdlDAL(mstAgencyBranch objmstAgencyBranch) { try { SqlParameter[] P = new SqlParameter[] { new SqlParameter("@agencyID", objmstAgencyBranch.agencyID), new SqlParameter("@StateID", objmstAgencyBranch.StateID), new SqlParameter("@CityID", objmstAgencyBranch.CityID) }; DataSet dtResult = new DataSet(); dtResult = DataLib.GetStoredProcData(DataLib.Connection.SetConnectionString, SPKeys.SPGetManageAgentBranch, P); return(dtResult); } catch { throw; } }