Beispiel #1
0
        internal static object ExtractComplexObject(global::System.Data.DataRow dr, global::System.Type objectType, bool allowNullValues, int schemeId, bool extractRelated)
        {
            object[] args = new object[] {
                dr,
                objectType,
                allowNullValues,
                schemeId,
                extractRelated
            };
            object ret = ((object)(m_privateType.InvokeStatic("ExtractComplexObject", new System.Type[] {
                typeof(global::System.Data.DataRow),
                typeof(global::System.Type),
                typeof(bool),
                typeof(int),
                typeof(bool)
            }, args)));

            return(ret);
        }
Beispiel #2
0
        public DimensionalModel(global::System.Data.DataRow dr)
        {
            Length = DataUtility.GetFromDataRow <int>(dr, "DimensionalModelLength");
            Height = DataUtility.GetFromDataRow <int>(dr, "DimensionalModelHeight");
            Width  = DataUtility.GetFromDataRow <int>(dr, "DimensionalModelWidth");

            long outDimModId = DataUtility.GetFromDataRow <long>(dr, "DimensionalModelID");

            if (outDimModId > 0)
            {
                ModelBackingData = ReferenceWrapper.GetOne <DimensionalModelData>(outDimModId);

                string materialComps = DataUtility.GetFromDataRow <string>(dr, "DimensionalModelMaterialCompositions");
                Composition = DeserializeMaterialCompositions(materialComps);
            }
            else //0 dimensional models don't have an actual model
            {
                ModelBackingData           = new DimensionalModelData();
                ModelBackingData.ModelType = DimensionalModelType.None;
                Composition = new Dictionary <string, IMaterial>();
            }
        }
Beispiel #3
0
 private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List <global::System.Data.DataRow> allAddedRows)
 {
     if (((updatedRows == null) ||
          (updatedRows.Length < 1)))
     {
         return(updatedRows);
     }
     if (((allAddedRows == null) ||
          (allAddedRows.Count < 1)))
     {
         return(updatedRows);
     }
     global::System.Collections.Generic.List <global::System.Data.DataRow> realUpdatedRows = new global::System.Collections.Generic.List <global::System.Data.DataRow>();
     for (int i = 0; (i < updatedRows.Length); i = (i + 1))
     {
         global::System.Data.DataRow row = updatedRows[i];
         if ((allAddedRows.Contains(row) == false))
         {
             realUpdatedRows.Add(row);
         }
     }
     return(realUpdatedRows.ToArray());
 }
 public virtual int Update(global::System.Data.DataRow dataRow)
 {
     return(this.Adapter.Update(new global::System.Data.DataRow[] {
         dataRow
     }));
 }
Beispiel #5
0
 internal static void ExtractNestedObjects(global::SimpleORM.Attributes.DataRelationMapAttribute relationMapAttr, object obj, global::System.Data.DataRow dr, global::System.Reflection.PropertyInfo prop, bool allowNullValues)
 {
     object[] args = new object[] {
         relationMapAttr,
         obj,
         dr,
         prop,
         allowNullValues
     };
     m_privateType.InvokeStatic("ExtractNestedObjects", new System.Type[] {
         typeof(global::SimpleORM.Attributes.DataRelationMapAttribute),
         typeof(object),
         typeof(global::System.Data.DataRow),
         typeof(global::System.Reflection.PropertyInfo),
         typeof(bool)
     }, args);
 }
Beispiel #6
0
        internal static bool ExtractValue(global::SimpleORM.Attributes.DataColumnMapAttribute columnMapAttr, object obj, global::System.Data.DataRow dr, global::System.Reflection.PropertyInfo prop, bool allowNullValues)
        {
            object[] args = new object[] {
                columnMapAttr,
                obj,
                dr,
                prop,
                allowNullValues
            };
            bool ret = ((bool)(m_privateType.InvokeStatic("ExtractValue", new System.Type[] {
                typeof(global::SimpleORM.Attributes.DataColumnMapAttribute),
                typeof(object),
                typeof(global::System.Data.DataRow),
                typeof(global::System.Reflection.PropertyInfo),
                typeof(bool)
            }, args)));

            return(ret);
        }
Beispiel #7
0
 /// <summary>
 /// Fills a data object with data from a data row
 /// </summary>
 /// <param name="dr">the data row to fill from</param>
 public abstract void Fill(global::System.Data.DataRow dr);
