public override void SetFormPermission(FormPermission formPermission, DAODataForm ddf, bool saveEnable)
 {
     base.SetFormPermission(formPermission, ddf, saveEnable);
     try
     {
         if (base.Controls.Contains(this.tblData))
         {
             this.tblData.SelectedTabPageIndex = formPermission.PageIndex;
         }
     }
     catch (Exception exception)
     {
         LoggingService.Error(exception);
     }
     if (saveEnable)
     {
         Control control;
         if (!StringHelper.IsNull(formPermission.UnableFrame))
         {
             string[] strArray = StringHelper.Split(formPermission.UnableFrame);
             foreach (string str in strArray)
             {
                 control = this.FindControl(str);
                 if (control != null)
                 {
                     this.SetControlDisable(control);
                 }
             }
         }
         if (!StringHelper.IsNull(formPermission.InVisibleFrame))
         {
             string[] strArray2 = StringHelper.Split(formPermission.InVisibleFrame, ',');
             foreach (string str in strArray2)
             {
                 control = this.FindControl(str);
                 if (control != null)
                 {
                     if (control.GetType().FullName == "DevExpress.XtraTab.XtraTabPage")
                     {
                         ((XtraTabPage) control).PageVisible = false;
                     }
                     else
                     {
                         control.Visible = false;
                     }
                     if (LoggingService.IsDebugEnabled)
                     {
                         LoggingService.DebugFormatted("set {0} invisible", new object[] { control.Name });
                     }
                 }
             }
             this.ResizeMe();
         }
     }
     else if (base.Controls.Contains(this.tblData))
     {
         foreach (XtraTabPage page in this.tblData.TabPages)
         {
             foreach (Control control2 in page.Controls)
             {
                 control2.Enabled = false;
             }
         }
     }
 }
 public virtual void SetFormPermission(FormPermission formPermission, SkyMap.Net.DataForms.DAODataForm ddf, bool saveEnable)
 {
     this.formPermission = formPermission;
     this.daoDataForm = ddf;
     this.AsyncLoadDataSet();
 }
 public virtual void SetFormPermission(FormPermission formPermission, DAODataForm ddf, bool saveEnable)
 {
     this.DataFormConntroller.SetFormPermission(formPermission, ddf, saveEnable);
 }
