Exemple #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_customer oObject = new tbm_customer();
                 oConn.Open();
                 oObject.Koneksi    = oConn.Conn;
                 oObject.customerid = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCustomerid));
                 oObject.opedit     = clsGlobal.strUserName;
                 oObject.pcedit     = SystemInformation.ComputerName;
                 oObject.SoftDelete();
                 oObject = null;
                 gridViewData.DeleteSelectedRows();
             }
         }
         catch (NpgsqlException ex)
         {
         }
         catch (Exception ex)
         {
             ////clsGlobal.generateErrMessageAndSendmail(ex, false);
         }
         finally
         {
             frmMain.setLoadDialog(false, "");
         }
     }
 }
Exemple #2
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);
                            }
                            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();
                                MessageBox.Show("Data Inserted", "Insert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                oObject = null;
                            }
                        }
                        else
                        {
                        }
                    }
                }
                catch (NpgsqlException ex)
                {
                    ////clsGlobal.generateErrMessageAndSendmail(ex, false);
                }
                catch (Exception ex)
                {
                    ////clsGlobal.generateErrMessageAndSendmail(ex, false);
                }
            }
        }
Exemple #3
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();
                }
            }
        }
Exemple #4
0
        private void Login(string strUsername, string strPassword)
        {
            try
            {
                clsEncryption oEncryption = new clsEncryption();
                using (clsConnection oconn = new clsConnection())
                {
                    NpgsqlCommand ocmd = new NpgsqlCommand();
                    oconn.Open();
                    ocmd.Connection = oconn.Conn;

                    ocmd            = new NpgsqlCommand();
                    ocmd.Connection = oconn.Conn;
                    bool   isActive = true;
                    string strsql   = @"select userid, username, fullname,email, groupusers from tbm_users where username=@username and password=@password and dlt='0' and active='1'";
                    ocmd.Parameters.Add("@username", NpgsqlTypes.NpgsqlDbType.Varchar).Value = oEncryption.Encrypt(strUsername.ToString().ToUpper());
                    ocmd.Parameters.Add("@password", NpgsqlTypes.NpgsqlDbType.Varchar).Value = oEncryption.Encrypt(strPassword.ToString());
                    ocmd.CommandText = strsql;
                    NpgsqlDataReader dr;
                    dr = ocmd.ExecuteReader();
                    if (dr.Read())
                    {
                        clsRegKey oRegKey = new clsRegKey();
                        oRegKey.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;
                        oRegKey = null;
                        clsGlobal.strUserName     = oEncryption.Decrypt(dr["username"].ToString());
                        clsGlobal.strUserID       = dr["userid"].ToString();
                        clsGlobal.strHakAkses     = dr["groupusers"].ToString();
                        clsGlobal.strNamaPetugas  = dr["fullname"].ToString();
                        clsGlobal.strUserPassword = txtPassword.Text;
                        clsGlobal.strGroupUser    = dr["groupusers"].ToString();
                    }
                    else
                    {
                        XtraMessageBox.Show("Invalid username or password .!", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        strPassword = "";
                        oconn.Close();
                        ocmd        = null;
                        oEncryption = null;
                        return;
                    }
                    oconn.Close();
                    ocmd = null;
                }
                oEncryption       = null;
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Unable connect to database server, please configure the database connection first", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                frmServerInitialize frm = new frmServerInitialize();
                frm.ShowDialog(this);
            }
        }
Exemple #5
0
        private void doStuff()
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    string carId      = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCarId));
                    string platnumber = Convert.ToString(gridViewData.GetFocusedRowCellValue(colPlatnumber));
                    string strCount   = clsGlobal.getData1Field("select count(*) from tbm_car where dlt='0' and trim(lower(platnumber))=trim(lower('" + platnumber + "')) and carid <>'" + carId + "'");
                    if (Convert.ToInt32(strCount) == 0)
                    {
                        tbm_car oObject = new tbm_car();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(carId))
                        {
                            oObject.GetByPrimaryKey(carId);
                        }


                        oObject.carid = carId;
                        if (string.IsNullOrEmpty(carId))
                        {
                            oObject.carid = oObject.NewID();
                            oObject.opadd = clsGlobal.strUserName;
                            oObject.pcadd = SystemInformation.ComputerName;
                            oObject.luadd = DateTime.Now;
                            oObject.Insert();
                        }
                        else
                        {
                            oObject.available = status;
                            oObject.opedit    = clsGlobal.strUserName;
                            oObject.pcedit    = SystemInformation.ComputerName;
                            oObject.luedit    = DateTime.Now;
                            oObject.Update();
                        }
                    }
                    else
                    {
                    }
                }
            }

            catch (NpgsqlException ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
Exemple #6
0
        public frmMain()
        {
            try
            {
                formSplash = new frmLogin();
                formSplash.ShowDialog(this);
                if (formSplash.DialogResult == DialogResult.OK)
                {
                    clsGlobal.xpatchDatabase();

                    loadDialog = new WaitDialogForm("Loading Components...", "Processing...Please Wait...", new Size(420, 78));
                    InitializeComponent();

                    if (clsGlobal.bolevaluationversion)
                    {
                        clsGlobal.pstrAppName = "EVALUATION VERSION - Mobilo Rental";
                        this.Text             = "EVALUATION VERSION - Mobilo Rental";
                    }
                    else
                    {
                        clsGlobal.pstrAppName = "MobiloRental";
                        this.Text             = "Mobilo Rental";
                    }

                    oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey;

                    using (clsConnection oconn = new clsConnection())
                    {
                        oconn.Open();


                        lblWelcome.Text  = "WELCOME : " + clsGlobal.strUserName.ToUpper();
                        lblPosition.Text = "POSITION : " + clsGlobal.strGroupUser.ToUpper();
                        oconn.Close();
                    }
                    setUserPrivillage();
                    nbiVisibility();
                }
            }
            catch
            {
            }
            finally
            {
                setLoadDialog(false, "");
            }

            try
            {
                if (clsGlobal.isusebackgroundimage)
                {
                    if (System.IO.File.Exists(Application.StartupPath.ToString() + "\\bg\\mainbg.jpg"))
                    {
                        panelHome.Visible               = true;
                        panelHome.BackgroundImage       = Image.FromFile(Application.StartupPath.ToString() + "\\bg\\mainbg.jpg");
                        panelHome.BackgroundImageLayout = ImageLayout.Stretch;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #7
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, "");
                }
            }
        }
Exemple #8
0
        private void gridViewData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    string customerid = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCustomerid));
                    string strCount   = clsGlobal.getData1Field("select count(*) from tbm_customer where dlt='0' and trim(lower(name))=trim(lower('" + Convert.ToString(gridViewData.GetFocusedRowCellValue(colName)) + "')) and customerid <>'" + customerid + "'");
                    if (Convert.ToInt32(strCount) == 0)
                    {
                        tbm_customer oObject = new tbm_customer();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(customerid))
                        {
                            oObject.GetByPrimaryKey(customerid);
                        }
                        oObject.customerid      = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCustomerid));
                        oObject.name            = Convert.ToString(gridViewData.GetFocusedRowCellValue(colName));
                        oObject.identity_type   = Convert.ToString(gridViewData.GetFocusedRowCellValue(colIdentityType));
                        oObject.identity_number = Convert.ToString(gridViewData.GetFocusedRowCellValue(colIdentityNumber));
                        oObject.gender          = Convert.ToString(gridViewData.GetFocusedRowCellValue(colGender));
                        oObject.phoneNumber     = Convert.ToDecimal(gridViewData.GetFocusedRowCellValue(colPhoneNumber));
                        oObject.dob             = Convert.ToDateTime(gridViewData.GetFocusedRowCellValue(colDob));
                        oObject.address         = Convert.ToString(gridViewData.GetFocusedRowCellValue(colAddress));

                        if (oObject.name == "")
                        {
                            XtraMessageBox.Show("Data Can't Be Null", "Warning");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(customerid))
                            {
                                oObject.customerid = oObject.NewID();
                                oObject.opadd      = clsGlobal.strUserName;
                                oObject.pcadd      = SystemInformation.ComputerName;
                                oObject.luadd      = DateTime.Now;
                                oObject.Insert();
                                gridViewData.SetFocusedRowCellValue(colCustomerid, oObject.customerid);
                            }
                            else
                            {
                                oObject.opedit = clsGlobal.strUserName;
                                oObject.pcedit = SystemInformation.ComputerName;
                                oObject.luedit = DateTime.Now;
                                oObject.Update();
                            }
                            oObject = null;
                            e.Valid = true;
                        }
                    }
                    else
                    {
                        e.ErrorText = "This code " + Convert.ToString(gridViewData.GetFocusedRowCellValue(colName)) + " already exists in database and cannot be filled the same value.!\n";
                        gridViewData.FocusedColumn = colName;
                        e.Valid = false;
                        return;
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
            catch (Exception ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
        }
Exemple #9
0
        private void gridViewData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    string strID          = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId));
                    string strPassword    = Convert.ToString(gridViewData.GetFocusedRowCellValue(colPassword));
                    string strUsername    = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUsername));
                    string strCount       = clsGlobal.getData1Field("select count(*) from tbm_users where dlt='0' and trim(lower(username))=trim(lower('" + Convert.ToString(gridViewData.GetFocusedRowCellValue(colUsername)) + "')) and userid<>'" + strID + "'");
                    string strGetPassword = clsGlobal.getData1Field("select password from tbm_users where userid='" + strID + "'");
                    string strGetUsername = clsGlobal.getData1Field("select username from tbm_users where userid='" + strID + "'");

                    if (Convert.ToInt32(strCount) == 0)
                    {
                        tbm_users oObject = new tbm_users();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(strID))
                        {
                            oObject.GetByPrimaryKey(strID);
                        }
                        clsEncryption oEncryption = new clsEncryption();
                        if (strPassword == strGetPassword)
                        {
                            oObject.password = strGetPassword;
                        }
                        else
                        {
                            oObject.password = oEncryption.Encrypt(strPassword);
                        }
                        if (strUsername == strGetUsername)
                        {
                            oObject.username = strGetUsername;
                        }
                        else
                        {
                            oObject.username = oEncryption.Encrypt(strUsername);
                        }
                        oObject.userid     = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId));
                        oObject.fullname   = Convert.ToString(gridViewData.GetFocusedRowCellValue(colFullname));
                        oObject.email      = Convert.ToString(gridViewData.GetFocusedRowCellValue(colEmail));
                        oObject.groupusers = Convert.ToString(gridViewData.GetFocusedRowCellValue(colGroupUsers)).ToLower();
                        if (oObject.username == "" || oObject.password == "" || oObject.fullname == "" || oObject.email == "" || oObject.groupusers == "")
                        {
                            XtraMessageBox.Show("Data Can't Be Null", "Warning");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(strID))
                            {
                                oObject.userid = oObject.NewID();
                                oObject.active = true;
                                oObject.opadd  = clsGlobal.strUserName;
                                oObject.pcadd  = SystemInformation.ComputerName;
                                oObject.luadd  = DateTime.Now;
                                oObject.Insert();
                                gridViewData.SetFocusedRowCellValue(colUserId, oObject.userid);
                            }
                            else
                            {
                                oObject.active = Convert.ToBoolean(gridViewData.GetFocusedRowCellValue(colActive));
                                oObject.opedit = clsGlobal.strUserName;
                                oObject.pcedit = SystemInformation.ComputerName;
                                oObject.Update();
                            }
                            oObject = null;
                            e.Valid = true;
                        }
                    }
                    else
                    {
                        e.ErrorText = "This code " + Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId)) + " already exists in database and cannot be filled the same value.!\n";
                        gridViewData.FocusedColumn = colUsername;
                        e.Valid = false;
                        return;
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
            catch (Exception ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
        }
