Exemplo n.º 1
0
 public ActionResult _ManageClientUsers(int clientId, string clientName)
 {
     try
     {
         ViewBag.Error        = "";
         ViewBag.SessionError = "";
         var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
         if (userData.UserId < 1)
         {
             ViewBag.SessionError = "Your session has expired! Please re-login";
             return(View(new ClientItemObj()));
         }
         if (clientId < 1 || string.IsNullOrEmpty(clientName))
         {
             ViewBag.Error = "Invalid Client Selection";
             return(View(new ClientItemObj()));
         }
         return(View(new ClientItemObj
         {
             ClientName = clientName,
             ClientId = clientId
         }));
     }
     catch (Exception ex)
     {
         ViewBag.Error = "Error Occurred! Please try again later";
         UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
         return(View(new ClientItemObj()));
     }
 }
        public ActionResult _AddAlertProviderItem(int providerId, string providerName)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new RegAlertProviderItemObj()));
                }

                if (providerId < 1 || string.IsNullOrEmpty(providerName) || providerName.Length < 2)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new RegAlertProviderItemObj()));
                }
                return(View(new RegAlertProviderItemObj {
                    AlertProviderId = providerId, AlertProviderName = providerName
                }));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new RegAlertProviderItemObj()));
            }
        }
        public ActionResult AddRequestTypeSetting(int clientId, int productId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                #region Client Product productItem Session Check

                var userClientSession = (AppSession)Session["_UserClientSession_"];
                if (userClientSession == null || userClientSession.ClientId < 1 || userClientSession.ProductId < 1 || userClientSession.ProductItemId < 1)
                {
                    return(RedirectToAction("Index", "Dashboard"));
                }
                #endregion

                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new RegRequestTypeSettingObj()));
                }

                return(View(new RegRequestTypeSettingObj {
                    ProductId = productId, ClientId = clientId, ProductItemId = userClientSession.ProductItemId
                }));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new RegRequestTypeSettingObj()));
            }
        }
Exemplo n.º 4
0
        public ActionResult _AddTab()
        {
            try
            {
                ViewBag.Error = "";
                var tabModel = new PortalRoleViewModel {
                    AllRoles = new List <NameValueObject>(), MyRoleIds = new[] { 0 }
                };

                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(tabModel));
                }

                if (!(Session["_portal_tab_allroles"] is List <NameValueObject> allRoles) || !allRoles.Any())
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(tabModel));
                }

                tabModel.AllRoles = allRoles;


                return(View(tabModel));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new PortalRoleViewModel()));
            }
        }
