Beispiel #1
0
        private void btnHome_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //log
                SaveUserLogsTbl.logThis(csteActionType.UserManagement_HomeClicked.ToString());

                HomeScreen _home = new HomeScreen();
                _home.Show();
                this.Close();
            }
            catch (Exception Ex)
            {
                ErrorLoger.save("UserManagement.btnHome_Click()", Ex.Message.ToString());
            }
        }
 private void btnAdminHome_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //log.
         SaveUserLogsTbl.logThis(csteActionType.MainWindow_Button_Home.ToString());
         HomeScreen _AdminHome = new HomeScreen();
         _AdminHome.Show();
         this.Close();
     }
     catch (Exception Ex)
     {
         //Log the Error to the Error Log table
         ErrorLoger.save("wndShipmentScanPage - btnAdminHome_Click", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
     }
 }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Packing_Net.Pages.HomeScreen H = new HomeScreen();
     H.Show();
     this.Close();
 }
        /// <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());
            }
        }