Exemplo n.º 1
0
        public void BatchComplete(BatchInfo batch)
        {
            var item = chkLstBatchName.Items[batch];

            if (item != null)
            {
                lstExecuteResult.Items.Add(item.Description, ThemeUtils.GetImage16x16Index("DONE"));
                chkLstBatchName.Items.Remove(item);
            }
        }
Exemplo n.º 2
0
        public void BatchError(BatchInfo batch, FaultException ex)
        {
            var item = chkLstBatchName.Items[batch];

            if (item != null)
            {
                var index = lstExecuteResult.Items.Add(item.Description, ThemeUtils.GetImage16x16Index("ERROR"));
                ProcessErrors[index] = ex;
            }
        }
Exemplo n.º 3
0
 public override void InitializeLanguage()
 {
     base.Language = new GroupRoleSetupLanguage(ModuleInfo)
     {
         RoleYesImageIndex      = ThemeUtils.GetImage16x16Index("ROLE[YES]"),
         RoleNoImageIndex       = ThemeUtils.GetImage16x16Index("ROLE[NO]"),
         HightRoleYesImageIndex = ThemeUtils.GetImage16x16Index("HIGHROLE[YES]"),
         HighRoleNoImageIndex   = ThemeUtils.GetImage16x16Index("HIGHROLE[NO]"),
         FolderOpenImageIndex   = ThemeUtils.GetImage16x16Index("FOLDER[OPEN]"),
         FolderCloseImageIndex  = ThemeUtils.GetImage16x16Index("FOLDER[CLOSE]"),
         Info = LangUtils.TranslateModuleItem(LangType.MODULE_TEXT, ModuleInfo, "Info")
     };
     base.InitializeLanguage();
 }
Exemplo n.º 4
0
        protected override void InitializeModuleData()
        {
            base.InitializeModuleData();

            var ds = new DataSet();

            ds.ReadXml((string)this["P01"]);

            var modules = ds.Tables["DEFMOD"].Rows;

            lstModule.ImageList = ThemeUtils.Image16;

            for (var i = 0; i < modules.Count; i++)
            {
                var codeName = CodeUtils.GetCodeName("DEFMOD", "SUBMOD", (string)modules[i]["SUBMOD"]);
                lstModule.Items.Add(modules[i]["MODNAME"], ThemeUtils.GetImage16x16Index(codeName));
            }
        }
Exemplo n.º 5
0
        protected override void InitializeModuleData()
        {
            base.InitializeModuleData();
            if (GroupID != 0)
            {
                lbTitle.Text = string.Format(Language.Info, GroupName);

                try
                {
                    using (var ctrlSA = new SAController())
                    {
                        List <User> users;
                        ctrlSA.ListUsersInGroup(out users, GroupID);
                        lstUserList.ImageList = ThemeUtils.Image16;
                        foreach (var user in users)
                        {
                            lstUserList.Items.Add(new ImageListBoxItem
                            {
                                Value      = user,
                                ImageIndex = ThemeUtils.GetImage16x16Index("USER_EDIT")
                            });
                        }

                        ctrlSA.ListGroupRoles(out m_Roles, GroupID);
                        foreach (var role in m_Roles)
                        {
                            role.TranslatedRoleName = Language.GetRoleName(role.RoleName);
                        }

                        roleTree.DataSource = m_Roles;
                        UpdateCategory(roleTree.Nodes);
                    }
                }
                catch (Exception ex)
                {
                    ShowError(ex);
                    CloseModule();
                }
#if !DEBUG
                colRoleID.Visible = false;
#endif
            }
        }