Exemplo n.º 5
0
        public JsonResult ProcessPasswordResetRequest(string myUsername)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                //var bearerAuth = MvcApplication.GetSessionBearerData(userData.Username);
                //var authToken = MvcApplication.GetSessionAuthData(userData.Username);

                //if (string.IsNullOrEmpty(bearerAuth) || bearerAuth.Length < 5)
                //{
                //    return Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid User Session! Please Re-Login" });
                //}

                //if (string.IsNullOrEmpty(authToken) || authToken.Length < 5)
                //{
                //    return Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid User Session! Please Re-Login" });
                //}

                if (string.IsNullOrEmpty(myUsername) || myUsername.Length < 2)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid Username" }));
                }


                var passObj = new ResetPasswordObj
                {
                    Email       = myUsername,
                    AdminUserId = userData.UserId,
                };


                var changePassword = new PortalUserManager().ResetPassword(passObj, userData.Username);
                if (changePassword?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                //MvcApplication.SetSessionBearerData(changePassword.Status.CustomSetting, userData.Username);
                //MvcApplication.SetSessionAuthData(changePassword.Status.CustomToken, userData.Username);

                if (!changePassword.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(changePassword.Status.Message.FriendlyMessage) ? "Process Failed! Unable to change your password" : changePassword.Status.Message.FriendlyMessage }));
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = changePassword.NewPassword }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
        public JsonResult ProcessEditAlertProviderItemRequest(AlertProviderItemObj model)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                var selAlertProviderItem = Session["_CurrentSelAlertProviderItem_"] as AlertProviderItemObj;
                if (selAlertProviderItem == null || selAlertProviderItem.AlertProviderItemId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }


                if (model.AlertItemId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Kindly select valid Alert Item" }));
                }

                var passObj = new EditAlertProviderItemObj
                {
                    AdminUserId         = userData.UserId,
                    AlertProviderItemId = selAlertProviderItem.AlertProviderItemId,
                    AlertProviderId     = selAlertProviderItem.AlertProviderId,
                    AlertItemId         = model.AlertItemId,
                    Status = model.StatusVal ? 1 : 0,
                };

                if (!GenericVal.Validate(model, out var msg))
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = $"Validation Error Occurred! Detail: {msg}" }));
                }


                var response = AlertProviderItemService.UpdateAlertProviderItem(passObj, userData.Username);
                if (response?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.TechnicalMessage) ? "Process Failed! Unable to add course of study" : response.Status.Message.TechnicalMessage }));
                }

                Session["_CurrentSelAlertProviderItem_"] = null;
                Session["_AlertProviderItemList_" + selAlertProviderItem.AlertProviderId] = null;
                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
        public ActionResult LoadUserClientProducts(int clientId)
        {
            var add = new NameValueObject {
                Id = 0, Name = "-- Empty Client List --"
            };

            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    return(Json(new List <NameValueObject> {
                        add
                    }, JsonRequestBehavior.AllowGet));
                }

                if (userData.ClientProductList == null || !userData.ClientProductList.Any())
                {
                    return(Json(new List <NameValueObject> {
                        add
                    }, JsonRequestBehavior.AllowGet));
                }

                var clients = new List <ProductObj>();
                foreach (var item in userData.ClientProductList)
                {
                    if (item.ClientInfo.ClientId == clientId)
                    {
                        clients.AddRange(item.Products.Select(m => m.ProductInfo).ToList());
                        break;
                    }
                }

                if (!clients.Any())
                {
                    return(Json(new List <NameValueObject> {
                        add
                    }, JsonRequestBehavior.AllowGet));
                }

                var parentTabs = clients.Where(c => c.Status == 1).OrderBy(c => c.ProductId);
                add = new NameValueObject {
                    Id = 0, Name = "-- Select Product  --"
                };

                var jsonitem = parentTabs.Select(o => new NameValueObject {
                    Id = o.ProductId, Name = o.Name
                }).ToList();
                jsonitem.Insert(0, add);
                return(Json(jsonitem, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new List <NameValueObject> {
                    add
                }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 8
0
        public JsonResult ProcessDeleteTabRequest(int tabId)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                //var bearerAuth = MvcApplication.GetSessionBearerData(userData.Username);
                //var authToken = MvcApplication.GetSessionAuthData(userData.Username);

                //if (string.IsNullOrEmpty(bearerAuth) || bearerAuth.Length < 5)
                //{
                //    return Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid User Session! Please Re-Login" });
                //}

                //if (string.IsNullOrEmpty(authToken) || authToken.Length < 5)
                //{
                //    return Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid User Session! Please Re-Login" });
                //}

                if (tabId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid Tab Selection" }));
                }



                var passObj = new DeleteTabObj
                {
                    TabId       = tabId,
                    AdminUserId = userData.UserId,
                };


                var response = new PortalTabManager().DeleteTab(passObj, userData.Username);
                if (response == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }



                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.FriendlyMessage) ? "Process Failed! Unable to delete tab" : response.Status.Message.FriendlyMessage }));
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 9
0
        public JsonResult ProcessAddSMSRouteRequest(RegSMSRouteObj model)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (model == null)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (string.IsNullOrEmpty(model.Name) || model.Name.Length < 2)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid SMS Route Name" }));
                }

                if (model.Rate < 0)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid SMS Rate" }));
                }

                model.AdminUserId = userData.UserId;
                model.Status      = model.StatusVal ? 1 : 0;

                if (Session["_SMSRouteList_"] is List <SMSRouteObj> previousSMSRouteList)
                {
                    if (previousSMSRouteList.Count(x => x.Name.ToLower().Trim().ToStandardHash() == model.Name.ToLower().Trim().ToStandardHash()) > 0)
                    {
                        return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "SMS Route Information  Already Exist!" }));
                    }
                }


                var response = SMSRouteService.AddSMSRoute(model, userData.Username);
                if (response?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.TechnicalMessage) ? "Process Failed! Unable to add nomination Source" : response.Status.Message.TechnicalMessage }));
                }

                Session["_SMSRouteList_"] = null;
                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
        public ActionResult _ProviderItemView(int providerId)
        {
            try
            {
                ViewBag.Error = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <AlertProviderItemObj>()));
                }
                if (Session["_AlertProviderItemList_" + providerId] is List <AlertProviderItemObj> mylist && mylist.Any())
                {
                    return(View(mylist));
                }

                var searchObj = new AlertProviderItemSearchObj
                {
                    AdminUserId         = userData.UserId,
                    AlertProviderItemId = 0,
                    AlertProviderId     = providerId,
                    AlertItemId         = 0,
                    Status = 0
                };

                var retVal = AlertProviderItemService.LoadAlertProviderItems(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = "Alert Provider Item list is empty!";
                    return(View(new List <AlertProviderItemObj>()));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    ViewBag.Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage)
                            ? " Alert Provider Item list is empty!"
                            : retVal.Status.Message.FriendlyMessage;
                    return(View(new List <AlertProviderItemObj>()));
                }
                if (retVal.AlertProviderItems == null || !retVal.AlertProviderItems.Any())
                {
                    ViewBag.Error = "Alert Provider Item list is empty!";
                    return(View(new List <AlertProviderItemObj>()));
                }

                //Order By AlertProviderItem Name
                var AlertProviderItems = retVal.AlertProviderItems.OrderBy(m => m.AlertProviderName).ToList();
                Session["_AlertProviderItemList_" + providerId] = AlertProviderItems;

                return(View(retVal.AlertProviderItems));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Unable to load Users' list! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <AlertProviderItemObj>()));
            }
        }
        public ActionResult Index(int?ExpenseRequisitionId)
        {
            try
            {
                ViewBag.Error = "";
                #region current user session check

                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <WorkflowItemObj>()));
                }

                #endregion

                var searchObjForUser = new UserSearchObj
                {
                    AdminUserId = userData.UserId,
                    Status      = -2,
                    StopDate    = "",
                    StartDate   = "",
                    UserId      = 0,
                };
                var retValForUsers = new PortalUserManager().LoadUsers(searchObjForUser, userData.Username);
                var usersList      = retValForUsers.Users.Where(m => m.Status == 1).ToList();
                Session["_usersList_"] = usersList;
                var searchObj = new  WorkflowItemSearchObj
                {
                    AdminUserId    = userData.UserId,
                    WorkflowItemId = 0,
                    Status         = -2,
                    StartDate      = "",
                    StopDate       = "",
                };
                var retVal = WorkflowItemServices.LoadWorkflowItems(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = " WorkflowItem list is empty!";
                    return(View(new List <WorkflowItemObj>()));
                }

                if (retVal.WorkflowItems == null || !retVal.WorkflowItems.Any())
                {
                    return(View(new List <WorkflowItemObj>()));
                }
                var WorkflowItems = retVal.WorkflowItems.OrderBy(m => m.WorkflowItemId).Where(x => x.ExpenseRequisitionId == ExpenseRequisitionId).ToList();
                return(View(WorkflowItems));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <WorkflowItemObj>()));
            }
        }
