public HttpResponseMessage PostSetAgentActiveInactive(AgenctActiveInactive agenctActiveInactive) { AgencyBranchDAL objAgencyBranchDAL = new AgencyBranchDAL(); Response objResponse = new Response(); try { var jsonResult = new StringBuilder(); jsonResult = objAgencyBranchDAL.AgentActiveInactiveDAL(agenctActiveInactive); objResponse.Data = jsonResult.ToString(); if (!string.IsNullOrEmpty(jsonResult.ToString()) && jsonResult.ToString() != "-1") { objResponse.Success = true; } else { objResponse.Success = false; } return(Request.CreateResponse(HttpStatusCode.OK, objResponse)); } catch (Exception ex) { #region set exception response string logMsg = Environment.NewLine + DateTime.Now + Environment.NewLine + "Method Name: SetAgentActiveInactive | Contoller Name: AgencyBranch Controller" + Environment.NewLine; logMsg += "userinfoid:" + agenctActiveInactive.UserInfoID + "|" + DateTime.Now + "|" + ex.ToString() + "-" + Environment.NewLine; ErrorHandler.ErrorLog(logMsg); #endregion objResponse.ErrorList.Add(new Error { errorCode = "EX", errorMsg = ex.Message }); objResponse.Success = false; return(Request.CreateResponse(HttpStatusCode.BadRequest, objResponse)); } }
public StringBuilder AgentActiveInactiveDAL(AgenctActiveInactive agenctActiveInactive) { try { SqlParameter[] P = new SqlParameter[] { new SqlParameter("@userinfoid", agenctActiveInactive.UserInfoID), new SqlParameter("@ActiveInactive", agenctActiveInactive.ActiveInactive), new SqlParameter("@CreatedBy", agenctActiveInactive.CreatedBy), }; var jsonResult = new StringBuilder(); jsonResult = DataLib.JsonStringExecuteReader(DataLib.Connection.GetConnectionString, SPKeys.SPSetAgentuserActiveInactive, P); return(jsonResult); } catch { throw; } }