Exemple #1
0
 private void Change()
 {
     if (MyRule.IsEdit("bbiHoliday"))
     {
         DIC_HOLIDAY dICHOLIDAY          = new DIC_HOLIDAY();
         object      focusedRowCellValue = this.gbList.GetFocusedRowCellValue("HolidayID");
         if (focusedRowCellValue != null)
         {
             base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
             if (!(dICHOLIDAY.Get(focusedRowCellValue.ToString()) != "OK"))
             {
                 this.DoHide();
                 xfmHolidayAdd _xfmHolidayAdd = new xfmHolidayAdd(Actions.Update, dICHOLIDAY);
                 _xfmHolidayAdd.Updated += new xfmHolidayAdd.UpdatedEventHander(this.frm_Updated);
                 _xfmHolidayAdd.Added   += new xfmHolidayAdd.AddedEventHander(this.frm_Added);
                 _xfmHolidayAdd.ShowDialog();
             }
             else
             {
                 this.DoHide();
                 XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Exemple #2
0
 private void RaiseSuccessEventHander(DIC_HOLIDAY item)
 {
     if (this.Success != null)
     {
         this.Success(this, item);
     }
 }
 public void RaiseUpdatedEventHander(DIC_HOLIDAY Item)
 {
     if (this.Updated != null)
     {
         this.Updated(this, Item);
     }
 }
Exemple #4
0
 public void SetData(DIC_HOLIDAY item)
 {
     this.m_HolidayID = item.HolidayID;
     SYS_LOG.Insert("Danh Mục Ngày Nghỉ", "Xem", this.m_HolidayID.ToString());
     this.txtName.Text        = item.HolidayName;
     this.dtFromDate.DateTime = item.FromDate;
     this.dtToDate.DateTime   = item.ToDate;
     this.txtDescription.Text = item.Description;
 }
        public xfmHolidayAdd(Actions Action)
        {
            this.InitializeComponent();
            this.Init();
            this.ucAdd.Status = Action;
            DIC_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY();

            this.ucAdd.SetData(dICHOLIDAY.NewID());
            this.Text = "Thêm";
        }
Exemple #6
0
        private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            string str;
            object rowCellValue;

            if (MyRule.IsDelete("bbiHoliday"))
            {
                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_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY();
                    for (int i = (int)selectedRows.Length; i > 0; i--)
                    {
                        flag         = true;
                        rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "HolidayID");
                        if (rowCellValue != null)
                        {
                            //  SYS_LOG.Insert("Danh Sách Ngày Nghỉ, Ngày Lể", "Xoá", rowCellValue.ToString());
                            str = dICHOLIDAY.Delete(new Guid(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", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                        }
                    }
                    this.DoHide();
                    if (!flag)
                    {
                        rowCellValue = this.gbList.GetFocusedRowCellValue("HolidayID");
                        if (rowCellValue != null)
                        {
                            //   SYS_LOG.Insert("Danh Sách Ngày Nghỉ, Ngày Lể", "Xoá", rowCellValue.ToString());
                            base.SetWaitDialogCaption("Đang xóa...");
                            str = dICHOLIDAY.Delete(new Guid(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", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            this.DoHide();
                        }
                    }
                }
            }
        }
Exemple #7
0
        private void UpdateRow(DIC_HOLIDAY item)
        {
            GridView gridView         = this.gbList;
            int      focusedRowHandle = this.gbList.FocusedRowHandle;

            gridView.SetRowCellValue(focusedRowHandle, "HolidayID", item.HolidayID);
            gridView.SetRowCellValue(focusedRowHandle, "HolidayName", item.HolidayName);
            gridView.SetRowCellValue(focusedRowHandle, "FromDate", item.FromDate);
            gridView.SetRowCellValue(focusedRowHandle, "ToDate", item.ToDate);
            gridView.SetRowCellValue(focusedRowHandle, "Description", item.Description);
            gridView.UpdateCurrentRow();
        }
Exemple #8
0
        protected override string uc_Delete()
        {
            DIC_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY()
            {
                HolidayID = this.m_HolidayID
            };
            string str = dICHOLIDAY.Delete();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICHOLIDAY);
            }
            return(str);
        }
 public xfmHolidayAdd(Actions Action, DIC_HOLIDAY Item)
 {
     this.InitializeComponent();
     this.Init();
     this.ucAdd.Status = Action;
     if (Action == Actions.Update)
     {
         this.ucAdd.SetData(Item);
         this.Text = "Cập nhật";
     }
     else if (Action == Actions.Delete)
     {
         this.ucAdd.SetData(Item.HolidayID.ToString());
     }
 }
 private void ucAdd_Success(object sender, DIC_HOLIDAY 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 #11
0
        protected override string uc_Update()
        {
            SYS_LOG.Insert("Danh Mục Ngày Nghỉ", "Cập Nhật", this.m_HolidayID.ToString());
            base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
            DIC_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY(this.m_HolidayID, this.txtName.Text, this.dtFromDate.DateTime, this.dtToDate.DateTime, this.txtDescription.Text);
            string      str        = dICHOLIDAY.Update();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICHOLIDAY);
            }
            if (str != "OK")
            {
                XtraMessageBox.Show(str, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            this.DoHide();
            return(str);
        }
Exemple #12
0
        protected override string uc_Save()
        {
            SYS_LOG.Insert("Danh Mục Ngày Nghỉ", "Thêm", this.m_HolidayID.ToString());
            base.SetWaitDialogCaption("Đang lưu dữ liệu...");
            Cursor.Current   = Cursors.WaitCursor;
            this.m_HolidayID = Guid.NewGuid();
            DIC_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY(this.m_HolidayID, this.txtName.Text, this.dtFromDate.DateTime, this.dtToDate.DateTime, this.txtDescription.Text);
            string      str        = dICHOLIDAY.Insert();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICHOLIDAY);
            }
            Cursor.Current = Cursors.Default;
            this.DoHide();
            if (str != "OK")
            {
                XtraMessageBox.Show(str, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return(str);
        }
Exemple #13
0
        private void LoadGrid()
        {
            DIC_HOLIDAY dICHOLIDAY = new DIC_HOLIDAY();

            this.gcList.DataSource = dICHOLIDAY.GetByYear(this.m_Year);
        }
Exemple #14
0
 private void frm_Updated(object sender, DIC_HOLIDAY Item)
 {
     this.UpdateRow(Item);
 }
Exemple #15
0
 private void frm_Added(object sender, DIC_HOLIDAY Item)
 {
     this.LoadGrid();
 }