public static TabExistsResponse HasOrders(HttpContext httpContext, ControllerContext controllerContext)
        {
            var response = new TabExistsResponse()
            {
                DoesExists = false,
                IsError    = false
            };

            try
            {
                #region Arguments Validation

                if (httpContext == null)
                {
                    throw new ArgumentNullException("httpContext cannot be null.");
                }

                if (controllerContext == null)
                {
                    throw new ArgumentNullException("controllerContext cannot be null.");
                }

                #endregion

                #region Variable Declarations
                bool gatewaysconfigured = false;
                bool hasOrders          = false;

                var transactions = new TransactionsController
                {
                    ControllerContext = controllerContext
                };

                var gatewayResponse = transactions.GetGateways();
                var orders          = transactions.GetOrdersData();
                #endregion

                #region Checking Avaliable Data
                if (gatewayResponse.GetType() == typeof(JsonResult))
                {
                    gatewaysconfigured = true;
                }

                if (orders.GetType() == typeof(JsonResult))
                {
                    var result     = (JsonResult)orders;
                    var value      = JsonConvert.DeserializeObject <dynamic>(result.Value.ToString());
                    var extra      = value["Extra"];
                    var dataLength = (extra != null ? (extra["TotalCount"] != null ? (int)extra["TotalCount"] : 0) : 0);
                    if (dataLength > 0)
                    {
                        hasOrders = true;
                    }
                }
                #endregion

                response.DoesExists = gatewaysconfigured || hasOrders;
            }
            catch (Exception ex)
            {
                response.IsError = true;
            }

            return(response);
        }
        public static TabExistsResponse HasCallLogs(HttpContext httpContext, ControllerContext controllerContext)
        {
            var response = new TabExistsResponse()
            {
                DoesExists = false,
                IsError    = false
            };

            try
            {
                #region Arguments Validation

                if (httpContext == null)
                {
                    throw new ArgumentNullException("httpContext cannot be null.");
                }

                if (controllerContext == null)
                {
                    throw new ArgumentNullException("controllerContext cannot be null.");
                }

                #endregion

                #region Variable Declarations
                bool hasVirtualMobileNumbers = false;
                bool hasCallLogs             = false;

                var transactions = new CallTrackerController
                {
                    ControllerContext = controllerContext
                };

                var vmnDetailsResponse = transactions.GetVMNDetails();
                var callLogsResponse   = transactions.GetCallLogs(new CallLogRequest()
                {
                    DataforAllNumbers = true,
                    Limit             = 10000
                });
                #endregion

                #region Checking Avaliable Data
                if (vmnDetailsResponse.GetType() == typeof(JsonResult))
                {
                    var result         = (JsonResult)vmnDetailsResponse;
                    var parsedResponse = JsonConvert.DeserializeObject <dynamic>(result.Value.ToString());
                    var dataLength     = parsedResponse["Data"] != null ? (new JArray(parsedResponse["Data"])).Count : 0;
                    hasVirtualMobileNumbers = dataLength > 0 ? true : false;
                }

                if (callLogsResponse.GetType() == typeof(JsonResult))
                {
                    var result         = (JsonResult)callLogsResponse;
                    var parsedResponse = JsonConvert.DeserializeObject <dynamic>(result.Value.ToString());
                    var dataLength     = parsedResponse != null ? ((new JArray(parsedResponse)).Count) : 0;
                    hasCallLogs = dataLength > 0 ? true : false;
                }
                #endregion

                response.DoesExists = hasVirtualMobileNumbers || hasCallLogs;
            }
            catch (Exception ex)
            {
                response.IsError = true;
            }

            return(response);
        }