Exemple #1
0
 public void RaiseUpdatedEventHander(DIC_SYMBOL Item)
 {
     if (this.Updated != null)
     {
         this.Updated(this, Item);
     }
 }
        protected override string uc_Update()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiSymbol") != "OK")
            {
                str = "";
            }
            else if (MyRule.AllowEdit)
            {
                //  SYS_LOG.Insert("Danh Mục Ký Hiệu Chấm Công", "Cập Nhật", this.txtID.Text);
                base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
                DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL(this.txtID.Text, this.txtNAME.Text, double.Parse(this.calPercentSalary.Text), this.cheIsEdit.Checked, this.cheIsShow.Checked, this.txtDescription.Text);
                string     str1      = dICSYMBOL.Update();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(dICSYMBOL);
                }
                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 #3
0
 public override void Change()
 {
     if (!(MyRule.Get(MyLogin.RoleId, "bbiSymbol") != "OK"))
     {
         if (MyRule.AllowAccess)
         {
             DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();
             object     cellValue = base.GetCellValue(this.m_RowClickEventArgs.RowIndex, "SymbolCode");
             if (cellValue != null)
             {
                 base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                 if (!(dICSYMBOL.Get(cellValue.ToString()) != "OK"))
                 {
                     this.DoHide();
                     xfmSymbolAdd _xfmSymbolAdd = new xfmSymbolAdd(Actions.Update, dICSYMBOL);
                     _xfmSymbolAdd.Updated += new xfmSymbolAdd.UpdatedEventHander(this.frm_Updated);
                     _xfmSymbolAdd.Added   += new xfmSymbolAdd.AddedEventHander(this.frm_Added);
                     _xfmSymbolAdd.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 #4
0
 private void RaiseItemSelectedEventHander(DIC_SYMBOL item)
 {
     if (this.ItemSelected != null)
     {
         this.ItemSelected(this, item);
     }
 }
 private void RaiseSuccessEventHander(DIC_SYMBOL item)
 {
     if (this.Success != null)
     {
         this.Success(this, item);
     }
 }
        protected override void Add()
        {
            base.Add();
            DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();

            this.txtID.Text = dICSYMBOL.NewID();
            this.txtNAME.Focus();
        }
        public xfmSymbolAdd(Actions Action)
        {
            this.InitializeComponent();
            this.Init();
            this.ucAdd.Status = Action;
            DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();

            this.ucAdd.SetData(dICSYMBOL.NewID());
            this.Text = "Thêm";
        }
Exemple #8
0
        private void UpdateRow(DIC_SYMBOL item, RowClickEventArgs e)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int rowIndex = e.RowIndex;

            advBandedGridView.SetRowCellValue(rowIndex, "IsEdit", item.IsEdit);
            advBandedGridView.SetRowCellValue(rowIndex, "SymbolCode", item.SymbolCode);
            advBandedGridView.SetRowCellValue(rowIndex, "SymbolName", item.SymbolName);
            advBandedGridView.SetRowCellValue(rowIndex, "PercentSalary", item.PercentSalary);
            advBandedGridView.SetRowCellValue(rowIndex, "Description", item.Description);
            advBandedGridView.UpdateCurrentRow();
            this.RaiseUpdatedEventHander(item);
        }
        protected override string uc_Delete()
        {
            DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL()
            {
                SymbolCode = this.txtID.Text
            };
            string str = dICSYMBOL.Delete();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICSYMBOL);
            }
            return(str);
        }
 public xfmSymbolAdd(Actions Action, DIC_SYMBOL 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.SymbolCode);
     }
 }
Exemple #11
0
        private void AddRow(DIC_SYMBOL Item)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int focusedRowHandle = advBandedGridView.FocusedRowHandle;

            advBandedGridView.AddNewRow();
            focusedRowHandle = advBandedGridView.FocusedRowHandle;
            advBandedGridView.SetRowCellValue(focusedRowHandle, "IsEdit", Item.IsEdit);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "SymbolCode", Item.SymbolCode);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "SymbolName", Item.SymbolName);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "PercentSalary", Item.PercentSalary);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "Description", Item.Description);
            advBandedGridView.UpdateCurrentRow();
            this.RaiseAddedEventHander(Item);
        }
 private void ucAdd_Success(object sender, DIC_SYMBOL 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();
 }
        protected override void txtID_KeyDown(object sender, KeyEventArgs e)
        {
            TextEdit textEdit = (TextEdit)sender;

            if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab)
            {
                DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();
                if (this.m_Status == Actions.Add)
                {
                    if (dICSYMBOL.Exist(textEdit.Text))
                    {
                        this.Err.SetError(textEdit, "Mã đã tồn tại.");
                        textEdit.Focus();
                    }
                }
            }
        }
 public void SetData(DIC_SYMBOL item)
 {
     this.txtID.Text = item.SymbolCode;
     //  SYS_LOG.Insert("Danh Mục Ký Hiệu Chấm Công", "Xem", this.txtID.Text);
     if (this.m_Status == Actions.Update)
     {
         this.txtID.Properties.ReadOnly = true;
     }
     if (!item.IsEdit)
     {
         this.txtNAME.Properties.ReadOnly = true;
     }
     this.txtNAME.Text          = item.SymbolName;
     this.calPercentSalary.Text = item.PercentSalary.ToString();
     this.cheIsEdit.Checked     = item.IsEdit;
     this.cheIsShow.Checked     = item.IsShow;
     this.txtDescription.Text   = item.Description;
 }