Exemplo n.º 6
0
        public void UpdatePageList()
        {
            cboPages.SelectedIndexChanged -= cboPages_SelectedIndexChanged;
            cboPages.ButtonClick          -= cboPages_ButtonClick;

            if (BufferResult != null && BufferResult.IsNotEmpty)
            {
                var buttons = new List <EditorButton>();
                cboPages.SuspendLayout();

                while (cboPages.Properties.Buttons.Count > 1)
                {
                    cboPages.Properties.Buttons.RemoveAt(1);
                }

                var showBackButton = (SelectedPage != 0);
                var showNextButton = (SelectedPage != BufferResult.MaxPage);

                if (StatisticsInfo.PageMode == CODES.MODSEARCH.PAGEMODE.APPEND_FROM_READER)
                {
                    cboPages.Properties.Buttons[0].Visible = false;
                    cboPages.Properties.Items.Clear();
                    cboPages.Properties.NullText = string.Format(Language.MorePageInfo, BufferResult.Rows.Count);

                    var moreButton = new EditorButton
                    {
                        Kind          = ButtonPredefines.Plus,
                        IsLeft        = false,
                        Tag           = SelectedPage + 1,
                        Caption       = Language.MoreRowsCaption,
                        ImageLocation = ImageLocation.MiddleLeft
                    };
                    buttons.Add(moreButton);

                    showBackButton = false;
                    showNextButton = false;
                }
                else if (StatisticsInfo.PageMode == CODES.MODSEARCH.PAGEMODE.PAGE_FROM_READER)
                {
                    cboPages.Properties.Buttons[0].Visible = false;
                    cboPages.Properties.ShowDropDown       = ShowDropDown.Never;
                    cboPages.Properties.TextEditStyle      = TextEditStyles.DisableTextEditor;

                    for (var i = BufferResult.MinPage; i <= BufferResult.MaxPage; i++)
                    {
                        var pageButton = new EditorButton {
                            Kind = ButtonPredefines.Glyph, Tag = i
                        };
                        if (i == SelectedPage)
                        {
                            pageButton.Caption = string.Format("[{0}]", i + 1);
                            pageButton.Enabled = false;
                        }
                        else
                        {
                            pageButton.Caption = string.Format("{0}", i + 1);
                            pageButton.Width   = 20;
                        }
                        buttons.Add(pageButton);
                    }

                    // TODO: Optimize code
                    cboPages.Properties.NullText = string.Format(Language.PageInfo, SelectedPage + 1, BufferResult.StartRow + 1, BufferResult.StartRow + BufferResult.Rows.Count);
                }
                else if (StatisticsInfo.PageMode == CODES.MODSEARCH.PAGEMODE.ALL_FROM_DATASET)
                {
                    cboPages.Properties.Buttons[0].Visible = false;
                    cboPages.Properties.ShowDropDown       = ShowDropDown.Never;
                    cboPages.Properties.TextEditStyle      = TextEditStyles.DisableTextEditor;
                    cboPages.Properties.NullText           = string.Format(Language.PageInfo, SelectedPage + 1, BufferResult.StartRow + 1, BufferResult.StartRow + BufferResult.Rows.Count);
                }
                else
                {
                    cboPages.Properties.Items.Clear();
                    var bottom = 1;
                    for (var i = 0; i <= BufferResult.MaxPage; i++)
                    {
                        cboPages.Properties.Items.Add(new ImageComboBoxItem
                        {
                            // TODO: Optimize code
                            Description = string.Format(Language.PageInfo, string.Format("{0}/{1}", i + 1, BufferResult.MaxPage + 1), bottom, Math.Min(bottom + m_MaxPageSize, BufferResult.BufferSize)),
                            Value       = i,
                            ImageIndex  = ThemeUtils.GetImage16x16Index("PAGE")
                        });
                        bottom = bottom + m_MaxPageSize;
                    }
                    cboPages.SelectedIndex = SelectedPage;
                }

                if (showBackButton)
                {
                    var pageButton = new EditorButton
                    {
                        Kind   = ButtonPredefines.Left,
                        IsLeft = true,
                        Tag    = (SelectedPage - 1),
                        Width  = 20
                    };
                    buttons.Insert(0, pageButton);
                }

                if (showNextButton)
                {
                    var pageButton = new EditorButton
                    {
                        Kind  = ButtonPredefines.Right,
                        Tag   = (SelectedPage + 1),
                        Width = 20
                    };
                    buttons.Add(pageButton);
                }

                cboPages.Properties.Buttons.AddRange(buttons.ToArray());

                cboPages.SelectedIndexChanged += cboPages_SelectedIndexChanged;
                cboPages.ButtonClick          += cboPages_ButtonClick;

                cboPages.ResumeLayout();
            }
            else
            {
                cboPages.Properties.Items.Clear();
                cboPages.EditValue = null;
            }
        }
