Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Validation2())
            {
                if (tnew.Text.Equals(trnew.Text))
                {
                    err.Dispose();
                    String oldp = db.GetValue("SELECT [Password]FROM [AVVMS].[dbo].[Login]");
                    if (oldp.Equals(told.Text))
                    {
                        db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Login]SET [Password] = '" + tnew.Text + "'");
                        MessageBox.Show("Up Success");
                        Common_Tasks.nullify(told);
                        Common_Tasks.nullify(tnew);
                        Common_Tasks.nullify(trnew);
                    }
                    else
                    {
                        err.Dispose();

                        err.SetError(told, "Enter Correct old password");
                        told.Focus();
                    }
                }
                else
                {
                    err.Dispose();

                    err.SetError(tnew, "Unmatched passwords");
                    tnew.Focus();
                }
            }
        }
Пример #2
0
        public Trip_Completion(string id, string vehicle, string purpose, string name, string address, string mobile, string driver, string startm, string startt, string sdate, string remark, string j)
        {
            InitializeComponent();
            jtype = 1;
            dateTimePicker1.MinDate = DateTime.Parse(sdate);

            numericUpDown1.Minimum = ((Convert.ToInt32(startm)));

            DGV_traffic_exception.Rows.Add("Toll Fee", "", "");
            DGV_traffic_exception.Rows.Add("Parking Fee", "", "");
            DGV_traffic_exception.Rows.Add("Fuel", "", "");
            label20.Text    = id;
            lb_address.Text = address;
            lb_driver.Text  = driver;
            lb_mobile.Text  = mobile;
            lb_name.Text    = name;
            lb_purpose.Text = purpose;
            lb_smeter.Text  = startm;

            lb_vehicle.Text = vehicle;


            lb_remarks.Text = remark;
            ld_sdatea.Text  = sdate + " " + startt;
            date            = sdate;

            lb_j.Text = j;



            Common_Tasks.nullify(lb_fc);
            Common_Tasks.nullify(lb_sc);
            Common_Tasks.nullify(label11);
            Common_Tasks.nullify(label4);


            label31.Text = db.GetValue("SELECT [mail]FROM [AVVMS].[dbo].[Trips] where [Id]='" + id + "'");

            groupBox2.Text = groupBox2.Text + " : For Driver";

            lbextraheavy.Hide();
            tkmdheavy.Hide();
            panelheavy.Hide();

            lb_b.Hide();
            txt_hbatha.Hide();

            ebatha.Text = db.GetValue("SELECT [light extra amount]FROM [AVVMS].[dbo].[batha]");
            hbatha.Text = db.GetValue("SELECT [light hault batha]FROM [AVVMS].[dbo].[batha]");
            ini_flag    = 1;
        }
Пример #3
0
        public Test_Form()
        {
            InitializeComponent();

            //oDateTimePicker.TextChanged += new EventHandler(dateTimePicker_OnTextChange);
            a = new System.Windows.Forms.NumericUpDown();
            this.Controls.Add(a);
            a.Minimum       = Convert.ToInt32("10") + 1;
            a.ValueChanged += new EventHandler(a_OnValueChange);

            System.Windows.Forms.Control[] c = new Control[2];
            c[0] = label1;
            c[1] = label9;
            Common_Tasks.disableg(c);

            String fields = "[Id] as [Sl. No.],[Vehicle] as [Vehicle No.],[Reason] ,[Remarks]";
            string table  = "[AVVMS].[dbo].[Vehicle_Notifications]";
            //DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search(fields,table));

            String searchkey    = "v2";
            String search_field = "[Vehicle]";

            //DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search_feild_start(fields, table, search_field, searchkey));

            //DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search_feild_end(fields, table, search_field, searchkey));

            //DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search_feild_contains(fields, table, search_field, searchkey));

            //DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search_feild_notcontains(fields, table, search_field, searchkey));

            DGV_Vehicle.DataSource = db.GetTable(Search_Handler.query_builder_search_feild(fields, table, search_field, searchkey));

            Control[] cx = new Control[2] {
                label1, label9
            };
            Common_Tasks.disableg(cx);
        }
