private void btnSetting_Click(object sender, RoutedEventArgs e)
        {
            //log
            SaveUserLogsTbl.logThis(csteActionType.Home_Button_Setting.ToString());
            SettingWindow _setting = new SettingWindow();

            _setting.Show();
            this.Close();
        }
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            //log
            SaveUserLogsTbl.logThis(csteActionType.Home_Button_Shipment.ToString());
            MainWindow _Shipment = new MainWindow();

            _Shipment.Show();
            this.Close();
        }
Exemple #3
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            //log
            SaveUserLogsTbl.logThis(csteActionType.UserManagement_ScreenLoaded.ToString());
            //Auto Timer Restart..
            SessionManager.StartTime();

            //Convert To Language
            WindowLanguages.Convert(this);
        }
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            //log
            SaveUserLogsTbl.logThis(csteActionType.Home_Button_UserManagement.ToString());

            UserManagement _UserRegis = new UserManagement();

            _UserRegis.Show();
            this.Close();
        }
        /// <summary>
        /// KeyPress event of User Name textbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtUserName_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == System.Windows.Input.Key.Enter)
                {
                    #region Login enter perssed
                    if (txtUserName.Text != "")
                    {
                        //Same User login for session again. when session expired.
                        if (Global.TimeOutUserName == txtUserName.Text && Global.ISTimerRaised == true)
                        {
                            //Logger add log.
                            SaveUserLogsTbl.logThis(csteActionType.SessionReLogin.ToString());

                            //Session start..
                            SessionManager.StartTime();

                            //Close this window
                            this.Close();
                        }
                        else if ((Global.TimeOutUserName == "" || Global.TimeOutUserName == null) && Global.ISTimerRaised == false)
                        {
                            //if session not expired then login is first time.
                            login_Prorgam();
                        }
                        else
                        {
                            //Worong username or password

                            txtUserName.Text = "";
                            txtMask.Text     = "";

                            //Logger add log.
                            SaveUserLogsTbl.logThis(csteActionType.Login_Invalid_User_00.ToString());

                            //Show msg strip.
                            _scrollMsg(Global.controller.ConvetLanguage("You are not previously logged User.", Global.LanguageFileName), Color.FromRgb(222, 87, 24));
                        }
                    }
                    else
                    {
                        e.Handled = false;
                    }
                    #endregion
                }
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndLogin - txtUserName_KeyDown", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString());
            }

            // if key pressed at the textbox is enter the this will go on. - avinash6jun2013
        }
 private void btnExit_Click(object sender, RoutedEventArgs e)
 {
     //log
     SaveUserLogsTbl.logThis(csteActionType.Home_Button_Exit.ToString());
     Global.MsgBoxResult = "";
     MsgBox.Show("Error", "Exit", Environment.NewLine + " Are you sure want to Exit?");
     if (Global.MsgBoxResult == "Ok")
     {
         Application.Current.Shutdown();
     }
 }
        private void Autotimer_Tick(object sender, EventArgs e)
        {
            if (Global.ISTimerRaised == false)
            {
                //Log .
                SaveUserLogsTbl.logThis(csteActionType.SessionTimeOut.ToString());

                Global.ISTimerRaised = true;
                Login _login = new Login();
                _login.ShowDialog();
            }
        }
 private void btnLogout_Click(object sender, RoutedEventArgs e)
 {
     //log
     SaveUserLogsTbl.logThis(csteActionType.Logout.ToString());
     Global.MsgBoxResult = "";
     MsgBox.Show("Error", "Logout", Environment.NewLine + " Are you sure want to logout? ");
     if (Global.MsgBoxResult == "Ok")
     {
         System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
         Application.Current.Shutdown();
     }
 }
Exemple #9
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Log
                SaveUserLogsTbl.logThis(csteActionType.Setting_LocalSettingUpdated.ToString(), Global.ShippingNumber);

                String Location   = "";
                String LogoutTime = lblHoures.Content + ":" + lblMin.Content + ":" + lblSec.Content;
                String Language   = "";
                if (cmbLocation.Text == "" || cmbLocation.Text == null)
                {
                    Location = lblCLocation.Text;
                }
                else
                {
                    Location = cmbLocation.Text;
                }
                if (cmbLanguage.Text == "" || cmbLanguage.Text == null)
                {
                    Language = lblCLanguage.Text;
                }
                else
                {
                    Language = cmbLanguage.Text;
                }

                SetGlobalFileName(Language);

                //Reset the Timer Intervals .
                int _Hour = Convert.ToInt32(lblHoures.Content.ToString());
                int _Min  = Convert.ToInt32(lblMin.Content.ToString());
                int _Sec  = Convert.ToInt32(lblSec.Content.ToString());

                MsgBox.Show("Error", "Update", Environment.NewLine + "To apply the settings application need to restart." + Environment.NewLine + " Are you sure want to restart application?");
                if (Global.MsgBoxResult == "Ok")
                {
                    //Change station location from device location changed
                    UpdateStationLocation(Location);
                    //seve to the text file overrites the existing contents.
                    Boolean _return = Global.controller.WriteStringTofile(Location, LogoutTime, Language, Global.ISBarcodeShow);
                    SessionManager.Autotimer.Interval = new TimeSpan(_Hour, _Min, _Sec);
                    System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
                    Application.Current.Shutdown();
                }
            }
            catch (Exception Ex)
            {
                ErrorLoger.save("PgTimeSetting.UpdateBtn()", Ex.ToString());
            }
        }
