Exemplo n.º 1
0
        private void InsertDataRawUnit(FbTransaction trans, DataRawUnitDataSet set, DataRaw raw)
        {
            raw.RecNo = context.DB.GetGenNo("GN_DATARAWUNIT");

            set.RecNo      = raw.RecNo;
            set.DataBookNo = context.Report.RecNo;
            set.DataName   = raw.Row.Name;
            set.UnitType   = (int)raw.Row.Unit.Type;
            set.UnitFrom   = (int)raw.Row.Unit.From;
            set.UnitTo     = (int)raw.Row.Unit.To;
            set.Insert(trans);
        }
Exemplo n.º 2
0
        private void InsertHalfFullDataRaw()
        {
            DataRaw raw = null;

            context.DB.Lock();

            try
            {
                context.Report.Lock();

                FbTransaction trans = context.DB.BeginTrans();

                try
                {
                    for (int i = 0; i < context.Report.DataRaw.Count; i++)
                    {
                        raw = context.Report.DataRaw.HalfFullDataRaw;
                        if (raw == null)
                        {
                            break;
                        }

                        ValueStorageRaw storageRaw = raw.Row.Storage.HalfFullValues;

                        if (raw.RecNo < 0)
                        {
                            InsertDataRawUnit(trans, context.DB.DataRawUnitSet, raw);
                        }

                        InsertDataRaw(trans, context.DB.DataRawSet, storageRaw, raw.RecNo);
                    }

                    context.DB.CommitTrans();
                }
                catch (Exception e)
                {
                    Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                    context.DB.RollbackTrans();
                }
                finally
                {
                    context.Report.Unlock();
                }
            }
            finally
            {
                context.DB.Unlock();
            }
        }
Exemplo n.º 3
0
        private void InsertAllDataRaw()
        {
            DataRaw raw = null;

            context.DB.Lock();

            try
            {
                context.Value.Lock();
                context.Report.Lock();

                FbTransaction trans = context.DB.BeginTrans();

                try
                {
                    ValueStorageRaw storageRaw;

                    foreach (KeyValuePair <string, DataRaw> dataRaw in context.Report.DataRaw.Rows)
                    {
                        raw = dataRaw.Value;

                        if (raw.Row.Storage.HalfFull == true)
                        {
                            storageRaw = raw.Row.Storage.HalfFullValues;

                            if (raw.RecNo < 0)
                            {
                                InsertDataRawUnit(trans, context.DB.DataRawUnitSet, raw);
                            }

                            InsertDataRaw(trans, context.DB.DataRawSet, storageRaw, raw.RecNo);
                        }

                        storageRaw = raw.Row.Storage.CurrentValues;
                        if (storageRaw != null)
                        {
                            if (raw.RecNo < 0)
                            {
                                InsertDataRawUnit(trans, context.DB.DataRawUnitSet, raw);
                            }

                            InsertDataRaw(trans, context.DB.DataRawSet, storageRaw, raw.RecNo);
                        }

                        Win32.SwitchToThread();
                    }

                    context.DB.CommitTrans();
                }
                catch (Exception e)
                {
                    Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                    context.DB.RollbackTrans();
                }
                finally
                {
                    context.Report.Unlock();
                    context.Value.Unlock();
                }
            }
            finally
            {
                context.DB.Unlock();
            }
        }