Exemple #1
0
        protected override string uc_Save()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiJob") != "OK")
            {
                str = "";
            }
            else if (MyRule.AllowAdd)
            {
                //   SYS_LOG.Insert("Danh Mục Công Việc", "Thêm", this.txtID.Text);
                base.SetWaitDialogCaption("Đang lưu dữ liệu...");
                Cursor.Current = Cursors.WaitCursor;
                DIC_JOB dICJOB = new DIC_JOB(this.txtID.Text, this.txtNAME.Text, this.txtDescription.Text, this.chxUse.Checked);
                string  str1   = dICJOB.Insert();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(dICJOB);
                }
                Cursor.Current = Cursors.Default;
                this.DoHide();
                if (str1 != "OK")
                {
                    XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                str = str1;
            }
            else
            {
                MyRule.Notify();
                str = "";
            }
            return(str);
        }
Exemple #2
0
 private void RaiseSuccessEventHander(DIC_JOB item)
 {
     if (this.Success != null)
     {
         this.Success(this, item);
     }
 }
Exemple #3
0
        protected override string uc_Update()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiJob") != "OK")
            {
                str = "";
            }
            else if (MyRule.AllowEdit)
            {
                //  SYS_LOG.Insert("Danh Mục Công Việc", "Cập Nhật", this.txtID.Text);
                base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
                DIC_JOB dICJOB = new DIC_JOB(this.txtID.Text, this.txtNAME.Text, this.txtDescription.Text, this.chxUse.Checked);
                string  str1   = dICJOB.Update();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(dICJOB);
                }
                if (str1 != "OK")
                {
                    XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                this.DoHide();
                str = str1;
            }
            else
            {
                MyRule.Notify();
                str = "";
            }
            return(str);
        }
Exemple #4
0
 public override void Change()
 {
     if (!(MyRule.Get(MyLogin.RoleId, "bbiJob") != "OK"))
     {
         if (MyRule.AllowAccess)
         {
             DIC_JOB dICJOB    = new DIC_JOB();
             object  cellValue = base.GetCellValue(this.m_RowClickEventArgs.RowIndex, "JobCode");
             if (cellValue != null)
             {
                 base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                 if (!(dICJOB.Get(cellValue.ToString()) != "OK"))
                 {
                     this.DoHide();
                     xfmJobAdd _xfmJobAdd = new xfmJobAdd(Actions.Update, dICJOB);
                     _xfmJobAdd.Updated += new xfmJobAdd.UpdatedEventHander(this.frm_Updated);
                     _xfmJobAdd.Added   += new xfmJobAdd.AddedEventHander(this.frm_Added);
                     _xfmJobAdd.ShowDialog();
                 }
                 else
                 {
                     this.DoHide();
                     XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
             }
         }
         else
         {
             MyRule.Notify();
         }
     }
 }
Exemple #5
0
 private void RaiseItemSelectedEventHander(DIC_JOB item)
 {
     if (this.ItemSelected != null)
     {
         this.ItemSelected(this, item);
     }
 }
Exemple #6
0
 public void RaiseUpdatedEventHander(DIC_JOB Item)
 {
     if (this.Updated != null)
     {
         this.Updated(this, Item);
     }
 }
Exemple #7
0
        protected override void Add()
        {
            base.Add();
            DIC_JOB dICJOB = new DIC_JOB();

            this.txtID.Text = dICJOB.NewID();
            this.txtNAME.Focus();
        }
Exemple #8
0
        public xfmJobAdd(Actions Action)
        {
            this.InitializeComponent();
            this.Init();
            this.ucAdd.Status = Action;
            DIC_JOB dICJOB = new DIC_JOB();

            this.ucAdd.SetData(dICJOB.NewID());
            this.Text = "Tên";
        }
Exemple #9
0
        private void UpdateRow(DIC_JOB item, RowClickEventArgs e)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int rowIndex = e.RowIndex;

            advBandedGridView.SetRowCellValue(rowIndex, "Active", item.Active);
            advBandedGridView.SetRowCellValue(rowIndex, "JobCode", item.JobCode);
            advBandedGridView.SetRowCellValue(rowIndex, "JobName", item.JobName);
            advBandedGridView.SetRowCellValue(rowIndex, "Description", item.Description);
            advBandedGridView.UpdateCurrentRow();
        }
Exemple #10
0
 public void SetData(DIC_JOB item)
 {
     this.txtID.Text = item.JobCode;
     // SYS_LOG.Insert("Danh Mục Công Việc", "Xem", this.txtID.Text);
     if (this.m_Status == Actions.Update)
     {
         this.txtID.Properties.ReadOnly = true;
     }
     this.txtNAME.Text        = item.JobName;
     this.txtDescription.Text = item.Description;
     this.chxUse.Checked      = item.Active;
 }
Exemple #11
0
        private void AddRow(DIC_JOB Item)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int focusedRowHandle = advBandedGridView.FocusedRowHandle;

            advBandedGridView.AddNewRow();
            focusedRowHandle = advBandedGridView.FocusedRowHandle;
            advBandedGridView.SetRowCellValue(focusedRowHandle, "Active", Item.Active);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "JobCode", Item.JobCode);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "JobName", Item.JobName);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "Description", Item.Description);
            advBandedGridView.UpdateCurrentRow();
        }
Exemple #12
0
        protected override string uc_Delete()
        {
            DIC_JOB dICJOB = new DIC_JOB()
            {
                JobCode = this.txtID.Text
            };
            string str = dICJOB.Delete();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICJOB);
            }
            return(str);
        }
