Exemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!isValid())
            {
                return;
            }

            if (g_FormStatus == 2)
            {
                if (g_IDKhachDat <= 0)
                {
                    return;
                }

                getDataInput();//Lay du Lieu
                if (objKhachDat.UpdateKhachDat())
                {
                    lblMsg.ForeColor = Color.Blue;
                    lblMsg.Text      = "Cập nhật thành công";

                    if (g_IsNow)
                    {
                        getKhachDat_NgayTiepNhan();
                    }
                    else
                    {
                        setData_BySearch();
                    }
                }
                else
                {
                    lblMsg.Text      = "Cập nhật không thành công";
                    lblMsg.ForeColor = Color.Red;
                }
            }
            else if (g_FormStatus == 1)
            {
                getDataInput();// Lay dữ liệu

                if (objKhachDat.InsertKhachDat())
                {
                    lblMsg.Text      = "Thêm mới thành công";
                    lblMsg.ForeColor = Color.Blue;

                    refreshForm(1);
                    fillDefaultDataToForm(1);
                    getKhachDat_NgayTiepNhan();
                }
                else
                {
                    lblMsg.Text      = "Thêm mới không thành công";
                    lblMsg.ForeColor = Color.Red;
                }
            }
            else if (g_FormStatus == 0)
            {
                getKhachDat_Search();
                setData_BySearch();
            }
        }
Exemplo n.º 2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (!isValid())
            {
                return;
            }

            if (g_IsUpdate)
            {
                if (g_IDKhachDat <= 0)
                {
                    return;
                }

                if (objKhachDat.UpdateKhachDat())
                {
                    new MessageBox.MessageBoxBA().Show("Cập nhật thành công", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information);
                    //lblMsg.ForeColor = Color.Blue;
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    lblMsg.Text      = "Cập nhật không thành công";
                    lblMsg.ForeColor = Color.Red;
                }
            }
            else
            {
                if (getDataInput())// Lay dữ liệu + ktra xem có IDCuocGoi ko
                {
                    if (objKhachDat.InsertKhachDat())
                    {
                        new MessageBox.MessageBoxBA().Show("Thêm mới thành công", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information);
                        //btnLuu.Enabled = false;//Insert thành công, vẫn hiển thị dữ liệu trên form nhưng không cho phép insert or update tiếp
                        //g_IsUpdate = true;
                        DialogResult = DialogResult.OK;
                        Close();
                    }
                    else
                    {
                        lblMsg.Text      = "Thêm mới không thành công";
                        lblMsg.ForeColor = Color.Red;
                    }
                }
            }
        }