Exemplo n.º 1
0
 private void RaiseSuccessEventHander(DIC_MACHINE item)
 {
     if (this.Success != null)
     {
         this.Success(this, item);
     }
 }
Exemplo n.º 2
0
        protected override string uc_Update()
        {
            string str;

            if (MyRule.Get(MyLogin.RoleId, "bbiMachine") != "OK")
            {
                str = "";
            }
            else if (MyRule.AllowEdit)
            {
                //  SYS_LOG.Insert("Danh Mục Ca Làm Việc", "Cập Nhật", this.txtID.Text);
                base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
                DIC_MACHINE dICMACHINE = new DIC_MACHINE(this.txtID.Text, this.txtNAME.Text, this.cboPortType.Text, this.txtPortID.Text, this.txtIP.Text, this.txtPassword.Text, this.cboCom.Text);
                string      str1       = dICMACHINE.Update();
                if (str1 == "OK")
                {
                    this.RaiseSuccessEventHander(dICMACHINE);
                }
                if (str1 != "OK")
                {
                    XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                this.DoHide();
                str = str1;
            }
            else
            {
                MyRule.Notify();
                str = "";
            }
            return(str);
        }
Exemplo n.º 3
0
 public override void Change()
 {
     if (!(MyRule.Get(MyLogin.RoleId, "bbiMachine") != "OK"))
     {
         if (MyRule.AllowAccess)
         {
             DIC_MACHINE dICMACHINE = new DIC_MACHINE();
             object      cellValue  = base.GetCellValue(this.m_RowClickEventArgs.RowIndex, "MachineCode");
             if (cellValue != null)
             {
                 base.SetWaitDialogCaption("Đang kiểm tra dữ liệu....");
                 if (!(dICMACHINE.Get(cellValue.ToString()) != "OK"))
                 {
                     this.DoHide();
                     xfmMachineAdd _xfmMachineAdd = new xfmMachineAdd(Actions.Update, dICMACHINE);
                     _xfmMachineAdd.Updated += new xfmMachineAdd.UpdatedEventHander(this.frm_Updated);
                     _xfmMachineAdd.Added   += new xfmMachineAdd.AddedEventHander(this.frm_Added);
                     _xfmMachineAdd.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();
         }
     }
 }
Exemplo n.º 4
0
 public void RaiseDeletedEventHander(DIC_MACHINE Item, RowClickEventArgs e)
 {
     if (this.Deleted != null)
     {
         this.Deleted(this, Item, e);
     }
 }
Exemplo n.º 5
0
 private void RaiseItemSelectedEventHander(DIC_MACHINE item)
 {
     if (this.ItemSelected != null)
     {
         this.ItemSelected(this, item);
     }
 }
Exemplo n.º 6
0
 public void RaiseUpdatedEventHander(DIC_MACHINE Item)
 {
     if (this.Updated != null)
     {
         this.Updated(this, Item);
     }
 }
Exemplo n.º 7
0
        private void repMachine_EditValueChanged(object sender, EventArgs e)
        {
            DIC_MACHINE dICMACHINE = new DIC_MACHINE();

            dICMACHINE.Get(this.m_MachineCode);
            this.m_IP   = dICMACHINE.IP;
            this.m_Port = dICMACHINE.PortID;
        }
Exemplo n.º 8
0
        protected override void Add()
        {
            base.Add();
            DIC_MACHINE dICMACHINE = new DIC_MACHINE();

            this.txtID.Text = dICMACHINE.NewID();
            this.txtNAME.Focus();
        }
Exemplo n.º 9
0
 private void InitMachine()
 {
     foreach (DataRow row in (new DIC_MACHINE()).GetList().Rows)
     {
         DIC_MACHINE dICMACHINE = new DIC_MACHINE();
         dICMACHINE.Get(row["MachineCode"].ToString());
         this.InitOneMachine(dICMACHINE);
     }
 }
Exemplo n.º 10
0
        public xfmMachineAdd(Actions Action)
        {
            this.InitializeComponent();
            this.Init();
            this.ucAdd.Status = Action;
            DIC_MACHINE dICMACHINE = new DIC_MACHINE();

            this.ucAdd.SetData(dICMACHINE.NewID());
            this.Text = "Thêm";
        }
Exemplo n.º 11
0
        private void UpdateRow(DIC_MACHINE item, RowClickEventArgs e)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int rowIndex = e.RowIndex;

            advBandedGridView.SetRowCellValue(rowIndex, "MachineCode", item.MachineCode);
            advBandedGridView.SetRowCellValue(rowIndex, "MachineName", item.MachineName);
            advBandedGridView.SetRowCellValue(rowIndex, "PortType", item.PortType);
            advBandedGridView.SetRowCellValue(rowIndex, "PortID", item.PortID);
            advBandedGridView.SetRowCellValue(rowIndex, "IP", item.IP);
            advBandedGridView.SetRowCellValue(rowIndex, "Com", item.Com);
            advBandedGridView.UpdateCurrentRow();
            this.RaiseUpdatedEventHander(item);
        }
Exemplo n.º 12
0
        protected override string uc_Delete()
        {
            DIC_MACHINE dICMACHINE = new DIC_MACHINE()
            {
                MachineCode = this.txtID.Text
            };
            string str = dICMACHINE.Delete();

            if (str == "OK")
            {
                this.RaiseSuccessEventHander(dICMACHINE);
            }
            return(str);
        }
Exemplo n.º 13
0
 public xfmMachineAdd(Actions Action, DIC_MACHINE 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.MachineCode);
     }
 }
