HBM.GeneralManagement.DepartmentsDAO.InsertUpdateDelete C# (CSharp) Метод

InsertUpdateDelete() публичный Метод

public InsertUpdateDelete ( DataSet ds ) : bool
ds System.Data.DataSet
Результат bool
        public bool InsertUpdateDelete(DataSet ds)
        {
            Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING);
            DbCommand commandInsert = db.GetStoredProcCommand("usp_DepartmentInsert");

            db.AddInParameter(commandInsert, "@CompanyId", DbType.Int32, "CompanyId", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@DepartmentName", DbType.String, "DepartmentName", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@CreatedUser", DbType.Int32, "CreatedUser", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@StatusId", DbType.Int32, "StatusId", DataRowVersion.Current);

            DbCommand commandUpdate = db.GetStoredProcCommand("usp_DepartmentUpdate");
            db.AddInParameter(commandUpdate, "@DepartmentId", DbType.Int32, "DepartmentId", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@DepartmentName", DbType.String, "DepartmentName", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@UpdatedUser", DbType.Int32, "UpdatedUser", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@StatusId", DbType.Int32, "StatusId", DataRowVersion.Current);

            DbCommand commandDelete = db.GetStoredProcCommand("usp_DepartmentDelete");
            db.AddInParameter(commandDelete, "@DepartmentId", DbType.Int32, "DepartmentId", DataRowVersion.Current);

            db.UpdateDataSet(ds, ds.Tables[0].TableName, commandInsert, commandUpdate, commandDelete, UpdateBehavior.Transactional);

            return true;
        }