Exemple #10
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 { }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show(this, "Do you want to save this data?", clsGlobal.pstrAppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                loadImage();
                if (txtPlatnumber.Text == "" || txtPathText.Text == "" || cmbTipe.Text == "" || txtkapasitas.Value <= 1 || txtHarga.Text == "" || txtDesc.Text == "")
                {
                    XtraMessageBox.Show("Data Can't Be Null", "Warning");
                }
                else
                {
                    getTypeid();
                    try
                    {
                        using (clsConnection oConn = new clsConnection())
                        {
                            string strCount = clsGlobal.getData1Field("select count(*) from tbm_car where dlt='0' and trim(lower(platnumber))=trim(lower('" + txtPlatnumber.Text + "')) and carid <>'" + CarId + "'");
                            if (Convert.ToInt32(strCount) == 0)
                            {
                                tbm_car oObject = new tbm_car();
                                oConn.Open();
                                oObject.Koneksi = oConn.Conn;


                                if (!string.IsNullOrEmpty(CarId))
                                {
                                    oObject.GetByPrimaryKey(CarId);
                                }

                                oObject.carid      = m_carid;
                                oObject.platnumber = txtPlatnumber.Text;

                                oObject.typeid       = typeid;
                                oObject.description  = txtDesc.Text;
                                oObject.capacity     = Convert.ToInt32(txtkapasitas.Value);
                                oObject.price        = Convert.ToInt32(txtHarga.Text);
                                oObject.filepath_car = txtPathText.Text;

                                if (pathText == null)
                                {
                                    pathText = getImage;
                                }


                                oObject.image_car = pathText;

                                if (string.IsNullOrEmpty(CarId))
                                {
                                    oObject.carid     = oObject.NewID();
                                    oObject.available = true;
                                    oObject.opadd     = clsGlobal.strUserName;
                                    oObject.pcadd     = SystemInformation.ComputerName;
                                    oObject.Insert();
                                    XtraMessageBox.Show("Data Has been Inserted", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    oObject.opedit = clsGlobal.strUserName;
                                    oObject.pcedit = SystemInformation.ComputerName;
                                    oObject.Update();
                                    XtraMessageBox.Show("Data Has been Updated", clsGlobal.pstrAppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                    //catch { }
                    catch (NpgsqlException ex)
                    {
                        XtraMessageBox.Show(ex.Message);
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show(ex.Message);
                    }
                    this.Close();
                    clsGlobal.isClose = true;
                }
            }
            else
            {
            }
        }