private void tripload_Checked(object sender, RoutedEventArgs e)
        {
            Thickness margin = insert.Margin;

            margin.Left   = 0; margin.Right = 0; margin.Top = 190; margin.Bottom = 0;
            insert.Margin = margin;
            Thickness margin1 = reset.Margin;

            margin1.Left           = 250; margin1.Right = 0; margin1.Top = 190; margin1.Bottom = 0;
            reset.Margin           = margin1;
            unloadpanel.Visibility = Visibility.Hidden;
            closepanel.Visibility  = Visibility.Hidden;
            tripnumber.IsEnabled   = false;
            string    S  = veh_typ.ToString();
            Trip_Load tl = new Trip_Load();

            number = tl.Trip_Load_Checked(S);
            if (number != null || number.All(x => string.IsNullOrWhiteSpace(x)))
            {
                loadpanel.Visibility = Visibility.Visible;
                vhlno.ItemsSource    = number;
            }
            else
            {
                MessageBox.Show("Vehicle Number Not Exist");
            }
        }
 private void loaddate_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         if (tripload.IsChecked == true)
         {
             if (!string.IsNullOrEmpty(vhlno.Text) && !string.IsNullOrEmpty(loaddate.Text))
             {
                 try
                 {
                     tripnumber.IsEditable = true;
                     Trip_Load tl = new Trip_Load();
                     tripnumber.Text      = tl.Load_Date_KeyDown(vhlno.Text, loaddate.Text);
                     tripnumber.IsEnabled = false;
                 }
                 catch
                 {
                     MessageBox.Show("Invalid Date");
                 }
             }
             else
             {
                 MessageBox.Show("Please Select Vehicle Number and Date");
             }
         }
     }
 }
 private void vhlno_LostFocus(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         string    l   = vhlno.Text;
         string    typ = null;
         string[]  VAL;
         Trip_Load tl = new Trip_Load();
         if (vhlno.Text.Length <= 10)
         {
             if (tripload.IsChecked == true)
             {
                 if (Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{2}[0-9]{4}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{2}[0-9]{3}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{1}[0-9]{4}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{1}[0-9]{3}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{6}"))
                 {
                     typ = "L";
                     VAL = tl.Vehicle_Number_Keydown(vhlno.Text, typ);
                     if (VAL[0].ToString() == "")
                     {
                         vhlno.Text = string.Empty;
                         e.Handled  = true;
                     }
                 }
                 else
                 {
                     MessageBox.Show("Invalid Vehicle Number");
                     vhlno.Text = string.Empty;
                     e.Handled  = true;
                 }
             }
             else if (tripunload.IsChecked == true)
             {
                 if (Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{2}[0-9]{4}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{2}[0-9]{3}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{1}[0-9]{4}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{2}[A-Za-z]{1}[0-9]{3}") || Regex.IsMatch(l, "^[A-Za-z]{2}[0-9]{6}"))
                 {
                     typ = "U";
                     tripnumber.IsEditable = true;
                     VAL                  = tl.Vehicle_Number_Keydown(vhlno.Text, typ);
                     tripnumber.Text      = VAL[0].ToString();
                     driname.Text         = VAL[1].ToString();
                     ldna.Text            = VAL[2].ToString();
                     loaddate.Text        = VAL[3].ToString();
                     tripnumber.IsEnabled = false;
                 }
                 else
                 {
                     MessageBox.Show("Invalid Vehicle Number");
                     vhlno.Text = string.Empty;
                     e.Handled  = true;
                 }
             }
         }
         else
         {
             MessageBox.Show("Invalid Vehicle Number");
             vhlno.Text = string.Empty;
             e.Handled  = true;
         }
     }
 }
        private void stkm_TextChanged(object sender, TextChangedEventArgs e)
        {
            Trip_Load tl  = new Trip_Load();
            string    MSG = tl.Startingkm_Textchanged(stkm.Text);

            if (MSG != "NO")
            {
                stkm.Text = string.Empty;
            }
        }
        private void unlodwgt_TextChanged(object sender, TextChangedEventArgs e)
        {
            Trip_Load tl  = new Trip_Load();
            string    msg = tl.Unload_Weight_Textchanged(unlodwgt.Text);

            if (msg == "")
            {
                unlodwgt.Text = "";
            }
        }
        private void wgt_TextChanged(object sender, TextChangedEventArgs e)
        {
            Trip_Load tl  = new Trip_Load();
            string    msg = tl.Load_Weight_Textchanged(wgt.Text);

            if (msg != "NO")
            {
                wgt.Text = string.Empty;
            }
        }
 private void unlodwgt_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         Trip_Load tl  = new Trip_Load();
         string    msg = tl.Unload_Weight_KeyDown(vhlno.Text, unlodwgt.Text);
         if (msg == "")
         {
             unlodwgt.Text = string.Empty;
             e.Handled     = true;
         }
     }
 }
        private void diesel_card_id_KeyDown(object sender, KeyEventArgs e)
        {
            Trip_Load tl = new Trip_Load();

            if (!string.IsNullOrWhiteSpace(diesel_card_id.Text))
            {
                string val = tl.CardId_Keydown(diesel_card_id.Text);
                if (val != string.Empty)
                {
                    card_balance.Text = val;
                }
            }
        }
        private void from_card_Checked(object sender, RoutedEventArgs e)
        {
            diesel_card_id.IsEnabled = true;
            Trip_Load tl = new Trip_Load();

            if (!string.IsNullOrWhiteSpace(vhlno.Text))
            {
                string[] msg = tl.Card_Checked(vhlno.Text);
                card_balance.Text   = msg[1].ToString();
                diesel_card_id.Text = msg[0].ToString();
            }
            else
            {
                MessageBox.Show("Please Select Vehicle Number");
                from_card.IsChecked = false;
            }
        }
