Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DatabaseLibrary Obj = new DatabaseLibrary();

            Obj.Connection();
            try
            {
                if (txtDN.Text != string.Empty &&
                    txtSD.Text != string.Empty &&
                    txtDest.Text != string.Empty)
                {
                    Obj.Edit(@"UPDATE tblrspickup SET TruckIn='" + dtTruckIn.Text + "',SLoad='" + dtSLoad.Text + "',FLoad='" + dtFLoad.Text + "',DocuRec='" + dtDocRec.Text + "',TruckOut='" +
                             dtTruckOut.Text + "',SDwell='" + txtDwell.Text + "',DNum='" + txtDN.Text + "',SDNum='" + txtSD.Text + "',Destination='" + txtDest.Text + "' WHERE TripNum='" + int.Parse(lblTNum.Text) + "'");
                    Obj.CloseConnection();
                    frm1.FillDatas();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please Enter Information!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DatabaseLibrary Obj = new DatabaseLibrary();

            Obj.Connection();
            try
            {
                if (txtBodyNum.Text != string.Empty &&
                    txtPlateNum.Text != string.Empty &&
                    txtDriver.Text != string.Empty &&
                    txtHelper.Text != string.Empty &&
                    txtSource.Text != string.Empty &&
                    txtWeek.Text != string.Empty)
                {
                    Obj.Edit(@"UPDATE tblrsload SET DispDate='" + dtDD.Text + "',BodyNum='" + txtBodyNum.Text + "',PlateNum='" + txtPlateNum.Text + "',Driver='" + txtDriver.Text + "',Helper='" +
                             txtHelper.Text + "',Waybill='" + txtWaybill.Text + "',Source='" + txtSource.Text + "',Week='" + txtWeek.Text + "',ETA='" + dtETA.Text + "' WHERE TripNum='" + int.Parse(lblTNum.Text) + "'");
                    Obj.CloseConnection();
                    frm1.FillDatas();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please Enter Information!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int tnum;

            CountFile();
            tnum = Convert.ToInt32(nCount);
            DatabaseLibrary Obj = new DatabaseLibrary();

            if (listView1.Items.Count == 0)
            {
                MessageBox.Show("Please Add Details!");
            }
            else if (listView1.Items.Count != 0)
            {
                DialogResult dr = MessageBox.Show(this, "Do you want to Save?", "Confimation", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                if (dr == DialogResult.Yes)
                {
                    try
                    {
                        for (int i = 0; i < listView1.Items.Count; i++)
                        {
                            tnum++;
                            Obj.Connection();
                            Obj.cmd = new MySqlCommand(@"INSERT INTO tblrsload(TripNum,DispDate,BodyNum,PlateNum,Driver,Helper,Waybill,Source,Week,ETA)VALUES
                                                                              (@TNum,@DD,@BNum,@PNum,@Drivers,@Helpers,@Wbill,@Source,@Weeks,@ETAs)", Obj.conn);
                            Obj.cmd.Parameters.AddWithValue("@TNum", tnum);
                            Obj.cmd.Parameters.AddWithValue("@DD", listView1.Items[i].SubItems[0].Text);
                            Obj.cmd.Parameters.AddWithValue("@BNum", listView1.Items[i].SubItems[1].Text);
                            Obj.cmd.Parameters.AddWithValue("@PNum", listView1.Items[i].SubItems[2].Text);
                            Obj.cmd.Parameters.AddWithValue("@Drivers", listView1.Items[i].SubItems[3].Text);
                            Obj.cmd.Parameters.AddWithValue("@Helpers", listView1.Items[i].SubItems[4].Text);
                            Obj.cmd.Parameters.AddWithValue("@Wbill", listView1.Items[i].SubItems[5].Text);
                            Obj.cmd.Parameters.AddWithValue("@Source", listView1.Items[i].SubItems[6].Text);
                            Obj.cmd.Parameters.AddWithValue("@Weeks", listView1.Items[i].SubItems[7].Text);
                            Obj.cmd.Parameters.AddWithValue("@ETAs", listView1.Items[i].SubItems[8].Text);
                            Obj.cmd.ExecuteNonQuery();
                            Obj.Insert("INSERT INTO tblrspickup(TripNum)VALUES('" + tnum + "')");
                            Obj.Insert("INSERT INTO tblrsunload(TripNum)VALUES('" + tnum + "')");
                            Obj.Insert("INSERT INTO tblrsdoc(TripNum)VALUES('" + tnum + "')");
                            Obj.CloseConnection();
                        }
                        frm1.FillDatas();
                        this.Close();
                        MessageBox.Show("Data Saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception ex)
                    { MessageBox.Show(ex.Message); }
                }
                else
                {
                }
            }
        }