Пример #1
0
 private void RefreshForm()
 {
     try
     {
         ClearValues();
         LoadLkCustomerTypes();
         LoadLkSearchCustomerType();
         LoadLkSearchCustomerGroup(sCustomerTypeId);
         LoadLkCustomerGroup(sCustomerTypeId);
         LoadCustomer();
         sCustomerId = ClassProperty.sCustomerId;
         if (sCustomerId != 0)
         {
             GetData(sCustomerId);
             GridViewCustomer.FocusedRowHandle = GridViewCustomer.LocateByValue("CustomerName", stCustomerName);
         }
         if (ClassProperty.IsCusType == 0)
         {
             BtnSelect.Visible = false;
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            // 16	5 : สิทธิ์ใช้งานหน้าสมาชิก	บันทึกข้อมูลสมาชิก
            int AuthorizeId = 16;

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

            if (stCustomerTypeId == 0)
            {
                XtraMessageBox.Show("กรุณาระบุประเภทลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                LkCustomerTypes.ShowPopup();
                return;
            }
            if (LkCustomerGroup.EditValue == null)
            {
                XtraMessageBox.Show("กรุณาระบุกลุ่มลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                LkCustomerGroup.ShowPopup();
                return;
            }

            if (TxtCustomerName.Text.Trim() == string.Empty)
            {
                XtraMessageBox.Show("กรุณาระบุชื่อลูกค้า !", "คำเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TxtCustomerName.Focus();
                return;
            }

            sCustomerCode = TxtCustomerCode.Text;
            sCustomerName = TxtCustomerName.Text;

            if (SaveData() == true)
            {
                LoadCustomer();
                GridViewCustomer.FocusedRowHandle = GridViewCustomer.LocateByValue("CustomerName", TxtCustomerName.Text);
                sCustomerId = Convert.ToInt32(GridViewCustomer.GetFocusedRowCellValue("CustomerId"));
                if (CheckCustomerPrice(sCustomerId))
                {
                    GetData(sCustomerId);
                }
            }
        }