Ejemplo n.º 10
0
 private void endkms_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         Trip_Load tl  = new Trip_Load();
         string    msg = tl.Endingkm_KeyDown(vhlno.Text, endkms.Text);
         if (msg == "")
         {
             endkms.Text = string.Empty;
             e.Handled   = true;
         }
         else
         {
             totalkm.Text = msg;
         }
     }
 }
Ejemplo n.º 11
0
        private void driname_GotFocus(object sender, RoutedEventArgs e)
        {
            Trip_Load tl = new Trip_Load();

            number = tl.Driver_Name_GotFocus();
            string id = tl.Get_Driver_Id(vhlno.Text);

            if (number != null || number.All(x => string.IsNullOrWhiteSpace(x)))
            {
                driname.ItemsSource = number;
                driname.Text        = id;
            }
            else
            {
                MessageBox.Show("Drivers Id Not Exist");
            }
        }
Ejemplo n.º 12
0
        private void ok_Click(object sender, RoutedEventArgs e)
        {
            Trip_Load tl = new Trip_Load();
            int       i  = Convert.ToInt32(dripaymt.Text) + Convert.ToInt32(clinerpymt.Text) + Convert.ToInt32(commis.Text);

            i = tl.Payment_Ok_btn_Click(i);
            if (i > 0)
            {
                paymt.Text         = i.ToString();
                dripaymt.Text      = "0";
                clinerpymt.Text    = "0";
                commis.Text        = "0";
                payment.Visibility = Visibility.Hidden;
            }
            else
            {
            }
        }
Ejemplo n.º 13
0
 private void tripnumber_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         if (tripclose.IsChecked == true && !string.IsNullOrWhiteSpace(tripnumber.Text))
         {
             Trip_Load tl = new Trip_Load();
             trp_val       = tl.TripNumber_Keydown(tripnumber.Text);
             vhlno.Text    = trp_val[0].ToString();
             loaddate.Text = trp_val[1].ToString();
             driname.Text  = trp_val[2].ToString();
             ldna.Text     = trp_val[3].ToString();
         }
         else
         {
             MessageBox.Show("Select Trip Number");
         }
     }
 }
Ejemplo n.º 14
0
 private void vhlno_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     if (vhlno.Text.Length < 10)
     {
         Trip_Load tl  = new Trip_Load();
         string    msg = tl.Vehicle_Number_Previewtextinput(vhlno.Text);
         if (msg != "NO")
         {
             vhlno.Text = string.Empty;
             e.Handled  = true;
         }
     }
     else
     {
         MessageBox.Show("Maximum length is 10");
         vhlno.Text = string.Empty;
         e.Handled  = true;
     }
 }