Exemple #10
0
 private void btnNewUser_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //log
         SaveUserLogsTbl.logThis(csteActionType.UserManagement_NewUserClicked.ToString());
         NewUserRegistration _pgNewUser = new NewUserRegistration();
         frmMain.Content = _pgNewUser;
     }
     catch (Exception Ex)
     {
         ErrorLoger.save("UserManagement.btnNewUser_Click()", Ex.Message.ToString());
     }
 }
        /// <summary>
        /// Lock the Screen and show shipment window.
        /// </summary>
        private void _show_Shipment()
        {
            try
            {
                Boolean _return = false;
                //lock the shipment that is under packing process.
                if (Global.Mode == "SameUser")
                {
                    _return = _shipmentLock(2);
                }
                else if (Global.Mode == "Override")
                {
                    _return = _shipmentLock(1);
                }
                else
                {
                    _return = _shipmentLock(0);
                }
                if (_return)
                {
                    //Start please wait screen in saprate thread.
                    WindowThread.start();

                    //Set the Global Shiment Number
                    Global.ShippingNumber = txtShipmentId.Text.ToUpper();

                    ShipmentScreen shipmentScreen = new ShipmentScreen();

                    //loger add log.
                    SaveUserLogsTbl.logThis(csteActionType.ShipmentID_Scan.ToString(), Global.ShippingNumber.ToString());
                    _scrollMsg("Valid Shipment Scanned. Shipment ID =" + Global.ShippingNumber, Color.FromRgb(38, 148, 189));

                    shipmentScreen.Show();

                    //close thi screen.
                    this.Close();
                }
                else
                {
                    _scrollMsg("Warning: shipping information not available. Please scan another shipment.", Color.FromRgb(222, 87, 24));
                    txtShipmentId.Text = "";
                }
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - _show_Shipment", " [" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            //Log .
            SaveUserLogsTbl.logThis(csteActionType.HomeScreenLoaded.ToString());

            //Auto Timer Restart..
            SessionManager.StartTime();
            if (Global.ISTimerTickInitialised == false)
            {
                SessionManager.Autotimer.Tick += Autotimer_Tick;
                Global.ISTimerTickInitialised  = true;
            }
            //Convert Language
            WindowLanguages.Convert(this);
        }
Exemple #13
0
        private void cmbLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Log
            SaveUserLogsTbl.logThis(csteActionType.Setting_LanguageChanged.ToString(), Global.ShippingNumber);

            lblCLanguage.Visibility = cmbLanguage.SelectedItem == null ? Visibility.Visible : System.Windows.Visibility.Hidden;
            if (cmbLanguage.Text == "" || cmbLanguage.Text == null)
            {
                SetGlobalFileName(lblCLanguage.Text);
            }
            else
            {
                SetGlobalFileName(cmbLanguage.Text);
            }
        }
Exemple #14
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);
     }
 }
        /// <summary>
        /// Logout Confirmation msg
        /// </summary>
        private void btnHome_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //log.
                SaveUserLogsTbl.logThis(csteActionType.Logout.ToString());

                MsgBox.Show("Error", "Logout", Environment.NewLine + "Are you sure want to logout? ");
                if (Global.MsgBoxResult == "Ok")
                {
                    System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
                    Application.Current.Shutdown();
                }
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - btnHome_Click", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Global.LoginType == "UPSandFEDEX")
                {
                    rbtnltl.Visibility   = Visibility.Hidden;
                    rbtnother.Visibility = Visibility.Hidden;
                }

                //log.
                SaveUserLogsTbl.logThis(csteActionType.MainWindowLoaded.ToString());
                if (Global.controller.IsSuperUser(Global.LoggedUserId))
                {
                    cvsHomeBtn.Visibility = System.Windows.Visibility.Visible;
                }

                lblTime.Content = DateTime.UtcNow.ToLongDateString();
                txtShipmentId.Focus();
                lblUserName.Content = Global.WindowTopUserName;

                // txtShipmentId.Text = "SH0002XXX";
                lblStationName.Content = Global.StationName;
                //Display label Last Login time Of The  user;
                DateTime Dt = Convert.ToDateTime(Global.LastLoginDateTime);
                lblLastLoginTime.Content = Dt.ToString("MMM dd, yyyy h:mm tt ").ToString();

                //Show Error message on the Strip;
                _scrollMsg("Please Scan shipment ID.", Colors.Green);

                //Convert All Form labels to Language.
                WindowLanguages.Convert(this);
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - Window_Loaded_1", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
 /// <summary>
 ///After Message Box button clicked. how to act on that message result is informed in this function.
 /// </summary>
 private void _actMessageResult()
 {
     try
     {
         if (Global.MsgBoxResult != "")
         {
             if (Global.MsgBoxResult == "Cancel")
             {
                 //log.
                 SaveUserLogsTbl.logThis(csteActionType.Manager_Override_Request.ToString(), txtShipmentId.Text);
                 MsgBox.Show("Continue", "Manager Override", Environment.NewLine + Environment.NewLine + "   Manager override required." + Environment.NewLine + "   Please scan your badge.");
             }
             if (Global.MsgBoxResult == "Ok")
             {
             }
         }
     }
     catch (Exception Ex)
     {
         //Log the Error to the Error Log table
         ErrorLoger.save("wndShipmentScanPage - _actMessageResult", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
     }
 }
 private void Autotimer_Tick(object sender, EventArgs e)
 {
     try
     {
         if (Global.ISTimerRaised == false)
         {
             //log.
             SaveUserLogsTbl.logThis(csteActionType.SessionTimeOut.ToString());
             //Set Timer rased flag on
             Global.ISTimerRaised = true;
             //Open login Form
             Login _login = new Login();
             //Set it as top most form.
             _login.Topmost = true;
             _login.ShowDialog();
         }
     }
     catch (Exception Ex)
     {
         //Log the Error to the Error Log table
         ErrorLoger.save("wndShipmentScanPage - Autotimer_Tick", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
     }
 }
        private void btnReprint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Global.RecentlyPackedID != Guid.Empty)
                {
                    //Save to Audit table
                    SaveUserLogsTbl.logThis(Global.LoggedUserId.ToString(), csteActionType.Re_Print_PackingSlip.ToString(), DateTime.UtcNow.ToString(), Global.controller.GetShippingNumber(Global.RecentlyPackedID));

                    //Get Box number Packed Per Packing ID
                    List <cstBoxPackage> _lsPackageDetail = Global.controller.GetBoxPackageByPackingID(Global.RecentlyPackedID);

                    //For each these Box Print Packing slip.
                    foreach (cstBoxPackage _boxitem in _lsPackageDetail)
                    {
                        //New Object Of Print window
                        wndBoxSlip _printSlip = new wndBoxSlip();

                        //assing To Pring BOXID
                        Global.PrintBoxID = _boxitem.BoxID;

                        //Open New Form
                        _printSlip.ShowDialog();
                    }

                    //Show message to user
                    _scrollMsg("Re-Printing: Packing Slip for Shipment Number " + Global.controller.GetShippingNumber(Global.RecentlyPackedID) + " printed.", Color.FromRgb(222, 87, 24));
                    txtShipmentId.Focus();
                }
                else
                {
                    _scrollMsg("Warning: Recently packed shipment information not available.", Color.FromRgb(222, 87, 24));
                }
            }
            catch (Exception)
            {}
        }
        /// <summary>
        /// Author: Avinash.
        /// Version: Alfa.
        /// Login Page Initialze event method
        /// </summary>
        public Login()
        {
            #region initialization page

            InitializeComponent();
            try
            {
                //Logger add log.
                SaveUserLogsTbl.logThis(csteActionType.Login_PageStart.ToString());


                //set language for the application.
                _setLanguage();

                // if AutoLogout occur.
                BErrorMsg.Visibility = System.Windows.Visibility.Hidden;

                //session expired
                if (Global.ISTimerRaised == true)
                {
                    _scrollMsg(Global.controller.ConvetLanguage("Session expired. Please login again to Continue...", Global.LanguageFileName), Color.FromRgb(222, 87, 24));
                }

                #region Message
                //Set Error message on the Sctrip and Visible it to animate.
                _scrollMsg("Please scan your badge.", Color.FromRgb(19, 136, 49));
                #endregion
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndLogin - public Login()", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString());
            }

            #endregion
        }
        /// <summary>
        /// Check for shipment Packed or not exist in the table .
        /// </summary>
        private void _saveClick()
        {
            BErrorMsg.Visibility = System.Windows.Visibility.Hidden;
            try
            {
                Global.PackingID      = Guid.Empty;
                Global.ShippingNumber = txtShipmentId.Text.ToUpper();

                //Get model of shipment;
                model_Shipment modelshipment        = Global.controller.getModelShipment(Global.ShippingNumber);
                String         ApplicationLocation  = Global.controller.ApplicationLocation();
                Boolean        ISSameLocationPacked = modelshipment.ShipmentFucntions.IsShipmentPackedAtSameLocation(modelshipment.PackedLocations, ApplicationLocation, modelshipment.IsAlreadyPacked);
                if (modelshipment.IsShipmentValidated)
                {
                    if (modelshipment.IsAlreadyPacked && ISSameLocationPacked)
                    {
                        List <cstPackageTbl> _lsPck = modelshipment.PackingInfo;
                        int      PackingStatus      = modelshipment.PackingInfo.FirstOrDefault(i => i.ShipmentLocation == ApplicationLocation).PackingStatus;
                        Guid     UserId             = modelshipment.PackingInfo.FirstOrDefault(i => i.ShipmentLocation == ApplicationLocation).UserID;
                        String   UserName           = modelshipment.UserInfo_ShipmentPackedBy.FirstOrDefault(i => i.UserID == UserId).UserFullName;
                        String   StationName        = Global.controller.GetStationMaster(modelshipment.PackingInfo[0].StationID).StationName;
                        DateTime PakedDate          = modelshipment.PackingInfo[0].EndTime;

                        #region single location packed
                        if (modelshipment.IsMultiLocation == false)
                        {
                            // if (PackingStatus == 1)
                            // {
                            //log.
                            SaveUserLogsTbl.logThis(csteActionType.ShipmentID_UnderPacking_Scan_00.ToString(), _lsPck[0].PackingId.ToString());

                            //if (UserId == Global.LoggedUserId)
                            if (true)
                            {
                                //if (modelshipment.CanOverride)
                                //{
                                //    //set mod to the SameUser packing the Shipment;
                                Global.Mode = "SameUser";
                                Global.SameUserpackingID = modelshipment.PackingInfo[0].PackingId;
                                this.Dispatcher.Invoke(new Action(() => { _show_Shipment(); }));
                                //    }
                                //    else
                                //    {
                                //        //Show Error message on the Strip;
                                //        _scrollMsg("Warning:\"" + txtShipmentId.Text + "\" is already overridden by you. Can not override shipment more than one.", Color.FromRgb(222, 87, 24));
                                //    }
                                //}
                                //else
                                //{
                                //    _scrollMsg("Warning: " + "'" + txtShipmentId.Text.ToUpper() + "' Shipment is under packing. user " + UserName + " is packing The Shipment at station  " + StationName, Color.FromRgb(222, 87, 24));
                                //    MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text.ToUpper() + "'" + Environment.NewLine + " Shipment is under packing." + Environment.NewLine + "user " + UserName + " is packing The Shipment at station  " + StationName);

                                //}
                                //_actMessageResult();
                                txtShipmentId.Text = "";
                            }
                            else if (PackingStatus == 0)
                            {
                                //log.
                                SaveUserLogsTbl.logThis(csteActionType.ShipmentID_AlreadyPacked_Scan_00.ToString(), _lsPck[0].PackingId.ToString());
                                //Distroy Shipment Object;
                                modelshipment = new model_Shipment();
                                _scrollMsg("Warning: " + "'" + txtShipmentId.Text + "'" + " Shipment is already packed  by  " + UserName + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + " at " + PakedDate.ToString("hh:mm:ss tt"), Color.FromRgb(222, 87, 24));
                                MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text + "'" + " Shipment is already packed " + Environment.NewLine + " by  " + UserName + Environment.NewLine + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + Environment.NewLine + " at " + PakedDate.ToString("hh:mm:ss tt"));
                                _actMessageResult();
                                txtShipmentId.Text = "";
                            }
                        }
                        #endregion
                        else if (modelshipment.IsMultiLocation)
                        {
                            //log.
                            SaveUserLogsTbl.logThis(csteActionType.MultiLocation_ShipmentIDScan.ToString());
                            Boolean LocationFound = false;
                            foreach (cstPackageTbl _packed in modelshipment.PackingInfo)
                            {
                                if (_packed.ShipmentLocation == ApplicationLocation)
                                {
                                    LocationFound = true;
                                    // if (_packed.PackingStatus == 1)
                                    //  {
                                    //log.
                                    SaveUserLogsTbl.logThis(csteActionType.ShipmentID_UnderPacking_Scan_00.ToString(), _lsPck[0].PackingId.ToString());

                                    //same User Override
                                    // if (UserId == Global.LoggedUserId)
                                    // {
                                    //set mod to the SameUser packing the Shipment;
                                    Global.Mode = "SameUser";
                                    Global.SameUserpackingID = _packed.PackingId;
                                    _show_Shipment();
                                    //  }
                                    //  else
                                    //  {
                                    //      _scrollMsg("Warning: " + "'" + txtShipmentId.Text.ToUpper() + "' Shipment is under packing. user " + UserName + " is packing The Shipment at station  " + StationName, Color.FromRgb(222, 87, 24));
                                    //      MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text.ToUpper() + "'" + Environment.NewLine + " Shipment is under packing." + Environment.NewLine + "user " + UserName + " is packing The Shipment at station  " + StationName);
                                    //  }
                                    //  _actMessageResult();
                                    txtShipmentId.Text = "";
                                    // break;
                                    // }
                                    if (_packed.PackingStatus == 0)
                                    {
                                        //log.
                                        SaveUserLogsTbl.logThis(csteActionType.ShipmentID_AlreadyPacked_Scan_00.ToString(), _lsPck[0].PackingId.ToString());
                                        //Distroy Shipment Object;
                                        modelshipment = new model_Shipment();
                                        MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text + "'" + " Shipment is already packed " + Environment.NewLine + " by  " + UserName + Environment.NewLine + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + Environment.NewLine + " at " + PakedDate.ToString("hh:mm:ss tt"));
                                        _scrollMsg("Warning: " + "'" + txtShipmentId.Text + "'" + " Shipment is already packed  by  " + UserName + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + " at " + PakedDate.ToString("hh:mm:ss tt"), Color.FromRgb(222, 87, 24));
                                        _actMessageResult();
                                        txtShipmentId.Text = "";
                                        break;
                                    }
                                }
                            }
                            if (LocationFound == false)
                            {
                                //Open Shipment Screen Directly.
                                _show_Shipment();
                            }
                        }
                    }
                    else if (modelshipment.ShipmentDetailSage == null || modelshipment.ShipmentDetailSage.Count <= 0)
                    {
                        //log.
                        SaveUserLogsTbl.logThis(csteActionType.Invalid_ShipmentScan__00.ToString(), txtShipmentId.Text);
                        //show error
                        _catchErrorInCondition();
                    }
                    else
                    {
                        Boolean Shown = false;
                        foreach (var sage in modelshipment.ShipmentDetailSage)
                        {
                            if (sage.Location == ApplicationLocation)
                            {
                                Shown = true;
                                _show_Shipment();
                                break;
                            }
                        }
                        if (Shown == false)
                        {
                            //Distroy Shipment Object;
                            modelshipment = new model_Shipment();

                            //Show Error message on the Strip;
                            _scrollMsg("Warning: Please check the shipment ID! - \"" + txtShipmentId.Text + "\" is not belongs to this location.", Color.FromRgb(222, 87, 24));

                            //clear the shipment textbox
                            txtShipmentId.Text = "";
                        }
                    }
                }
                else if (!modelshipment.IsShipmentValidated && modelshipment.ShipmentDetailSage.Count > 0)
                {
                    //Show error message.
                    _scrollMsg("Warning: Shipment Number: " + txtShipmentId.Text + " is already Shipped.", Color.FromRgb(222, 87, 24));
                    //clear the shipment textbox
                    txtShipmentId.Text = "";
                    //Distroy Shipment Object;
                    model_Shipment _shipment = new model_Shipment();
                }
                else
                {
                    //Show error message.
                    _scrollMsg("Warning: Shipment Number: " + txtShipmentId.Text + " is not valid. Please check Shipment Number.", Color.FromRgb(222, 87, 24));
                    //clear the shipment textbox
                    txtShipmentId.Text = "";
                    //Distroy Shipment Object;
                    model_Shipment _shipment = new model_Shipment();
                }
            }
            catch (Exception Ex)
            {
                //Show error
                _catchErrorInCondition();
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - _saveClick", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
Exemple #23
0
 /// <summary>
 /// Open role page.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRole_Click(object sender, RoutedEventArgs e)
 {
     //log
     SaveUserLogsTbl.logThis(csteActionType.UserManagement_NewRoleClicked.ToString());
     frmMain.Navigate(new RoleUI());
 }
Exemple #24
0
 private void cmbLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     lblCLocation.Visibility = cmbLocation.SelectedItem == null ? Visibility.Visible : Visibility.Hidden;
     //Log
     SaveUserLogsTbl.logThis(csteActionType.Setting_LocationChanged.ToString(), Global.ShippingNumber);
 }
        /// <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());
            }
        }
 private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
 {
     //Log.
     SaveUserLogsTbl.logThis(csteActionType.HomeScreenClosed.ToString());
 }