private void cvsMain_Loaded(object sender, RoutedEventArgs e) { try { Guid _UserID = UserInfoPage.UserID; model_User User = new model_User(_UserID); List <cstUserMasterTbl> _lsUserMaseter = Global.controller.GetSelcetedUserMaster(_UserID); foreach (var _UserItem in _lsUserMaseter) { UserID = _UserItem.UserID; lblVUserName.Content = _UserItem.UserName; txtFullName.Text = _UserItem.UserFullName; txtAddress.Text = _UserItem.UserAddress; txtUserName.Text = _UserItem.UserName; dtpJoiningDate.Text = _UserItem.JoiningDate.ToShortDateString(); lblCRole.Text = _UserItem.RoleName; cmbRole.Text = _UserItem.RoleName; lblVUserFullName.Content = _UserItem.UserFullName; lblVJoinigDate.Content = _UserItem.JoiningDate.ToShortDateString(); lblVAddress.Content = _UserItem.UserAddress; } } catch (Exception Ex) { ErrorLoger.save("PgUserinfoDisplay.cvsMain_Loaded()", Ex.ToString()); } }
/// <summary> /// Blank Object Of User Model. /// </summary> /// <returns> model object instance.</returns> public model_User getModelUser() { model_User _command = new model_User(); return(_command); }
/// <summary> /// user information Properites model /// </summary> /// <param name="UserID">Guid User id </param> /// <returns>mUser Model object</returns> public model_User getModelUser(Guid UserID) { model_User _command = new model_User(UserID); return(_command); }
/// <summary> /// Login Code /// </summary> public void login_Prorgam() { List <cstUserMasterTbl> _lsUseMaster = new List <cstUserMasterTbl>(); try { //find the username and password. _lsUseMaster = modelUser.UserFunctions.GetUserMaster(txtUserName.Text); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndLogin - login_Prorgam_Sub1", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString()); } try { if (_lsUseMaster.Count() > 0) { modelUser = new model_User(_lsUseMaster[0].UserID); Global.LoggedUserModel = modelUser; Global.LoggedUserId = modelUser.UserInfo.UserID; //Set UserID for created and update responsible operations, in all application for Audit table and Error log table. Global.controller.SetCreatedOrUpdatedUserID(Global.LoggedUserId); Global.WindowTopUserName = modelUser.UserInfo.UserFullName; Global.LastLoginDateTime = modelUser.LastLoginTime; //Admin User Check and rediract to the Home screen. if (Global.controller.IsSuperUser(Global.LoggedUserId)) { if (CheckStationRegistred.IsRegistered() == false) { wndStationMaster _Station = new wndStationMaster(); this.Dispatcher.Invoke(new Action(() => { _Station.ShowDialog(); })); try { _addLogUserStationtable(); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndLogin - login_Prorgam_Sub2", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString()); } } else if (CheckStationRegistred.IsRegistered()) { _addLogUserStationtable(); } txtUserName.Text = ""; txtMask.Text = ""; //save User Log SaveUserLogsTbl.logThis(csteActionType.Login.ToString()); HomeScreen _Home = new HomeScreen(); this.Dispatcher.Invoke(new Action(() => { _Home.Show(); })); this.Close(); } else { #region station Registration Check if (CheckStationRegistred.IsRegistered() == false) { wndStationMaster _Station = new wndStationMaster(); this.Dispatcher.Invoke(new Action(() => { _Station.ShowDialog(); })); try { //save new station. _addLogUserStationtable(); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndLogin - login_Prorgam_Sub3", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString()); } } else { _addLogUserStationtable(); Global.StationModel = new model_Station(MACAddresss); } #endregion txtUserName.Text = ""; txtMask.Text = ""; //Set Error message on the Sctrip and Visible it to animate. _scrollMsg("Welcome " + Global.LoggedUserModel.UserInfo.UserFullName, Color.FromRgb(38, 148, 189)); //save User Log SaveUserLogsTbl.logThis(csteActionType.Login.ToString()); //Open admin home page for admin. MainWindow ScanWindow = new MainWindow(); this.Dispatcher.Invoke(new Action(() => { ScanWindow.Show(); })); //close this window this.Close(); } } else { txtUserName.Text = ""; txtMask.Text = ""; //Set Error message on the Sctrip and Visible it to animate. _scrollMsg("Warning : Access Denied. Incorrect User Name.", Color.FromRgb(222, 87, 24)); } } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndLogin - login_Prorgam_Sub3", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString()); } }