Пример #4
0
        private void dataGridView6_Click(object sender, EventArgs e)
        {
            if (dataGridView6.SelectedRows.Count != 0)
            {
                groupBox1.Text = "Trip No. : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString();


                if (db.GetValue("SELECT [Type]FROM [AVVMS].[dbo].[Vehicles] where [Vehicle No.]='" + dataGridView6.SelectedRows[0].Cells[1].Value.ToString() + "'").Contains("Heavy"))
                {
                    dt = db.GetTable("SELECT [first cleaner],[second cleaner],[address],[start meter],[start time],[moment slip no.]FROM [AVVMS].[dbo].[Trips] where [id]=" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "");

                    lb_fc.Text = "First Cleaner : " + dt.Rows[0]["first cleaner"].ToString();
                    if (dt.Rows[0]["second cleaner"].ToString().Equals(""))
                    {
                        Common_Tasks.nullify(lb_sc);
                    }
                    else
                    {
                        lb_sc.Text = "Second Cleaner : " + dt.Rows[0]["second cleaner"].ToString();
                    }
                }
                else
                {
                    Common_Tasks.nullify(lb_fc);
                    Common_Tasks.nullify(lb_sc);
                    dt = db.GetTable("SELECT [address],[start meter],[start time],[moment slip no.]FROM [AVVMS].[dbo].[Trips] where [id]=" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "");
                }

                lb_address.Text    = "Provider Address : " + dt.Rows[0]["address"].ToString();
                lb_startmeter.Text = "Start Meter : " + dt.Rows[0]["start meter"].ToString();
                lb_starttime.Text  = "Start Time : " + dt.Rows[0]["start time"].ToString();
                lb_moment.Text     = "Moment Slip No. : " + dt.Rows[0]["moment slip no."].ToString();

                groupBox1.Show();
            }
        }