Exemplo n.º 12
0
        public ActionResult ChangeFirstTimePassword()
        {
            ViewBag.Error = "";
            var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
            var model    = new ChangePasswordContract {
                Username = User.Identity.Name, UserId = userData.UserId
            };

            return(View(model));
        }
Exemplo n.º 13
0
        public ActionResult Index()
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <SMSProviderObj>()));
                }

                if (Session["_SMSProviderList_"] is List <SMSProviderObj> mylist && mylist.Any())
                {
                    return(View(mylist));
                }

                var searchObj = new SMSProviderSearchObj
                {
                    AdminUserId   = userData.UserId,
                    SMSProviderId = 0,
                    Status        = 0
                };

                var retVal = SMSProviderService.LoadSMSProviders(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = "SMSProvider list is empty!";
                    return(View(new List <SMSProviderObj>()));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    ViewBag.Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage)
                        ? " SMSProvider list is empty!"
                        : retVal.Status.Message.FriendlyMessage;
                    return(View(new List <SMSProviderObj>()));
                }
                if (retVal.SMSProviders == null || !retVal.SMSProviders.Any())
                {
                    ViewBag.Error = "SMSProvider list is empty!";
                    return(View(new List <SMSProviderObj>()));
                }

                //Order By SMSProvider Name
                var SMSProviders = retVal.SMSProviders.OrderBy(m => m.Name).ToList();
                Session["_SMSProviderList_"] = SMSProviders;
                return(View(SMSProviders));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <SMSProviderObj>()));
            }
        }
        public JsonResult ProcessDeleteRequest(int clientId, int prodId, int itemId)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (clientId < 1 || prodId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Invalid / Empty Selection" }));
                }

                var passObj = new DeleteProductItemObj
                {
                    AdminUserId   = userData.UserId,
                    ProductItemId = itemId,
                };

                var response = ProductItemService.DeleteProductItem(passObj, User.Identity.Name);
                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = response.Status.Message.FriendlyMessage }));
                }

                var searchObj = new ProductItemSearchObj
                {
                    AdminUserId = userData.UserId,
                    ClientId    = clientId,
                    ProductId   = prodId,
                    Status      = -2,
                };

                var retVal = ProductItemService.LoadProductItems(searchObj, userData.Username);
                if (retVal?.Status != null && retVal.Status.IsSuccessful)
                {
                    if (retVal.ProductItems != null && retVal.ProductItems.Any())
                    {
                        Session[$"_myProductItemList_{prodId}"] = retVal.ProductItems;
                    }
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 15
0
        public JsonResult ProcessProfileUpdate(EditUserObj model)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (model.UserId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Invalid Email Address" }));
                }

                if (string.IsNullOrEmpty(model.FirstName) || model.FirstName.Length < 2)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "First Name must be at least 2 characters" }));
                }

                if (string.IsNullOrEmpty(model.LastName) || model.LastName.Length < 2)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Last Name must be at least 2 characters" }));
                }

                if (string.IsNullOrEmpty(model.MobileNumber) || model.MobileNumber.Length != 11)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Invalid Mobile Number" }));
                }

                model.AdminUserId = userData.UserId;
                var retVal = new PortalUserManager().ModifyUser(model, userData.Email);
                if (retVal == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Unable to update your profile at this time" }));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage) ? "Unable to update your profile at this time!" : retVal.Status.Message.FriendlyMessage }));
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 16
0
        public ActionResult Index()
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <ClientObj>()));
                }

                var searchObj = new ClientSearchObj
                {
                    AdminUserId = userData.UserId,
                    ClientId    = 0,
                    Status      = -2
                };

                var retVal = ClientService.LoadClients(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = "Client list is empty!";
                    return(View(new List <ClientObj>()));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    ViewBag.Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage)
                        ? " Client list is empty!"
                        : retVal.Status.Message.FriendlyMessage;
                    return(View(new List <ClientObj>()));
                }
                if (retVal.Clients == null || !retVal.Clients.Any())
                {
                    ViewBag.Error = "Client list is empty!";
                    return(View(new List <ClientObj>()));
                }

                //Order By Client Name
                var clients = retVal.Clients.OrderBy(m => m.ClientName).ToList();
                Session["_ClientList_"] = clients;
                return(View(clients));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <ClientObj>()));
            }
        }
        public ActionResult _ProductUserView(int clientId, int productId)
        {
            try
            {
                ViewBag.Error           = "";
                Session["_selUserIds_"] = new List <int>();
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <ClientUserObj>()));
                }
                var searchObj = new ClientUserSearchObj
                {
                    AdminUserId = userData.UserId,
                    ClientId    = clientId,
                    ProductId   = productId
                };

                var retVal = ClientService.LoadClientUsers(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = "Users' List is empty!";
                    return(View(new List <ClientUserObj>()));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    ViewBag.Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage)
                        ? "Users' list is empty!"
                        : retVal.Status.Message.FriendlyMessage;
                    return(View(new List <ClientUserObj>()));
                }
                if (retVal.ClientUsers == null || !retVal.ClientUsers.Any())
                {
                    ViewBag.Error = " Users' list is empty!";
                    return(View(new List <ClientUserObj>()));
                }

                Session["_selUserIds_"] = retVal.ClientUsers.Select(m => m.UserId).ToList();

                return(View(retVal.ClientUsers));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Unable to load Users' list! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <ClientUserObj>()));
            }
        }
        public JsonResult ProcessAddAlertProviderItemRequest(RegAlertProviderItemObj model)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (model == null)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (model.AlertProviderId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Kindly select valid Alert Provider" }));
                }

                if (model.AlertItemId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Kindly select valid Alert Item" }));
                }

                model.AdminUserId = userData.UserId;
                model.Status      = model.StatusVal ? 1 : 0;

                var response = AlertProviderItemService.AddAlertProviderItem(model, userData.Username);
                if (response?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.TechnicalMessage) ? "Process Failed! Unable to add nomination Source" : response.Status.Message.TechnicalMessage }));
                }

                Session["_AlertProviderItemList_" + model.AlertProviderId] = null;
                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 19
