public int InsertOtherMigration(OtherMemberMigrations objOtherMemberMigrations,
                                        List<DocumentsPerOtherMemberMigration> lstDocumentsPerOtherMemberMigration,
                                        List<ProblemsPerOtherMemberMigration> lstProblemsPerOtherMemberMigration)
        {
            objOtherMemberMigrations.OtherMemberMigrationID = 1;
            BeginTransaction();

            try
            {
                objOtherMemberMigrations.OtherMemberMigrationID = Insert(objOtherMemberMigrations);

                foreach (DocumentsPerOtherMemberMigration objDocumentsPerOtherMemberMigration in lstDocumentsPerOtherMemberMigration)
                {
                    objDocumentsPerOtherMemberMigration.OtherMemberMigrationID = objOtherMemberMigrations.OtherMemberMigrationID;
                    Insert(objDocumentsPerOtherMemberMigration);
                }
                foreach (ProblemsPerOtherMemberMigration objProblemsPerOtherMemberMigration in lstProblemsPerOtherMemberMigration)
                {
                    objProblemsPerOtherMemberMigration.OtherMemberMigrationID = objOtherMemberMigrations.OtherMemberMigrationID;
                    Insert(objProblemsPerOtherMemberMigration);
                }

                CommitTransaction();
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                objOtherMemberMigrations.OtherMemberMigrationID = -1;
            }

            return objOtherMemberMigrations.OtherMemberMigrationID;
        }
        public int UpdateOtherMigration(OtherMemberMigrations objOtherMemberMigrations, 
                                        List<DocumentsPerOtherMemberMigration> lstDocumentsPerOtherMemberMigration,
                                        List<ProblemsPerOtherMemberMigration> lstProblemsPerOtherMemberMigration)
        {
            int rowsaffected = -1;
            BeginTransaction();
            try
            {
                String[] UpdateProperties = new String[] { "FamilyMemberID", "CountryID", "DoesSendMoney", 
                                                            "MoneyRangeID", "FacedProblem",
                                                            "ProblemID", "VisitSameCountry", "UpdatedBy", "UpdatedDate"
                                                            };
                rowsaffected = Update(objOtherMemberMigrations, UpdateProperties);

                Delete("tbl_documents_per_other_member_migration", "OtherMemberMigrationID = " + objOtherMemberMigrations.OtherMemberMigrationID);
                foreach (DocumentsPerOtherMemberMigration objDocumentsPerOtherMemberMigration in lstDocumentsPerOtherMemberMigration)
                {
                    objDocumentsPerOtherMemberMigration.OtherMemberMigrationID = objOtherMemberMigrations.OtherMemberMigrationID;
                    Insert(objDocumentsPerOtherMemberMigration);
                }

                Delete("tbl_problems_per_other_member_migration", "OtherMemberMigrationID = " + objOtherMemberMigrations.OtherMemberMigrationID);
                foreach (ProblemsPerOtherMemberMigration objProblemsPerOtherMemberMigration in lstProblemsPerOtherMemberMigration)
                {
                    objProblemsPerOtherMemberMigration.OtherMemberMigrationID = objOtherMemberMigrations.OtherMemberMigrationID;
                    Insert(objProblemsPerOtherMemberMigration);
                }

                CommitTransaction();
            }
            catch (Exception e)
            {
                RollBackTransaction();
                rowsaffected = -1;
            }
            return rowsaffected;

        }
        public static OtherMemberMigrations GetOtherMemberMigration(int OtherMemberMigrationID)
        {
            OtherMemberMigrations objOtherMemberMigrations = new OtherMemberMigrations();
            return (OtherMemberMigrations)(new OtherMemberMigrationDAO().FillDTO(objOtherMemberMigrations, "OtherMemberMigrationID=" + OtherMemberMigrationID));

        }
 public static int UpdateOtherMigration(OtherMemberMigrations objOtherMemberMigrations, 
                                       List<DocumentsPerOtherMemberMigration> lstDocumentsPerOtherMemberMigration,
                                       List<ProblemsPerOtherMemberMigration> lstProblemsPerOtherMemberMigration)
 {
     return new OtherMemberMigrationDAO().UpdateOtherMigration(objOtherMemberMigrations, lstDocumentsPerOtherMemberMigration, lstProblemsPerOtherMemberMigration);
 }