Beispiel #1
0
        private void edtTextID_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.TheGlobalStep)
                {
                case 1:
                {
                    if (edtTextID.Text.Equals(""))
                    {
                        break;
                    }
                    lblHeaderText.Text = mt.ReadResFile(this.Name.ToString() + "LeadText01");

                    BalanceProduktion TimeJob = new BalanceProduktion();
                    TimeJob.UseDefaultCredentials = true;

                    if (Globals.TheGlobalCome)
                    {
                        try
                        {
                            if (TimeJob.WSCreateProdRessLine(Employee.TheEmployeeNo, Employee.TheWorkingWorkCenter, DateTime.Now, DateTime.MinValue, "J"))
                            {
                                edtTextID.Text = mt.ReadResFile(this.Name.ToString() + "OK01");
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        TimeJob.Dispose();
                    }
                    else
                    {
                        try
                        {
                            if (TimeJob.WSCreateProdRessLine(Employee.TheEmployeeNo, Employee.TheWorkingWorkCenter, DateTime.MinValue, DateTime.Now, "J"))
                            {
                                edtTextID.Text = mt.ReadResFile(this.Name.ToString() + "OK01");
                            }
                            else
                            {
                                edtTextID.Text = mt.ReadResFile(this.Name.ToString() + "ERROR01");
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    Globals.TheGlobalStep = 0;
                    TimeJob.Dispose();
                    timer1.Interval = 1500;
                    timer1.Start();
                }
                break;
                }
            }

            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.TheGlobalStep)
                {
                case 0: this.Close();
                    break;
                }
            }
        }
        private void edtTextID_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.TheGlobalStep)
                {
                case 1: this.Close();
                    break;

                case 0: this.Close();
                    break;
                }
            }

            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.TheGlobalStep)
                {
                case 1:
                {
                    BalanceProduktion TimeJob = new BalanceProduktion();
                    TimeJob.UseDefaultCredentials = true;
                    if (Globals.TheGlobalCome)
                    {
                        try
                        {
                            if (TimeJob.WSCreateTimeStampLine(Employee.TheEmployeeNo, Employee.TheTimeGroupCode, Employee.TheAbsenceCode, DateTime.Now.Date, DateTime.Now, 1))
                            {
                                edtTextID.Text = mt.ReadResFile(this.Name.ToString() + "OK01");
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        timer1.Interval = 1500;
                        timer1.Start();
                    }
                    else
                    {
                        try
                        {
                            if (TimeJob.WSCreateTimeStampLine(Employee.TheEmployeeNo, Employee.TheTimeGroupCode, Employee.TheAbsenceCode, DateTime.Now.Date, DateTime.Now, 2))
                            {
                                edtTextID.Text = mt.ReadResFile(this.Name.ToString() + "OK01");
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        timer1.Interval = 1500;
                        timer1.Start();
                    }
                    Globals.TheGlobalStep = 0;
                    TimeJob.Dispose();
                }
                break;
                }
            }
        }