0
        public ActionResult _EditExpenseItemSetting(int ExpenseItemSettingId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";

                #region User Session Check

                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new ExpenseItemSettingObj()));
                }

                #endregion

                if (ExpenseItemSettingId < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View(new ExpenseItemSettingObj()));
                }

                if (!(Session["_ExpenseItemSettingList_"] is List <ExpenseItemSettingObj> ExpenseItemSettingList) || ExpenseItemSettingList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new ExpenseItemSettingObj()));
                }

                var ExpenseItemSetting = ExpenseItemSettingList.Find(m => m.ExpenseItemSettingId == ExpenseItemSettingId);
                if (ExpenseItemSetting == null || ExpenseItemSetting.ExpenseItemSettingId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new ExpenseItemSettingObj()));
                }

                Session["_CurrentSelExpenseItemSetting_"] = ExpenseItemSetting;

                ExpenseItemSetting.StatusVal = ExpenseItemSetting.Status == 1;
                return(View(ExpenseItemSetting));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new ExpenseItemSettingObj()));
            }
        }
Exemplo n.º 20
0
        public ActionResult Index()
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    ViewBag.Error = "Session Has Expired! Please Re-Login";
                    return(View(new List <RoleObj>()));
                }

                var searchObj = new RoleSearchObj
                {
                    AdminUserId = userData.UserId,
                    RoleId      = 0,
                    Status      = -200,
                };
                var retVal = new PortalRoleManager().LoadRoles(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    ViewBag.Error = "Role Item list is empty!";
                    return(View(new List <RoleObj>()));
                }

                if (!retVal.Status.IsSuccessful)
                {
                    ViewBag.Error = string.IsNullOrEmpty(retVal.Status.Message.FriendlyMessage)
                        ? "Role Item list is empty!"
                        : retVal.Status.Message.FriendlyMessage;
                    return(View(new List <RoleObj>()));
                }
                if (!retVal.Roles.Any())
                {
                    ViewBag.Error = "Role Item list is empty!";
                    return(View(new List <RoleObj>()));
                }

                var allRoles = retVal.Roles.OrderBy(m => m.RoleId).ToList();
                Session["_portalRoles"] = allRoles;
                return(View(allRoles));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new List <RoleObj>()));
            }
        }
