Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        protected void Alert(String msg)
        {
            try {
                if (null != msg && msg.Length > 0 && msg.Contains("Please select document for currCoPrinting."))
                {
                    timer.Dispose();
                    MessageBox.Show(msg, Properties.Resources.FORM_ALERT_TITLE);
                    //if no document selected for currCoPrinting redirecting user to form config page
                    this.Hide();
                    config = new FormConfig(sessionId);
                    config.ShowDialog(this);
                }
                else if (null != msg && msg.Length > 0 && msg.Contains("Error occured while updating CO record."))
                {
                    timer.Dispose();
                    MessageBox.Show(msg, Properties.Resources.FORM_ALERT_TITLE);
                    //if no document selected for currCoPrinting redirecting user to form config page

                    this.Show();
                }
                else
                {
                    MessageBox.Show(msg, Properties.Resources.FORM_ALERT_TITLE);
                    this.Show();
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Event handler for button submit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void bntSubmit_Click(object sender, EventArgs e)
        {
            try {
                this.bntSubmit.Hide();
                if (this.txtUserID.TextLength == 0)
                {
                    this.txtUserID.Focus();
                }
                if (this.txtPassword.TextLength == 0)
                {
                    this.txtPassword.Focus();
                }

                //Get the default setting from here and set to the txtUserID
                if (this.txtUserID.Text != string.Empty)
                {
                    Properties.Settings.Default.UserUid = this.txtUserID.Text;
                    Properties.Settings.Default.Save();
                }
                //Added to upper to convert all the characters into uppercase
                String sessionId = await restProxy.DoLoginAsync(this.txtUserID.Text + ":" + this.txtPassword.Text);

                Console.WriteLine("sessionId: " + sessionId);

                switch (sessionId)
                {
                case BLANK:
                case GENERIC_ERROR:
                    Alert(Properties.Resources.ERR_LOGIN_EXCEPTION);
                    this.bntSubmit.Show();
                    return;

                case CREDENTIALS_ERROR:
                    Alert(Properties.Resources.ERR_LOGIN_FAIL);
                    this.bntSubmit.Show();
                    return;

                default:
                    break;
                }
                this.Hide();

                Settings1.Default.LoggedInDateTime = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss");
                config = new FormConfig(sessionId);
                config.ShowDialog(this);
            } catch (Exception ex) {
                LogException(ex);
            }
            this.Close();
        }
Exemple #3
0
 //for closing application on Exit
 private void bntClose_Click(object sender, EventArgs e)
 {
     try
     {
         timer.Dispose();
         this.Hide();
         config = new FormConfig(sessionId);
         config.ShowDialog(this);
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Exemple #4
0
 /// <summary>
 /// Log exception
 /// </summary>
 /// <param name="ex"></param>
 protected void LogException(Exception ex)
 {
     if (ex.Message.Contains("No Printer tray selected for the Print media type"))
     {
         timer.Dispose();
         this.Hide();
         Console.WriteLine(ex.StackTrace);
         FormException form = new FormException(ex);
         form.ShowDialog();
         config = new FormConfig(sessionId);
         config.ShowDialog(this);
     }
     else if (ex.Message == "Non Zero Error code received from the Server. Error COde ")
     {
         timer.Dispose();
         Console.WriteLine(ex.StackTrace);
         FormException form = new FormException(ex);
         form.ShowDialog();
     }
 }