Exemple #1
0
        protected void CopyBase(MapObject o, IDGenerator generator, bool performClone = false)
        {
            if (performClone && o.ID != ID)
            {
                var parent = o.Parent;
                var setPar = o.Parent != null && o.Parent.Children.ContainsKey(o.ID) && o.Parent.Children[o.ID] == o;
                if (setPar)
                {
                    o.SetParent(null);
                }
                o.ID = ID;
                if (setPar)
                {
                    o.SetParent(parent);
                }
            }
            o.ClassName = ClassName;
            o.Visgroups.AddRange(Visgroups);
            o.AutoVisgroups.AddRange(AutoVisgroups);
            o.Parent           = Parent;
            o.Colour           = Colour;
            o.IsSelected       = IsSelected;
            o.IsCodeHidden     = IsCodeHidden;
            o.IsRenderHidden2D = IsRenderHidden2D;
            o.IsRenderHidden3D = IsRenderHidden3D;
            o.IsVisgroupHidden = IsVisgroupHidden;
            o.BoundingBox      = BoundingBox.Clone();
            o.MetaData         = MetaData.Clone();
            var children = GetChildren().Select(x => performClone ? x.Clone() : x.Copy(generator));

            foreach (var c in children)
            {
                c.SetParent(o);
            }
        }
 public EntityNavigator(ParentEntity Entity, bool CallSetDefault)
 {
     _Entity = Entity;
     _Entity.CurrentNavigator = this;
     _Entity._Original        = (ParentEntity)MetaData.Clone(_Entity);
     DoInit(CallSetDefault);
 }
Exemple #3
0
 /// <summary>
 /// performs a deep copy of Script
 /// </summary>
 /// <returns></returns>
 public Script Clone()
 {
     return(new Script(MetaData.Clone(), Lines.ToList())
     {
         LineNumber = LineNumber,
     });
 }
Exemple #4
0
        public ImportDataColumn Clone()
        {
            var retValue = new ImportDataColumn
            {
                ColumnName        = ColumnName,
                Required          = Required,
                Description       = Description,
                DisplayName       = DisplayName,
                SkipNullValueRows = SkipNullValueRows,
                Source            = Source
            };

            if (Dimensions != null)
            {
                retValue.Dimensions = DimensionHelper.Clone(Dimensions);
                if (ActiveDimension != null)
                {
                    retValue.ActiveDimension     = DimensionHelper.FindDimension(retValue.Dimensions, ActiveDimension.Name);
                    retValue.ActiveUnit          = retValue.ActiveDimension.FindUnit(ActiveUnit.Name);
                    retValue.IsUnitExplicitlySet = IsUnitExplicitlySet;
                }
            }
            if (MetaData != null)
            {
                retValue.MetaData = MetaData.Clone();
            }

            retValue.ColumnNameOfRelatedColumn = ColumnNameOfRelatedColumn;
            return(retValue);
        }
        protected override void AfterSaveNew()
        {
            if (IsErrorExist())
            {
                return;
            }

            if (_BuatJurnalPembalik)
            {
                Jurnal JurnalBalik = (Jurnal)MetaData.Clone(this);
                JurnalBalik.BuatJurnalPembalik = false;
                JurnalBalik._Internal          = true;
                JurnalBalik._NoJurnal          = string.Empty;
                JurnalBalik._NoJurnalPembalik  = string.Empty;
                JurnalBalik._NoDokSumber       = _NoJurnal;
                JurnalBalik.JenisDokSumber     = "Jurnal Pembalik";
                JurnalBalik._TglJurnal         = _TglDibalik;
                foreach (JurnalDetil Jd in JurnalBalik.JurnalDetil)
                {
                    Jd.DebitKurs  = -Jd.DebitKurs;
                    Jd.KreditKurs = -Jd.KreditKurs;
                }
                JurnalBalik.SaveNew(true, false);
                _NoJurnalPembalik = JurnalBalik._NoJurnal;
                ExecuteNonQuery(
                    "UPDATE Jurnal SET NoJurnalPembalik=@0 WHERE NoJurnal=@1",
                    new FieldParam("0", _NoJurnalPembalik),
                    new FieldParam("1", _NoJurnal));
            }
            BaseGL.RingkasanAkun.Hapus(_TglJurnal);
            _AturanJurnal      = string.Empty;
            LastJenisDokSumber = _JenisDokSumber;
        }
