Пример #1
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            // 21	5 : สิทธิ์ใช้งานหน้าสมาชิก	ลบข้อมูลราคาล่วงหน้า
            int AuthorizeId = 21;

            if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false)
            {
                SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าสมาชิก", "ไลบข้อมูลราคาล่วงหน้า");
                return;
            }

            int  pid       = Convert.ToInt32(GridViewCustomerPrice.GetFocusedRowCellValue("PriceId"));
            bool IsDefault = Convert.ToBoolean(GridViewCustomerPrice.GetFocusedRowCellValue("IsDefault"));

            if (IsDefault == true)
            {
                XtraMessageBox.Show("ไม่สามารถลบราคา Default ได้", "สถานะ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (pid == 0)
            {
                GridViewCustomerPrice.DeleteSelectedRows();
            }
            else
            {
                if (XtraMessageBox.Show("คุณยืนยันที่จะลบข้อมูล ใช่หรือไม่?", "ยืนยัน", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    if (DeleteData(pid))
                    {
                        RefreshForm();
                    }
                }
            }
        }
Пример #2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            int PriceId = Convert.ToInt32(GridViewCustomerPrice.GetFocusedRowCellValue("PriceId"));

            if (PriceId == 0)
            {
                XtraMessageBox.Show("กรุณาบันทึกข้อมูลก่อน", "สถานะ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            GetData(PriceId);
        }