Exemplo n.º 1
0
 private void Child_DeleteSelf(C06_Country parent)
 {
     using (var dalManager = DalFactorySelfLoad.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnDeletePre(args);
         var dal = dalManager.GetProvider <IC07_Country_ReChildDal>();
         using (BypassPropertyChecks)
         {
             dal.Delete(parent.Country_ID);
         }
         OnDeletePost(args);
     }
 }
 private void Child_DeleteSelf(C06_Country parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("DeleteC07_Country_ReChild", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Country_ID2", parent.Country_ID).DbType = DbType.Int32;
             var args = new DataPortalHookArgs(cmd);
             OnDeletePre(args);
             cmd.ExecuteNonQuery();
             OnDeletePost(args);
         }
     }
 }
Exemplo n.º 3
0
 private void Child_Insert(C06_Country parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddC07_Country_Child", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Country_ID1", parent.Country_ID).DbType = DbType.Int32;
             cmd.Parameters.AddWithValue("@Country_Child_Name", ReadProperty(Country_Child_NameProperty)).DbType = DbType.String;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
         }
     }
 }
Exemplo n.º 4
0
 private void Child_Insert(C06_Country parent)
 {
     using (var dalManager = DalFactorySelfLoad.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IC07_Country_ChildDal>();
         using (BypassPropertyChecks)
         {
             dal.Insert(
                 parent.Country_ID,
                 Country_Child_Name
                 );
         }
         OnInsertPost(args);
     }
 }
Exemplo n.º 5
0
        private void Child_Insert(C06_Country parent)
        {
            var dto = new C07_Country_ChildDto();

            dto.Parent_Country_ID  = parent.Country_ID;
            dto.Country_Child_Name = Country_Child_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IC07_Country_ChildDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
            }
        }
Exemplo n.º 6
0
 private void Child_Insert(C06_Country parent)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad"))
     {
         using (var cmd = new SqlCommand("AddC08_Region", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Parent_Country_ID", parent.Country_ID).DbType           = DbType.Int32;
             cmd.Parameters.AddWithValue("@Region_ID", ReadProperty(Region_IDProperty)).Direction  = ParameterDirection.Output;
             cmd.Parameters.AddWithValue("@Region_Name", ReadProperty(Region_NameProperty)).DbType = DbType.String;
             var args = new DataPortalHookArgs(cmd);
             OnInsertPre(args);
             cmd.ExecuteNonQuery();
             OnInsertPost(args);
             LoadProperty(Region_IDProperty, (int)cmd.Parameters["@Region_ID"].Value);
         }
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
     }
 }
Exemplo n.º 7
0
        private void Child_Update(C06_Country parent)
        {
            if (!IsDirty)
            {
                return;
            }

            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs();
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IC07_Country_ReChildDal>();
                using (BypassPropertyChecks)
                {
                    dal.Update(
                        parent.Country_ID,
                        Country_Child_Name
                        );
                }
                OnUpdatePost(args);
            }
        }
Exemplo n.º 8
0
 private void Child_Insert(C06_Country parent)
 {
     using (var dalManager = DalFactorySelfLoad.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IC08_RegionDal>();
         using (BypassPropertyChecks)
         {
             int region_ID = -1;
             dal.Insert(
                 parent.Country_ID,
                 out region_ID,
                 Region_Name
                 );
             LoadProperty(Region_IDProperty, region_ID);
         }
         OnInsertPost(args);
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
     }
 }
Exemplo n.º 9
0
        private void Child_Insert(C06_Country parent)
        {
            var dto = new C08_RegionDto();

            dto.Parent_Country_ID = parent.Country_ID;
            dto.Region_Name       = Region_Name;
            using (var dalManager = DalFactorySelfLoad.GetManager())
            {
                var args = new DataPortalHookArgs(dto);
                OnInsertPre(args);
                var dal = dalManager.GetProvider <IC08_RegionDal>();
                using (BypassPropertyChecks)
                {
                    var resultDto = dal.Insert(dto);
                    LoadProperty(Region_IDProperty, resultDto.Region_ID);
                    args = new DataPortalHookArgs(resultDto);
                }
                OnInsertPost(args);
                // flushes all pending data operations
                FieldManager.UpdateChildren(this);
            }
        }