示例#1
0
        private void estimation_Click(object sender, EventArgs e)
        {
            try
            {
                float cost   = float.Parse(duration.Text);
                float total1 = cost * 3 + 1000;
                // int x;
                total.Text = total1.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            try
            {
                Database1       db   = new Database1();
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                genarateID1();
                cmd.CommandText = "insert into vestimation (estimationID,projectID,vehicleID,estCost) values('" + estimation1 + "','" + projectID.Text + "','" + vehicleID.Text + "','" + double.Parse(total.Text) + "')";

                cmd.ExecuteNonQuery();
                conn.Close();

                MessageBox.Show("Success");
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Database1 db = new Database1();

                string query = "select *from reserved where vehicleID like '%" + search.Text + "%'";

                MySqlConnection  conn    = db.getConnection();
                MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
                DataTable        table   = new DataTable();
                adapter.Fill(table);

                BindingSource bsource = new BindingSource();
                bsource.DataSource = table;
                vehicle_reserve.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                vehicle_reserve.DataSource = bsource;
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
        private void genarateID1()
        {
            Database1       db   = new Database1();
            MySqlConnection conn = db.getConnection();
            MySqlCommand    cmd  = new MySqlCommand("select count(estimationID) from vestimation", conn);
            int             i    = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            i++;
            estimation1 = estimation1 + i.ToString();
        }
示例#4
0
        private void genarateID()
        {
            Database1       db   = new Database1();
            MySqlConnection conn = db.getConnection();
            MySqlCommand    cmd  = new MySqlCommand("select count(incomeID) from vincome", conn);
            int             i    = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            i++;
            incomeID1.Text = incomeid + i.ToString();
        }
示例#5
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            try
            {
                float km     = float.Parse(milage.Text);
                float cost   = float.Parse(duration.Text);
                float total1 = cost * 3 + 1000 + (km / 100 * 10);
                total.Text = total1.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            try
            {
                Database1 db = new Database1();
                //string query = "select *from Employee";
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                cmd.CommandText = "update  register set status='Aviliable' where vehicleID='" + vehicleID.Text + "'";

                cmd.ExecuteNonQuery();

                conn.Close();

                MessageBox.Show("the record wass updated success");
            }
            catch (SqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            try
            {
                Database1       db   = new Database1();
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                cmd.CommandText = "insert into vincome (incomeID,projectID,vehicleID,duration) values('" + incomeID1.Text + "','" + projectID.Text + "','" + vehicleID.Text + "','" + Convert.ToInt32(duration.Text) + "')";
                cmd.ExecuteNonQuery();
                conn.Close();
                genarateID();
                MessageBox.Show("Success");
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            vehicleID.Clear();
            duration.Clear();
        }
示例#6
0
        private void generateID()
        {
            Database1       db   = new Database1();
            MySqlConnection conn = db.getConnection();
            MySqlCommand    cmd  = new MySqlCommand("SELECT COUNT(JobID) from assignJobs", conn);
            int             i    = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            i++;
            bunifuMaterialTextbox2.Text = jbID + i.ToString();
        }
示例#7
0
        private void genarateID()
        {
            Database1       db   = new Database1();
            MySqlConnection conn = db.getConnection();
            MySqlCommand    cmd  = new MySqlCommand("select Count(vehicleID) from register", conn);
            int             i    = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            i++;
            vehicleID.Text = vehicleid + i.ToString();
        }
示例#8
0
文件: vsr.cs 项目: Nipun96/team_fire
        private void genarateID()
        {
            Database1       db   = new Database1();
            MySqlConnection conn = db.getConnection();
            MySqlCommand    cmd  = new MySqlCommand("select Count(Serv_No) from services", conn);
            int             i    = Convert.ToInt32(cmd.ExecuteScalar());

            conn.Close();
            i++;
            Serv_No.Text = serid + i.ToString();
        }
示例#9
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                Database1       db   = new Database1();
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                cmd.CommandText = "insert into reserved (vehicleID,startDate,endDate,projectID,projectName,duration) values('" + comboBox1.Text + "','" + startDate.Value.Date.ToString("yyyy-MM-dd") + "','" + endDate.Value.Date.ToString("yyyy-MM-dd") + "','" + projectID.Text + "','" + projectName.Text + "','" + duration.Text + "')";

                cmd.ExecuteNonQuery();

                conn.Close();

                MessageBox.Show("The record wass inserterd success");
            }
            catch (SqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            try
            {
                Database1 db = new Database1();

                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                cmd.CommandText = "update  register set status='Not aviliable' where vehicleID='" + comboBox1.Text + "'";

                cmd.ExecuteNonQuery();

                conn.Close();

                MessageBox.Show("the record wass updated success");
            }
            catch (SqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
        }
示例#10
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                Database1 db = new Database1();
                //string query = "select *from Employee";
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();
                cmd.CommandText = "update  register set vNo='" + vNo.Text + "',category='" + category.Text + "',vModel='" + vModel.Text + "',chassisNo='" + Convert.ToInt32(chassisNo.Text) + "',fuelType='" + fuelType.Text + "',engineNo='" + Convert.ToInt32(engineNo.Text) + "',manufactYear='" + manufactYear.Text + "' where vehicleID='" + vehicleID.Text + "'";

                cmd.ExecuteNonQuery();

                conn.Close();

                MessageBox.Show("the record wass updated success");
            }
            catch (SqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
        }
示例#11
0
文件: vsr.cs 项目: Nipun96/team_fire
 private void add2_Click(object sender, EventArgs e)
 {
     try
     {
         Database1       db   = new Database1();
         MySqlConnection conn = db.getConnection();
         MySqlCommand    cmd  = conn.CreateCommand();
         cmd.CommandText = "insert into repair (Rep_Id,Note,Rep_cost,V_Id) values('" + Rep_Id.Text + "','" + rNote.Text + "','" + Rep_Cost.Text + "','" + vId.Text + "')";
         cmd.ExecuteNonQuery();
         conn.Close();
         MessageBox.Show("Success");
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(Convert.ToString(ex));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#12
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                //byte[] image = null;
                //FileStream streem = new FileStream(imageLocation, FileMode.Open, FileAccess.Read);
                //BinaryReader brs = new BinaryReader(streem);
                //image = brs.ReadBytes((int)streem.Length);
                MemoryStream ms = new MemoryStream();
                image1.Image.Save(ms, image1.Image.RawFormat);
                byte[] img = ms.ToArray();

                bool test = Validte_Data();
                if (test == true)
                {
                    Database1       db     = new Database1();
                    MySqlConnection conn   = db.getConnection();
                    MySqlCommand    cmd    = conn.CreateCommand();
                    string          status = "Aviliable";
                    cmd.CommandText = "insert into register (vehicleID,vNo,category,vModel,chassisNo,fuelType,engineNo,manufactYear,image,status) values('" + vehicleID.Text + "','" + vNo.Text + "','" + category.Text + "','" + vModel.Text + "','" + Convert.ToInt32(chassisNo.Text) + "','" + fuelType.Text + "','" + Convert.ToInt32(engineNo.Text) + "','" + manufactYear.Text + "',@img,'" + status + "')";
                    cmd.Parameters.Add(new MySqlParameter("@img", MySqlDbType.LongBlob));
                    cmd.Parameters["@img"].Value = img;

                    // VehicleNo,vehicleManufact,vehicleModel,chassieNo,fuelType,enginNo,manufactYear ,'" + txt2.Text + "','" + txt3.Text + "','" + txt4.Text + "'," + txt5.Text + "','" + txt6.Text + "','" + txt7.Text + "','" + txt8.Text + "
                    cmd.ExecuteNonQuery();

                    conn.Close();
                    genarateID();
                    MessageBox.Show("the record wass inserterd success");
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#13
0
文件: vsr.cs 项目: Nipun96/team_fire
 private void add1_Click(object sender, EventArgs e)
 {
     try
     {
         Database1       db   = new Database1();
         MySqlConnection conn = db.getConnection();
         MySqlCommand    cmd  = conn.CreateCommand();
         fillcombo();
         cmd.CommandText = "insert into services (Serv_No,Next_Milage,Note,Services,Current_Milage,V_Id,sCost) values('" + Serv_No.Text + "','" + Convert.ToInt32(Next_Milage.Text) + "','" + Note.Text + "','" + Services.Text + "','" + Convert.ToInt32(Current_Milage.Text) + "','" + V_Id.Text + "','" + Convert.ToDouble(sCost.Text) + "')";
         cmd.ExecuteNonQuery();
         conn.Close();
         MessageBox.Show("Success");
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(Convert.ToString(ex));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#14
0
        private void vehicle_details_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int             index       = e.RowIndex;
            DataGridViewRow selectedRow = vehicle_details.Rows[index];

            vehicleID.Text    = selectedRow.Cells[0].Value.ToString();
            vNo.Text          = selectedRow.Cells[1].Value.ToString();
            category.Text     = selectedRow.Cells[2].Value.ToString();
            vModel.Text       = selectedRow.Cells[3].Value.ToString();
            chassisNo.Text    = selectedRow.Cells[4].Value.ToString();
            fuelType.Text     = selectedRow.Cells[5].Value.ToString();
            engineNo.Text     = selectedRow.Cells[6].Value.ToString();
            manufactYear.Text = selectedRow.Cells[7].Value.ToString();
            avilibility.Text  = selectedRow.Cells[9].Value.ToString();

            try
            {
                Database1       db   = new Database1();
                MySqlConnection conn = db.getConnection();
                MySqlCommand    cmd  = conn.CreateCommand();

                // string query = "select *from register";
                string sql = "select image from register where vNo='" + vNo.Text + "'";
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                cmd = new MySqlCommand(sql, conn);

                MySqlDataReader DataRead = cmd.ExecuteReader();
                DataRead.Read();



                if (DataRead.HasRows)
                {
                    //vehicleID.Text = DataRead[0].ToString();
                    byte[] image1 = (byte[])(DataRead[0]);

                    if (imageBox == null)
                    {
                        imageBox.Image = null;
                    }
                    else
                    {
                        MemoryStream mstreem = new MemoryStream(image1);
                        imageBox.Image = Image.FromStream(mstreem);
                    }
                }

                else
                {
                    MessageBox.Show("Not Avilible");
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                imageBox.Image = null;
            }
        }