private void Login_Click(object sender, RoutedEventArgs e) { User_Controller Controller = new User_Controller(); if (UserName.Text.Length == 0 && Password.Password.Length == 0) { UserNameErrorMessage.Text = "You must enter valid username"; PasswordErrorMessage.Text = "You must enter password"; UserName.Focus(); Password.Focus(); } else if (UserName.Text.Length == 0) { UserNameErrorMessage.Text = "You must enter valid username"; UserName.Focus(); } else if (Password.Password.Length == 0) { PasswordErrorMessage.Text = "You must enter password"; Password.Focus(); } else { string username = UserName.Text; string password = Password.Password; var status = Controller.UserLogin(username, password); if (status == true) { this.Hide(); Home home = new Home(username); home.Show(); } } }
public static Hashtable c_hash_User = new Hashtable(); //luu UserInfo, key: Id /// <summary> /// load tham số hệ thống /// </summary> public static void LoadParamSystem() { try { #region User lock (c_hash_User.SyncRoot) { User_Controller _User_Controller = new User_Controller(); c_hash_User.Clear(); List <User_Info> _lst_us = _User_Controller.User_Get_All(); if (_lst_us.Count > 0) { foreach (User_Info item in _lst_us) { c_hash_User[item.User_Id] = item; } } } #endregion } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public static void LoadFunctionUsers() { try { FunctionsController _FunctionsController = new FunctionsController(); ArrayList _arr = _FunctionsController.Function_GetAll(); c_hashFunctionList.Clear(); foreach (FunctionsInfo _FuncInfo in _arr) { if (_FuncInfo.objname != null && _FuncInfo.objname != "") { c_hashFunctionList[_FuncInfo.objname] = _FuncInfo; } } User_Controller _UserControler = new User_Controller(); c_arrQuyen = _UserControler.Send_Users_Get_MenuItem(CommonData.c_Urser_Info.User_Name); c_hash_Quyen.Clear(); foreach (User_FunctionsInfo item in c_arrQuyen) { if (item.name != null) { c_hash_Quyen[item.name] = item; } } } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
public ActionResult Index() { List <FileModel> ListFiles = new List <FileModel>(); List <InzPost> ListPost = new List <InzPost>(); PostService ObjPostSericeLayer = new PostService(); ListPost = ObjPostSericeLayer.GetPostDetails(USerConfig.GetUserID()); foreach (var Post in ListPost) { FileModel fileModel = new FileModel { FileId = Post.PostId, Name = Post.Title, Path = Post.path }; ListFiles.Add(fileModel); } ViewBag.Users = User_Controller.getAllUsers(); return(View(ListFiles)); }
private void Btn_Login_Click(object sender, RoutedEventArgs e) { User user = new User(); User_Controller _user = new User_Controller(); MyContext _contex = new MyContext(); if (Txt_Email.Text.Length != 0 && Txt_Password.Password.Length != 0) { string email = Txt_Email.Text; string password = Txt_Password.Password; var get = _contex.Users.Where(u => u.Email == email).FirstOrDefault <User>(); string NIK = get.Employee_Id; var status = _user.UserLogin(email, password); if (status == true) { this.Hide(); Home home = new Home(NIK); home.Show(); } } else { MessageBox.Show("Please Fill All The Requirement!"); } }
//public async Task<ActionResult> AsyncDownload(int FileId) //{ // await Task.Run(() => PrepareFile(FileId)); // return Json(new { success = 1 }, JsonRequestBehavior.AllowGet); //} //public async void PrepareFile(int FileId) //{ // Task<bool> task = new Task<bool>(SyncService); // task.Start(); // bool FileDownloaded = await task; //} public bool SyncService() { try { if (Convert.ToBoolean(Session["OTPsent"]) == false) { int FileId = Convert.ToInt32(TempData["FileId"]); int CurrentUserId = USerConfig.GetUserID(); if (objFileDataLayer.FileUserAccess(FileId, CurrentUserId)) { int RequestId = objFileDataLayer.GenerateRequest(FileId, CurrentUserId); List <int> PartnerIds = objFileDataLayer.GetPartnerIds(FileId); objFileDataLayer.GenerateOTP(PartnerIds, RequestId); string AccessStatus = objFileDataLayer.AuthorizeOTP(RequestId);//Until and unless we get NouserPending status the file will not download User_Controller userData = new User_Controller(); foreach (var partnerid in PartnerIds) { int GetOtp = userData.GetOtp(RequestId, partnerid); SMTPProtocol.NotifyPartners("Notification", string.Format("You partners is waiting for the file ,Please find the OTP : {0} \n Use this link to enter the OTP : /File/EnterOtp?RequestId={1}&UserId={2}", GetOtp, RequestId, partnerid), userData.GetEmailbyPartnerId(partnerid.ToString())); } } Session["OTPsent"] = "true"; } } catch (Exception) { Session["OTPsent"] = "false"; throw; } return(true); }
private void Renew_Click(object sender, RoutedEventArgs e) { User_Controller Controller = new User_Controller(); if (Username.Text.Length == 0 && Password.Password.Length == 0) { UsernameErrorMessage.Text = "You are Enter Valid Username!"; PasswordErrorMessage.Text = "You are Enter Password"; } else if (Username.Text.Length == 0) { UsernameErrorMessage.Text = "Enter the valid username"; Username.Focus(); } else if (Password.Password.Length == 0) { PasswordErrorMessage.Text = "You must enter password"; Password.Focus(); } else { string username = Username.Text; string password = Password.Password; Controller.ChangePass(username, password); this.Hide(); Home home = new Home(GUsername); home.Show(); } }
private void UserLogin() { try { tblError.Visibility = Visibility.Collapsed; if (c_LoadCommonDataStatus != 2) { return; } User_Controller _User_Controller = new User_Controller(); User_Info _User_Info = _User_Controller.User_Login(txtUsername.Text, txtPassword.Text); if (_User_Info == null) { NoteBox.Show("Sai tên đăng nhập hoặc mật khẩu", "", NoteBoxLevel.Error); txtPassword.Focus(); return; } _User_Controller.User_Update_Last_Login(_User_Info.User_Id, DateTime.Now); CommonData.c_Urser_Info = _User_Info; this.DialogResult = true; this.Close(); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); NoteBox.Show("Đăng nhập thất bại", "Thông báo"); } }
private void Btn_Change_Click(object sender, RoutedEventArgs e) { User_Controller Controller = new User_Controller(); if (Txt_OldPassword.Password.Length == 0 && Txt_NewPassword.Password.Length == 0 && Txt_VerifyPassword.Password.Length == 0) { OldPasswordErrorMassage.Text = "Enter your Old Password"; NewPasswordErrorMassage.Text = "Enter your New Password"; VerifyPasswordErrorMassage.Text = "Enter your Verify Password"; Txt_OldPassword.Focus(); } else if (Txt_OldPassword.Password.Length == 0 && Txt_VerifyPassword.Password.Length == 0) { OldPasswordErrorMassage.Text = "Enter your Old Password"; VerifyPasswordErrorMassage.Text = "Enter your Verify Password"; Txt_OldPassword.Focus(); } else if (Txt_NewPassword.Password.Length == 0 && Txt_VerifyPassword.Password.Length == 0) { NewPasswordErrorMassage.Text = "Enter your New Password"; VerifyPasswordErrorMassage.Text = "Enter your Verify Password"; Txt_NewPassword.Focus(); } else if (Txt_OldPassword.Password.Length == 0) { OldPasswordErrorMassage.Text = "Enter your Old Password"; Txt_OldPassword.Focus(); } else if (Txt_NewPassword.Password.Length == 0) { NewPasswordErrorMassage.Text = "Enter your New Password"; Txt_NewPassword.Focus(); } else if (Txt_VerifyPassword.Password.Length == 0) { VerifyPasswordErrorMassage.Text = "Enter your Verify Password"; Txt_VerifyPassword.Focus(); } else if (Txt_OldPassword.Password == Txt_NewPassword.Password) { NewPasswordErrorMassage.Text = "Password Can't Be Same"; Txt_OldPassword.Focus(); } else if (Txt_VerifyPassword.Password != Txt_NewPassword.Password) { NewPasswordErrorMassage.Text = "Verify Password Must Be Same"; Txt_NewPassword.Focus(); } else { string oldpassword = Txt_OldPassword.Password; string newpassword = Txt_NewPassword.Password; Controller.ChangePass(oldpassword, newpassword); this.Hide(); Home home = new Home(G_NIK); home.Show(); } }
public ActionResult ViewPartner(int FileId) { User_Controller _USerDatalayer = new User_Controller(); ViewBag.FileId = FileId; List <User> ListUser = _USerDatalayer.GetPartnersbyFileId(FileId); return(View(ListUser)); }
void loadCombobox() { try { User_Controller _UserControler = new User_Controller(); List <User_Info> _arr = _UserControler.User_Get_All(); User_Info _objshort = new User_Info(); _objshort.User_Id = -1; _objshort.User_Name = CommonData.c_All_Content; _arr.Insert(0, _objshort); cboNguoidung.ItemsSource = _arr; cboNguoidung.DisplayMemberPath = "User_name"; cboNguoidung.SelectedValuePath = "User_id"; cboNguoidung.SelectedIndex = 0; //Add tinh thong tin vao Combobox! ArrayList _arrTable = new ArrayList(); TableInfo _TableInfo1 = new TableInfo(); _TableInfo1.ID = 1; _TableInfo1.Name = "CONTRACT"; _arrTable.Add(_TableInfo1); TableInfo _TableInfo7 = new TableInfo(); _TableInfo7.ID = 1; _TableInfo7.Name = "CUSTOMER"; _arrTable.Add(_TableInfo7); TableInfo _TableInfo0 = new TableInfo(); _TableInfo0.ID = -1; _TableInfo0.Name = CommonData.c_All_Content; _arrTable.Insert(0, _TableInfo0); cboTenbang.ItemsSource = _arrTable; cboTenbang.SelectedValuePath = "ID"; cboTenbang.DisplayMemberPath = "Name"; cboTenbang.SelectedIndex = 0; List <int> lstTotalRow = new List <int>() { 10, 20, 50, 100, 200 }; cboTotalRow.ItemsSource = lstTotalRow; cboTotalRow.SelectedIndex = 0; CommonData.RowTotalDock = int.Parse(cboTotalRow.SelectedValue.ToString()); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
public ActionResult Index() { if (USerConfig.GetUserName() == "admin") { User_Controller _USerDatalayer = new User_Controller(); List <User> ListUser = _USerDatalayer.ListUsers(); return(View(ListUser)); } else { return(RedirectToAction("Index", "Home")); } }
private void Btn_Register_Click(object sender, RoutedEventArgs e) { User_Controller user = new User_Controller(); MainWindow main = new MainWindow(); string _Name = Txt_Name.Text; string _Username = Txt_Username.Text; string _Password = Txt_Password.Password; user.AddUser(_Name, _Username, _Password); this.Hide(); main.Show(); this.Close(); }
public ActionResult Delete() { User_Controller _USerDatalayer = new User_Controller(); bool Result = _USerDatalayer.UserDisableEnable(Request.Form["Email"].ToString()); if (Result) { TempData["AlertMessage"] = "Sucess"; } else { TempData["AlertMessage"] = "Error"; } return(RedirectToAction("Index")); }
private void UserLogin() { try { tblError.Visibility = Visibility.Collapsed; if (c_LoadCommonDataStatus != 2) { return; } User_Controller _User_Controller = new User_Controller(); User_Info _User_Info = _User_Controller.User_Login(txtUsername.Text, txtPassword.Text); if (_User_Info == null) { NoteBox.Show("Sai tên đăng nhập hoặc mật khẩu", "", NoteBoxLevel.Error); txtPassword.Focus(); return; } _User_Controller.User_Update_Last_Login(_User_Info.User_Id, DateTime.Now); System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); config.AppSettings.Settings.Remove("LastestUser"); config.AppSettings.Settings.Add("LastestUser", _User_Info.User_Name); config.AppSettings.Settings.Remove("Password"); config.AppSettings.Settings.Add("Password", txtPassword.Text); config.Save(System.Configuration.ConfigurationSaveMode.Modified); System.Configuration.ConfigurationManager.RefreshSection("appSettings"); CommonData.c_Urser_Info = _User_Info; DBMemory.LoadFunctionUsers(); this.DialogResult = true; this.Close(); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); NoteBox.Show("Đăng nhập thất bại", "Thông báo"); } }
private void User_Right_Insert() { try { if (c_change) { User_RightsController _User_RightsController = new User_RightsController(); ArrayList arrRight = new ArrayList(); foreach (User_FunctionsInfo item in c_arrFunction) { if (item.right != "000000") { User_RightsInfo _User_RightsInfo = ConvertToUser_RightsInfo(item, c_UsersInfo.User_Id); arrRight.Add(_User_RightsInfo); } } if (arrRight.Count > 0) { MessageBoxResult result1 = NoteBox.Show("Bạn có muốn sửa thông tin này hay không?", "Thông báo", NoteBoxLevel.Question); if (result1 == MessageBoxResult.Yes) { _User_RightsController.User_Rights_DelByUser(c_UsersInfo.User_Name); _User_RightsController.User_Rights_Insert_Barth(arrRight, c_UsersInfo.User_Name); User_Controller _usC0n = new User_Controller(); _usC0n.User_Change_SetRight(c_UsersInfo.User_Id); NoteBox.Show("Cập nhật dữ liệu thành công"); this.Close(); } } else { NoteBox.Show("Bạn chưa đặt quyền cho chức năng nào", "Thông báo", NoteBoxLevel.Error); } } else { NoteBox.Show("Bạn chưa thực hiện thay đổi quyền nào", "Thông báo", NoteBoxLevel.Error); } } catch (Exception ex) { CommonData.log.Error(ex.ToString()); NoteBox.Show("Cập nhật dữ liệu không thành công", "Lỗi", NoteBoxLevel.Error); } }
private void Btn_Login_Click(object sender, RoutedEventArgs e) { User_Controller user = new User_Controller(); string _username = Txt_Username.Text; string _password = Txt_Password.Password; var result = user.Login(_username, _password); if (result == true) { this.Hide(); Home home = new Home(_username); home.Show(); this.Close(); } else { MessageBox.Show("User/Password Error!"); } }
public ActionResult RegisterUSer(FormCollection FrmUserDetails) { User _user = new User(); _user.Username = FrmUserDetails["username"]; _user.Password = FrmUserDetails["confirm-password2"]; _user.EmailID = FrmUserDetails["email"]; _user.Category = FrmUserDetails["Category"]; if (User_Controller.UserRegister(_user)) { TempData["AlertMessage"] = "Sucess"; return(RedirectToAction("index", "Login")); } else { TempData["AlertMessage"] = "Exists"; return(RedirectToAction("index", "Login")); } }
bool CheckUserNotSame(string code) { try { User_Controller _UsersController = new User_Controller(); foreach (User_Info item in c_lst) { if (item.User_Name.ToUpper() == code.ToUpper()) { return(false); } } return(true); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); return(false); } }
static void LoadUsers() { try { lock (c_hash_User.SyncRoot) { c_ar_Users.Clear(); User_Controller _usercontrol = new User_Controller(); c_ar_Users = _usercontrol.User_Get_All(); c_hash_Users.Clear(); foreach (User_Info item in c_ar_Users) { c_hash_Users[item.User_Id] = item; } } } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
static void Main(string[] args) { Console.WriteLine("Вас приветствует приложение CodeBlogFitness"); Console.WriteLine("Введите имя пользователя "); var name = Console.ReadLine(); Console.WriteLine("Введите пол"); var gender = Console.ReadLine(); Console.WriteLine("Введите дату рождения "); var birthData = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Введите вес "); var weight = double.Parse(Console.ReadLine()); Console.WriteLine("Введите рост "); var height = double.Parse(Console.ReadLine()); var userController = new User_Controller(name, gender, birthData, weight, height); userController.Save(); }
void LoadCombobox() { try { AllCode_Info _AllCode_Info = new AllCode_Info(); _AllCode_Info.Content = CommonData.c_All_Content; _AllCode_Info.CdValue = CommonData.c_All_Value; Estate_Object_Controller _Estate_Object_Controller = new Estate_Object_Controller(); List <Estate_Object_Info> _lst_eb = _Estate_Object_Controller.Estate_Object_GetAll(); Estate_Object_Info _Estate_Object_Info = new Estate_Object_Info(); _Estate_Object_Info.Estate_Code = CommonData.c_All_Value; _Estate_Object_Info.Estate_Name = CommonData.c_All_Value; _lst_eb.Insert(0, _Estate_Object_Info); cboEsateCode.ItemsSource = _lst_eb; cboEsateCode.DisplayMemberPath = "Estate_Name"; cboEsateCode.SelectedValuePath = "Estate_Code"; cboEsateCode.SelectedIndex = 0; User_Controller c_User_Controller = new User_Controller(); List <User_Info> _lst_us = c_User_Controller.User_Get_All(); User_Info _User_Info = new User_Info(); _User_Info.User_Name = CommonData.c_All_Value; _User_Info.User_Name = CommonData.c_All_Value; _lst_us.Insert(0, _User_Info); cboCreatedBy.ItemsSource = _lst_us; cboCreatedBy.DisplayMemberPath = "User_Name"; cboCreatedBy.SelectedValuePath = "User_Name"; cboCreatedBy.SelectedIndex = 0; } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
void Accept() { try { if (!CheckValidate_F()) { return; } MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn đổi mật khẩu hay không", "Thông báo", NoteBoxLevel.Question); if (MessageBoxResult.Yes == result) { decimal _id = CommonData.c_Urser_Info.User_Id; if (c_is_reset == 1) { _id = c_User_Info.User_Id; } User_Controller _User_Controller = new User_Controller(); if (_User_Controller.User_Update_Pass(_id, txtPassword_New.Text)) { NoteBox.Show("Đổi mật khẩu thành công"); c_ok = 1; this.Close(); } else { NoteBox.Show("Có lỗi trong quá trình đổi mật khẩu", "", NoteBoxLevel.Error); } } } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public ActionResult Login() { bool isChecked = false; if (Request.Form["remember"] != null) { isChecked = true; } if (User_Controller.AuthenticateUser(Request.Form["USer name"].ToString(), Request.Form["password"].ToString()))//Authentication in database //if (FormsAuthentication.Authenticate(Request.Form["USer name"].ToString(), Request.Form["password"].ToString()))//Authentication in Web.config { FormsAuthentication.SetAuthCookie(Request.Form["USer name"].ToString(), isChecked); FormsAuthentication.RedirectFromLoginPage(Request.Form["USer name"].ToString(), isChecked); ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name; return(RedirectToAction("index", "Home")); } else { TempData["AlertMessage"] = "Invalid"; return(RedirectToAction("index", "Login")); } }
private void Btn_Change_Click(object sender, RoutedEventArgs e) { Home home = new Home(G_Username); User_Controller user = new User_Controller(); string _a_password = Txt_a_password.Password; string _b_password = Txt_b_password.Password; string _c_password = Txt_c_password.Password; var result = user.changePassword(G_Username, _a_password, _b_password, _c_password); if (result == 1) { MessageBox.Show("Change Password Success!"); } else if (result == 2) { MessageBox.Show("New Password Didnt Same!"); } else { MessageBox.Show("Wrong Current Password!"); } }
public ActionResult Download() { int FileId = Convert.ToInt32(TempData["FileId"]); try { int CurrentUserId = USerConfig.GetUserID(); if (objFileDataLayer.FileUserAccess(FileId, CurrentUserId)) { int RequestId = objFileDataLayer.GenerateRequest(FileId, CurrentUserId); List <int> PartnerIds = objFileDataLayer.GetPartnerIds(FileId); objFileDataLayer.GenerateOTP(PartnerIds, RequestId); string AccessStatus = objFileDataLayer.AuthorizeOTP(RequestId);//Until and unless we get NouserPending status the file will not download User_Controller userData = new User_Controller(); foreach (var partnerid in PartnerIds) { int GetOtp = userData.GetOtp(RequestId, partnerid); SMTPProtocol.NotifyPartners("Notification", string.Format("You partners is waiting for the file ,Please find the OTP : {0} .Use the following url to enter your ", GetOtp), userData.GetEmailbyPartnerId(partnerid.ToString())); } if (AccessStatus == "NoUserPending" && AccessStatus != "") { string fileName = objFileDataLayer.GetFileName(FileId); if (fileName != "NIL") { var filepath = Path.Combine(Server.MapPath("~/PostImage"), fileName); byte[] filedata = System.IO.File.ReadAllBytes(filepath); string contentType = MimeMapping.GetMimeMapping(filepath); var cd = new System.Net.Mime.ContentDisposition { FileName = fileName, Inline = true, }; Response.AppendHeader("Content-Disposition", cd.ToString()); objFileDataLayer.DeleteRequest(RequestId); return(File(filedata, contentType)); } else { ViewBag.Title = "File not found"; ViewBag.Message = "The file you are trying to access is deleted"; return(View()); } } else { return(View()); } } else { ViewBag.Title = "Illegal Entry"; ViewBag.Message = "You are not authorized to access this file"; return(View()); } } catch { return(View()); } }
private void Submit_Click(object sender, RoutedEventArgs e) { User_Controller Controller = new User_Controller(); if (Username.Text.Length == 0 && Password.Password.Length == 0 && VerifyPassword.Password.Length == 0) { UsernameErrorMessage.Text = "Enter the valid username"; PasswordErrorMessage.Text = "You must enter password"; VerifyPasswordErrorMessage.Text = "You must enter verify password"; Username.Focus(); Password.Focus(); VerifyPassword.Focus(); } else if (Username.Text.Length == 0 && Password.Password.Length == 0) { UsernameErrorMessage.Text = "Enter the valid username"; PasswordErrorMessage.Text = "You must enter password"; Username.Focus(); Password.Focus(); } else if (Username.Text.Length == 0 && VerifyPassword.Password.Length == 0) { UsernameErrorMessage.Text = "Enter the valid username"; VerifyPasswordErrorMessage.Text = "You must enter password"; Username.Focus(); VerifyPassword.Focus(); } else if (Password.Password.Length == 0 && VerifyPassword.Password.Length == 0) { PasswordErrorMessage.Text = "Enter the valid username"; VerifyPasswordErrorMessage.Text = "You must enter password"; Password.Focus(); VerifyPassword.Focus(); } else if (Username.Text.Length == 0) { UsernameErrorMessage.Text = "Enter the valid username"; Username.Focus(); } else if (Password.Password.Length == 0) { PasswordErrorMessage.Text = "You must enter password"; Password.Focus(); } else if (VerifyPassword.Password.Length == 0) { VerifyPasswordErrorMessage.Text = "You must enter verify password"; } else if (Password.Password.Length != VerifyPassword.Password.Length) { VerifyPasswordErrorMessage.Text = "Verify password must be same with Password"; VerifyPassword.Focus(); } else { string username = Username.Text; string password = Password.Password; Controller.addUser(username, password); this.Hide(); MainWindow main = new MainWindow(); main.Show(); } }
void Start() { controller = User.GetComponent <User_Controller>(); Slider = gameObject.GetComponent <Slider>(); }