bool IModuleAccessForm.ShowDialog(ModuleAccess ma,
                                   Dictionary <string, List <string> > ListKey, ref bool AllDocumentData)
 {
     labelControl2.Text = ma.ModuleName;
     this.ma            = ma;
     checkEdit5.Checked = ma.GetVariable <bool>(
         SecurityVarName.DocumentView, false);
     return(ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK);
 }
        bool IModuleAccessForm.ShowDialog(ModuleAccess ma,
                                          Dictionary <string, List <string> > ListKey, ref bool AllDocumentData)
        {
            labelControl2.Text = string.Concat(ma.FolderName, "\\",
                                               ma.ModuleName);
            this.ma            = ma;
            _OnLoad            = true;
            checkEdit3.Checked = AllDocumentData;
            checkEdit1.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportView, false);

            checkEdit12.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportPrint, false);
            checkEdit11.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportDesignPrint, false);
            checkEdit10.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportSave, false);
            checkEdit4.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportLayoutSave, false);
            _OnLoad = false;
            return(ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK);
        }
        public void ShowForm2(EntityForm EntityForm,
                              string ReportName, string FreeFilter,
                              object TransStartDate, object TransEndDate,
                              object[] Parameters)
        {
            _ReportName = ReportName;
            _EntityForm = EntityForm;

            if (EntityForm.ModuleName.Length > 0 && BaseSecurity.CurrentLogin
                .CurrentRole.Length > 0)
            {
                ModuleAccess ma = BaseSecurity.GetModuleAccess(EntityForm.ModuleName);

                if (!ma.GetVariable <bool>(SecurityVarName.ReportDesignPrint, false))
                {
                    comboBoxEdit1.Properties.Buttons[2].Enabled = false;
                }
            }

            _Evaluator = BaseFactory.CreateInstance <Evaluator>();
            if (_ReportName.Contains("Laporan"))
            {
                Text = _ReportName;
            }
            else
            {
                Text = "Laporan " + _ReportName;
            }

            _FilterForm = BaseFactory.CreateInstance(
                _EntityForm.FilterFormType) as IFilterForm;
            if (_FilterForm == null)
            {
                XtraMessageBox.Show("Form Filter harus implement Interface IFilterForm !",
                                    "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }
            _ShowViewForm = _FilterForm as IShowView;
            if (_ShowViewForm == null)
            {
                XtraMessageBox.Show("Form Filter harus implement Interface IShowView !",
                                    "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            if (_EntityForm.FilterFormType == null || _FilterForm as ReportEntity != null)
            {
                splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            }
            else
            {
                XtraForm Frm = _FilterForm as XtraForm;
                if (Frm != null)
                {
                    InitFilterForm(Frm, xtraScrollableControl1,
                                   splitContainerControl1);
                }
                else
                {
                    QueryReportEntity(xtraScrollableControl1,
                                      splitContainerControl1);
                }
            }

            List <string> ListItems = DocPrintBrowseLayout
                                      .GetListLayout("F_" + _ReportName);

            if (ListItems.Count == 0)
            {
                if (re != null)
                {
                    Dictionary <string, object> Vars = new Dictionary <string, object>();
                    re.GetVariables(Vars);
                    SaveReportFromTemplateFolder("F_", ReportName,
                                                 ListItems, Vars);
                }
                else
                {
                    SaveReportFromTemplateFolder("F_", ReportName,
                                                 ListItems, _FilterForm != null ?
                                                 _FilterForm.FilterList : null);
                }
            }
            comboBoxEdit1.Properties.Items.AddRange(ListItems);

            string CurrBrowseLayoutId = string.Empty;
            bool   Tmp;

            DocDefault.GetDefaultLayout(_ReportName,
                                        out CurrBrowseLayoutId, out CurrPrintLayoutId, out Tmp);

            if (re != null)
            {
                ((IShowView)re).ShowView(Parameters);
            }
            else if (_ShowViewForm != null)
            {
                _ShowViewForm.ShowView(Parameters);
            }

            comboBoxEdit1.SelectedItem = CurrBrowseLayoutId;
            if (comboBoxEdit1.SelectedIndex < 0 && comboBoxEdit1.Properties.Items.Count > 0)
            {
                comboBoxEdit1.SelectedIndex = 0;
            }
            else
            {
                comboBoxEdit1_SelectedIndexChanged(null, null);
            }
            sbTotal.Caption = "Total Halaman: " +
                              printControl1.PrintingSystem.Pages.Count;
            ribbonStatusBar1.Refresh();
            printControl1.PrintingSystem.AfterChange += new DevExpress.XtraPrinting.ChangeEventHandler(PrintingSystem_AfterChange);
            Show();
            printControl1.Focus();
        }
Beispiel #4
0
        bool IModuleAccessForm.ShowDialog(ModuleAccess ma,
                                          Dictionary <string, List <string> > ListKey,
                                          ref bool AllDocumentData)
        {
            labelControl2.Text = string.Concat(ma.FolderName, "\\",
                                               ma.ModuleName);
            this.ma            = ma;
            _OnLoad            = true;
            checkEdit5.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentView, false);
            checkEdit6.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportView, false);

            checkEdit1.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentNew, false);
            checkEdit2.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentEdit, false);
            checkEdit3.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentDelete, false);
            checkEdit7.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentPrint, false);
            checkEdit8.Checked = ma.GetVariable <bool>(
                SecurityVarName.DocumentDesignPrint, false);

            checkEdit12.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportPrint, false);
            checkEdit11.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportDesignPrint, false);
            checkEdit10.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportSave, false);
            checkEdit4.Checked = ma.GetVariable <bool>(
                SecurityVarName.ReportLayoutSave, false);
            _OnLoad = false;

            this.ListKey = ListKey;

            if (ma.ListDataField.Count == 0)
            {
                xtraTabPage2.PageVisible = false;
            }
            else
            {
                DataPersistance dp = BaseSecurity.CurrentLogin.Dp;
                checkEdit14.Checked = AllDocumentData;
                foreach (ModuleDataField mdf in ma.ListDataField)
                {
                    List <Item> ListItem = new List <Item>();
                    ListDataField.Add(mdf.DataFieldName, ListItem);
                    comboBoxEdit1.Properties.Items.Add(mdf.DataFieldName);

                    IDataReader rdr = dp.ExecuteReader(mdf.SqlQuery);
                    while (rdr.Read())
                    {
                        bool   Pilih   = false;
                        string DataKey = (string)rdr[0];
                        foreach (string key in ListKey[mdf.DataFieldName])
                        {
                            if (key == DataKey)
                            {
                                Pilih = true;
                                break;
                            }
                        }
                        ListItem.Add(new Item(Pilih, DataKey));
                    }
                    rdr.Close();
                }
                comboBoxEdit1.SelectedIndex = 0;
            }

            if (ShowDialog(BaseWinFramework.MdiParent) == DialogResult.OK)
            {
                AllDocumentData = this.AllDocumentData;
                return(true);
            }
            else
            {
                return(false);
            }
        }