Ejemplo n.º 1
0
        public TimeSpan?GetTimeFromRouteresult()
        {
            int      hours    = 0;
            int      minutes  = 0;
            TimeSpan?duration = null;

            try
            {
                if (DurationText.ToLowerInvariant().Contains("ώρ"))
                {
                    var endHourIndex = DurationText.IndexOf("ώρ");
                    hours    = int.Parse(DurationText.Substring(0, endHourIndex).Trim());
                    minutes  = int.Parse(DurationText.Substring(6, 3).Trim());
                    duration = new TimeSpan(0, hours, minutes, 0);
                    return(duration);
                }

                else
                {
                    minutes  = int.Parse(DurationText.Substring(0, 2).Trim());
                    duration = new TimeSpan(0, hours, minutes, 0);

                    return(duration);
                }
            }

            catch (Exception exp)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public int GetCurrentDurationMinutes()
        {
            if (GetDurationInputType() == DurationInputType.TextBox)
            {
                if (string.IsNullOrEmpty(DurationText.Trim()))
                {
                    throw new Exception("Please enter the duration in minutes.");
                }

                return(Convert.ToInt32(DurationText.Trim()));
            }
            else
            {
                if (string.IsNullOrEmpty(DurationSelectedValue))
                {
                    return(0);
                }
                else
                {
                    return(Convert.ToInt32(DurationSelectedValue));
                }
            }
        }
Ejemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (GameModeLabel != null)
            {
                GameModeLabel.Dispose();
                GameModeLabel = null;
            }

            if (BGBox != null)
            {
                BGBox.Dispose();
                BGBox = null;
            }

            if (TextArea != null)
            {
                TextArea.Dispose();
                TextArea = null;
            }

            if (VerticalLine != null)
            {
                VerticalLine.Dispose();
                VerticalLine = null;
            }

            if (HorizontalLine != null)
            {
                HorizontalLine.Dispose();
                HorizontalLine = null;
            }

            if (AccuracyText != null)
            {
                AccuracyText.Dispose();
                AccuracyText = null;
            }

            if (SpeedText != null)
            {
                SpeedText.Dispose();
                SpeedText = null;
            }

            if (DurationText != null)
            {
                DurationText.Dispose();
                DurationText = null;
            }

            if (AccuracyNum != null)
            {
                AccuracyNum.Dispose();
                AccuracyNum = null;
            }

            if (SpeedNum != null)
            {
                SpeedNum.Dispose();
                SpeedNum = null;
            }

            if (DurationNum != null)
            {
                DurationNum.Dispose();
                DurationNum = null;
            }

            if (BGBoxWhite != null)
            {
                BGBoxWhite.Dispose();
                BGBoxWhite = null;
            }

            if (InputBox != null)
            {
                InputBox.Dispose();
                InputBox = null;
            }
        }
Ejemplo n.º 4
0
        private void SaveTrain_Click(object sender, EventArgs e)
        {
            string query = "";

            if (comStaffID.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Staff ID");
                comStaffID.Focus();
                return;
            }

            if (CompanyNameText.Text == "")
            {
                MessageBox.Show("Company Name");
                CompanyNameText.Focus();
                return;
            }


            if (TrainingNameText.Text == "")
            {
                MessageBox.Show("Please Enter Training Name");
                TrainingNameText.Focus();
                return;
            }


            if (TrainingInsText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Training Institute");
                TrainingInsText.Focus();
                return;
            }
            if (DurationText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Duration Time");
                DurationText.Focus();
                return;
            }
            if (TrainType.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Training type");
                TrainType.Focus();
                return;
            }
            if (traindate.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Training Date");
                traindate.Focus();
                return;
            }

            try
            {
                if (Hide.Text == "")
                {
                    query = "INSERT INTO Training_Info(StaffID,Companyname,TrainingName,TrainingInstitute,Duration,TrainingType,TrainingDate) VALUES(" + Convert.ToInt32(comStaffID.Text) + ",  '" + CompanyNameText.Text + "',  '" + TrainingNameText.Text + "', '" + TrainingInsText.Text + "', '" + DurationText.Text + "', '" + TrainType.Text + "', '" + traindate.Value.ToString("yyyy/MM/dd") + "' )";
                }


                else
                {
                    query = "UPDATE Training_Info SET Companyname = '" + CompanyNameText.Text + "',TrainingInstitute = '" + TrainingInsText.Text + "', Duration= '" + DurationText.Text + "',TrainingType = '" + TrainType.Text + "',TrainingDate = '" + traindate.Value.ToString("yyyy/MM/dd") + "' WHERE ID= " + Convert.ToInt32(Hide.Text);
                }

                if (DbAccess.ExecuteToDB(query))
                {
                    if (Hide.Text == "")
                    {
                        MessageBox.Show("Saved Successfully!!!");
                    }
                    else
                    {
                        MessageBox.Show("Update Successfully!!!");
                    }
                }
                else
                {
                    MessageBox.Show("Failed To Save!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Error!!!");
            }
            finally
            {
                Reset();
            }
        }