Exemple #13
0
 public xfmJobAdd(Actions Action, DIC_JOB Item)
 {
     this.InitializeComponent();
     this.Init();
     this.ucAdd.Status = Action;
     if (Action == Actions.Update)
     {
         this.ucAdd.SetData(Item);
         this.Text = "Cập nhâtk";
     }
     else if (Action == Actions.Delete)
     {
         this.ucAdd.SetData(Item.JobCode);
     }
 }
Exemple #14
0
 private void ucAdd_Success(object sender, DIC_JOB Item)
 {
     if (this.ucAdd.Status == Actions.Add)
     {
         this.RaiseAddedEventHander(Item);
     }
     else if (this.ucAdd.Status == Actions.Update)
     {
         this.RaiseUpdatedEventHander(Item);
     }
     if (this.ucAdd.IsClose == CloseOrNew.Close)
     {
         base.Close();
     }
     this.ucAdd.Clear();
 }
Exemple #15
0
        private void txtID_KeyDown(object sender, KeyEventArgs e)
        {
            TextEdit textEdit = (TextEdit)sender;

            if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab)
            {
                DIC_JOB dICJOB = new DIC_JOB();
                if (this.m_Status == Actions.Add)
                {
                    if (dICJOB.Exist(textEdit.Text))
                    {
                        this.Err.SetError(textEdit, "Mã đã tồn tại.");
                        textEdit.Focus();
                    }
                }
            }
        }
Exemple #16
0
        public override void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            DIC_JOB dICJOB = new DIC_JOB();

            this.gcList.DataSource = dICJOB.GetList();
            base.SetWaitDialogCaption("Đang nạp cấu hình...");
            this.List_Init(this.gbList);
            base.SetWaitDialogCaption("Nạp quyền sử dụng...");
            MyRule.Get(MyLogin.RoleId, "bbiJob");
            if (!MyRule.AllowPrint)
            {
                this.ucToolBar.bbiPrint.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiJob");
            if (!MyRule.AllowExport)
            {
                this.ucToolBar.bbiExport.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiJob");
            if (!MyRule.AllowAdd)
            {
                this.ucToolBar.bbiAdd.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiJob");
            if (!MyRule.AllowDelete)
            {
                this.ucToolBar.bbiDelete.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiJob");
            if (!MyRule.AllowEdit)
            {
                this.ucToolBar.bbiEdit.Visibility = BarItemVisibility.Never;
            }
            base.SetWaitDialogCaption("Đã xong...");
            this.DoHide();
        }
Exemple #17
0
        public override void Delete()
        {
            object cellValue;

            if (!(MyRule.Get(MyLogin.RoleId, "bbiJob") != "OK"))
            {
                if (MyRule.AllowDelete)
                {
                    if (ClsOption.System2.IsQuestion)
                    {
                        if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    base.SetWaitDialogCaption("Đang xóa...");
                    string            str  = "";
                    bool              flag = false;
                    AdvBandedGridView advBandedGridView = this.gbList;
                    int[]             selectedRows      = advBandedGridView.GetSelectedRows();
                    DIC_JOB           dICJOB            = new DIC_JOB();
                    for (int i = (int)selectedRows.Length; i > 0; i--)
                    {
                        flag      = true;
                        cellValue = base.GetCellValue(selectedRows[i - 1], "JobCode");
                        if (cellValue != null)
                        {
                            // SYS_LOG.Insert("Danh Mục Công Việc", "Xoá", cellValue.ToString());
                            str = dICJOB.Delete(cellValue.ToString());
                            if (str == "OK")
                            {
                                advBandedGridView.DeleteRow(selectedRows[i - 1]);
                            }
                            else if (str != "OK")
                            {
                                MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                        }
                    }
                    this.DoHide();
                    if (!flag)
                    {
                        if (advBandedGridView.DataSource != null)
                        {
                            RowClickEventArgs rowClickEventArg = new RowClickEventArgs((advBandedGridView == null ? -1 : advBandedGridView.FocusedRowHandle), (advBandedGridView.FocusedColumn == null ? -1 : advBandedGridView.FocusedColumn.ColumnHandle), (advBandedGridView.FocusedColumn == null ? "" : advBandedGridView.FocusedColumn.FieldName));
                            this.m_RowClickEventArgs = rowClickEventArg;
                            cellValue = null;
                            cellValue = base.GetCellValue(rowClickEventArg.RowIndex, "JobCode");
                            if (cellValue != null)
                            {
                                //  SYS_LOG.Insert("Danh Mục Công Việc", "Xoá", cellValue.ToString());
                                base.SetWaitDialogCaption("Đang xóa...");
                                str = dICJOB.Delete(cellValue.ToString());
                                if (str == "OK")
                                {
                                    advBandedGridView.DeleteRow(rowClickEventArg.RowIndex);
                                }
                                else if (str != "OK")
                                {
                                    MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                }
                                this.DoHide();
                            }
                        }
                    }
                }
                else
                {
                    MyRule.Notify();
                }
            }
        }
Exemple #18
0
 private void frm_Updated(object sender, DIC_JOB Item)
 {
     this.UpdateRow(Item, this.m_RowClickEventArgs);
 }
Exemple #19
0
 private void frm_Added(object sender, DIC_JOB e)
 {
     this.AddRow(e);
 }