Ejemplo n.º 1
0
        public static void ShowForm(string ReportName, ref bool UsePrintPreview)
        {
            frmSetDefault frm = new frmSetDefault();

            frm.ReportName = ReportName;
            frm.Text       = "Set Default Laporan " + ReportName;

            frm.comboBoxEdit1.Properties.Items.AddRange(
                DocBrowseLayout.GetListLayout(ReportName));

            frm.radioGroup1.SelectedIndex = UsePrintPreview ? 0 : 1;
            string DefBrowse;
            string DefPrint;
            bool   Tmp;

            DocDefault.GetDefaultLayout(ReportName, out DefBrowse,
                                        out DefPrint, out Tmp);

            try
            {
                frm.comboBoxEdit1.Text = DefBrowse;
            }
            catch { }

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UsePrintPreview = UsePreview;
            }
        }
Ejemplo n.º 2
0
        public static int DeleteLayout(string DocId, string LayoutId)
        {
            DocBrowseLayout dbl = new DocBrowseLayout();

            dbl.DocId    = DocId;
            dbl.LayoutId = LayoutId;
            return(dbl.SaveDelete());
        }
Ejemplo n.º 3
0
        public static void SaveNewLayout(string DocId, string LayoutId,
                                         MemoryStream LayoutData, string QueryFilter,
                                         Dictionary <string, object> QueryFormFilter)
        {
            DocBrowseLayout dbl = new DocBrowseLayout();

            dbl.DocId           = DocId;
            dbl.LayoutId        = LayoutId;
            dbl.LayoutData      = LayoutData.ToArray();
            dbl.QueryFilter     = QueryFilter;
            dbl.QueryFormFilter = BaseUtility.Dictionary2String(QueryFormFilter);
            dbl.SaveNew();
        }
Ejemplo n.º 4
0
 private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (new WaitCursor())
     {
         try
         {
             if (comboBoxEdit1.SelectedIndex == 0)
             {
                 DefaultLayout.Seek(0, SeekOrigin.Begin);
                 pivotGridControl1.RestoreLayoutFromStream(DefaultLayout);
             }
             else
             {
                 MemoryStream ms;
                 string       QueryFilter;
                 Dictionary <string, object> QueryFormFilter;
                 DocBrowseLayout.GetLayoutData(_ReportName,
                                               comboBoxEdit1.Text, out ms, out QueryFilter,
                                               out QueryFormFilter);
                 if (ms != null)
                 {
                     pivotGridControl1.RestoreLayoutFromStream(ms);
                 }
                 bool NeedRefresh = false;
                 if (QueryFilter.Length > 0)
                 {
                     textEdit1.Text = QueryFilter;
                     NeedRefresh    = true;
                 }
                 if (_FilterForm != null && QueryFormFilter != null)
                 {
                     _FilterForm.FilterList = QueryFormFilter;
                     NeedRefresh            = true;
                 }
                 if (NeedRefresh)
                 {
                     barButtonItem8_ItemClick(null, null);
                 }
             }
         }
         catch (Exception ex)
         {
             XtraMessageBox.Show(ex.Message,
                                 "Error Baca Layout Laporan", MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
         }
     }
 }
Ejemplo n.º 5
0
        public static void GetLayoutData(string DocId, string LayoutId,
                                         out MemoryStream LayoutData, out string QueryFilter,
                                         Dictionary <string, object> QueryFormFilter)
        {
            DocBrowseLayout dbl = new DocBrowseLayout();

            dbl.DocId    = DocId;
            dbl.LayoutId = LayoutId;
            if (dbl.LoadEntity())
            {
                LayoutData  = new MemoryStream(dbl.LayoutData);
                QueryFilter = dbl.QueryFilter;
                BaseUtility.String2Dictionary(
                    dbl.QueryFormFilter, QueryFormFilter);
            }
            else
            {
                LayoutData      = null;
                QueryFilter     = string.Empty;
                QueryFormFilter = null;
            }
        }