Exemple #15
0
        public override void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            this.PreviewData();
            DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();

            this.gcList.DataSource = dICSYMBOL.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, "bbiSymbol");
            if (!MyRule.AllowPrint)
            {
                this.ucToolBar.bbiPrint.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiSymbol");
            if (!MyRule.AllowExport)
            {
                this.ucToolBar.bbiExport.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiSymbol");
            if (!MyRule.AllowAdd)
            {
                this.ucToolBar.bbiAdd.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiSymbol");
            if (!MyRule.AllowDelete)
            {
                this.ucToolBar.bbiDelete.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiSymbol");
            if (!MyRule.AllowEdit)
            {
                this.ucToolBar.bbiEdit.Visibility = BarItemVisibility.Never;
            }
            base.SetWaitDialogCaption("Đã xong...");
            this.DoHide();
        }
Exemple #16
0
 private void frm_Updated(object sender, DIC_SYMBOL Item)
 {
     this.UpdateRow(Item, this.m_RowClickEventArgs);
 }
Exemple #17
0
 private void ucList_Updated(object sender, DIC_SYMBOL Item)
 {
     this.RaiseUpdatedEventHander(Item);
 }
Exemple #18
0
        public override void Delete()
        {
            object cellValue;

            if (!(MyRule.Get(MyLogin.RoleId, "bbiSymbol") != "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_SYMBOL        dICSYMBOL         = new DIC_SYMBOL();
                    for (int i = (int)selectedRows.Length; i > 0; i--)
                    {
                        cellValue = base.GetCellValue(selectedRows[i - 1], "SymbolCode");
                        if (cellValue != null)
                        {
                            dICSYMBOL.Get(cellValue.ToString());
                            if (dICSYMBOL.IsEdit)
                            {
                                flag = true;
                                //   SYS_LOG.Insert("Danh Mục Ký Hiệu Chấm Công", "Xoá", cellValue.ToString());
                                str = dICSYMBOL.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);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Dòng này không thể xóa");
                            }
                        }
                    }
                    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, "SymbolCode");
                            if (cellValue != null)
                            {
                                dICSYMBOL.Get(cellValue.ToString());
                                if (!dICSYMBOL.IsEdit)
                                {
                                    MessageBox.Show("Dòng này không thể xóa");
                                    return;
                                }
                                //   SYS_LOG.Insert("Danh Mục Ký Hiệu Chấm Công", "Xoá", cellValue.ToString());
                                base.SetWaitDialogCaption("Đang xóa...");
                                str = dICSYMBOL.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
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    this.RaiseDeletedEventHander();
                }
                else
                {
                    MyRule.Notify();
                }
            }
        }
Exemple #19
0
        public void Init(bool IsShowLateEarly, bool IsShowShift)
        {
            DIC_SYMBOL dICSYMBOL = new DIC_SYMBOL();

            this.flowLayoutPanel1.Controls.Clear();
            this.flowLayoutPanel2.Controls.Clear();
            foreach (DataRow row in dICSYMBOL.GetList().Rows)
            {
                if (bool.Parse(row["IsShow"].ToString()))
                {
                    string str = "";
                    if (!(row["SymbolCode"].ToString() == ""))
                    {
                        str = ((row["SymbolCode"].ToString() == "CS" || row["SymbolCode"].ToString() == "KCR" ? false : !(row["SymbolCode"].ToString() == "KCV")) ? row["SymbolCode"].ToString() : string.Concat("<color=red>", row["SymbolCode"].ToString(), "</color>"));
                    }
                    else
                    {
                        str = "(trống)";
                    }
                    xucSymbolItem _xucSymbolItem = new xucSymbolItem()
                    {
                        Height     = 13,
                        SymbolCode = string.Concat(":  ", str),
                        SymbolName = row["SymbolName"].ToString()
                    };
                    this.flowLayoutPanel1.Controls.Add(_xucSymbolItem);
                }
            }
            bool isShowLateEarly = IsShowLateEarly;
            bool flag            = isShowLateEarly;

            this.m_IsShowLateEarly = isShowLateEarly;
            if (flag)
            {
                xucSymbolItem _xucSymbolItem1 = new xucSymbolItem()
                {
                    Height     = 13,
                    SymbolCode = ":  +(số phút)",
                    SymbolName = "Số phút đi trễ"
                };
                this.flowLayoutPanel1.Controls.Add(_xucSymbolItem1);
                xucSymbolItem _xucSymbolItem2 = new xucSymbolItem()
                {
                    Height     = 13,
                    SymbolCode = ":  -(số phút)",
                    SymbolName = "Số phút về sớm"
                };
                this.flowLayoutPanel1.Controls.Add(_xucSymbolItem2);
                xucSymbolItem _xucSymbolItem3 = new xucSymbolItem()
                {
                    Height     = 13,
                    SymbolCode = ": +(sp):-(sp)",
                    SymbolName = "Đi trễ, về sớm"
                };
                this.flowLayoutPanel1.Controls.Add(_xucSymbolItem3);
                xucSymbolItem _xucSymbolItem4 = new xucSymbolItem()
                {
                    Height     = 13,
                    SymbolCode = ": <color=black>+;V +;P ...</color>",
                    SymbolName = "<color=black>Tách đôi ca</color>"
                };
                this.flowLayoutPanel1.Controls.Add(_xucSymbolItem4);
            }
            bool isShowShift = IsShowShift;

            flag = isShowShift;
            this.m_IsShowShift = isShowShift;
            if (!flag)
            {
                this.flowLayoutPanel2.Height = 0;
            }
            else
            {
                this.flowLayoutPanel2.Height = 17;
                DIC_SHIFT    dICSHIFT     = new DIC_SHIFT();
                LabelControl labelControl = new LabelControl()
                {
                    Text = "* Ký hiệu theo ca: "
                };
                this.flowLayoutPanel2.Controls.Add(labelControl);
                foreach (DataRow dataRow in dICSHIFT.GetList().Rows)
                {
                    xucSymbolItem _xucSymbolItem5 = new xucSymbolItem()
                    {
                        Height = 13,
                        Width  = 184
                    };
                    _xucSymbolItem5.lbSymbolCode.Width = 46;
                    _xucSymbolItem5.SymbolCode         = string.Concat(":  <color=blue>", dataRow["ShiftCode"].ToString(), "</color>");
                    string[] shortTimeString = new string[] { "<u>", dataRow["ShiftName"].ToString(), " <i>(", null, null, null, null };
                    DateTime dateTime        = Convert.ToDateTime(dataRow["BeginTime"]);
                    shortTimeString[3]         = dateTime.ToShortTimeString();
                    shortTimeString[4]         = " - ";
                    dateTime                   = Convert.ToDateTime(dataRow["EndTime"]);
                    shortTimeString[5]         = dateTime.ToShortTimeString();
                    shortTimeString[6]         = ")</i></u>";
                    _xucSymbolItem5.SymbolName = string.Concat(shortTimeString);
                    SuperToolTip          superToolTip = new SuperToolTip();
                    ToolTipItemCollection items        = superToolTip.Items;
                    shortTimeString    = new string[] { dataRow["ShiftName"].ToString(), " (", null, null, null, null, null };
                    dateTime           = Convert.ToDateTime(dataRow["BeginTime"]);
                    shortTimeString[2] = dateTime.ToShortTimeString();
                    shortTimeString[3] = " - ";
                    dateTime           = Convert.ToDateTime(dataRow["EndTime"]);
                    shortTimeString[4] = dateTime.ToShortTimeString();
                    shortTimeString[5] = "): ";
                    shortTimeString[6] = dataRow["ShiftCode"].ToString();
                    items.AddTitle(string.Concat(shortTimeString));
                    if (Convert.ToBoolean(dataRow["IsOvernight"].ToString()))
                    {
                        superToolTip.Items.Add("- Làm việc qua đêm");
                    }
                    if (!Convert.ToBoolean(dataRow["IsBreak"].ToString()))
                    {
                        superToolTip.Items.Add("- Không nghỉ giữa ca");
                    }
                    else
                    {
                        ToolTipItemCollection toolTipItemCollection = superToolTip.Items;
                        dateTime = Convert.ToDateTime(dataRow["BreakBeginTime"]);
                        string shortTimeString1 = dateTime.ToShortTimeString();
                        dateTime = Convert.ToDateTime(dataRow["BreakEndTime"]);
                        toolTipItemCollection.Add(string.Concat("- Nghỉ giữa ca từ ", shortTimeString1, " - ", dateTime.ToShortTimeString()));
                    }
                    _xucSymbolItem5.lbSymbolName.SuperTip = superToolTip;
                    this.flowLayoutPanel2.Controls.Add(_xucSymbolItem5);
                }
            }
            SimpleButton simpleButton = new SimpleButton()
            {
                Text  = "Chỉnh Sửa Bảng Ký Hiệu Chấm Công",
                Width = 200
            };

            simpleButton.Click += new EventHandler(this.bt_Click);
            this.flowLayoutPanel1.Controls.Add(simpleButton);
        }
Exemple #20
0
 private void frm_Added(object sender, DIC_SYMBOL e)
 {
     this.AddRow(e);
 }