private void Send_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { UserC user = sw.GetUserById(Const.session, Const.IdFocus); sw.SendMessage(Const.session, user.userName, Box.Text); Box.Text = ""; }
public void SetData(UserC user) { Alert.Visibility = Visibility.Hidden; Inform.Visibility = Visibility.Visible; MessageText.Visibility = Visibility.Visible; NameSurname.Content = user.name + " " + user.surname; }
public ArrayList GetMyData(string hach) { int id = swh.GetIdUserByHach(hach); if (id == -1) { return(null); } using (UserContext db1 = new UserContext()) { foreach (var u in db1.Users) { if (u.idUser == id) { UserC user = new UserC { email = u.email, name = u.name, phone = u.phone, surname = u.surname, userName = u.userName }; return(Package.PackageClass(user)); } } } return(null); }
public ActionResult Index(LoginViewModel model, string returnUrl) { try { if (!ModelState.IsValid) { return(View(model)); } LoginResponse result = new UserC().UserLogin(model.UserName, model.Password); if (result.LoginStatus == true) { Session["UserID"] = result.UserID; Session["RoleID"] = result.RoleID; Session["FullName"] = result.FullName; Session["LoginStatus"] = result.LoginStatus; return(RedirectToAction("Index", "Notification")); } } catch (Exception ex) { string error = ex.Message.ToString(); if (ex.InnerException != null) { if (ex.InnerException.Message != null) { error = error + ex.InnerException.Message.ToString(); } } ViewBag.error = "Please contact administrator. "; } return(View(model)); }
public Menu() { UserC user = (UserC)Unpackage <UserC> .Upackage(sw.GetMyData(Const.session)); InitializeComponent(); tName.Content = user.name + " " + user.surname; tPhone.Content = user.phone; tEmai.Content = user.email; elipse.Fill = Brushes.BlueViolet; tSubname.Content = ("" + user.name[0] + user.surname[0]).ToUpper(); GMenu = this; LAutor.Cursor = Cursors.Hand; Contacts.Cursor = Cursors.Hand; Settings.Cursor = Cursors.Hand; Exit.Cursor = Cursors.Hand; Contacts.MouseEnter += Contacts_MouseEnter; Contacts.MouseLeave += Contacts_MouseLeave; Settings.MouseEnter += Contacts_MouseEnter; Settings.MouseLeave += Contacts_MouseLeave; Exit.MouseEnter += Contacts_MouseEnter; Exit.MouseLeave += Contacts_MouseLeave; Contacts.MouseLeftButtonDown += InformMouseLeftButtonDown; LAutor.MouseLeftButtonDown += Settings_MouseLeftButtonDown; Exit.MouseLeftButtonDown += Exit_MouseLeftButtonDown; Settings.MouseLeftButtonDown += Origin_MouseLeftButtonDown; }
public async Task <Response> Login(UserC usuario) { try { var request = JsonConvert.SerializeObject(usuario); var content = new StringContent(request, Encoding.UTF8, "application/json"); var client = new HttpClient(); client.BaseAddress = new Uri(Constants.ServiceUrl); var url = Constants.Usuario + "Login"; var response = await client.PostAsync(url, content); if (!response.IsSuccessStatusCode) { return(new Response { IsSuccess = false, Message = "Usuario o Contraseña incorrecto", }); } var result = await response.Content.ReadAsStringAsync(); var user = JsonConvert.DeserializeObject <Response>(result); return(user); } catch (Exception ex) { return(new Response { IsSuccess = false, Message = ex.Message }); throw; } }
public UserC GetUserById(string hach, int id) { ArrayList user = Service.GetUserById(hach, id); UserC u = (UserC)Unpackage <UserC> .Upackage(user); return(u); }
private void showLocal() { G.currentForm = this; getBestRecorEachUser(); int currentX = 3, currentY = 5; for (int i = 0; i < inp.Count; i++) { UserC userc = new UserC(); userc.userName = inp[i].UserName; userc.score = inp[i].Score; userc.max = inp[i].Max; userc.path = inp[i].UserPicture; if (i % 2 == 0) { userc.colour = "#EDF0FC"; } else { userc.colour = "#ffffff"; } userc.Location = new Point(currentX, currentY); this.panel3.Controls.Add(userc); currentY = currentY + 45; } }
public RegisterViewModel() { services = new ApiService(); UserData = new UserC(); dialogService = new DialogService(); RegisterCommand = new Command(async() => await ExecuteRegisterCommand(UserData)); }
async Task ExecuteRegisterCommand(UserC userC) { var a = await services.Register(userC); if (a.IsSuccess) { dialogService.ShowMessage(Constants.TittelApp, "¡Registro realizado con éxito!"); } }
public async Task Edit(UserC entity) { var response = await _httpService.Put <UserC>(url, entity); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } }
public Boolean insertUserInfo(UserC user) { if (userGetway.InsertUser(user) > 0) { return(true); } return(false); }
public List <ArrayList> GetSearchResult(string hach, string search) { int myId = swh.GetIdUserByHach(hach); List <ArrayList> list = new List <ArrayList>(); switch (search[0]) { case '+': { using (UserContext db1 = new UserContext()) { foreach (var u in db1.Users) { if (u.phone.Contains(search) && u.idUser != myId) { UserC user = new UserC { email = u.email, name = u.name, phone = u.phone, surname = u.surname, userName = u.userName }; list.Add(Package.PackageClass(user)); } } } return(list); } case '@': { search = search.Remove(0, 1); using (UserContext db1 = new UserContext()) { foreach (var u in db1.Users) { if (u.userName.Contains(search) && u.idUser != myId) { UserC user = new UserC { email = u.email, name = u.name, phone = u.phone, surname = u.surname, userName = u.userName }; list.Add(Package.PackageClass(user)); } } } return(list); } } return(null); }
public void ChangeUserStatus(User u, string status) { if (status != "Client")//all kind of status { u.Status = status; } UserC inter = new UserC(); inter.UpdateUser(u); }
public async Task <long> Create(UserC entity) { var response = await _httpService.Post2 <UserC, long>(url, entity); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } return(response.Response); }
public static object Upackage(ArrayList list) { if (list != null) { switch ((string)list[0]) { case "UserC": { UserC user = new UserC { email = (string)list[1], name = (string)list[2], phone = (string)list[3], surname = (string)list[4], userName = (string)list[5] }; return(user); } case "MessageC": { MessageC message = new MessageC { message = (string)list[1], id = (int)list[2], idReseiver = (int)list[3], idSender = (int)list[4], idUserMessage = (int)list[5], status = (int)list[6], time = (string)list[7] }; return(message); } case "LastMessageC": { LastMessageC message = new LastMessageC { message = (string)list[1], id = (int)list[2], idReseiver = (int)list[3], idSender = (int)list[4], idUserMessage = (int)list[5], status = (int)list[6], time = (string)list[7], CountNewMessage = (int)list[8] }; return(message); } default: return(null); } } return(null); }
private static void Exit_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ServerWorks server = new ServerWorks(); UserC user = (UserC)Unpackage <UserC> .Upackage(server.GetMyData(Const.session)); using (FileStream fstream = File.Open(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "session.txt"), FileMode.Create)) { } server.RemoveHach(user.userName); MessageBox.Show("Всего хорошего!"); Environment.Exit(0); }
public LoginViewModel() { FacebookLoginCommand = new Command(async() => await ExecuteFacebookLoginCommand(Navigation)); TwitterLoginCommand = new Command(async() => await ExecuteTwitterLoginCommand(Navigation)); RegisterCommand = new Command(async() => await ExecuteRegisterCommand(Navigation)); apiService = new ApiService(); dialogService = new DialogService(); var ciudad = GetGeoLocation(); usuario = new UserC(); LoginCommand = new Command(async() => await ExecuteLoginCommand(Navigation)); }
public void UpdateSetting(Client c, string cid, string password) { if (c.Mail == "") { throw new Exception("The Email Filed Is Empty"); } if (c.Fname == "") { throw new Exception("The First Name Filed Is Empty"); } if (c.Lname == "") { throw new Exception("The Last Name Filed Is Empty"); } if (c.Address == "") { throw new Exception("The Billing Address Filed Is Empty"); } if (c.Suite == "") { throw new Exception("The Suite Field Is Empty"); } if (c.City == "") { throw new Exception("The Unit City Filed Is Empty"); } if (c.Zip == "") { throw new Exception("The Zip Code Filed Is Empty"); } if (c.MobileNum == "") { throw new Exception("The Mobile Phone Filed Is Empty"); } UserC u = new UserC(); User user = u.FindUser(c.Id); if (password != "") { user.Password = password; } user.Mail = c.Mail; user.MobileNum = c.MobileNum; user.Fname = c.Fname; user.Lname = c.Lname; u.UpdateUser(user); c.Id = cid; ClientGlobal global = new ClientGlobal(); c.SalesRep = global.FindClient(c.Id).SalesRep; global.UpdateClient(c); throw new Exception("The Update Was Successful"); }
public static UserDto Login(string username, string password) { using (DAL.TafToTafEntities2 db = new DAL.TafToTafEntities2()) { var user = db.Users.FirstOrDefault(p => p.UserName == username && p.Password == password); if (user == null) { return(null); } return(UserC.ToUserDto(user)); } }
public int InsertUser(UserC user) { SqlConnection connection = new SqlConnection(connectionString); String Query = "INSERT INTO users VALUES ('" + user.FirstName + "','" + user.LastName + "','" + user.Email + "','" + user.Password + "')"; SqlCommand command = new SqlCommand(Query, connection); connection.Open(); int res = command.ExecuteNonQuery(); connection.Close(); return(res); }
public MainViewModel(UserC user) { initProfile(user); addPhotoCommand = new Command(async() => await ExecuteAddPhotoCommand()); viewMapCommand = new Command(async() => await ExecuteMapCommand()); RefreshDenuncias = new Command(async() => await ExecuteUpdateList()); MyProfileCommand = new Command(async() => await ExecuteMyProfileCommand()); tapCommand = new Command <object>(OnTapped); tapCommand2 = new Command <object>(OnTapped2); // CommentCommand = new Command(async () => await commentCommand(Navigation)); }
public void UpdateMessage() { while (true) { Thread.Sleep(2000); Dispatcher.BeginInvoke(new ThreadStart(delegate { if (sw.GetLastIdLastUser(Const.session) > Const.LastIdLastUser && string.IsNullOrEmpty(tBox.Text)) { List <LastMessageC> list = Unpackage <LastMessageC> .Upackage(sw.GetLastMessageUser(Const.session)); if (list != null) { StackPanel.Children.Clear(); foreach (var l in list) { UserC user = new UserC(); user = sw.GetUserById(Const.session, swh.GetIdSecondUser(l)); DateTime dt = DateTime.Parse(l.time); CustomButton bt = new CustomButton { IdUser = swh.GetIdSecondUser(l), Template = (ControlTemplate)this.TryFindResource("BtTemplate") }; if (l.idUserMessage == l.idSender) { bt.TextMessage = "Вы: " + l.message; bt.StatusMessage = -1; } else { bt.TextMessage = l.message; bt.StatusMessage = l.status; } bt.TextName = user.name + " " + user.surname; bt.TextSubname = ("" + user.name[0] + user.surname[0]).ToUpper(); bt.TextTime = dt.TimeOfDay.ToString(); bt.ColorMessage = new SolidColorBrush(System.Windows.Media.Color.FromRgb(168, 168, 168)); bt.ColorName = new SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 34, 34)); bt.ColorTime = new SolidColorBrush(System.Windows.Media.Color.FromRgb(168, 168, 168)); bt.CountNewMessage = l.CountNewMessage.ToString(); StackPanel.Children.Add(bt); Const.LastIdLastUser = sw.GetLastIdLastUser(Const.session); } } } })); } }
public static UserDto IsLoggedIn(string token) { int idUser = TokenLogic.DecodeToken(token); using (DAL.TafToTafEntities2 db = new DAL.TafToTafEntities2()) { var user = db.Users.FirstOrDefault(u => u.Id == idUser); if (user == null) { return(null); } return(UserC.ToUserDto(user)); } }
public void uploadAndCreate(string cid) { ClientC c = new ClientC(); Client client = c.FindClient(cid); client.MiddleProcess = "2"; c.UpdateClient(client); SendEmailC send = new SendEmailC(); Client c1 = c.FindClient(cid); UserC u = new UserC(); string message = "Client: " + c1.Mail + " " + c1.MobileNum + " " + c1.Fname + " " + c1.Lname + "Send he reports"; send.SendEmailF(u.FindNeedEmail("Manager", cid), "Report Of " + c1.Fname + " " + c1.Lname, message); }
public JsonResult userSignUp(String FirstName, String LastName, String email, String Password) { UserC user = new UserC(FirstName, LastName, email, Password); Boolean res = userManager.insertUserInfo(user); if (res) { UserC loginuser = userManager.getAUser(email, Password); return(Json(loginuser, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> Post(UserC entity) { #region Start the watch var watch = new Stopwatch(); watch.Start(); #endregion var result = await _entityServices.Post(entity); #region End the watch watch.Stop(); result.Meta.TotalProcessingTime = watch.ElapsedMilliseconds; #endregion return(Ok(result)); }
private void Box_KeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } if (Box.Text.Equals("")) { return; } UserC user = sw.GetUserById(Const.session, Const.IdFocus); sw.SendMessage(Const.session, user.userName, Box.Text); Box.Text = ""; }
public Info() { sw = new ServerWorks(); InitializeComponent(); BtnClose.Cursor = Cursors.Hand; BtnClose.MouseLeftButtonDown += Message.GlobalCanvas_MouseLeftButtonDown; GlobalInfo = this; UserC user = sw.GetUserById(Const.session, Const.IdFocus); Ellipse.Fill = Const.secondColor; NameSurname.Content = user.name + " " + user.surname; SubName.Content = (user.name[0] + "" + user.surname[0]).ToUpper(); UserName.Content = user.userName; Phone.Content = user.phone; Email.Content = user.email; }
async Task initProfile(UserC user) { apiService = new ApiService(); dialogService = new DialogService(); ListDenuncia = await apiService.GetComplain(); Debug.WriteLine("" + ListDenuncia.Count); if (user.FacebookId != null || user.TwitterId != null) { var x = await apiService.Register(user); var usuario = (UserC)x.Result; App.Instance.userC = usuario; this.userC = usuario; Debug.WriteLine(userC.IdUser); } }