Ejemplo n.º 6
0
        public void ShowForm(XtraForm MdiParent, Type FormType,
                             Type EntityType, DataPersistance dp,
                             Type FilterFormType, string DataFilter)
        {
            _Evaluator      = new Evaluator();
            Dp              = dp;
            this.DataFilter = DataFilter;
            comboBoxEdit1.Properties.Items.Add("(Layout Default)");

            if (EntityType != null)
            {
                _FormType   = FormType;
                _EntityType = EntityType;

                td = MetaData.GetTableDef(EntityType);
                Dp.ValidateTableDef(td);
                if (td.fldTransactionDate != null)
                {
                    dateEdit1.DateTime = DateTime.Today;
                    dateEdit2.DateTime = DateTime.Today;
                }
                else
                {
                    label3.Visible    = false;
                    label4.Visible    = false;
                    dateEdit1.Visible = false;
                    dateEdit2.Visible = false;
                }
                _ReportName = BaseUtility.SplitName(_EntityType.Name);
            }
            else
            {
                label3.Visible    = false;
                label4.Visible    = false;
                dateEdit1.Visible = false;
                dateEdit2.Visible = false;
                if (FilterFormType != null)
                {
                    _ReportName = FilterFormType.Name.Substring(0, 3).ToLower();
                    if (_ReportName == "frm" || _ReportName == "rpt")
                    {
                        _ReportName = BaseUtility.SplitName(
                            FilterFormType.Name.Substring(3));
                    }
                    else
                    {
                        _ReportName = BaseUtility.SplitName(FilterFormType.Name);
                    }
                }
                else
                {
                    _ReportName = "Bebas";
                }
            }
            Text = "Laporan " + _ReportName;

            comboBoxEdit1.Properties.Items.AddRange(
                DocBrowseLayout.GetListLayout(_ReportName));

            this.MdiParent = MdiParent;

            if (FilterFormType == null)
            {
                splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            }
            else
            {
                _FilterForm = BaseFactory.CreateInstance(FilterFormType) as IFilterForm;
                if (_FilterForm == null)
                {
                    XtraMessageBox.Show("Form Filter harus implement Interface IFilterForm !",
                                        "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                    return;
                }
                XtraForm Frm = _FilterForm as XtraForm;
                if (Frm != null)
                {
                    Frm.FormBorderStyle = FormBorderStyle.None;
                    Frm.TopLevel        = false;
                    Frm.Parent          = xtraScrollableControl1;
                    splitContainerControl1.SplitterPosition = Frm.Height + 5;
                    Frm.KeyPreview = true;
                    Frm.KeyDown   += new KeyEventHandler(frmGridReport_KeyDown);
                    xtraScrollableControl1.BackColor = Frm.BackColor;
                    Frm.Show();
                }
                else
                {
                    splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
                }
            }
            barButtonItem8_ItemClick(null, null);

            DefaultLayout = new MemoryStream();
            pivotGridControl1.SaveLayoutToStream(DefaultLayout);

            string CurrBrowseLayoutId = string.Empty;
            bool   Tmp;

            DocDefault.GetDefaultLayout(_ReportName,
                                        out CurrBrowseLayoutId, out CurrPrintLayoutId, out Tmp);
            Show();
            comboBoxEdit1.SelectedItem = CurrBrowseLayoutId;
            if (comboBoxEdit1.SelectedIndex < 0)
            {
                comboBoxEdit1.SelectedIndex = 0;
            }
            textEdit1.Focus();
        }
Ejemplo n.º 7
0
        private void LayoutAction(int ActionId)
        {
            using (new WaitCursor())
            {
                MemoryStream mst;
                Dictionary <string, object> DictFormFilter = null;
                int i = comboBoxEdit1.SelectedIndex;

                if (i == 0 && (ActionId == 1 || ActionId == 3))
                {
                    XtraMessageBox.Show("(Layout Default) tidak dapat disimpan/ dihapus !",
                                        "Error Simpan Layout",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                switch (ActionId)
                {
                case 1:     //Simpan
                    if (XtraMessageBox.Show("Update Layout Laporan ?",
                                            "Konfirmasi Update Layout Laporan", MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }

                    try
                    {
                        mst = new MemoryStream();
                        pivotGridControl1.SaveLayoutToStream(mst);
                        if (_FilterForm != null)
                        {
                            DictFormFilter = _FilterForm.FilterList;
                        }
                        DocBrowseLayout.SaveUpdateLayout(_ReportName,
                                                         comboBoxEdit1.Text, mst, textEdit1.Text, DictFormFilter);
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show(ex.Message, "Error Update Layout",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    break;

                case 2:     //Tambah
                    frmSaveLayout frm = new frmSaveLayout();
                    if (frm.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }

                    mst = new MemoryStream();
                    pivotGridControl1.SaveLayoutToStream(mst);
                    if (_FilterForm != null)
                    {
                        DictFormFilter = _FilterForm.FilterList;
                    }

                    try
                    {
                        DocBrowseLayout.SaveNewLayout(_ReportName,
                                                      frm.strText, mst, textEdit1.Text, DictFormFilter);
                        comboBoxEdit1.Properties.Items.Add(frm.strText);
                        comboBoxEdit1.SelectedIndex = comboBoxEdit1.Properties.Items.Count - 1;
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show(ex.Message, "Error Menambah Layout",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    break;

                case 3:     //Hapus
                    if (XtraMessageBox.Show("Hapus Layout Laporan ?",
                                            "Konfirmasi Hapus Layout Laporan", MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }

                    try
                    {
                        DocBrowseLayout.DeleteLayout(_ReportName, comboBoxEdit1.Text);
                        int idx = comboBoxEdit1.SelectedIndex;
                        comboBoxEdit1.Properties.Items.RemoveAt(idx);
                        int Cnt = comboBoxEdit1.Properties.Items.Count;
                        if (idx < Cnt)
                        {
                            comboBoxEdit1.SelectedIndex = idx;
                        }
                        else
                        {
                            comboBoxEdit1.SelectedIndex = Cnt - 1;
                        }
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show(ex.Message, "Error Hapus Layout",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    break;
                }
            }
        }