public void AuthenticateUser(ref AuthenticationModel authenticationModel, ref string sMsjError) { #region Local variables string sNombreTabla, sNombreSP, sEncryptedPass = authenticationModel.UserPassword; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); EncryptionViewModel encryptionViewModel = new EncryptionViewModel(); #endregion encryptionViewModel.EncryptString(ref sEncryptedPass); dbViewModel.GenerarDataTableParametros(ref dbModel); DataRow dr1 = dbModel.dtParametros.NewRow(); dr1["Nombre"] = "@email"; dr1["TipoDato"] = "4"; dr1["Valor"] = authenticationModel.UserName; DataRow dr2 = dbModel.dtParametros.NewRow(); dr2["Nombre"] = "@s_contrasena"; dr2["TipoDato"] = "4"; dr2["Valor"] = sEncryptedPass; dbModel.dtParametros.Rows.Add(dr1); dbModel.dtParametros.Rows.Add(dr2); sNombreTabla = (App.Current as App).TblAuthentication.ToString(); sNombreSP = (App.Current as App).SpAuthentication.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; authenticationModel.UserProfile = String.Empty; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { authenticationModel.UserProfile = dbModel.DS.Tables[sNombreTabla].Rows[0][0].ToString(); if (authenticationModel.UserProfile == "Invalid Credentials") { authenticationModel.IsErrorMessageVisible = true; authenticationModel.UserProfile = ""; } } else { authenticationModel.UserProfile = string.Empty; authenticationModel.IsErrorMessageVisible = true; } } }
public void LoadServices(ref string sMsjError, ref CasesModel casesModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion dbViewModel.GenerarDataTableParametros(ref dbModel); DataRow dr1 = dbModel.dtParametros.NewRow(); dr1["Nombre"] = "@id_area"; dr1["TipoDato"] = "9"; dr1["Valor"] = casesModel.IdServiceArea; dbModel.dtParametros.Rows.Add(dr1); sNombreTabla = (App.Current as App).TblServices.ToString(); sNombreSP = (App.Current as App).SpListServices.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { casesModel.DataTableServices = dbModel.DS.Tables[sNombreTabla]; if (casesModel.ServicesList is null) { casesModel.ServicesList = new List <CasesModel>(); } else { casesModel.ServicesList.Clear(); } for (int i = 0; i < casesModel.DataTableServices.Rows.Count; i++) { CasesModel service = new CasesModel(); service.IdCaseService = Convert.ToInt16(casesModel.DataTableServices.Rows[i]["ID_SERVICIO"]); service.IdServiceArea = Convert.ToInt16(casesModel.DataTableServices.Rows[i]["ID_AREA"]); service.DescriptionCaseService = casesModel.DataTableServices.Rows[i]["NOMBRE"].ToString(); casesModel.ServicesList.Add(service); } } } }
public void LoadUserRoles(ref string sMsjError, ref UsersModel usersModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion //dbViewModel.GenerarDataTableParametros(ref dbModel); //DataRow dr1 = dbModel.dtParametros.NewRow(); //dr1["Nombre"] = "@email"; //dr1["TipoDato"] = "4"; //dr1["Valor"] = authenticationModel.UserName; //DataRow dr2 = dbModel.dtParametros.NewRow(); //dr2["Nombre"] = "@s_contrasena"; //dr2["TipoDato"] = "4"; //dr2["Valor"] = sEncryptedPass; //dbModel.dtParametros.Rows.Add(dr1); //dbModel.dtParametros.Rows.Add(dr2); sNombreTabla = (App.Current as App).TblProfiles.ToString(); sNombreSP = (App.Current as App).SpListProfiles.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { usersModel.DataTableProfiles = dbModel.DS.Tables[sNombreTabla]; usersModel.ProfilesList = new List <UsersModel>(); for (int i = 0; i < usersModel.DataTableProfiles.Rows.Count; i++) { UsersModel profile = new UsersModel(); profile.UserProfileId = Convert.ToInt32(usersModel.DataTableProfiles.Rows[i][0]); profile.UserProfileName = usersModel.DataTableProfiles.Rows[i][1].ToString(); usersModel.ProfilesList.Add(profile); } } } }
public void LoadCasesStatus(ref string sMsjError, ref CasesModel casesModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion dbViewModel.GenerarDataTableParametros(ref dbModel); sNombreTabla = (App.Current as App).TblStatus.ToString(); sNombreSP = (App.Current as App).SpListPossibleCaseStatus.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { casesModel.DataTableStatus = dbModel.DS.Tables[sNombreTabla]; if (casesModel.StatusList is null) { casesModel.StatusList = new List <CasesModel>(); } else { casesModel.StatusList.Clear(); } for (int i = 0; i < casesModel.DataTableStatus.Rows.Count; i++) { CasesModel status = new CasesModel(); status.IdCaseStatus = Convert.ToInt16(casesModel.DataTableStatus.Rows[i]["ID_ESTADO"]); status.DescriptionCaseStatus = casesModel.DataTableStatus.Rows[i]["NOMBRE_ESTADO"].ToString(); casesModel.StatusList.Add(status); } } } }