Exemple #6
0
 /// <summary>
 /// Reload dari Entity Original
 /// </summary>
 /// <returns></returns>
 public bool ReloadFromOriginal()
 {
     if (SaveType == SaveType.SaveNew)
     {
         return(false);
     }
     MetaData.Clone(_Entity, _Original, true);
     if (onAfterLoad != null)
     {
         onAfterLoad();
     }
     return(true);
 }
Exemple #7
0
        public new ImportDataTable Clone()
        {
            var retValue = (ImportDataTable)base.Clone();

            retValue.File  = File;
            retValue.Sheet = Sheet;
            foreach (ImportDataColumn col in Columns)
            {
                var newCol = retValue.Columns.ItemByName(col.ColumnName);
                newCol.DisplayName               = col.DisplayName;
                newCol.Description               = col.Description;
                newCol.Source                    = col.Source;
                newCol.SkipNullValueRows         = col.SkipNullValueRows;
                newCol.ColumnNameOfRelatedColumn = col.ColumnNameOfRelatedColumn;
                if (col.MetaData != null)
                {
                    newCol.MetaData = col.MetaData.Clone();
                }
                if (col.Dimensions == null)
                {
                    continue;
                }
                newCol.Dimensions = DimensionHelper.Clone(col.Dimensions);
            }
            if (MetaData != null)
            {
                retValue.MetaData = MetaData.Clone();
            }

            //this second run overt the columns is necessary to avoid side effects on unit setting by setting the dimensions.
            foreach (ImportDataColumn col in Columns)
            {
                if (col.ActiveDimension == null)
                {
                    continue;
                }
                var newCol = retValue.Columns.ItemByName(col.ColumnName);
                newCol.ActiveDimension     = DimensionHelper.FindDimension(newCol.Dimensions, col.ActiveDimension.Name);
                newCol.ActiveUnit          = newCol.ActiveDimension.FindUnit(col.ActiveUnit.Name);
                newCol.IsUnitExplicitlySet = col.IsUnitExplicitlySet;
            }
            return(retValue);
        }
        protected override void AfterSaveUpdate()
        {
            if (ListAkun == null || IsErrorExist())
            {
                return;
            }

            Jurnal OrigJurnal = GetOriginal <Jurnal>();

            if (OrigJurnal == null)
            {
                return;
            }

            if (OrigJurnal._NoJurnalPembalik.Length > 0)
            {
                FieldParam Param1 = new FieldParam("0",
                                                   OrigJurnal._NoJurnalPembalik);
                ExecuteNonQuery(
                    "DELETE FROM Jurnal WHERE NoJurnal=@0",
                    Param1);
                ExecuteNonQuery(
                    "DELETE FROM JurnalDetil WHERE NoJurnal=@0",
                    Param1);
            }
            if (_BuatJurnalPembalik)
            {
                Jurnal JurnalBalik = (Jurnal)MetaData.Clone(
                    this);
                if (OrigJurnal._NoJurnalPembalik.Length > 0)
                {
                    JurnalBalik._NoJurnal =
                        OrigJurnal._NoJurnalPembalik;
                }

                JurnalBalik.BuatJurnalPembalik = false;
                JurnalBalik._Internal          = true;
                JurnalBalik._NoJurnal          = string.Empty;
                JurnalBalik._NoJurnalPembalik  = string.Empty;
                JurnalBalik._NoDokSumber       = _NoJurnal;
                JurnalBalik.JenisDokSumber     = "Jurnal Pembalik";
                JurnalBalik._TglJurnal         = _TglDibalik;
                foreach (JurnalDetil Jd in JurnalBalik.JurnalDetil)
                {
                    Jd.Debit  = -Jd.Debit;
                    Jd.Kredit = -Jd.Kredit;
                }
                JurnalBalik.SaveNew(true, false);
                _NoJurnalPembalik = JurnalBalik._NoJurnal;
                ExecuteNonQuery(
                    "UPDATE Jurnal SET NoJurnalPembalik=@0 WHERE NoJurnal=@1",
                    new FieldParam("0", _NoJurnalPembalik),
                    new FieldParam("1", _NoJurnal));
            }
            DateTime Tmp = OrigJurnal._TglJurnal;

            if (Tmp > _TglJurnal)
            {
                Tmp = _TglJurnal;
            }
            BaseGL.RingkasanAkun.Hapus(Tmp);
            _AturanJurnal = string.Empty;
        }
Exemple #9
0
        public bool MoveData(MoveType MovingType)
        {
            IDataReader rdr;

            #region Cek MovingType
            switch (MovingType)
            {
            case MoveType.MoveFirst:
                rdr = DataPersistance.ExecuteReader(SqlMoveFirst());
                break;

            case MoveType.MovePrevious:
                if (!IsError)
                {
                    rdr = DataPersistance.ExecuteReader(SqlMovePrevious(
                                                            DataPersistance.FormatSqlValue(_OrderFld.GetValue(_Original), _OrderFld.DataType),
                                                            DataPersistance.FormatSqlValue(_CurrentKeyValue, DataType.VarChar)));
                }
                else
                {
                    rdr = DataPersistance.ExecuteReader(SqlMoveFirst());
                }
                break;

            case MoveType.MoveNext:
                if (!IsError)
                {
                    rdr = DataPersistance.ExecuteReader(SqlMoveNext(
                                                            DataPersistance.FormatSqlValue(_OrderFld.GetValue(_Original), _OrderFld.DataType),
                                                            DataPersistance.FormatSqlValue(_CurrentKeyValue, DataType.VarChar)));
                }
                else
                {
                    rdr = DataPersistance.ExecuteReader(SqlMoveLast());
                }
                break;

            case MoveType.FindCriteria:
                rdr = DataPersistance.ExecuteReader(SqlFindCriteria());
                break;

            case MoveType.FindFirst:
                rdr = DataPersistance.ExecuteReader(
                    SqlFindFirst(DataPersistance.FormatSqlValue(
                                     FindValue, _OrderFld.DataType)));
                break;

            case MoveType.FindLast:
                rdr = DataPersistance.ExecuteReader(
                    SqlFindLast(DataPersistance.FormatSqlValue(
                                    FindValue, _OrderFld.DataType)));
                break;

            default:        // MoveLast
                rdr = DataPersistance.ExecuteReader(
                    SqlMoveLast());
                break;
            }
            #endregion

            if (rdr.Read())
            {
                _CurrentKeyValue = rdr.GetString(0);

                string Criteria = string.Concat(DataPersistance
                                                .BuildKeyField(td), "=", DataPersistance
                                                .FormatSqlValue(_CurrentKeyValue));

                DataPersistance.LoadEntity(_Entity, Criteria, true);
                MetaData.Clone(_Original, _Entity, true);
                if (e != null)
                {
                    e._Original = (ParentEntity)_Original;
                }

                IsError   = false;
                _SaveType = SaveType.SaveUpdate;
                if (e != null)
                {
                    e._SaveType = SaveType.SaveUpdate;
                }
            }
            else
            {
                switch (MovingType)
                {
                case MoveType.MovePrevious:
                    return(MoveFirst());

                case MoveType.MoveNext:
                    return(MoveLast());
                }
                IsError = true;
            }
            if (onAfterLoad != null)
            {
                onAfterLoad();
            }
            if (onDataMoving != null)
            {
                onDataMoving(MovingType, IsError);
            }

            return(!IsError);
        }