Ejemplo n.º 15
0
 private void wgt_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         if (!string.IsNullOrWhiteSpace(wgt.Text))
         {
             Trip_Load tl  = new Trip_Load();
             string    msg = tl.Load_Weight_KeyDown(wgt.Text);
             if (msg != "NO")
             {
                 wgt.Text  = string.Empty;
                 e.Handled = true;
             }
         }
         else
         {
             MessageBox.Show("Enter Weight");
         }
     }
 }
Ejemplo n.º 16
0
        public void diesel_back_click(object sender, RoutedEventArgs e)
        {
            try
            {
                array_clear();
                diesel_calculation.Visibility = Visibility.Hidden;
                diesel_price.Text             = "";
                diesel_litter.Text            = "";
                diesel_price.Focus();
                da = 0;
                tl = 0;
                total_price.Text = "";

                Trip_Load t = new Trip_Load();
                t.Diesel_Calculation_Back_btn_Click();
            }
            catch
            {
                MessageBox.Show("Diesel Text Doesn't Clear");
            }
        }
Ejemplo n.º 17
0
 private void stkm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Tab || e.Key == Key.Enter)
     {
         if (!string.IsNullOrWhiteSpace(vhlno.Text) && !string.IsNullOrWhiteSpace(stkm.Text))
         {
             Trip_Load tl  = new Trip_Load();
             string    msg = tl.Startingkm_KeyDown(stkm.Text, vhlno.Text);
             if (msg != "NO")
             {
                 stkm.Text = string.Empty;
                 e.Handled = true;
             }
             else if (msg == "0")
             {
                 stkm.Text = "0";
             }
         }
         else
         {
             MessageBox.Show("Select Vehicle Number and Enter the Km");
         }
     }
 }
