public ActionResult CheckUserIDAvailability(string UserID) { ResponseModel Result = new ResponseModel(); UserModel userModel = new UserModel(); Result.FailedWithoutException(); try { Result = userModel.CheckUserIDAvailability(UserID); } catch (Exception ex) { Result.FailedWithException(); } if (userModel.isUserIDAvailable) { return(Json(new { success = true, isUserIDAvailable = true })); } else { return(Json(new { success = false, isUserIDAvailable = false })); } }
public ResponseModel setLicenseVariables(out LicenseModel License) { string sFunctionName = "setLicenseVariables()"; ResponseModel Response = new ResponseModel(); //LicenseModel License = new LicenseModel(); License = new LicenseModel(); try { License.OrganizationName = OrganizationModel.Name; License.OrganizationMnemonic = OrganizationModel.Mnemonic; License.ProductionYear = OrganizationModel.ProdutionYear; License.TotalBranches = OrganizationModel.TotalBranches; Response.SuccessfullyPassed(); } catch (Exception ex) { #region Text Logging oLog.Log( sClassName, sFunctionName, ex.ToString()); #endregion Text Logging Response.FailedWithException(); } return(Response); }
public ActionResult AddUser(UserModel userModel) { ResponseModel Result = new ResponseModel(); Result.FailedWithoutException(); try { Result = userModel.AddUserLoginAndUserProfile(); } catch (Exception ex) { Result.FailedWithException(); } if (Result.isSuccessful) { return(Json(new { success = true, ResponseMessage = "User " + userModel.UserID + " successfully added." })); } else { return(Json(new { success = false, ResponseMessage = "User " + userModel.UserID + " failed to add." })); } }
public ResponseModel LoadChildMenuItemsList(List <UserModel.UserPermission> UserPermissions) { string sFunctionName = "LoadChildMenuItemsList"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.LoadChildMenuItemsList(UserPermissions); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ResponseModel GetUserPermissions(UserModel userModel) { string sFunctionName = "GetUserPermissions"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.GetUserPermissions(userModel); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ResponseModel ValidateUserLogin(string UserID, string Password) { string sFunctionName = "ValidateUserLogin"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.AuthenticateUserLogin(UserID, Password); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ActionResult AddUserLevel(UserLevelModel userLevel) //public ActionResult AddUserLevel(string model) { string sFunctionName = "AddUserLevel()"; //UserLevelModel userLevel = (UserLevelModel)JsonConvert.DeserializeObject(model); ResponseModel Result = new ResponseModel(); try { Result = userLevel.AddUserLevel(userLevel.UserTypeID, userLevel.UserLevelName); if (Result.isSuccessful) { return(Json(new { ResponseMessage = "User Level \"" + userLevel.UserLevelName + "\" Successfully Added.", success = true })); //return RedirectToAction(Constants.WebPageAction.AddUserLevelDone, Constants.WebPageController.UserManagement, userLevel); } else { return(Json(new { ResponseMessage = "User Level \"" + userLevel.UserLevelName + "\" already exist.", success = false })); //return RedirectToAction(Constants.WebPageAction.Index, Constants.WebPageController.Error); } } catch (Exception ex) { Result.FailedWithException(); return(Json(new { ResponseMessage = "User Level \"" + userLevel.UserLevelName + "\" Failed to Add.", success = false })); } }
protected void btnLogin_Click(object sender, EventArgs e) { string sFunctionName = "btnLogin_Click(,)"; ResponseModel Result = new ResponseModel(); try { Result = Web.ValidateUserLogin(tbUserID.Text.Trim(), tbPassword.Text); if (Result.isSuccessful) { Response.Redirect("~/UI/Home.aspx"); } else { Response.Redirect("~/UI/Sample4.aspx"); } } catch (Exception ex) { Result.FailedWithException(); } }
public ActionResult SearchUsers(UserModel userModel) { string sFunctionName = "SearchUsers()"; ResponseModel Result = new ResponseModel(); Result.FailedWithoutException(); try { Result = userModel.SearchUsersByFilter(); if (userModel.FilteredUsersList.Count() > 0) { return(Json(new { UsersList = JsonConvert.SerializeObject(userModel.FilteredUsersList), ResponseMessage = "Results Found.", success = true })); } else { return(Json(new { ResponseMessage = "Your search did not return any results.", success = false })); } } catch (Exception ex) { Result.FailedWithException(); return(Json(new { ResponseMessage = "Failed to fetch the results. Please try again.", success = false })); } }
public ActionResult AddUserType(UserTypeModel userType) { string sFunctionName = "AddUserType()"; ResponseModel Result = new ResponseModel(); try { Result = userType.AddUserType(userType.UserTypeName); if (Result.isSuccessful) { return(Json(new { success = true, ResponseMessage = "User Type \"" + userType.UserTypeName + "\" Successfully Added." })); //return RedirectToAction(Constants.WebPageAction.AddUserTypeDone, Constants.WebPageController.UserManagement, userType); } else { return(Json(new { success = true, ResponseMessage = "User Type \"" + userType.UserTypeName + "\" Already exist." })); //return RedirectToAction(Constants.WebPageAction.Index, Constants.WebPageController.Error); } } catch (Exception ex) { Result.FailedWithException(); return(Json(new { success = true, ResponseMessage = "User Type \"" + userType.UserTypeName + "\" Failed to Add." })); } }
public bool ValidateLicense() { string sFunctionName = "ValidateLicense()"; bool isLicenseValidated = false; #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Validate License Procedure Initiated."); #endregion Text Logging ResponseModel Response = new ResponseModel(); try { LicenseStructure LicenseStructure = new LicenseStructure(); LicenseModel LicenseModel; if (ApplicationWrapper.OrganizationModel != null) { LicenseStructure.OrganizationModel = ApplicationWrapper.OrganizationModel; } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Organization Model is null."); #endregion Text Logging } Response = LicenseStructure.setLicenseVariables(out LicenseModel); if (Response.isSuccessful) { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "License Details fetched. Going to Validate License"); #endregion Text Logging if (LicenseModel != null) { bool LicensesSet = LicenseModel.setLicenses(); if (LicensesSet) { if (LicenseModel.LicenseHash == ApplicationWrapper.OrganizationModel.LicenseHash) { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "License Details Validated Successfully."); #endregion Text Logging isLicenseValidated = true; } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Invalid License Details. License Mismatch"); #endregion Text Logging isLicenseValidated = false; } } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Invalid License Details."); #endregion Text Logging } } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Failed to fetch License details."); #endregion Text Logging } } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Failed to load license details."); #endregion Text Logging } } catch (Exception ex) { #region Text Logging oLog.Log( sClassName, sFunctionName, ex.ToString()); #endregion Text Logging Response.FailedWithException(); } return(isLicenseValidated); }
public ResponseModel setOrganization() { string sFunctionName = "setOrganization()"; #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Going to fetch Organization Configuration."); #endregion Text Logging ResponseModel Response = new ResponseModel(); try { //OrganizationStructure OrganizationStruct = new OrganizationStructure(); //Response = OrganizationStruct.setOrganization(); OrganizationModel OrganizationModel = new OrganizationModel(); OrganizationModel.Initialize(); if (OrganizationModel != null) { bool LicenseHashSet = OrganizationModel.setLicenseHash(); if (LicenseHashSet) { ApplicationWrapper.OrganizationModel = OrganizationModel; Response.SuccessfullyPassed(); } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Failed to Set Licenses."); #endregion Text Logging Response.FailedWithoutException(); } } else { #region Text Logging MvcApplication.oLog.Log( sClassName, sFunctionName, "Failed to fetch Organization Configuration."); #endregion Text Logging Response.FailedWithoutException(); } } catch (Exception ex) { #region Text Logging oLog.Log( sClassName, sFunctionName, ex.ToString()); #endregion Text Logging Response.FailedWithException(); } return(Response); }