예제 #1
0
        public override void Delete()
        {
            string str;
            object rowCellValue;

            if (MyRule.IsDelete("bbiDepartment"))
            {
                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...");
                    HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT();
                    for (int i = (int)selectedRows.Length; i > 0; i--)
                    {
                        flag         = true;
                        rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "DepartmentCode");
                        if (rowCellValue != null)
                        {
                            //   SYS_LOG.Insert("Danh Sách Phòng Ban", "Xoá", rowCellValue.ToString());
                            str = hRMDEPARTMENT.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 (hRMDEPARTMENT.GetList().Rows.Count != 0)
                        {
                            rowCellValue = this.gbList.GetFocusedRowCellValue("DepartmentCode");
                            if (rowCellValue != null)
                            {
                                // SYS_LOG.Insert("Danh Sách Phòng Ban", "Xoá", rowCellValue.ToString());
                                base.SetWaitDialogCaption("Đang xóa...");
                                str = hRMDEPARTMENT.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
        public override void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT();

            this.gcList.DataSource = hRMDEPARTMENT.GetList();
            base.SetWaitDialogCaption("Đang nạp cấu hình...");
            this.gbList.ClearColumnsFilter();
            base.SetWaitDialogCaption("Đã xong...");
            this.DoHide();
        }
예제 #3
0
        private void glkBranch_EditValueChanged(object sender, EventArgs e)
        {
            HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT();

            if ((this.glkBranch.EditValue == null ? false : !(this.glkBranch.Text == "")))
            {
                hRMDEPARTMENT.AddGridLookupEdit(this.glkDepartment, this.glkBranch.EditValue.ToString());
            }
            else
            {
                this.glkDepartment.Properties.DataSource = hRMDEPARTMENT.GetList();
            }
        }
예제 #4
0
        private void Init()
        {
            MyRule.Check("bbiDepartment");
            this.ucToolBar.bbiPrint.Visibility  = MyRule.Printed;
            this.ucToolBar.bbiExport.Visibility = MyRule.Exported;
            this.ucToolBar.bbiAdd.Visibility    = MyRule.Added;
            this.ucToolBar.bbiDelete.Visibility = MyRule.Deleted;
            this.ucToolBar.bbiEdit.Visibility   = MyRule.Edited;
            base.RibbonBar.Add.Visibility       = MyRule.Added;
            base.RibbonBar.Change.Visibility    = MyRule.Edited;
            base.RibbonBar.Delete.Visibility    = MyRule.Deleted;
            base.RibbonBar.Print.Visibility     = MyRule.Printed;
            base.RibbonBar.Export.Visibility    = MyRule.Exported;
            base.RibbonBar.Import.Visibility    = MyRule.Imported;
            HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT();

            this.gcList.DataSource = hRMDEPARTMENT.GetList();
        }
예제 #5
0
        private void glk_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            string name;

            if (e.Button.Kind == ButtonPredefines.Plus)
            {
                name = (sender as GridLookUpEdit).Name;
                if (name != null)
                {
                    if (name == "glkSubsidiary")
                    {
                        xfmSubsidiaryAdd _xfmSubsidiaryAdd = new xfmSubsidiaryAdd(Actions.Add);
                        _xfmSubsidiaryAdd.Added += new xfmSubsidiaryAdd.AddedEventHander((object s, HRM_SUBSIDIARY i) => (new HRM_SUBSIDIARY()).AddGridLookupEdit(this.glkSubsidiary));
                        _xfmSubsidiaryAdd.ShowDialog();
                        goto Label2;
                    }
                    else if (name == "glkBranch")
                    {
                        xfmBranchAdd _xfmBranchAdd = new xfmBranchAdd(Actions.Add);
                        _xfmBranchAdd.Added += new xfmBranchAdd.AddedEventHander((object s, HRM_BRANCH i) => {
                            HRM_BRANCH hRMBRANCH = new HRM_BRANCH();
                            if ((this.glkSubsidiary.EditValue == null ? false : !(this.glkSubsidiary.Text == "")))
                            {
                                this.glkBranch.Properties.DataSource = hRMBRANCH.GetListBySubsidiary(this.glkSubsidiary.EditValue.ToString());
                            }
                            else
                            {
                                this.glkBranch.Properties.DataSource = hRMBRANCH.GetList();
                            }
                        });
                        _xfmBranchAdd.ShowDialog();
                        goto Label2;
                    }
                    else
                    {
                        if (name != "glkDepartment")
                        {
                            goto Label2;
                        }
                        xfmDepartmentAdd _xfmDepartmentAdd = new xfmDepartmentAdd(Actions.Add);
                        _xfmDepartmentAdd.Added += new xfmDepartmentAdd.AddedEventHander((object s, HRM_DEPARTMENT i) => {
                            HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT();
                            if ((this.glkBranch.EditValue == null ? false : !(this.glkBranch.Text == "")))
                            {
                                hRMDEPARTMENT.AddGridLookupEdit(this.glkDepartment, this.glkBranch.EditValue.ToString());
                            }
                            else
                            {
                                this.glkDepartment.Properties.DataSource = hRMDEPARTMENT.GetList();
                            }
                        });
                        _xfmDepartmentAdd.ShowDialog();
                        goto Label2;
                    }
                }
                Label2 :;
            }
            else if (e.Button.Kind == ButtonPredefines.Delete)
            {
                name = (sender as GridLookUpEdit).Name;
                if (name != null)
                {
                    if (name == "glkSubsidiary")
                    {
                        this.glkSubsidiary.EditValue = null;
                        goto Label0;
                    }
                    else if (name == "glkBranch")
                    {
                        this.glkBranch.EditValue = null;
                        goto Label0;
                    }
                    else
                    {
                        if (name != "glkDepartment")
                        {
                            goto Label0;
                        }
                        this.glkDepartment.EditValue = null;
                        goto Label0;
                    }
                }
                Label0 :;
            }
        }