Exemplo n.º 21
0
        private ProductItemObj getProductItemObj(int clientId, int prodId, int prodItem)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name);
                if (userData == null || userData.UserId < 1)
                {
                    return(new ProductItemObj());
                }

                if (userData.ClientProductList == null || !userData.ClientProductList.Any())
                {
                    return(new ProductItemObj());
                }

                var clients = new List <ProductItemObj>();
                foreach (var item in userData.ClientProductList)
                {
                    if (item.ClientInfo.ClientId == clientId)
                    {
                        var prodItemList = item.Products.Find(m => m.ProductInfo.ProductId == prodId);
                        if (prodItemList != null && prodItemList.ProductInfo.ProductId > 0)
                        {
                            clients.AddRange(prodItemList.ProductItems);
                            break;
                        }
                    }
                }

                if (!clients.Any())
                {
                    return(new ProductItemObj());
                }

                var product = clients.Find(c => c.ProductItemId == prodItem && c.Status == 1);
                if (product == null || product.ProductItemId < 1)
                {
                    return(new ProductItemObj());
                }

                return(product);
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(new ProductItemObj());
            }
        }
Exemplo n.º 22
0
        public JsonResult ProcessDeleteRequest(int id)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (id < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Invalid / Empty Selection" }));
                }
                var previousSMSProviderList = Session["_SMSProviderList_"] as List <SMSProviderObj>;
                if (previousSMSProviderList == null)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = true }));
                }

                var thisItem = previousSMSProviderList.Find(m => m.SMSProviderId == id);
                if (thisItem == null || thisItem.SMSProviderId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Selected item does not exist in the collection" }));
                }

                var passObj = new DeleteSMSProviderObj
                {
                    AdminUserId   = userData.UserId,
                    SMSProviderId = id
                };

                var response = SMSProviderService.DeleteSMSProvider(passObj, User.Identity.Name);
                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = response.Status.Message.FriendlyMessage }));
                }

                Session["_SMSProviderList_"] = null;
                return(Json(new { IsAuthenticated = true, IsSuccessful = true, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 23
0
        public static decimal GetretiredAmountByRequisitionId(long ExpenseRequisitionId)
        {
            try
            {
                #region Current Session Check
                var user     = System.Web.HttpContext.Current.User.Identity.Name;
                var userData = MvcApplication.GetUserData(user);
                if (userData == null || userData.UserId < 1)
                {
                    return(decimal.Zero);
                }


                #endregion
                var searchObj = new RetirementSearchObj
                {
                    AdminUserId  = userData.UserId,
                    RetirementId = 0,
                    StartDate    = "",
                    StopDate     = "",
                    VoucheNumber = "",
                    Status       = -1000
                };
                var retVal = RetirementServices.LoadRetirements(searchObj, userData.Username);
                if (retVal?.Status == null)
                {
                    return(decimal.Zero);
                }
                if (retVal.Retirements == null || !retVal.Retirements.Any())
                {
                    return(decimal.Zero);
                }
                var retirement = retVal.Retirements.SingleOrDefault(x => x.ExpenseRequisitionId == ExpenseRequisitionId);
                if (retirement == null)
                {
                    return(decimal.Zero);
                }
                return(retirement.AmountRetired);
            }
            catch (Exception ex)
            {
                return(decimal.Zero);
            }
        }
Exemplo n.º 24
0
        public JsonResult ProcessAddRoleRequest(string myRoleName, bool myRoleStatus)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (string.IsNullOrEmpty(myRoleName) || myRoleName.Length < 2)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid Role Name" }));
                }


                var passObj = new RegRoleObj
                {
                    Name        = myRoleName,
                    Status      = myRoleStatus ? 1 : 0,
                    AdminUserId = userData.UserId,
                };


                var response = new PortalRoleManager().AddRole(passObj, userData.Username);
                if (response?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.FriendlyMessage) ? "Process Failed! Unable to add role" : response.Status.Message.FriendlyMessage }));
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
Exemplo n.º 25
0
        public JsonResult ProcessAddClientUserRequest(RegClientUserObj model)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }


                if (model.ClientId < 1 || model.UserId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Invalid User Selection" }));
                }

                model.AdminUserId = userData.UserId;

                if (!GenericVal.Validate(model, out var msg))
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = $"Validation Error Occurred! Detail: {msg}" }));
                }


                var response = ClientService.AddClientUser(model, userData.Username);
                if (response?.Status == null)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Error Occurred! Please try again later" }));
                }

                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = string.IsNullOrEmpty(response.Status.Message.TechnicalMessage) ? "Process Failed! Unable to add course of study" : response.Status.Message.TechnicalMessage }));
                }

                return(Json(new { IsAuthenticated = true, IsSuccessful = true, IsReload = false, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }
        public ActionResult _EditBeneficiary(int BeneficiaryId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new BeneficiaryObj()));
                }
                if (BeneficiaryId < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View(new BeneficiaryObj()));
                }

                if (!(Session["_BeneficiaryList_"] is List <BeneficiaryObj> BeneficiaryList) || BeneficiaryList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new BeneficiaryObj()));
                }

                var Beneficiary = BeneficiaryList.Find(m => m.BeneficiaryId == BeneficiaryId);
                if (Beneficiary == null || Beneficiary.BeneficiaryId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new BeneficiaryObj()));
                }

                Session["_CurrentSelBeneficiary_"] = Beneficiary;

                Beneficiary.StatusVal = Beneficiary.Status == 1;
                return(View(Beneficiary));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new BeneficiaryObj()));
            }
        }
        public ActionResult _EditRequestTypeSetting(int RequestTypeSettingId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new RequestTypeSetting()));
                }
                if (RequestTypeSettingId < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View(new RequestTypeSetting()));
                }

                if (!(Session["_RequestTypeSettingList_"] is List <RequestTypeSetting> RequestTypeSettingList) || RequestTypeSettingList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new RequestTypeSetting()));
                }

                var RequestTypeSetting = RequestTypeSettingList.Find(m => m.RequestTypeSettingId == RequestTypeSettingId);
                if (RequestTypeSetting == null || RequestTypeSetting.RequestTypeSettingId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new RequestTypeSetting()));
                }

                Session["_CurrentSelRequestTypeSetting_"] = RequestTypeSetting;

                // RequestTypeSetting.StatusVal = RequestTypeSetting.Status == 1;
                return(View(RequestTypeSetting));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new RequestTypeSetting()));
            }
        }
