public static bool AddLibrariandetails(TMSLibrianDetails objLib, TMSAddressDetails objAddress)
    {
        ConnectionHelper CHelper = new ConnectionHelper();
        DbTransaction _SqlTrans = null;
        SqlConnection _connection = null; ;
        bool flag = false;
        try
        {
            _connection = CHelper.GetConnection();
            _SqlTrans = _connection.BeginTransaction();
            objAddress.Insert(_SqlTrans);

            objLib.LDAddressId = objAddress.ADAddressId;
            objLib.Insert(_SqlTrans);
            flag = true;
            _SqlTrans.Commit();
        }
        catch (Exception ex)
        {
            flag = false;
            _SqlTrans.Rollback();
        }
        finally
        {
            CHelper.CloseConnection(_connection);
        }
        return flag;
    }
    public static TMSLibrianDetails Get(System.Int64 ldLibrianId)
    {
        DataSet           ds;
        Database          db;
        string            sqlCommand;
        DbCommand         dbCommand;
        TMSLibrianDetails instance;


        instance = new TMSLibrianDetails();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSLibrianDetails_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, ldLibrianId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0)
        {
            throw new ApplicationException("Could not get TMSLibrianDetails ID:" + ldLibrianId.ToString() + " from Database.");
        }
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Exemple #3
0
    public static bool UpdateLibrariandetails(TMSLibrianDetails objLib, TMSAddressDetails objAddress)
    {
        ConnectionHelper CHelper     = new ConnectionHelper();
        DbTransaction    _SqlTrans   = null;
        SqlConnection    _connection = null;;
        bool             flag        = false;

        try
        {
            _connection = CHelper.GetConnection();
            _SqlTrans   = _connection.BeginTransaction();
            objAddress.Update(_SqlTrans);
            objLib.LDAddressId = objAddress.ADAddressId;
            objLib.Update(_SqlTrans);
            flag = true;
            _SqlTrans.Commit();
        }
        catch (Exception ex)
        {
            flag = false;
            _SqlTrans.Rollback();
        }
        finally
        {
            CHelper.CloseConnection(_connection);
        }
        return(flag);
    }
    public static TMSLibrianDetails[] Search(System.Int64?ldLibrianId, System.Int64?ldLibraryId, System.Int64?ldLibraryManagerId, System.String ldSchoolType, System.String ldName, System.String ldImage, System.Int64?ldAddressId, System.DateTime?ldDateOfJoining, System.DateTime?ldDate, System.Int32?ldStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSLibrianDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, ldLibrianId, ldLibraryId, ldLibraryManagerId, ldSchoolType, ldName, ldImage, ldAddressId, ldDateOfJoining, ldDate, ldStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSLibrianDetails.MapFrom(ds));
    }
    public static TMSLibrianDetails[] MapFrom(DataSet ds)
    {
        List <TMSLibrianDetails> objects;


        // Initialise Collection.
        objects = new List <TMSLibrianDetails>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[TMS_LibrianDetails] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_LibrianDetails] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSLibrianDetails instance = new TMSLibrianDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 public static void Update(TMSLibrianDetails tMSLibrianDetails, DbTransaction transaction)
 {
     tMSLibrianDetails.Update(transaction);
 }
 public static void Update(TMSLibrianDetails tMSLibrianDetails)
 {
     tMSLibrianDetails.Update();
 }
 public static TMSLibrianDetails[] Search(TMSLibrianDetails searchObject)
 {
     return Search ( searchObject.LDLibrianId, searchObject.LDLibraryId, searchObject.LDLibraryManagerId, searchObject.LDSchoolType, searchObject.LDName, searchObject.LDImage, searchObject.LDAddressId, searchObject.LDDateOfJoining, searchObject.LDDate, searchObject.LDStatus);
 }
    public static TMSLibrianDetails[] MapFrom(DataSet ds)
    {
        List<TMSLibrianDetails> objects;

        // Initialise Collection.
        objects = new List<TMSLibrianDetails>();

        // Validation.
        if (ds == null)
        throw new ApplicationException("Cannot map to dataset null.");
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        return objects.ToArray();

        if (ds.Tables[TABLE_NAME] == null)
        throw new ApplicationException("Cannot find table [dbo].[TMS_LibrianDetails] in DataSet.");

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        throw new ApplicationException("Table [dbo].[TMS_LibrianDetails] is empty.");

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSLibrianDetails instance = new TMSLibrianDetails();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return objects.ToArray();
    }
    public static TMSLibrianDetails Get(System.Int64 ldLibrianId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSLibrianDetails instance;

        instance = new TMSLibrianDetails();

        db = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSLibrianDetails_SELECT";
        dbCommand = db.GetStoredProcCommand(sqlCommand, ldLibrianId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSLibrianDetails ID:" + ldLibrianId.ToString()+ " from Database.");
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
Exemple #11
0
 public static DataSet GetSearch(TMSLibrianDetails searchObject)
 {
     return(GetSearch(searchObject.LDLibrianId, searchObject.LDLibraryId, searchObject.LDLibraryManagerId, searchObject.LDSchoolType, searchObject.LDName, searchObject.LDImage, searchObject.LDAddressId, searchObject.LDDateOfJoining, searchObject.LDDate, searchObject.LDStatus));
 }
 public static void Update(TMSLibrianDetails tMSLibrianDetails, DbTransaction transaction)
 {
     tMSLibrianDetails.Update(transaction);
 }
 public static void Update(TMSLibrianDetails tMSLibrianDetails)
 {
     tMSLibrianDetails.Update();
 }