Beispiel #1
0
        private void ThemXe()
        {
            // Khoi tao doi tuong DoiTac voi ma
            Xe    objXe = new Xe();
            frmXe frm   = new frmXe(objXe, true, G_LoaiXe, G_Gara);// them moi

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                objXe = frm.GetXe();
                frm.Dispose();
                //Insert DataBase
                if (!objXe.Insert())
                {
                    new MessageBox.MessageBoxBA().Show("Lỗi thêm mới xe taxi");
                    return;
                }
                else
                {
                    //Load lai grid
                    LoadListXe();
                }
            }
            else
            {
                return;
            }
        }
Beispiel #2
0
        ///// <summary>
        ///// Mo form DOiTac de edit
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        private void grdXe_DoubleClick(object sender, EventArgs e)
        {
            grdXe.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (grdXe.SelectedItems.Count > 0)
            {
                GridEXRow row   = ((GridEXSelectedItem)grdXe.SelectedItems[0]).GetRow();
                Xe        objXe = (Xe)((GridEXSelectedItem)grdXe.SelectedItems[0]).GetRow().DataRow;
                frmXe     frm   = new frmXe(objXe, false, G_LoaiXe, G_Gara);
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    objXe = frm.GetXe();
                    frm.Dispose();
                    try
                    {
                        //Insert DataBase
                        if (!objXe.Update())
                        {
                            new MessageBox.MessageBoxBA().Show("Lỗi cập nhật thông tin xe");
                            return;
                        }
                        else
                        {
                            //Load lai grid
                            LoadListXe();
                        }
                    }
                    catch (Exception ex)
                    {
                        LogError.WriteLogError("DM Xe update", ex);

                        LoadListXe();
                    }
                }
                else
                {
                    return;
                }
            }
        }