Пример #1
0
 private void Child_DeleteSelf(H08_Region parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("DeleteH09_Region_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID2", parent.Region_ID).DbType = DbType.Int32;
             var args = new DataPortalHookArgs(cmd);
             OnDeletePre(args);
             cmd.ExecuteNonQuery();
             OnDeletePost(args);
         }
     }
 }
Пример #2
0
 private void Child_Insert(H08_Region parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddH09_Region_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Region_ID1", parent.Region_ID).DbType = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_Child_Name", ReadProperty(Region_Child_NameProperty)).DbType = DbType.String;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
         }
     }
 }
 private void Child_Insert(H08_Region parent)
 {
     using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IH09_Region_ReChildDal>();
         using (BypassPropertyChecks)
         {
             dal.Insert(
                 parent.Region_ID,
                 Region_Child_Name
                 );
         }
         OnInsertPost(args);
     }
 }
        private void Child_Insert(H08_Region parent)
        {
            var dto = new H09_Region_ReChildDto();

            dto.Parent_Region_ID  = parent.Region_ID;
            dto.Region_Child_Name = Region_Child_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IH09_Region_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }
Пример #5
0
 private void Child_Insert(H08_Region parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddH10_City", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Parent_Region_ID", parent.Region_ID).DbType         = DbType.Int32;
             cmd.Parameters.AddWithValue("@City_ID", ReadProperty(City_IDProperty)).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@City_Name", ReadProperty(City_NameProperty)).DbType = DbType.String;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
             LoadProperty(City_IDProperty, (int)cmd.Parameters["@City_ID"].Value);
         }
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
     }
 }
        private void Child_Update(H08_Region parent)
        {
            if (!IsDirty)
            {
                return;
            }

            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs();
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IH09_Region_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    dal.Update(
                        parent.Region_ID,
                        Region_Child_Name
                        );
                }
                OnUpdatePost(args);
            }
        }
Пример #7
0
 private void Child_Insert(H08_Region parent)
 {
     using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IH10_CityDal>();
         using (BypassPropertyChecks)
         {
             int city_ID = -1;
             dal.Insert(
                 parent.Region_ID,
                 out city_ID,
                 City_Name
                 );
             LoadProperty(City_IDProperty, city_ID);
         }
         OnInsertPost(args);
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
     }
 }
Пример #8
0
        private void Child_Insert(H08_Region parent)
        {
            var dto = new H10_CityDto();

            dto.Parent_Region_ID = parent.Region_ID;
            dto.City_Name        = City_Name;
            using (var dalManager = DalFactorySelfLoadSoftDelete.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IH10_CityDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    LoadProperty(City_IDProperty, resultDto.City_ID);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }