Ejemplo n.º 1
0
        public Form ShowTabular()
        {
            if (!BaseWinFramework.CheckModuleAccessWithError(ModuleName,
                                                             SecurityVarName.ReportView, true))
            {
                return(null);
            }

            using (new WaitCursor())
            {
                if (!TypeChecked)
                {
                    CheckEntityType();
                }

                if (_UIN != null)
                {
                    IRuleInitUI riu = (IRuleInitUI)_UIN.Entity;
                    _DataFilter   = riu.GetBrowseFilter();
                    BrowseColumns = riu.GetBrowseColumns();
                    riu.GetBrowseSql(out BrowseSql, out BrowseCondition, out BrowseOrder);
                    BrowseFormat.Clear();
                    riu.GetBrowseFormat(BrowseFormat);

                    TableDef td = MetaData.GetTableDef(riu.GetType());
                    if (riu.GetFieldTransactionDate().Length == 0)
                    {
                        fldTransactionDate = td.fldTransactionDate;
                    }
                    else
                    {
                        fldTransactionDate = td.GetFieldDef(
                            riu.GetFieldTransactionDate());
                    }
                }

                if (_BrowseForm == null || _BrowseForm.IsDisposed ||
                    _BrowseType != BrowseType.Tabular)
                {
                    if (BaseWinFramework.TouchScreenVersion)
                    {
                        _BrowseForm = new frmGridReportTC();
                    }
                    else
                    {
                        _BrowseForm = new frmGridReport();
                    }
                    _BrowseForm.MdiParent = BaseWinFramework._MdiParent;
                    ((IBrowseForm)_BrowseForm).ShowForm(this, ModuleName);
                    _BrowseType = BrowseType.Tabular;
                }
                else
                {
                    _BrowseForm.BringToFront();
                }
                return(_BrowseForm);
            }
        }
Ejemplo n.º 2
0
        public static BaseEntity CloneAll(BaseEntity SourceObj)
        {
            TableDef   td      = GetTableDef(SourceObj.GetType());
            BaseEntity DestObj = (BaseEntity)BaseFactory
                                 .CreateInstance(td._ClassType);

            IRuleInitUI px = DestObj as IRuleInitUI;

            //CallLoadRule = CallLoadRule && px != null;

            DestObj.EntityOnLoad = true;
            try
            {
                DestObj = SourceObj.ShallowClone();

                if (td.ChildEntities.Count > 0)
                {
                    foreach (EntityCollDef ecd in td.ChildEntities)
                    {
                        //IEntityCollection cols = (IEntityCollection)
                        //    Activator.CreateInstance(ecd.ConstructionType);
                        //if (ecd.mi.MemberType == MemberTypes.Field)
                        //    ((FieldInfo)ecd.mi).SetValue(DestObj, cols);
                        //else
                        //    ((PropertyInfo)ecd.mi).SetValue(DestObj, cols, null);

                        IList SrcCols  = ecd.GetValue(SourceObj);
                        IList DestCols = (IList)ecd.CreateNew((BusinessEntity)DestObj);

                        ((IEntityCollection)DestCols).OnLoad = true;
                        foreach (BusinessEntity obj in SrcCols)
                        {
                            DestCols.Add(CloneAll(obj));
                        }
                        ((IEntityCollection)DestCols).OnLoad = false;
                    }
                }

                //if (CallLoadRule)
                //{
                //    px.AfterLoadFound();
                //    BaseFramework.DoEntityAction(DestObj, enEntityActionMode.AfterLoadFound);
                //}
                ParentEntity pe = DestObj as ParentEntity;
                if (pe != null)
                {
                    pe.AfterClone((ParentEntity)SourceObj);
                }
            }
            finally
            {
                DestObj.EntityOnLoad = false;
                DestObj.DataChanged();
            }
            return(DestObj);
        }
Ejemplo n.º 3
0
        public Form ShowFreeLayout()
        {
            if (!BaseWinFramework.CheckModuleAccessWithError(ModuleName,
                                                             SecurityVarName.ReportView, true))
            {
                return(null);
            }

            using (new WaitCursor())
            {
                if (!TypeChecked)
                {
                    CheckEntityType();
                }

                if (_UIN != null)
                {
                    IRuleInitUI riu = (IRuleInitUI)_UIN.Entity;
                    _DataFilter   = riu.GetBrowseFilter();
                    BrowseColumns = riu.GetBrowseColumns();
                    riu.GetBrowseSql(out BrowseSql, out BrowseCondition, out BrowseOrder);
                    BrowseFormat.Clear();
                    riu.GetBrowseFormat(BrowseFormat);
                }

                if (_BrowseForm == null || _BrowseForm.IsDisposed ||
                    _BrowseType != BrowseType.FreeLayout)
                {
                    if (BaseWinFramework.mdiRibbonControl != null)
                    {
                        _BrowseForm = new frmFreeReport();
                    }
                    else
                    {
                        _BrowseForm = new frmFreeReport2();
                    }

                    _BrowseForm.MdiParent = BaseWinFramework._MdiParent;
                    ((IFreeReport)_BrowseForm).ShowForm(this, ModuleName);
                    _BrowseType = BrowseType.FreeLayout;
                }
                else
                {
                    _BrowseForm.BringToFront();
                }
                return(_BrowseForm);
            }
        }
Ejemplo n.º 4
0
        public static BaseEntity Clone(BaseEntity SourceObj)
        {
            TableDef       td      = GetTableDef(SourceObj.GetType());
            BusinessEntity DestObj = (BusinessEntity)BaseFactory
                                     .CreateInstance(td._ClassType);
            IRuleInitUI px = DestObj as IRuleInitUI;

            //CallLoadRule = CallLoadRule && px != null;

            DestObj.EntityOnLoad = true;
            try
            {
                foreach (FieldDef fd in td.KeyFields.Values)
                {
                    fd.SetLoadValue(DestObj, fd.GetValue(SourceObj));
                }
                foreach (FieldDef fd in td.NonKeyFields.Values)
                {
                    fd.SetLoadValue(DestObj, fd.GetValue(SourceObj));
                }

                if (td.ChildEntities.Count > 0)
                {
                    foreach (EntityCollDef ecd in td.ChildEntities)
                    {
                        IList SrcCols  = ecd.GetValue(SourceObj);
                        IList DestCols = ecd.GetValue(DestObj);
                        int   NumDest  = DestCols.Count;
                        ((IEntityCollection)DestCols).OnLoad = true;
                        int i = 0;
                        foreach (BaseEntity obj in SrcCols)
                        {
                            if (i < NumDest)
                            {
                                Clone((BaseEntity)DestCols[i++], obj);
                            }
                            else
                            {
                                DestCols.Add(Clone(obj));
                            }
                        }
                        ((IEntityCollection)DestCols).OnLoad = false;
                    }
                }

                //if (CallLoadRule)
                //{
                //px.AfterLoadFound();
                //BaseFramework.DoEntityAction(DestObj, enEntityActionMode.AfterLoadFound);
                //}
                BusinessEntity be = DestObj as BusinessEntity;
                if (be != null)
                {
                    be.AfterClone((BusinessEntity)SourceObj);
                }
            }
            finally
            {
                DestObj.EntityOnLoad = false;
                DestObj.DataChanged();
            }
            return(DestObj);
        }