Beispiel #8
0
        public virtual int UpdateAll(School_SystemDataSet6 dataSet)
        {
            if ((dataSet == null))
            {
                throw new global::System.ArgumentNullException("dataSet");
            }
            if ((dataSet.HasChanges() == false))
            {
                return(0);
            }
            global::System.Data.IDbConnection workConnection = this.Connection;
            if ((workConnection == null))
            {
                throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" +
                                                              "ger TableAdapter property to a valid TableAdapter instance.");
            }
            bool workConnOpened = false;

            if (((workConnection.State & global::System.Data.ConnectionState.Broken)
                 == global::System.Data.ConnectionState.Broken))
            {
                workConnection.Close();
            }
            if ((workConnection.State == global::System.Data.ConnectionState.Closed))
            {
                workConnection.Open();
                workConnOpened = true;
            }
            global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction();
            if ((workTransaction == null))
            {
                throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" +
                                                              "ctions or the current state is not allowing the transaction to begin.");
            }
            global::System.Collections.Generic.List <global::System.Data.DataRow>                     allChangedRows = new global::System.Collections.Generic.List <global::System.Data.DataRow>();
            global::System.Collections.Generic.List <global::System.Data.DataRow>                     allAddedRows   = new global::System.Collections.Generic.List <global::System.Data.DataRow>();
            global::System.Collections.Generic.List <global::System.Data.Common.DataAdapter>          adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List <global::System.Data.Common.DataAdapter>();
            global::System.Collections.Generic.Dictionary <object, global::System.Data.IDbConnection> revertConnections = new global::System.Collections.Generic.Dictionary <object, global::System.Data.IDbConnection>();
            int result = 0;

            global::System.Data.DataSet backupDataSet = null;
            if (this.BackupDataSetBeforeUpdate)
            {
                backupDataSet = new global::System.Data.DataSet();
                backupDataSet.Merge(dataSet);
            }
            try {
                // ---- Prepare for update -----------
                //
                //
                //---- Perform updates -----------
                //
                if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete))
                {
                    result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
                    result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
                }
                else
                {
                    result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
                    result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
                }
                result = (result + this.UpdateDeletedRows(dataSet, allChangedRows));
                //
                //---- Commit updates -----------
                //
                workTransaction.Commit();
                if ((0 < allAddedRows.Count))
                {
                    global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
                    allAddedRows.CopyTo(rows);
                    for (int i = 0; (i < rows.Length); i = (i + 1))
                    {
                        global::System.Data.DataRow row = rows[i];
                        row.AcceptChanges();
                    }
                }
                if ((0 < allChangedRows.Count))
                {
                    global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count];
                    allChangedRows.CopyTo(rows);
                    for (int i = 0; (i < rows.Length); i = (i + 1))
                    {
                        global::System.Data.DataRow row = rows[i];
                        row.AcceptChanges();
                    }
                }
            }
            catch (global::System.Exception ex) {
                workTransaction.Rollback();
                // ---- Restore the dataset -----------
                if (this.BackupDataSetBeforeUpdate)
                {
                    global::System.Diagnostics.Debug.Assert((backupDataSet != null));
                    dataSet.Clear();
                    dataSet.Merge(backupDataSet);
                }
                else
                {
                    if ((0 < allAddedRows.Count))
                    {
                        global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
                        allAddedRows.CopyTo(rows);
                        for (int i = 0; (i < rows.Length); i = (i + 1))
                        {
                            global::System.Data.DataRow row = rows[i];
                            row.AcceptChanges();
                            row.SetAdded();
                        }
                    }
                }
                throw ex;
            }
            finally {
                if (workConnOpened)
                {
                    workConnection.Close();
                }
                if ((0 < adaptersWithAcceptChangesDuringUpdate.Count))
                {
                    global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count];
                    adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters);
                    for (int i = 0; (i < adapters.Length); i = (i + 1))
                    {
                        global::System.Data.Common.DataAdapter adapter = adapters[i];
                        adapter.AcceptChangesDuringUpdate = true;
                    }
                }
            }
            return(result);
        }
Beispiel #9
0
 public string Test3(global::System.Data.DataRow row, string columnName, Func <string> func)
 {
     return(row.Cell(columnName, func));
 }
Beispiel #10
0
 public string Test2(global::System.Data.DataRow row, string columnName, string defaultValue)
 {
     return(row.Cell(columnName, defaultValue));
 }
Beispiel #11
0
 public string Test1(global::System.Data.DataRow row, string columnName)
 {
     return(row.Cell <string>(columnName));
 }