Exemplo n.º 14
0
 public void SetData(DIC_MACHINE item)
 {
     this.txtID.Text = item.MachineCode;
     //  SYS_LOG.Insert("Danh Mục Ca Làm Việc", "Xem", this.txtID.Text);
     if (this.m_Status == Actions.Update)
     {
         this.txtID.Properties.ReadOnly = true;
     }
     this.txtNAME.Text     = item.MachineName;
     this.cboPortType.Text = item.PortType;
     this.txtPortID.Text   = item.PortID;
     this.txtIP.Text       = item.IP;
     this.txtPassword.Text = item.Password;
     this.cboCom.Text      = item.Com;
 }
Exemplo n.º 15
0
        private void AddRow(DIC_MACHINE Item)
        {
            AdvBandedGridView advBandedGridView = this.gbList;
            int focusedRowHandle = advBandedGridView.FocusedRowHandle;

            advBandedGridView.AddNewRow();
            focusedRowHandle = advBandedGridView.FocusedRowHandle;
            advBandedGridView.SetRowCellValue(focusedRowHandle, "MachineCode", Item.MachineCode);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "MachineName", Item.MachineName);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "PortType", Item.PortType);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "PortID", Item.PortID);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "IP", Item.IP);
            advBandedGridView.SetRowCellValue(focusedRowHandle, "Com", Item.Com);
            advBandedGridView.UpdateCurrentRow();
            this.RaiseAddedEventHander(Item);
        }
Exemplo n.º 16
0
 private void ucAdd_Success(object sender, DIC_MACHINE 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();
 }
Exemplo n.º 17
0
        protected override void txtID_KeyDown(object sender, KeyEventArgs e)
        {
            TextEdit textEdit = (TextEdit)sender;

            if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab)
            {
                DIC_MACHINE dICMACHINE = new DIC_MACHINE();
                if (this.m_Status == Actions.Add)
                {
                    if (dICMACHINE.Exist(textEdit.Text))
                    {
                        this.Err.SetError(textEdit, "Mã đã tồn tại.");
                        textEdit.Focus();
                    }
                }
            }
        }
Exemplo n.º 18
0
        private void InitOneMachine(DIC_MACHINE Machine)
        {
            int num = 0;

            try
            {
                num = int.Parse(Machine.Password);
            }
            catch
            {
                num = 0;
            }
            xucMachineItem _xucMachineItem = new xucMachineItem(Machine.MachineCode, Machine.MachineName, Machine.IP, Machine.PortID, num);

            _xucMachineItem.ConnectError       += new xucMachineItem.ConnectErrorEventHander(this.machineItem_ConnectError);
            _xucMachineItem.ConnectComplete    += new xucMachineItem.ConnectCompleteEventHander(this.machineItem_ConnectComplete);
            _xucMachineItem.DisConnectComplete += new xucMachineItem.DisConnectCompleteEventHander(this.machineItem_DisConnectComplete);
            _xucMachineItem.AddRowEvent        += new xucMachineItem.AddRowEventHandler(this.machineItem_AddRowEvent);
            _xucMachineItem.OnTransactionEvent += new xucMachineItem.OnTransactionEventHandler(this.machineItem_OnTransactionEvent);
            _xucMachineItem.Dock  = DockStyle.Top;
            _xucMachineItem.Width = this.flowMachineItem.Width - 38;
            this.flowMachineItem.Controls.Add(_xucMachineItem);
        }