Ejemplo n.º 18
0
        private void insert_Click(object sender, RoutedEventArgs e)
        {
            string[]  val   = new string[16];
            int[]     count = new int[4];
            double[]  total = new double[16];
            Trip_Load tl    = new Trip_Load();
            string    ch    = null;

            if (tripload.IsChecked == true)
            {
                ch      = "L";
                val[0]  = vhlno.Text; val[1] = loaddate.Text; val[2] = tripnumber.Text; val[3] = driname.Text; val[4] = ldna.Text; val[5] = form.Text;
                val[6]  = too.Text; val[7] = stkm.Text; val[8] = chln.Text; val[9] = ldadv.Text; val[10] = driadv.Text; val[11] = frgt.Text;
                val[12] = clname.Text; val[13] = wgt.Text; val[14] = ti.ToString(); val[15] = veh_typ.ToString();
                string msg = tl.Load_Trailer_Insert_btn_Click(ch, val, count, type, place, litter, price, date, tot_price, card_id, no_of_time, tollplace, rtoplace, otherreason, tollamount, rtoamount, otheramount, total);
                if (msg == "Success1")
                {
                    vhlno.Text     = string.Empty; loaddate.Text = DateTime.Now.ToShortDateString(); tripnumber.Text = string.Empty; driname.Text = string.Empty; ldna.Text = string.Empty; form.Text = string.Empty; too.Text = string.Empty; stkm.Text = string.Empty; chln.Text = string.Empty; ldadv.Text = string.Empty; driadv.Text = string.Empty; frgt.Text = string.Empty; clname.Text = string.Empty; wgt.Text = string.Empty; ti = 2;
                    load.IsChecked = false; trailer.IsChecked = false; tripload.IsChecked = false; time.IsChecked = false; untime.IsChecked = false;
                    lpg_trip_insert_imgs1.Visibility = System.Windows.Visibility.Hidden;
                    lpg_trip_insert_imgs2.Visibility = System.Windows.Visibility.Visible;
                    time1.Start();
                    chr = "i";
                }
            }
            else if (tripunload.IsChecked == true)
            {
                ch     = "U";
                val[0] = vhlno.Text;  val[1] = tripnumber.Text; val[2] = loaddate.Text; val[3] = endkms.Text; val[4] = totalkm.Text;
                val[5] = unlodwgt.Text; val[6] = paymt.Text;
                string msg = tl.Load_Trailer_Insert_btn_Click(ch, val, count, type, place, litter, price, date, tot_price, card_id, no_of_time, tollplace, rtoplace, otherreason, tollamount, rtoamount, otheramount, total);
                if (msg == "Success2")
                {
                    vhlno.Text     = string.Empty; undt.Text = DateTime.Now.ToShortDateString(); endkms.Text = string.Empty; totalkm.Text = string.Empty; unlodwgt.Text = string.Empty; tripnumber.Text = string.Empty; driname.Text = string.Empty; ldna.Text = string.Empty; paymt.Text = string.Empty;
                    load.IsChecked = false; trailer.IsChecked = false; tripunload.IsChecked = false;
                    lpg_trip_insert_imgs1.Visibility = System.Windows.Visibility.Hidden;
                    lpg_trip_insert_imgs2.Visibility = System.Windows.Visibility.Visible;
                    time1.Start();
                    chr = "i";
                }
            }
            else if (tripclose.IsChecked == true)
            {
                if (!string.IsNullOrWhiteSpace(tripdese.Text) && !string.IsNullOrWhiteSpace(tripmilg.Text) && !string.IsNullOrWhiteSpace(dieselamnt.Text) && !string.IsNullOrWhiteSpace(frtpty.Text) && !string.IsNullOrWhiteSpace(tripexpe.Text) && !string.IsNullOrWhiteSpace(profit.Text) && !string.IsNullOrWhiteSpace(driver_bal.Text))
                {
                    ch        = "C";
                    val[0]    = vhlno.Text; val[1] = tripnumber.Text; val[2] = trp_val[9].ToString(); val[3] = trp_val[10].ToString(); val[4] = veh_typ.ToString();
                    total[0]  = Convert.ToDouble(toll_total.Text); total[1] = Convert.ToDouble(rto_total.Text); total[2] = Convert.ToDouble(other_total.Text); total[3] = Convert.ToDouble(tripdese.Text); total[4] = Convert.ToDouble(dieselamnt.Text); total[5] = Convert.ToDouble(tripmilg.Text); total[6] = Convert.ToDouble(frtpty.Text);
                    total[7]  = Convert.ToDouble(tripexpe.Text); total[8] = Convert.ToDouble(profit.Text); total[9] = Convert.ToDouble(driver_bal.Text); total[10] = Convert.ToDouble(val11.Text); total[11] = Convert.ToDouble(val12.Text); total[12] = Convert.ToDouble(val13.Text);
                    total[13] = Convert.ToDouble(val14.Text); total[14] = Convert.ToDouble(val15.Text); total[15] = Convert.ToDouble(val16.Text);
                    count[0]  = t_count; count[1] = r_count; count[2] = o_count; count[3] = i;
                    string msg = tl.Load_Trailer_Insert_btn_Click(ch, val, count, type, place, litter, price, date, tot_price, card_id, no_of_time, tollplace, rtoplace, otherreason, tollamount, rtoamount, otheramount, total);
                    if (msg == "Success3")
                    {
                        val11.Text      = "0"; val12.Text = "0"; val13.Text = "0"; val14.Text = "0"; val15.Text = "0"; val16.Text = "0";
                        toll_total.Text = "0"; rto_total.Text = "0"; other_total.Text = "0";
                        tripdese.Text   = string.Empty; dieselamnt.Text = string.Empty; tripmilg.Text = string.Empty; frtpty.Text = string.Empty; tripexpe.Text = string.Empty; profit.Text = string.Empty; tripnumber.Text = string.Empty; vhlno.Text = string.Empty; loaddate.Text = DateTime.Now.ToShortDateString(); driname.Text = string.Empty; ldna.Text = string.Empty; driver_bal.Text = string.Empty;
                        load.IsChecked  = false; trailer.IsChecked = false; tripclose.IsChecked = false;
                        array_clear(); CLEAR();
                        lpg_trip_insert_imgs1.Visibility = System.Windows.Visibility.Hidden;
                        lpg_trip_insert_imgs2.Visibility = System.Windows.Visibility.Visible;
                        time1.Start();
                        chr = "i";
                    }
                }
                else
                {
                    MessageBox.Show("Should Fill All Text Field");
                }
            }
        }
Ejemplo n.º 19
0
        private void diesel_card_id_GotFocus(object sender, RoutedEventArgs e)
        {
            Trip_Load tl = new Trip_Load();

            diesel_card_id.ItemsSource = tl.Cardid_Gotfocus();
        }