Exemple #4
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case (Keys.Menu | Keys.Alt):
            {
                List <HubButton> buttons = hubItem.Controls.OfType <HubButton>().ToList();

                buttons.ForEach(i =>
                    {
                        if (i.SubSystemID == 8 | i.SubSystemID == 12)
                        {
                            i.Title.Select(1, 1);
                        }
                        else
                        {
                            i.Title.Select(0, 1);
                        }

                        i.Title.SelectionColor = Color.Crimson;
                    });
                timer.Start();
                return(true);
            }

            case (Keys.Alt | Keys.H):
            {
                HubButton button = new HubButton(Definitions.EnvironmentNames.BasicInformation, this);
                button.RunModule(Definitions.EnvironmentNames.BasicInformation);
                button.Dispose();
                return(true);
            }

            case (Keys.Alt | Keys.J):
            {
                HubButton button = new HubButton(Definitions.EnvironmentNames.Settings, this);
                button.RunModule(Definitions.EnvironmentNames.Settings);
                button.Dispose();
                return(true);
            }

            case (Keys.Alt | Keys.A):
            {
                HubButton button = new HubButton(Definitions.EnvironmentNames.BackupAndRestore, this);
                button.RunModule(Definitions.EnvironmentNames.BackupAndRestore);
                button.Dispose();
                return(true);
            }

            case ((Keys)Atiran.Connections.Enums.ShortcutKeyEnum.HelpKey):
            {
                Help H = new Help();
                UserControlLoader u = new UserControlLoader(H, true, false, true, false);
                return(true);
            }

            case (Keys.Alt | Keys.F4):
            {
                UI.WindowsForms.MessageBoxes.MessageBoxWarning.state = 0;
                DialogResult close =
                    Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام سيستم",
                                                                                                "آيا مي خواهيد از سيستم خارج شويد؟", "w");
                UI.WindowsForms.MessageBoxes.MessageBoxWarning.state = 1;
                if (close == DialogResult.Yes)
                {
                    if (Connections.Operaions.UserFormPermissionOp.FormPermission.CheckBackupPermission())
                    {
                        DialogResult res =
                            Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show(
                                "پيام سيستم", "آيا مي خواهيد از اطلاعات پشتيبان بگيريد؟", "w");
                        if (res == DialogResult.Yes)
                        {
                            // backup
                            UI.WindowsForms.Controls.FastBackup c = new UI.WindowsForms.Controls.FastBackup();
                            UserControlLoader(c);
                        }
                    }

                    Application.Exit();
                }

                return(true);
            }

            case (Keys)Atiran.Connections.Enums.ShortcutKeyEnum.SearchFormsKey:
            {
                try
                {
                    List <Atiran.Connections.AtiranAccModel.Menu> menu = new List <Connections.AtiranAccModel.Menu>();
                    AtiranSpotlight spotlight = new AtiranSpotlight(menu);
                    new UserControlLoader(spotlight, true, false, true);
                    if (menu.Count > 0)
                    {
                        if (FormPermission.AccessUserForm((int?)menu[0].FormID ?? 0))
                        {
                            RunnerFromHub((Definitions.EnvironmentNames)menu[0].SubSystemID - 1, menu[0], true);
                        }
                        else
                        {
                            UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام", "شما به اين فرم دسترسي نداريد", "i");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }

                return(true);
            }

            //case (Keys.Alt | Keys.F7):
            //    {
            //        try
            //        {
            //            List<Atiran.Connections.AtiranAccModel.Menu> menu = new List<Connections.AtiranAccModel.Menu>();
            //            UI.WindowsForms.Shortcuts.AtiranShortcuts ShortCutHere = new UI.WindowsForms.Shortcuts.AtiranShortcuts(menu);
            //            ShortCutHere.pnlLeft.Visible = false;
            //            ShortCutHere.Width = 470;
            //            Atiran.UI.WindowsForms.UIElements.Form frm = new Atiran.UI.WindowsForms.UIElements.Form
            //            {
            //                KeyPreview = true,
            //                StartPosition = System.Windows.Forms.FormStartPosition.Manual,
            //                Width = ShortCutHere.Width,
            //                Height = ShortCutHere.Height,
            //                MaximumSize = new Size(ShortCutHere.Width, ShortCutHere.Height)
            //            };
            //            ShortCutHere.Dock = System.Windows.Forms.DockStyle.Fill;
            //            frm.WindowState = System.Windows.Forms.FormWindowState.Normal;
            //            frm.Controls.Add(ShortCutHere);
            //            frm.Deactivate += (sender, e) => { ShortCutHere.ParentForm.Close(); };
            //            frm.Location = new Point(750, 39);
            //            frm.ShowDialog();
            //            if (menu.Count > 0)
            //            {
            //                if (Connections.Operaions.UserFormPermissionOp.FormPermission.AccessUserForm((int?)menu[0].FormID ?? 0))
            //                {
            //                    RunnerFromHub((Definitions.EnvironmentNames)menu[0].SubSystemID - 1, menu[0], true);
            //                }
            //                else
            //                {
            //                    UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام", "شما به اين فرم دسترسي نداريد", "i");
            //                }
            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            MessageBox.Show(ex.ToString());
            //            throw;
            //        }
            //        return true;
            //    }
            case (Keys)Atiran.Connections.Enums.ShortcutKeyEnum.ActivatedFormKey:
            {
                try
                {
                    if (Atiran.UI.WindowsForms.UIElements.TabBar.StaticTabs == null || Atiran.UI.WindowsForms.UIElements.TabBar.StaticTabs.Count == 0)
                    {
                        Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيغام", "هيچ فرمي باز نشده است");
                        return(true);
                    }
                    List <Guid>          menu       = new List <Guid>();
                    AtiranActivatedForms ActiveHere = new AtiranActivatedForms(menu)
                    {
                        Width = 470
                    };
                    Atiran.UI.WindowsForms.UIElements.Form frm = new Atiran.UI.WindowsForms.UIElements.Form
                    {
                        KeyPreview    = true,
                        StartPosition = System.Windows.Forms.FormStartPosition.Manual,
                        Width         = ActiveHere.Width,
                        Height        = ActiveHere.Height,
                        MaximumSize   = new Size(ActiveHere.Width, ActiveHere.Height)
                    };
                    ActiveHere.Dock = System.Windows.Forms.DockStyle.Fill;
                    frm.WindowState = System.Windows.Forms.FormWindowState.Normal;
                    frm.Controls.Add(ActiveHere);
                    frm.Deactivate += (sender, e) => { ActiveHere.ParentForm.Close(); };
                    //  frm.Location = new Point(MousePosition.X - 190, MousePosition.Y + 15);
                    frm.Location = new Point(800, 39);
                    // System.Windows.Forms.MessageBox.Show("X = " + MousePosition.X.ToString() + " Y = " + MousePosition.Y.ToString());
                    frm.ShowDialog();
                    if (menu.Count > 0)
                    {
                        foreach (Tab item in Atiran.UI.WindowsForms.UIElements.TabBar.StaticTabs)
                        {
                            if (item.control.UcGuid == menu.FirstOrDefault())
                            {
                                if (item.control.ProjectName == "Atiran.Accounting")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Accounting, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Accounting, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.BasicInformation")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.BasicInformation, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.BasicInformation, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.KalaGostaran")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.KalaGostaran, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.KalaGostaran, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Management")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.SalesManagement, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.SalesManagement, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Rahyab")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Rahyab, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Rahyab, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Reporting")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Reporting, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Reporting, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Sale")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Sales, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Sales, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Settings")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Settings, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Settings, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.SMS")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.SMS, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.SMS, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.TaskManager")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.EMS, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.EMS, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.Treasury")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.Treasury, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.Treasury, TabGUID: item.control.UcGuid);
                                }
                                else if (item.control.ProjectName == "Atiran.BackupAndRestore")
                                {
                                    HubButton basicInformation = new HubButton(Definitions.EnvironmentNames.BackupAndRestore, this);
                                    basicInformation.RunModule(Definitions.EnvironmentNames.BackupAndRestore, TabGUID: item.control.UcGuid);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                return(true);
            }
            }

            if (keyData == Keys.Escape)
            {
                // new by sharafzade
                UI.WindowsForms.MessageBoxes.MessageBoxWarning.state = 0;
                DialogResult res = Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام سيستم", "آيا مي خواهيد آتيران را ترك كنيد؟", "w");
                UI.WindowsForms.MessageBoxes.MessageBoxWarning.state = 1;
                if (res == DialogResult.Yes)
                {
                    if (Connections.Operaions.UserFormPermissionOp.FormPermission.CheckBackupPermission())
                    {
                        DialogResult res1 = Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام سيستم", "آيا مي خواهيد از اطلاعات پشتيبان بگيريد؟", "w");
                        if (res1 == DialogResult.Yes)
                        {
                            // backup
                            UI.WindowsForms.Controls.FastBackup c = new UI.WindowsForms.Controls.FastBackup();
                            UserControlLoader(c);
                        }
                    }

                    Application.Exit();
                }
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
        private void dgvFormHistory_DoubleClick(object sender, EventArgs e)
        {
            if (dgvFormHistory.SelectedRows == null)
            {
                return;
            }

            string type    = dgvFormHistory.SelectedRows[0].Cells[1].Value.ToString();
            string chaseno = dgvFormHistory.SelectedRows[0].Cells[7].Value.ToString();

            if (type == "IT技術支援")
            {
                FormSupport form = new FormSupport(chaseno);
                form.ShowDialog();
            }

            if (type == "IT意見箱")
            {
                FormComment form = new FormComment(chaseno);
                form.ShowDialog();
            }

            if (type == "權限關連及軟件安裝")
            {
                FormPermission form = new FormPermission(chaseno);
                form.ShowDialog();
            }

            if (type == "工具開發/修改")
            {
            }

            if (type == "資產外借")
            {
            }

            if (type == "R3申請")
            {
                FormR3 form = new FormR3(chaseno);
                form.ShowDialog();
            }

            if (type.ToLower().StartsWith("debit") || type.ToLower().StartsWith("credit"))
            {
                DebitNoteForm2 formDebit = new DebitNoteForm2(type.ToLower(), "view", chaseno);
                //DebitCreditNoteFormView2 formDebit = new DebitCreditNoteFormView2(chaseno, "view");
                if (formDebit.ShowDialog() == DialogResult.OK)
                {
                    LoadData();
                }
            }

            if (type.StartsWith("Outstanding"))
            {
                OutstandingViewForm formOutstanding = new OutstandingViewForm(chaseno);
                if (formOutstanding.ShowDialog() == DialogResult.OK)
                {
                    LoadData();
                }
            }
        }