public ResponseModel GetSLADetail(int SLAId) { ResponseModel _objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; StoreSLAResponseModel _objresponseModel = new StoreSLAResponseModel(); try { string _token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(_token)); StoreSLACaller _newSLA = new StoreSLACaller(); _objresponseModel = _newSLA.GetStoreSLADetail(new StoreSLAService(_connectioSting), authenticate.TenantId, SLAId); StatusCode = (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); _objResponseModel.Status = true; _objResponseModel.StatusCode = StatusCode; _objResponseModel.Message = statusMessage; _objResponseModel.ResponseData = _objresponseModel; } catch (Exception) { throw; } return(_objResponseModel); }
/// <summary> /// Get Store SLA details for Edit using SLAID /// </summary> /// <param name="tenantID"></param> /// <param name="SLAID"></param> /// <returns></returns> public StoreSLAResponseModel GetStoreSLADetail(int tenantID, int SLAID) { StoreSLAResponseModel objSLADetail = new StoreSLAResponseModel(); DataSet ds = new DataSet(); MySqlCommand cmd = new MySqlCommand(); try { conn.Open(); cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_GetStoreSLADetailsBySLAID", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@_tenantID", tenantID); cmd1.Parameters.AddWithValue("@SLA_ID", SLAID); MySqlDataAdapter da = new MySqlDataAdapter(); da.SelectCommand = cmd1; da.Fill(ds); if (ds != null && ds.Tables != null) { if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { objSLADetail.SLAID = Convert.ToInt16(ds.Tables[0].Rows[0]["SlaID"]); objSLADetail.FunctionID = Convert.ToInt16(ds.Tables[0].Rows[0]["FunctionID"]); objSLADetail.FunctionName = Convert.ToString(ds.Tables[0].Rows[0]["FunctionName"]); objSLADetail.BrandID = Convert.ToInt16(ds.Tables[0].Rows[0]["BrandID"]); objSLADetail.BrandName = Convert.ToString(ds.Tables[0].Rows[0]["BrandName"]); objSLADetail.DepartmentID = Convert.ToInt16(ds.Tables[0].Rows[0]["DepartmentID"]); objSLADetail.DepartmentName = Convert.ToString(ds.Tables[0].Rows[0]["DepartmentName"]); objSLADetail.StoreID = Convert.ToInt16(ds.Tables[0].Rows[0]["StoreID"]); objSLADetail.StoreName = Convert.ToString(ds.Tables[0].Rows[0]["StoreName"]); objSLADetail.isSLAActive = Convert.ToString(ds.Tables[0].Rows[0]["SLAStatus"]); } List <StoreSLATargetResponseModel> sLATargetDetails = new List <StoreSLATargetResponseModel>(); if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { StoreSLATargetResponseModel sLATargetDetail = new StoreSLATargetResponseModel(); sLATargetDetail.SLATargetID = Convert.ToInt32(ds.Tables[1].Rows[i]["SLATargetID"]); sLATargetDetail.PriorityID = Convert.ToInt32(ds.Tables[1].Rows[i]["PriorityID"]); sLATargetDetail.PriorityName = Convert.ToString(ds.Tables[1].Rows[i]["PriortyName"]); sLATargetDetail.SLABreachPercent = Convert.ToString(ds.Tables[1].Rows[i]["SLABreachPercent"]); sLATargetDetail.PriorityResolution = Convert.ToInt32(ds.Tables[1].Rows[i]["PriorityResolution"]); sLATargetDetail.PriorityResolutionDuration = Convert.ToString(ds.Tables[1].Rows[i]["PriorityResolutionDuration"]); sLATargetDetails.Add(sLATargetDetail); } } objSLADetail.SLATarget = sLATargetDetails; } } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } if (ds != null) { ds.Dispose(); } } return(objSLADetail); }