コード例 #1
0
        public override void Delete()
        {
            string str;
            object rowCellValue;
            bool   flag = false;

            int[] selectedRows = this.gbList.GetSelectedRows();
            if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)
            {
                base.SetWaitDialogCaption("Đang xóa...");
                DIC_STATE dICSTATE = new DIC_STATE();
                for (int i = (int)selectedRows.Length; i > 0; i--)
                {
                    flag         = true;
                    rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "StateCode");
                    if (rowCellValue != null)
                    {
                        //  SYS_LOG.Insert("Danh Mục Công Đoạn", "Xoá", rowCellValue.ToString());
                        str = dICSTATE.Delete(rowCellValue.ToString());
                        if (str == "OK")
                        {
                            this.gbList.DeleteRow(selectedRows[i - 1]);
                        }
                        else if (str != "OK")
                        {
                            MessageBox.Show(string.Concat("Thông tin không được xóa\r\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        }
                    }
                }
                this.DoHide();
                if (!flag)
                {
                    if (dICSTATE.GetList().Rows.Count != 0)
                    {
                        rowCellValue = this.gbList.GetFocusedRowCellValue("StateCode");
                        if (rowCellValue != null)
                        {
                            // SYS_LOG.Insert("Danh Mục Công Đoạn", "Xoá", rowCellValue.ToString());
                            base.SetWaitDialogCaption("Đang xóa...");
                            str = dICSTATE.Delete(rowCellValue.ToString());
                            if (str == "OK")
                            {
                                this.gbList.DeleteRow(this.gbList.FocusedRowHandle);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show(string.Concat("Thông tin không được xóa\r\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            this.DoHide();
                        }
                    }
                }
            }
        }
コード例 #2
0
        protected override string uc_Delete()
        {
            DIC_STATE dICSTATE = new DIC_STATE()
            {
                StateCode = this.txtID.Text
            };
            string str = dICSTATE.Delete();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICSTATE);
            }
            return(str);
        }