Exemplo n.º 7
0
        public void ExecuteReadFile(WorkerThread worker)
        {
            try
            {
                Parent.LockUserAction();
                try
                {
                    ExcelBufferTable = new DataTable();

                    var workbook = new Workbook();
                    workbook.Open(FileName);
                    var worksheet = workbook.Worksheets[0];

                    var rowLength = worksheet.Cells.MaxRow + 1;
                    var colLength = worksheet.Cells.MaxColumn + 1;

                    var befcol = 'A' - 1;
                    var col    = 'A';
                    for (var i = 0; i < colLength; i++)
                    {
                        if (col > 'Z')
                        {
                            col = 'A';
                            befcol++;
                        }

                        if (befcol == 'A' - 1)
                        {
                            ExcelBufferTable.Columns.Add(new DataColumn(string.Format("{0}", char.ConvertFromUtf32(col)), typeof(object)));
                        }
                        else
                        {
                            ExcelBufferTable.Columns.Add(new DataColumn(string.Format("{0}{1}", char.ConvertFromUtf32(befcol), char.ConvertFromUtf32(col)), typeof(object)));
                        }

                        col++;
                    }

                    ImportComboBoxItems =
                        (from DataColumn column in ExcelBufferTable.Columns
                         select new ImageComboBoxItem
                    {
                        ImageIndex = ThemeUtils.GetImage16x16Index("COLUMN"),
                        Value = column.ColumnName,
                        Description = column.ColumnName
                    }).ToArray();

                    for (var i = 0; i < rowLength; i++)
                    {
                        var row = ExcelBufferTable.NewRow();
                        ExcelBufferTable.Rows.Add(row);

                        for (var j = 0; j < colLength; j++)
                        {
                            row[j] = worksheet.Cells[i, j].Value;
                        }


                        PercentComplete = i * 100.0f / rowLength;
                        if (worksheet.Cells[i, 1].Value != null)
                        {
                            StatusText = worksheet.Cells[i, 1].Value.ToString();
                        }
                        ExecuteUpdateGUI();
                    }

                    ExcelBufferTable.Columns.Add(new DataColumn("COLUMN_ERROR", typeof(string))
                    {
                        Caption = Parent.Language.GetLabelText("COLUMN_ERROR")
                    });

                    PercentComplete = 100;
                    ExecuteUpdateGUI(true);
                }
                catch (IOException ex)
                {
                    ExcelBufferTable = null;
                    throw ErrorUtils.CreateErrorWithSubMessage(ERR_IMPORT.ERR_FILE_OPEN_ERROR, ex.Message);
                }
                catch (Exception ex)
                {
                    ExcelBufferTable = null;
                    throw ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_UNKNOWN, ex.Message);
                }
            }
            catch (Exception ex)
            {
                Parent.ShowError(ex);
            }
            finally
            {
                Parent.UnLockUserAction();
            }
        }
Exemplo n.º 8
0
        public override void Execute()
        {
            base.Execute();

            try
            {
                btnSetup.Enabled            = false;
                btnClose.Enabled            = false;
                ctrlMainTab.SelectedTabPage = tabUserList;
                ctrlMainTab.Refresh();

                UserRoleExceptions    = new Dictionary <int, FaultException>();
                UserRoleImageIndexies = new Dictionary <int, int>();

                foreach (ImageListBoxItem item in lstUserList.Items)
                {
                    item.ImageIndex = ThemeUtils.GetImage16x16Index("USER_EDIT");
                }

                using (var ctrlSA = new SAController())
                {
                    ctrlSA.SaveGroupRoles(m_Roles.Where(i => i.RoleValue == "Y").ToList(), GroupID);
                }
                btnClose.Enabled = true;
                //----------------------------------------------

                /*CurrentThread = new WorkerThread(delegate
                 *   {
                 *       CurrentThread.ExecuteUpdateGUI(true);
                 *       foreach (ImageListBoxItem item in lstUserList.Items)
                 *       {
                 *           var user = item.Value as User;
                 *           if (user != null)
                 *           {
                 *               try
                 *               {
                 *                   using (var ctrlSA = new SAController())
                 *                   {
                 *                       UserRoleImageIndexies[lstUserList.Items.IndexOf(item)] = ThemeUtils.GetImage16x16Index("EXECUTE_STORE");
                 *                       CurrentThread.ExecuteUpdateGUI(true);
                 *                       ctrlSA.SaveUserRoles(m_Roles.Where(i => i.RoleValue == "Y").ToList(), user.UserID);
                 *                       UserRoleImageIndexies[lstUserList.Items.IndexOf(item)] = ThemeUtils.GetImage16x16Index("USER_DONE");
                 *                   }
                 *               }
                 *               catch (FaultException ex)
                 *               {
                 *                   UserRoleImageIndexies[lstUserList.Items.IndexOf(item)] = ThemeUtils.GetImage16x16Index("USER_FAIL");
                 *                   UserRoleExceptions[lstUserList.Items.IndexOf(item)] = ex;
                 *               }
                 *               catch (Exception ex)
                 *               {
                 *                   UserRoleImageIndexies[lstUserList.Items.IndexOf(item)] = ThemeUtils.GetImage16x16Index("USER_FAIL");
                 *                   UserRoleExceptions[lstUserList.Items.IndexOf(item)] = ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_UNKNOWN, ex.Message);
                 *               }
                 *
                 *               CurrentThread.ExecuteUpdateGUI(true);
                 *           }
                 *       }
                 *   }, this);
                 * CurrentThread.DoUpdateGUI += CurrentThread_DoUpdateGUI;
                 * CurrentThread.ProcessComplete +=
                 *  delegate
                 *  {
                 *      btnSetup.Enabled = true;
                 *      btnClose.Enabled = true;
                 *      if (UserRoleExceptions.Count == 0)
                 *      {
                 *          CloseModule();
                 *      }
                 *  };
                 * CurrentThread.Start();*/
                //--------------------------------------------
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }