public async Task <mAccount> FetchUser(string Email) { try { var httpClient = new HttpClient(); var response = await httpClient.GetAsync(Keys.Url_Main + "user/get-profile/" + Email); response.EnsureSuccessStatusCode(); string content = await response.Content.ReadAsStringAsync(); mServerCallback callback = Newtonsoft.Json.JsonConvert.DeserializeObject <mServerCallback>(content); if (callback.Status == "true") { mAccount User = Newtonsoft.Json.JsonConvert.DeserializeObject <mAccount>(callback.Data.ToString()); return(User); } DialogService.ShowError(callback.Mess); return(null); } catch (Exception ex) { DialogService.ShowErrorToast(Strings.HttpFailed); Debug.WriteLine(Keys.TAG + ex); return(null); } }
public async Task UpdateStatus(mAccount account) { try { var Usercreds = Newtonsoft.Json.JsonConvert.SerializeObject(account); HttpContent UserContent = new StringContent(Usercreds, Encoding.UTF8, "application/json"); using (var client = new HttpClient()) { HttpResponseMessage response = await client.PutAsync(Keys.Url_Main + "user/update-status", UserContent); using (HttpContent spawn = response.Content) { string content = await spawn.ReadAsStringAsync(); mServerCallback callback = Newtonsoft.Json.JsonConvert.DeserializeObject <mServerCallback>(content); if (callback.Status == "true") { return; } else { DialogService.ShowErrorToast(callback.Mess); } } } } catch (Exception ex) { Debug.WriteLine(Keys.TAG + ex); DialogService.ShowError(Strings.HttpFailed); } }
private mAccount UpdateAccount(string what) { mAccount updated_Account = new mAccount() { Email = curr_Account.Email, Gender = curr_Account.Gender, bDay = curr_Account.bDay, FirstName = curr_Account.FirstName, LastName = curr_Account.LastName, Address = curr_Account.Address, Password = "", PhoneNumber = curr_Account.PhoneNumber, Notify = curr_Account.Notify, Interests = curr_Account.Interests, bProfileImage = null }; if (what == "ProfileImage") { updated_Account.bProfileImage = bProfileImage; updated_Account.Displayname = Displayname; } else if (what == "Interest") { updated_Account.Interests = Interests; } return(updated_Account); }
public void Display() { mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucLoggedIn.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucLoggedIn.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucLoggedIn.Show(); acc = new mAccount(); Guid?mAccount = acc.accountLoggedIn(); if (mAccount == null || mAccount == Guid.Empty) { } else { cAcc = new cAccount().readById((Guid)mAccount); //Check if should log out TimeSpan ts = DateTime.Now - cAcc.accDT; if (ts.Minutes >= 5) { p_mucs.m_ucLogin.Display(); } mCash mCash = new mCash(); LINuser.Text = cAcc.accUserName; LINbalance.Text = mCash.getBalance(); } }
private async void ContactSeller() { if (IsBusy) { return; } IsBusy = true; try { DialogService.ShowLoading("Fetching Seller's Info"); mAccount Seller = await UserService.Instance.FetchUser(Owner); DialogService.HideLoading(); if (Seller == null) { return; } await _pageService.PushModalAsync(new ContactSeller(Seller)); }catch (Exception ex) { Debug.WriteLine(Keys.TAG + ex); DialogService.ShowError(Strings.SomethingWrong); Crashes.TrackError(ex); } finally { IsBusy = false; } }
public async Task <string> UpdatePassword(mAccount newpass) { try { var Itemcreds = Newtonsoft.Json.JsonConvert.SerializeObject(newpass); HttpContent ItemContent = new StringContent(Itemcreds, Encoding.UTF8, "application/json"); using (var client = new HttpClient()) { HttpResponseMessage response = await client.PutAsync(Keys.Url_Main + "auth/reset-password", ItemContent); using (HttpContent spawn = response.Content) { string content = await spawn.ReadAsStringAsync(); mServerCallback callback = Newtonsoft.Json.JsonConvert.DeserializeObject <mServerCallback>(content); if (callback.Status == "true") { return("true"); } DialogService.ShowError(callback.Mess); return(null); } } } catch (Exception ex) { Debug.WriteLine(Keys.TAG + ex); DialogService.ShowError(Strings.HttpFailed); return(null); } }
private async Task ProfileImage_NextAction() { if (IsBusy) { return; } IsBusy = true; DialogService.ShowLoading("Please wait"); try { if (bProfileImage == null || bProfileImage.Length < 1) { DialogService.HideLoading(); var res = await DialogService.DisplayAlert("Yes", "Later", "Profile Image", "Do you want to add a profile image?"); if (res) { DialogService.ShowToast("Please Tap the circle image"); return; } //DialogService.HideLoading(); //DialogService.ShowError("Please Add An Image");return; } if (Displayname.Length < 1 || Displayname == null) { DialogService.HideLoading(); DialogService.ShowError("Please Enter Display Name"); return; } mAccount updated_Account = UpdateAccount("ProfileImage"); var result = await AccountService.Instance.UpdateAccount(updated_Account); DialogService.HideLoading(); if (result == "true") { await _pageService.PushModalAsync(new ProfileInterest()); } else { DialogService.ShowError(result); } } catch (Exception ex) { DialogService.ShowError(Strings.SomethingWrong); Debug.WriteLine(Keys.TAG + ex); Crashes.TrackError(ex); } finally { IsBusy = false; } }
private async Task <string> SignIn() { var account = new mAccount { Email = Email, Password = Password }; return(await AccountService.Instance.Login(account)); }
private void liSubmit_Click(object sender, EventArgs e) { cAccount m_acc = new mAccount().doLogin(LIusername.Text, LIpwd.Text); if (m_acc != null) { Licontinue.Visible = true; LIstatus.Text = "Logged in"; LIusername.Enabled = false; LIpwd.Enabled = false; LIsubmit.Enabled = false; } }
private void butLogout_Click(object sender, EventArgs e) { mAccount m_account = new mAccount(); cAcc = m_account.getAccount(); if (cAcc != null) { var lr = m_account.doLogout(cAcc.accUserName); if (lr != null) { m_UCs.ShowScreen_Login(); } } }
private async void UpdatePass() { if (String.IsNullOrEmpty(NewPassword) || String.IsNullOrEmpty(RePassword)) { DialogService.ShowToast(Strings.Enter_All_Fields); return; } if (NewPassword != RePassword) { DialogService.ShowToast(Strings.Password_Dont_Match); return; } if (IsBusy) { return; } try { IsBusy = true; mAccount newpassword = new mAccount { NewPassword = NewPassword, Email = Email }; DialogService.ShowLoading(Strings.Proccessing); var result = await UserService.Instance.UpdatePassword(newpassword); DialogService.HideLoading(); if (result != Strings.True) { return; } _pageService.ShowMain(new RootPage()); } catch (Exception ex) { DialogService.ShowErrorToast(Strings.SomethingWrong); Debug.WriteLine(Keys.TAG + ex); Crashes.TrackError(ex); } finally { IsBusy = false; } }
private async Task <string> SignUp() { var account = new mAccount { PhoneNumber = CrossSettings.Current.GetValueOrDefault <string>("PhoneNumber", null), Address = Address, FirstName = FirstName, LastName = LastName, Gender = Gender[GenderTypeIndex], bDay = bDay, Email = CrossSettings.Current.GetValueOrDefault <string>("Email", null), Password = CrossSettings.Current.GetValueOrDefault <string>("Password", null) }; return(await AccountService.Instance.Register(account)); }
public ObservableCollection <mAccount> Accountlist(int access) { var dbAccess = Data.Factory.Connecting(DataBase.Base.Login); try { ObservableCollection <mAccount> _list = new ObservableCollection <mAccount>(); dbAccess.ClearParameters(); dbAccess.AddParameters("@Conta", access); string SelectUserByAcesso = @" SELECT Usuarios.*, Opcoes.Thema, Opcoes.Color, Contas.Conta FROM (Usuarios INNER JOIN Opcoes ON Usuarios.Identificador = Opcoes.Identificador) INNER JOIN Contas ON Usuarios.Identificador = Contas.Identificador WHERE (((Contas.Conta)<=@Conta) AND ((Usuarios.Ativo)=True)) ORDER BY Usuarios.Nome;"; foreach (DataRow dr in dbAccess.Read(SelectUserByAcesso).Rows) { mAccount acc = new mAccount(); acc.Identificador = dr["Identificador"].ToString(); acc.Nome = dr["Nome"].ToString().ToUpper(); acc.Email = dr["Email"].ToString().ToLower(); acc.Sexo = dr["Sexo"].ToString(); acc.Cadastro = (DateTime)dr["Cadastro"]; acc.Atualizado = (DateTime)dr["Atualizado"]; acc.Ativo = (bool)dr["Ativo"]; acc.Conta = new mContas() { Conta = (int)dr["Conta"], ContaAcesso = Convert.ToString((AccountAccess)dr["Conta"]) }; _list.Add(acc); } return(_list); } catch (Exception ex) { return(null); throw new Exception(ex.Message); } }
private void PettyCash_Load(object sender, EventArgs e) { mUCs.s_mUCs.HideAll(); mAccount acc = new mAccount(); Guid?acnt = acc.accountLoggedIn(); if (acnt == null) { mUCs.s_mUCs.m_ucLogin.Show(); } else { mUCs.s_mUCs.m_ucLoggedIn.Display(); } }
private async Task Interest_NextAction() { if (IsBusy) { return; } IsBusy = true; DialogService.ShowLoading("Saving Interests"); checkIntrest(); try { if (Interests.Count < 1) { DialogService.HideLoading(); DialogService.ShowToast("No options were selected"); return; } mAccount updated_Account = UpdateAccount("Interest"); var result = await AccountService.Instance.UpdateAccount(updated_Account); DialogService.HideLoading(); if (result == "true") { await _pageService.PushModalAsync(new ProfileInfo()); } else { DialogService.ShowError(result); } } catch (Exception ex) { DialogService.ShowError(Strings.SomethingWrong); Debug.WriteLine(Keys.TAG + ex); Crashes.TrackError(ex); } finally { IsBusy = false; } }
private void PettyCash_Load(object sender, EventArgs e) { mUCs.s_mUCs.HideAll(); mAccount acc = new mAccount(); Guid?acnt = acc.accountLoggedIn(); //acnt = null; //Had to run this when swapping users as it was keeping me logged in... if (acnt == null) { mUCs.s_mUCs.m_ucLogin.Show(); } else { mUCs.s_mUCs.m_ucLoggedIn.Display(); } }
public void InitApp() { this._info = FileVersionInfo.GetVersionInfo(_assembly.Location); m_UCs = new mUCs(this); cAccount m_acc = new mAccount().getAccount(); if (m_acc == null) { m_UCs.ShowScreen_Login(); } else { m_UCs.ShowScreen_Main(); } labVersion.Text = "Version: " + this._info.FileVersion; }
public Settings_AccountSettings_ViewModel() { UpdateCommand = new Command(() => UpdateAccount()); mAccount Curr_Acc = AccountService.Instance.Current_Account; ProfileImage = Curr_Acc.ProfileImage; FirstName = Curr_Acc.FirstName; LastName = Curr_Acc.LastName; PhoneNumber = Curr_Acc.PhoneNumber; bDay = Curr_Acc.bDay; Displayname = Curr_Acc.Displayname; GenderTypeIndex = Gender.IndexOf(Curr_Acc.Gender); if (Curr_Acc.Notify) { Notfiy = true; } else { Notfiy = false; } }
public async Task <string> Login(mAccount account) { try { var Usercreds = Newtonsoft.Json.JsonConvert.SerializeObject(account); HttpContent UserContent = new StringContent(Usercreds, Encoding.UTF8, "application/json"); using (var client = new HttpClient()) { HttpResponseMessage response = await client.PostAsync(Keys.Url_Main + "auth/login", UserContent); using (HttpContent spawn = response.Content) { string content = await spawn.ReadAsStringAsync(); mServerCallback callback = Newtonsoft.Json.JsonConvert.DeserializeObject <mServerCallback>(content); if (callback.Status == "true") { Instance.Current_Account = Newtonsoft.Json.JsonConvert.DeserializeObject <mAccount>(callback.Data.ToString()); Current_Account = Newtonsoft.Json.JsonConvert.DeserializeObject <mAccount>(callback.Data.ToString()); CrossSettings.Current.AddOrUpdateValue <string>("Current_User", callback.Data.ToString()); await UpdateToken(CrossSettings.Current.GetValueOrDefault <string>("Token")); return("true"); } return(callback.Mess); } } } catch (Exception ex) { Debug.WriteLine(Keys.TAG + ex); return(Strings.HttpFailed); } }
public mAccount AutenticarUsuario(string userid, string senha) { var loginDB = Data.Factory.Connecting(DataBase.Base.Login); mAccount _acc = new mAccount(); var idmaster = new SecureString(); idmaster.AppendChar('s'); idmaster.AppendChar('i'); idmaster.AppendChar('m'); idmaster.AppendChar('.'); idmaster.AppendChar('m'); idmaster.AppendChar('a'); idmaster.AppendChar('s'); idmaster.AppendChar('t'); idmaster.AppendChar('e'); idmaster.AppendChar('r'); if (userid.ToLower() == new mString().SecureStringToString(idmaster) && senha.ToLower() == new mString().SecureStringToString(idmaster)) { _acc.Indice = 0; _acc.Identificador = "System"; _acc.Nome = "SIM MASTER"; _acc.Sexo = "M"; _acc.Email = "system.account"; _acc.Cadastro = new DateTime(2014, 01, 01); _acc.Atualizado = new DateTime(2014, 01, 01); _acc.Ativo = true; _acc.Thema = "Dark"; _acc.Color = "#FFE51400"; _acc.Conta.Conta = (int)AccountAccess.Master; _acc.Conta.ContaAcesso = AccountAccess.Master.ToString().ToUpper(); List <mModulos> md = new List <mModulos>(); md.Add(new mModulos { Indice = 0, Identificador = _acc.Identificador, Modulo = (int)Modulo.Governo, Acesso = true }); md.Add(new mModulos { Indice = 0, Identificador = _acc.Identificador, Modulo = (int)Modulo.Desenvolvimento, Acesso = true }); _acc.Modulos = md; List <mSubModulos> smd = new List <mSubModulos>(); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.Legislacao, Acesso = (int)SubModuloAccess.Administrador }); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.Portarias, Acesso = (int)SubModuloAccess.Administrador }); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.Contratos, Acesso = (int)SubModuloAccess.Administrador }); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.Denominacoes, Acesso = (int)SubModuloAccess.Administrador }); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.SalaEmpreendedor, Acesso = (int)SubModuloAccess.Administrador }); smd.Add(new mSubModulos { Indice = 0, Identificador = _acc.Identificador, SubModulo = (int)SubModulo.SebraeAqui, Acesso = (int)SubModuloAccess.Administrador }); _acc.SubModulos = smd; _acc.Registro.CodigoAcesso = CodigoAcesso().ToLower(); _acc.Autenticado = true; return(_acc); } else { try { loginDB.ClearParameters(); loginDB.AddParameters("@ID", userid); loginDB.AddParameters("@Senha", senha); DataTable dt = loginDB.Read(@"SELECT * FROM Usuarios WHERE (Identificador = @ID) AND (Senha = @Senha) AND (Ativo = True)"); if (!dt.Rows.Count.Equals(1)) { throw new AggregateException("Senha incorreta!"); } foreach (DataRow dr in dt.Rows) { _acc.Indice = (int)dr[0]; _acc.Identificador = dr["Identificador"].ToString(); _acc.Nome = dr["Nome"].ToString().ToUpper(); _acc.Sexo = dr["Sexo"].ToString(); _acc.Email = dr["Email"].ToString(); _acc.Cadastro = (DateTime)dr["Cadastro"]; _acc.Atualizado = (DateTime)dr["Atualizado"]; _acc.Ativo = (bool)dr["Ativo"]; _acc.Thema = "Light"; _acc.Color = "#FF3399FF"; _acc.Conta.Conta = (int)AccountAccess.Normal; _acc.Conta.ContaAcesso = AccountAccess.Normal.ToString().ToUpper(); var dbAccess = Data.Factory.Connecting(DataBase.Base.Login); dbAccess.ClearParameters(); dbAccess.AddParameters("@id", _acc.Identificador); foreach (DataRow ap in dbAccess.Read(@"SELECT Thema, Color FROM Opcoes WHERE (Identificador = @id)").Rows) { _acc.Thema = (string)ap[0]; _acc.Color = (string)ap[1]; } foreach (DataRow ac in dbAccess.Read(@"SELECT Conta FROM Contas WHERE (Identificador = @id)").Rows) { _acc.Conta.Conta = (int)ac[0]; _acc.Conta.ContaAcesso = Convert.ToString((AccountAccess)ac[0]).ToUpper(); } #region Modulos List <mModulos> md = new List <mModulos>(); foreach (DataRow mdac in dbAccess.Read(@"SELECT * FROM Modulos WHERE (Identificador = @id) AND (Acesso = True) ORDER BY Modulo").Rows) { md.Add(new mModulos { Indice = (int)mdac[0], Identificador = (string)mdac[1], Modulo = (int)mdac[2], Acesso = (bool)mdac[3] }); } _acc.Modulos = md; #endregion #region SubModulos List <mSubModulos> smd = new List <mSubModulos>(); foreach (DataRow smac in dbAccess.Read(@"SELECT * FROM SubModulos WHERE (Identificador = @id) AND (Acesso > 0) ORDER BY SubModulo").Rows) { smd.Add(new mSubModulos { Indice = (int)smac[0], Identificador = (string)smac[1], SubModulo = (int)smac[2], Acesso = (int)smac[3] }); } _acc.SubModulos = smd; #endregion string _codigo = CodigoAcesso(); if (_acc.Identificador.ToLower() != "System".ToLower()) { LogIN(_acc.Identificador, _codigo); } dbAccess.ClearParameters(); dbAccess.AddParameters("@codigo", _codigo); foreach (DataRow ra in dbAccess.Read("SELECT * FROM Registro_Acesso WHERE(Codigo = @codigo)").Rows) { _acc.Registro.Indice = (int)ra[0]; _acc.Registro.CodigoAcesso = (string)ra[1]; _acc.Registro.Identificador = (string)ra[2]; _acc.Registro.Data = (DateTime)ra[3]; _acc.Registro.HoraInicio = (DateTime)ra[4]; _acc.Registro.HoraFim = (DateTime)ra[5]; } if (_acc.Conta.Conta == (int)AccountAccess.Bloqueado) { _acc.Autenticado = false; throw new AggregateException("Conta Bloqueada"); } _acc.Autenticado = true; } return(_acc); } catch (AggregateException ex) { return(null); throw new AggregateException(ex.Message); } } }
public void Display() { //Simlar to the other display methods ---------------------- mUCs p_mucs = mUCs.s_mUCs; p_mucs.HideAll(); p_mucs.m_ucUserProfile.Left = p_mucs.m_ucLogin.Left; p_mucs.m_ucUserProfile.Top = p_mucs.m_ucLogin.Top; p_mucs.m_ucUserProfile.Show(); acc = new mAccount(); Guid?mAccount = acc.accountLoggedIn(); if (acc == null || mAccount == Guid.Empty) { } else { cAcc = new cAccount().readById((Guid)mAccount); //Check if should log out TimeSpan ts = DateTime.Now - cAcc.accDT; if (ts.Minutes >= 5) { p_mucs.m_ucLogin.Display(); } } //------------------------------------------------------------- p_mucs.m_ucUserProfile.lblFName.Text = cAcc.accFirstName; p_mucs.m_ucUserProfile.lblSName.Text = cAcc.accLastName; p_mucs.m_ucUserProfile.lblUsername.Text = cAcc.accUserName; p_mucs.m_ucUserProfile.lblRoles.Text = string.Empty; if (cAcc.accAccountTypeList != null && cAcc.accAccountTypeList.Count > 0) { p_mucs.m_ucUserProfile.lblRoles.Text = string.Join(", ", cAcc.accAccountTypeList.Select(x => x.actName)); //p_mucs.m_ucUserProfile.lblFName.Text.TrimEnd(new char[] { ' ', ',' }); } //Apologies, without spending a fair amount of time looking into your SQL adapter/connection pattern I don't fully understand how it works. //Normally I use dapper, however rather than start trying to implement that i'm resulting to a very simplistic way of querying. try { var dt = new DataTable(); dt.Columns.Add("EventTime"); dt.Columns.Add("EventType"); using (var connection = new SqlConnection(global::NetTest.Properties.Settings.Default.sitedbConnectionString)) { if (connection.State != ConnectionState.Open) { connection.Open(); } var cmd = new SqlCommand("spGetLoginTimesByAccountId", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@AccountId", cAcc.accId.ToString()); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { dt.Rows.Add(dr[0], dr[1]); } } p_mucs.m_ucUserProfile.dgLoginAudit.DataSource = dt; } } catch (Exception ex) { //Log error } }
private async void UpdateAccount() { if (IsBusy) { return; } if (String.IsNullOrEmpty(FirstName) || String.IsNullOrEmpty(LastName) || String.IsNullOrEmpty(PhoneNumber) || String.IsNullOrEmpty(Displayname) || String.IsNullOrEmpty(bDay.ToString())) { DialogService.ShowError(Strings.Enter_All_Fields); return; } mAccount updateAccount = new mAccount(); if (!String.IsNullOrEmpty(NewPassword)) { if (NewPassword != ReNewPassword) { DialogService.ShowError("New Passwords Dont Match"); return; } if (!String.IsNullOrEmpty(NewPassword) && String.IsNullOrEmpty(CurrPassword)) { DialogService.ShowError("Enter Current Password"); return; } updateAccount = new mAccount() { FirstName = FirstName, LastName = LastName, bDay = bDay, Displayname = Displayname, Gender = Gender[GenderTypeIndex], PhoneNumber = PhoneNumber, NewPassword = NewPassword, Password = CurrPassword, Interests = AccountService.Instance.Current_Account.Interests, Email = AccountService.Instance.Current_Account.Email, Notify = Notfiy, bProfileImage = bProfileImage }; } else { updateAccount = new mAccount() { FirstName = FirstName, LastName = LastName, Displayname = Displayname, bDay = bDay, Gender = Gender[GenderTypeIndex], PhoneNumber = PhoneNumber, Password = "", Interests = AccountService.Instance.Current_Account.Interests, Email = AccountService.Instance.Current_Account.Email, Notify = Notfiy, bProfileImage = bProfileImage }; } try { IsBusy = true; DialogService.ShowLoading(Strings.Updating_Account); var result = await AccountService.Instance.UpdateAccount(updateAccount); DialogService.HideLoading(); if (result == "true") { AccountService.Instance.Current_Account = await UserService.Instance.FetchUser(updateAccount.Email); DialogService.ShowToast(Strings.Account_Updated); } else { DialogService.ShowError(result); } } catch (Exception ex) { Debug.WriteLine(Keys.TAG + ex); DialogService.ShowError(Strings.SomethingWrong); Crashes.TrackError(ex); } finally { IsBusy = false; } }
public mAccount User(string id) { var ac = new mAccount(); var dbAccess = Data.Factory.Connecting(DataBase.Base.Login); try { dbAccess.ClearParameters(); dbAccess.AddParameters("@ID", id); foreach (DataRow dr in dbAccess.Read("SELECT * FROM Usuarios WHERE (Identificador = @ID)").Rows) { ac.Identificador = dr["Identificador"].ToString(); ac.Nome = dr["Nome"].ToString().ToUpper(); ac.Sexo = dr["Sexo"].ToString(); ac.Email = dr["Email"].ToString(); ac.Cadastro = (DateTime)dr["Cadastro"]; ac.Atualizado = (DateTime)dr["Atualizado"]; ac.Ativo = (bool)dr["Ativo"]; ac.Thema = "Light"; ac.Color = "#FF3399FF"; ac.Conta = new mContas() { Identificador = ac.Identificador, Indice = 0, ContaAcesso = AccountAccess.Normal.ToString().ToUpper(), Conta = (int)AccountAccess.Normal }; dbAccess.ClearParameters(); dbAccess.AddParameters("@id", id); foreach (DataRow ap in dbAccess.Read(@"SELECT Thema, Color FROM Opcoes WHERE (Identificador = @id)").Rows) { ac.Thema = (string)ap[0]; ac.Color = (string)ap[1]; } dbAccess.ClearParameters(); dbAccess.AddParameters("@id", id); foreach (DataRow ct in dbAccess.Read(@"SELECT * FROM Contas WHERE (Identificador = @id)").Rows) { ac.Conta.Indice = (int)ct[0]; ac.Conta.Identificador = (string)ct[1]; ac.Conta.Conta = (int)ct[2]; ac.Conta.ContaAcesso = Convert.ToString((AccountAccess)ct[2]); ac.Conta.Ativo = (bool)ct[3]; } #region Modulos dbAccess.ClearParameters(); dbAccess.AddParameters("@id", id); foreach (DataRow mdac in dbAccess.Read(@"SELECT * FROM Modulos WHERE (Identificador = @id) AND (Acesso = True) ORDER BY Modulo").Rows) { ac.Modulos.Add(new mModulos { Indice = (int)mdac[0], Identificador = (string)mdac[1], Modulo = (int)mdac[2], Acesso = (bool)mdac[3] }); } #endregion #region SubModulos dbAccess.ClearParameters(); dbAccess.AddParameters("@id", id); foreach (DataRow smac in dbAccess.Read(@"SELECT * FROM SubModulos WHERE (Identificador = @id) AND (Acesso > 0) ORDER BY SubModulo").Rows) { ac.SubModulos.Add(new mSubModulos { Indice = (int)smac[0], Identificador = (string)smac[1], SubModulo = (int)smac[2], Acesso = (int)smac[3] }); } #endregion } return(ac); } catch (Exception ex) { return(null); throw new Exception(ex.Message); } }
public BuySell_ContactSeller_ViewModel(mAccount sellerInfo) { CallCommand = new Command(() => CallAction()); Email = sellerInfo.Email; FullName = sellerInfo.FirstName + " " + sellerInfo.LastName; PhoneNumber = sellerInfo.PhoneNumber; }
public ContactSeller(mAccount seller) { viewModel = new BuySell_ContactSeller_ViewModel(seller); InitializeComponent(); SetStrings(); }
public void UpdateCurr_Account(mAccount update) { Current_Account = update; }