示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show(this, "Are you sure to delete selected record?", clsGlobal.pstrAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    using (clsConnection oConn = new clsConnection())
                    {
                        frmMain.setLoadDialog(true, "Deleting data...");
                        tbm_car oObject1 = new tbm_car();
                        oConn.Open();
                        oObject1.Koneksi    = oConn.Conn;
                        oObject1.carid      = "Example";
                        oObject1.platnumber = Convert.ToString(dgData.CurrentRow.Cells["platnumber"].Value.ToString());
                        oObject1.available  = true;
                        oObject1.pcedit     = SystemInformation.ComputerName;
                        oObject1.opedit     = clsGlobal.strUserName;
                        oObject1.luedit     = DateTime.Now;
                        oObject1.updateAv();

                        tbm_carrepair oObject = new tbm_carrepair();
                        oConn.Open();
                        oObject.Koneksi  = oConn.Conn;
                        oObject.repairid = Convert.ToString(dgData.CurrentRow.Cells["repairid"].Value.ToString());
                        oObject.opedit   = clsGlobal.strUserName;
                        oObject.pcedit   = SystemInformation.ComputerName;
                        oObject.Delete();
                        oObject = null;
                        XtraMessageBox.Show(this, "Record Successfully Deleted", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (NpgsqlException ex)
                {
                }
                catch (Exception ex)
                {
                    ////clsGlobal.generateErrMessageAndSendmail(ex, false);
                }
                finally
                {
                    frmMain.setLoadDialog(false, "");
                    loadData();
                }
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtBookingID.Text == "" || txtPenalty.Text == "" || txtPayment.Text == "")
            {
                MessageBox.Show("Please Provide All The Field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (dgData.Rows.Count == 0)
            {
                MessageBox.Show("You Have No Car To be Return", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                try
                {
                    using (clsConnection oConn = new clsConnection())
                    {
                        tbm_carreturn oObject = new tbm_carreturn();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(txtReturnID.Text))
                        {
                            oObject.GetByPrimaryKey(txtReturnID.Text);
                        }
                        oObject.returnid         = txtReturnID.Text;
                        oObject.bookingid        = txtBookingID.Text;
                        oObject.dtreturn         = dateReturn.Value;
                        oObject.remainingpayment = Convert.ToDecimal(txtRemaining.Text);
                        oObject.penaltypayment   = Convert.ToDecimal(txtPenalty.Text);
                        oObject.paymentamount    = Convert.ToDecimal(txtPayment.Text);
                        oObject.opadd            = clsGlobal.strUserName;
                        oObject.pcadd            = SystemInformation.ComputerName;
                        oObject.Insert();

                        for (int i = 0; i < dgData.Rows.Count; i++)
                        {
                            tbm_car oObject1 = new tbm_car();
                            oConn.Open();
                            oObject1.Koneksi    = oConn.Conn;
                            oObject1.carid      = "Example";
                            oObject1.platnumber = dgData.Rows[i].Cells[5].Value.ToString();
                            oObject1.available  = true;
                            oObject.pcedit      = SystemInformation.ComputerName;
                            oObject.opedit      = clsGlobal.strUserName;
                            oObject.luedit      = DateTime.Now;
                            oObject1.updateAv();
                        }
                        clear();
                        MessageBox.Show("Data Submitted", "Submit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (NpgsqlException ex)
                {
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    frmMain.setLoadDialog(false, "");
                }
            }
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            getRepairId();
            if (cmbPlatnumber.Text == "")
            {
                MessageBox.Show("Please Provide The Car ID", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    using (clsConnection oConn = new clsConnection())
                    {
                        string strGetCarid = clsGlobal.getData1Field("select carid from tbm_car where platnumber='" + cmbPlatnumber.Text + "'");
                        string strCount    = clsGlobal.getData1Field("select count(*) from tbm_carrepair where dlt='0' and trim(lower(carid))=trim(lower('" + strGetCarid + "')) and repairid <>'" + strRepairid + "'");
                        if (Convert.ToInt32(strCount) == 0)
                        {
                            tbm_carrepair oObject = new tbm_carrepair();
                            oConn.Open();
                            oObject.Koneksi = oConn.Conn;
                            if (!string.IsNullOrEmpty(strRepairid))
                            {
                                oObject.GetByPrimaryKey(strRepairid);
                            }

                            tbm_car oObject1 = new tbm_car();
                            oConn.Open();
                            oObject1.Koneksi    = oConn.Conn;
                            oObject1.carid      = "Example";
                            oObject1.platnumber = cmbPlatnumber.Text;
                            oObject1.available  = false;
                            oObject1.pcedit     = SystemInformation.ComputerName;
                            oObject1.opedit     = clsGlobal.strUserName;
                            oObject1.luedit     = DateTime.Now;
                            oObject1.updateAv();


                            oObject.repairid = strRepairid;
                            oObject.carid    = strGetCarid;

                            if (oObject.carid == "")
                            {
                                XtraMessageBox.Show("Data Can't Be Null", "Warning");
                            }
                            else
                            {
                                oObject.repairid = strRepairid;
                                oObject.opadd    = clsGlobal.strUserName;
                                oObject.pcadd    = SystemInformation.ComputerName;
                                oObject.luadd    = DateTime.Now;
                                oObject.Insert();
                                Clear();
                                loadData();
                                XtraMessageBox.Show(this, "Record Successfully Saved", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                oObject = null;
                            }
                        }
                        else
                        {
                        }
                    }
                }
                catch (NpgsqlException ex)
                {
                }
                catch (Exception ex)
                {
                }
            }
        }
示例#4
0
        private void save()
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    #region tbm_booking
                    tbm_booking oObject = new tbm_booking();
                    oConn.Open();
                    oObject.Koneksi          = oConn.Conn;
                    oObject.bookingid        = txtBookingId.Text;
                    oObject.customerid       = txtCustomerId.Text;
                    oObject.dateorder        = Convert.ToDateTime(dtTimeOrder.EditValue.ToString());
                    oObject.sdatebooking     = Convert.ToDateTime(dtSBooking.EditValue.ToString());
                    oObject.edatebooking     = Convert.ToDateTime(dtEBooking.EditValue.ToString());
                    oObject.duration_booking = Convert.ToDecimal(seDuration.Text);
                    oObject.downpayment      = Convert.ToDecimal(txtDP.Text);
                    #endregion tbm_booking
                    if (!string.IsNullOrEmpty(txtBookingId.Text))
                    {
                        oObject.GetByPrimaryKey(txtBookingId.Text);
                    }
                    for (int j = 0; j < 3; j++)
                    {
                        if (j == 0)
                        {
                            oObject.opadd = clsGlobal.strUserName;
                            oObject.pcadd = SystemInformation.ComputerName;
                            oObject.luadd = DateTime.Now;
                            oObject.Insert();
                        }

                        if (j == 1)
                        {
                            for (int i = 0; i < dataRight.Rows.Count; i++)
                            {
                                #region getCarId
                                string    strSQL = "Select * from tbm_car where platnumber='" + dataRight.Rows[i].Cells[0].Value.ToString() + "'";
                                DataTable dt     = oConn.GetData(strSQL);
                                #endregion getCarId
                                #region tbm_bookingDetail
                                tbm_bookingdetail oObject1 = new tbm_bookingdetail();
                                oConn.Open();
                                oObject1.Koneksi   = oConn.Conn;
                                oObject1.detailid  = oObject1.NewID();
                                oObject1.bookingid = txtBookingId.Text;
                                oObject1.carid     = dt.Rows[0]["carid"].ToString();
                                oObject1.price     = Convert.ToInt32(dt.Rows[0]["price"]);
                                oObject1.opadd     = clsGlobal.strUserName;
                                oObject1.pcadd     = SystemInformation.ComputerName;
                                oObject1.Insert();
                                #endregion tbm_bookingDetail
                            }
                        }
                        if (j == 2)
                        {
                            for (int i = 0; i < dataRight.Rows.Count; i++)
                            {
                                #region tbm_carid
                                tbm_car oObject2 = new tbm_car();
                                oConn.Open();
                                oObject2.Koneksi = oConn.Conn;

                                oObject2.platnumber = dataRight.Rows[i].Cells[0].Value.ToString();
                                oObject2.available  = false;
                                oObject2.opedit     = clsGlobal.strUserName;
                                oObject2.pcedit     = SystemInformation.ComputerName;
                                oObject2.updateAv();
                                #endregion tbm_carid

                                Refresh();
                                XtraMessageBox.Show(this, "Record Successfully Saved", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
            }
            catch { }
        }