Пример #5
0
        public Trip_Completion(string id, string vehicle, string purpose, string name, string address, string mobile, string driver, string startm, string startt, string sdate, string remark, string j, string fc, string sc)
        {
            InitializeComponent();


            dateTimePicker1.MinDate = DateTime.Parse(sdate);

            numericUpDown1.Minimum = ((Convert.ToInt32(startm)));


            DGV_traffic_exception.Rows.Add("Toll Fee", "", "");
            DGV_traffic_exception.Rows.Add("Parking Fee", "", "");
            DGV_traffic_exception.Rows.Add("Fuel", "", "");
            label20.Text    = id;
            lb_address.Text = address;
            lb_driver.Text  = driver;
            lb_mobile.Text  = mobile;
            lb_name.Text    = name;
            lb_purpose.Text = purpose;
            lb_smeter.Text  = startm;

            lb_vehicle.Text = vehicle;


            lb_remarks.Text = remark;
            ld_sdatea.Text  = sdate + " " + startt;
            date            = sdate;

            lb_j.Text  = j;
            lb_fc.Text = fc;
            lb_sc.Text = sc;


            label31.Text = db.GetValue("SELECT [mail]FROM [AVVMS].[dbo].[Trips] where [Id]='" + id + "'");
            tefc.Text    = db.GetValue("SELECT [heavy extra amount cleaner]FROM [AVVMS].[dbo].[batha]");

            if (db.GetValue("SELECT [Type]FROM [AVVMS].[dbo].[Employee] where [Employee ID]='" + fc + "'").Equals("Permanent"))
            {
                tkmfc.Text = db.GetValue("SELECT [heavy km alavence permanent cleaner]FROM [AVVMS].[dbo].[batha]");
            }
            else
            {
                tkmfc.Text = db.GetValue("SELECT [heavy km alavance temporary cleaner]FROM [AVVMS].[dbo].[batha]");
            }

            if (sc.Equals(""))
            {
                groupBox2.Text = groupBox2.Text + " : For Driver,First Cleaner";
                panel2sc.Hide();
                Common_Tasks.nullify(label4);

                jtype = 2;
            }
            else
            {
                groupBox2.Text = groupBox2.Text + " : For Driver,First Cleaner,Second Cleaner";
                jtype          = 3;

                tesc.Text = tefc.Text;
                if (db.GetValue("SELECT [Type]FROM [AVVMS].[dbo].[Employee] where [Employee ID]='" + sc + "'").Equals("Permanent"))
                {
                    tkmsc.Text = db.GetValue("SELECT [heavy km alavence permanent cleaner]FROM [AVVMS].[dbo].[batha]");
                }
                else
                {
                    tkmsc.Text = db.GetValue("SELECT [heavy km alavance temporary cleaner]FROM [AVVMS].[dbo].[batha]");
                }
            }


            lb_b.Hide();
            txt_hbatha.Hide();

            ebatha.Text    = db.GetValue("SELECT [heavy extra amount driver]FROM [AVVMS].[dbo].[batha]");
            hbatha.Text    = db.GetValue("SELECT [heavy hault batha]FROM [AVVMS].[dbo].[batha]");
            tkmdheavy.Text = db.GetValue("SELECT [heavy km alavence driver]FROM [AVVMS].[dbo].[batha]");

            ini_flag = 1;
        }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                error.Dispose();
                if (cal_flag == 1)
                {
                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Trips]SET [status] = 'Complete',km=" + lb_ekm.Text + " WHERE [Id]='" + label20.Text + "'");

                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [Status] = 'Available', [Meter Reading]=" + numericUpDown1.Value + ",[fuel]=" + lb_rfuel.Text + " WHERE [Vehicle No.] = '" + lb_vehicle.Text + "'");

                    if ((Convert.ToDouble(dt.Rows[0]["Fuel Refill Limit"].ToString())) >= (Convert.ToDouble(lb_rfuel.Text)))
                    {
                        db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Refill_Notifications]([Vehicle],[Remain],[Limit],[LastRefillDate])VALUES('" + lb_vehicle.Text + "'," + lb_rfuel.Text + "," + dt.Rows[0]["Fuel Refill Limit"].ToString() + ",'" + db.GetValue("SELECT     [last refill date]FROM         Vehicles WHERE     ([Vehicle No.] = '" + lb_vehicle.Text + "')") + "')");
                        Program.pi.Display("Vehicle No. " + lb_vehicle.Text + " is in refill stage");
                    }

                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'Available'WHERE [Employee ID] = '" + lb_driver.Text + "'");

                    if (!lb_fc.Text.Equals(""))
                    {
                        db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'Available'WHERE [Employee ID] = '" + lb_fc.Text + "'");
                    }

                    if (!lb_sc.Text.Equals(""))
                    {
                        db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'Available'WHERE [Employee ID] = '" + lb_sc.Text + "'");
                    }

                    if (txt_hbatha.Visible)
                    {
                        db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Batha_Report]([Trip No.],[Date],[Batha],[Batha Amount],[Employee ID])VALUES('" + label20.Text + "','" + date + "','" + lb_b.Text + "','" + txt_hbatha.Text + "','" + lb_driver.Text + "')");
                    }

                    try
                    {
                        MailMessage email = new MailMessage();
                        email.From = new MailAddress("*****@*****.**");
                        email.To.Add(label31.Text);
                        email.Body    = "Your Trip Expense " + lb_total.Text;
                        email.Subject = "Arya Vydya Shala Trip ";

                        SmtpClient mailclient = new SmtpClient("smtp.gmail.com", 587);
                        mailclient.Credentials = new NetworkCredential("avvmskottakkal", "9895091284");
                        mailclient.EnableSsl   = true;

                        //SmtpClient mailclient = new SmtpClient("localhost", 25);
                        //mailclient.Credentials = new NetworkCredential("*****@*****.**", "9895204814");


                        mailclient.Send(email);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Mailing Failure...\nReason : " + ex.Message + "\n" + ex.HelpLink);
                    }

                    MessageBox.Show("De-Assigned Successfully");

                    this.Close();
                }

                else
                {
                    int c1f = 0;
                    oa = 0;
                    for (int i = 0; i < DGV_traffic_exception.Rows.Count; i++)
                    {
                        if (DGV_traffic_exception.Rows[i].Cells[0].Value.ToString().Equals(""))
                        {
                            c1f = 1;
                            MessageBox.Show("Enter Description For Overhead Expense " + (i + 1));
                        }
                    }
                    if (c1f == 0)
                    {
                        for (int i = 0; i < DGV_traffic_exception.Rows.Count; i++)
                        {
                            if (DGV_traffic_exception.Rows[i].Cells[1].Value.ToString().Equals(""))
                            {
                                c1f = 1;
                                MessageBox.Show("Enter Amount For Overhead Expense " + (i + 1));
                            }
                            else
                            {
                                try
                                {
                                    Decimal k = Convert.ToDecimal(DGV_traffic_exception.Rows[i].Cells[1].Value.ToString());
                                }
                                catch (FormatException ex)
                                {
                                    c1f = 1;
                                    MessageBox.Show("Enter Correct Amount For Overhead Expense " + (i + 1));
                                }
                            }
                        }
                    }
                    if (c1f == 0)
                    {
                        if (carebatha())
                        {
                            for (int i = 0; i < DGV_traffic_exception.Rows.Count; i++)
                            {
                                oa = oa + Convert.ToDecimal(DGV_traffic_exception.Rows[i].Cells[1].Value.ToString());
                            }

                            if (jtype == 1)
                            {
                                lb_total.Text = ((Convert.ToDecimal(ebatha.Text)) + (Convert.ToDecimal(hbatha.Text)) + (Convert.ToDecimal(txt_hbatha.Text)) + oa).ToString();
                            }
                            else if (jtype == 2)
                            {
                                lbchault.Text = lbchault.Text + " *2";
                                lb_b.Text     = lb_b.Text + " *2";
                                lb_total.Text = ((Convert.ToDecimal(ebatha.Text)) + ((Convert.ToDecimal(hbatha.Text)) * 2) + ((Convert.ToDecimal(txt_hbatha.Text)) * 2) + (Convert.ToDecimal(tkmdheavy.Text)) + (Convert.ToDecimal(tefc.Text)) + (Convert.ToDecimal(tkmfc.Text)) + oa).ToString();
                            }
                            else if (jtype == 3)
                            {
                                lbchault.Text = lbchault.Text + " *3";
                                lb_b.Text     = lb_b.Text + " *3";
                                lb_total.Text = ((Convert.ToDecimal(ebatha.Text)) + ((Convert.ToDecimal(hbatha.Text)) * 3) + ((Convert.ToDecimal(txt_hbatha.Text)) * 3) + (Convert.ToDecimal(tkmdheavy.Text)) + (Convert.ToDecimal(tefc.Text)) + (Convert.ToDecimal(tkmfc.Text)) + (Convert.ToDecimal(tesc.Text)) + (Convert.ToDecimal(tkmsc.Text)) + oa).ToString();
                            }
                            lb_total.Show();
                            cal_flag = 1;
                            button2.Hide();
                            button3.Hide();

                            DGV_traffic_exception.ReadOnly = true;
                            Common_Tasks.disable(ebatha);
                            Common_Tasks.disable(txt_hbatha);
                            Common_Tasks.disable(hbatha);
                            Common_Tasks.disable(numericUpDown1);

                            oac = 0;
                            for (int i = 0; i < DGV_traffic_exception.Rows.Count; i++)
                            {
                                oac = oac + Convert.ToDecimal(DGV_traffic_exception.Rows[i].Cells[1].Value.ToString());
                            }
                            total.Text = "Total : " + oac.ToString();

                            Common_Tasks.disable(dateTimePicker1);
                            Common_Tasks.disable(timePicker);

                            Common_Tasks.disable(panelheavy);
                            Common_Tasks.disable(tkmdheavy);

                            button1.Text = "Submit,Mail";
                        }
                    }
                }
            }
        }