Exemplo n.º 28
0
        public ActionResult EditWorkflowSetting(int WorkflowSettingId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View("EditWorkflowSetting", new WorkflowSettingObj()));
                }
                if (WorkflowSettingId < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View("EditWorkflowSetting", new WorkflowSettingObj()));
                }

                if (!(Session["_WorkflowSettingList_"] is List <WorkflowSettingObj> WorkflowSettingList) || WorkflowSettingList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View("EditWorkflowSetting", new WorkflowSettingObj()));
                }

                var WorkflowSetting = WorkflowSettingList.Find(m => m.WorkflowSettingId == WorkflowSettingId);
                if (WorkflowSetting == null || WorkflowSetting.WorkflowSettingId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View("EditWorkflowSetting", new WorkflowSettingObj()));
                }

                Session["_CurrentSelWorkflowSetting_"] = WorkflowSetting;

                WorkflowSetting.StatusVal = WorkflowSetting.Status == 1 ? true : false;
                return(View(WorkflowSetting));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View("EditWorkflowSetting", new WorkflowSettingObj()));
            }
        }
Exemplo n.º 29
0
        public ActionResult _EditSMSProvider(int id)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new SMSProviderObj()));
                }
                if (id < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View(new SMSProviderObj()));
                }

                if (!(Session["_SMSProviderList_"] is List <SMSProviderObj> SMSProviderList) || SMSProviderList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new SMSProviderObj()));
                }

                var SMSProvider = SMSProviderList.Find(m => m.SMSProviderId == id);
                if (SMSProvider == null || SMSProvider.SMSProviderId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new SMSProviderObj()));
                }

                Session["_CurrentSelSMSProvider_"] = SMSProvider;

                SMSProvider.StatusVal = SMSProvider.Status == 1;
                return(View(SMSProvider));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new SMSProviderObj()));
            }
        }
Exemplo n.º 30
0
        public ActionResult _EditClient(int clientId)
        {
            try
            {
                ViewBag.Error        = "";
                ViewBag.SessionError = "";
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();
                if (userData.UserId < 1)
                {
                    ViewBag.SessionError = "Your session has expired! Please re-login";
                    return(View(new ClientObj()));
                }
                if (clientId < 1)
                {
                    ViewBag.Error = "Invalid selection";
                    return(View(new ClientObj()));
                }

                if (!(Session["_ClientList_"] is List <ClientObj> clientList) || clientList.Count < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new ClientObj()));
                }

                var client = clientList.Find(m => m.ClientId == clientId);
                if (client == null || client.ClientId < 1)
                {
                    ViewBag.Error = "Error Occurred! Unable to process selected item";
                    return(View(new ClientObj()));
                }

                Session["_CurrentSelClient_"] = client;

                client.StatusVal = client.Status == 1;
                return(View(client));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error Occurred! Please try again later";
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(View(new ClientObj()));
            }
        }