Exemplo n.º 19
0
        public override void ReLoad()
        {
            base.SetWaitDialogCaption("Đang nạp dữ liệu...");
            DIC_MACHINE dICMACHINE = new DIC_MACHINE();

            this.gcList.DataSource = dICMACHINE.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, "bbiMachine");
            if (!MyRule.AllowPrint)
            {
                this.ucToolBar.bbiPrint.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiMachine");
            if (!MyRule.AllowExport)
            {
                this.ucToolBar.bbiExport.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiMachine");
            if (!MyRule.AllowAdd)
            {
                this.ucToolBar.bbiAdd.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiMachine");
            if (!MyRule.AllowDelete)
            {
                this.ucToolBar.bbiDelete.Visibility = BarItemVisibility.Never;
            }
            MyRule.Get(MyLogin.RoleId, "bbiMachine");
            if (!MyRule.AllowEdit)
            {
                this.ucToolBar.bbiEdit.Visibility = BarItemVisibility.Never;
            }
            base.SetWaitDialogCaption("Đã xong...");
            this.DoHide();
        }
Exemplo n.º 20
0
        public override void Delete()
        {
            object cellValue;

            if (!(MyRule.Get(MyLogin.RoleId, "bbiMachine") != "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_MACHINE       dICMACHINE        = new DIC_MACHINE();
                    for (int i = (int)selectedRows.Length; i > 0; i--)
                    {
                        flag      = true;
                        cellValue = base.GetCellValue(selectedRows[i - 1], "MachineCode");
                        if (cellValue != null)
                        {
                            //   SYS_LOG.Insert("Danh Sách Thiết Bị", "Xoá", cellValue.ToString());
                            dICMACHINE.Get(cellValue.ToString());
                            str = dICMACHINE.Delete(cellValue.ToString());
                            if (str == "OK")
                            {
                                advBandedGridView.DeleteRow(selectedRows[i - 1]);
                                this.RaiseDeletedEventHander(dICMACHINE);
                            }
                            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, "MachineCode");
                            if (cellValue != null)
                            {
                                //  SYS_LOG.Insert("Danh Mục Ca Làm Việc", "Xoá", cellValue.ToString());
                                base.SetWaitDialogCaption("Đang xóa...");
                                dICMACHINE.Get(cellValue.ToString());
                                str = dICMACHINE.Delete(cellValue.ToString());
                                if (str == "OK")
                                {
                                    advBandedGridView.DeleteRow(rowClickEventArg.RowIndex);
                                    this.RaiseDeletedEventHander(dICMACHINE);
                                }
                                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();
                }
            }
        }
Exemplo n.º 21
0
 private void ucList_Deleted(object sender, DIC_MACHINE Item, RowClickEventArgs e)
 {
     this.RaiseDeletedEventHander(Item, e);
 }
Exemplo n.º 22
0
        private void FindMachine(bool IsResetAll, CHBK2014_N9.Common.Class.Actions Actions, DIC_MACHINE Machine)
        {
            //  xucMachineItem control = null;
            int num = 0;

            try
            {
                num = int.Parse(Machine.Password);
            }
            catch
            {
                num = 0;
            }
            if (!IsResetAll)
            {
                switch (Actions)
                {
                case CHBK2014_N9.Common.Class.Actions.Add:
                {
                    this.InitOneMachine(Machine);
                    break;
                }

                case CHBK2014_N9.Common.Class.Actions.Update:
                {
                    foreach (xucMachineItem control in this.flowMachineItem.Controls)
                    {
                        if (Machine.MachineCode == control.MachineCode)
                        {
                            if (control.IsConnected)
                            {
                                control.DisConnect();
                            }
                            control.MachineName = Machine.MachineName;
                            control.IP          = Machine.IP;
                            control.Port        = Machine.PortID;
                            control.Password    = num;
                            control.LoadInterface(true);
                        }
                    }
                    break;
                }

                case CHBK2014_N9.Common.Class.Actions.Change:
                {
                    break;
                }

                case CHBK2014_N9.Common.Class.Actions.Delete:
                {
                    foreach (xucMachineItem _xucMachineItem in this.flowMachineItem.Controls)
                    {
                        if (Machine.MachineCode == _xucMachineItem.MachineCode)
                        {
                            if (_xucMachineItem.IsConnected)
                            {
                                _xucMachineItem.DisConnect();
                            }
                            this.flowMachineItem.Controls.Remove(_xucMachineItem);
                        }
                    }
                    break;
                }

                default:
                {
                    goto case CHBK2014_N9.Common.Class.Actions.Change;
                }
                }
            }
            else
            {
                foreach (xucMachineItem control1 in this.flowMachineItem.Controls)
                {
                    if (!control1.IsConnected)
                    {
                        continue;
                    }
                    control1.DisConnect();
                }
                this.flowMachineItem.Controls.Clear();
                this.InitMachine();
            }
        }
Exemplo n.º 23
0
 private void frm_Updated(object sender, DIC_MACHINE Item)
 {
     this.UpdateRow(Item, this.m_RowClickEventArgs);
 }
Exemplo n.º 24
0
 private void ucList_Updated(object sender, DIC_MACHINE Item)
 {
     this.RaiseUpdatedEventHander(Item);
 }
Exemplo n.º 25
0
 private void frm_Added(object sender, DIC_MACHINE e)
 {
     this.AddRow(e);
 }