|
//---------------------------------------------------------------------------------------
// Copyright Notice
// This file contains proprietary information of The Austin Conner Group.
// Copying or reproduction without prior written approval is prohibited.
// Copyright (C) 2004 The Austin Conner Group. All rights reserved.
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// * Neither the name of The Austin Conner Group nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific prior
// written permission.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
//---------------------------------------------------------------------------------------
// History
// 11/15/2004 The Austin Conner Group - J.R. Hull - Generated Version
//---------------------------------------------------------------------------------------
using System;
using Sample.Objects.DataAccess;
namespace Sample.Objects.BusinessLogic
{
/// <summary>
/// Represents a Frequency Object.
/// </summary>
/// <remarks>
/// Frequency provides a base class for a Frequency object within the Sample.Objects namespace.
/// </remarks>
public class Frequency : BaseObjectClass
{
#region Private Properties
private String maintenanceScheduleId;
private bool isStrict;
private int value;
private String unit;
#endregion
#region Public Properties
/// <summary>
/// MaintenanceScheduleId.
/// </summary>
public String MaintenanceScheduleId
{
get
{
return maintenanceScheduleId;
}
set
{
maintenanceScheduleId = value;
}
}
/// <summary>
/// IsStrict.
/// </summary>
public bool IsStrict
{
get
{
return isStrict;
}
set
{
isStrict = value;
}
}
/// <summary>
/// Value.
/// </summary>
public int Value
{
get
{
return value;
}
set
{
value = value;
}
}
/// <summary>
/// Unit.
/// </summary>
public String Unit
{
get
{
return unit;
}
set
{
unit = value;
}
}
#endregion
#region Constructor
/// <summary>
/// Default Constructor - Frequency
/// </summary>
public Frequency()
{
}
/// <summary>
/// Constructor - Frequency
/// </summary>
/// <param name="_id">String: Id value for Frequency</param>
/// <param name="_maintenanceScheduleId">String: Maintenance Schedule Id value for Frequency</param>
/// <param name="_isStrict">bool: Is Strict value for Frequency</param>
/// <param name="_value">int: Value value for Frequency</param>
/// <param name="_unit">String: Unit value for Frequency</param>
public Frequency(String _id, String _maintenanceScheduleId, bool _isStrict, int _value, String _unit)
{
this.Name = "frequency";
this.Id = _id;
this.MaintenanceScheduleId = _maintenanceScheduleId;
this.IsStrict = _isStrict;
this.Value = _value;
this.Unit = _unit;
} // Frequency
#endregion
#region Public Methods
/// <summary>
/// Copy
/// </summary>
/// <param name="obj">Frequency</param>
public void Copy(Frequency obj)
{
Id = obj.Id;
MaintenanceScheduleId = obj.MaintenanceScheduleId;
IsStrict = obj.IsStrict;
Value = obj.Value;
Unit = obj.Unit;
} // Copy
/// <summary>
/// Delete a Frequency
/// </summary>
public bool Delete()
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.DeleteFrequency(this.id);
} // Delete
/// <summary>
/// Save a Frequency
/// </summary>
public int Save()
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.CreateNewFrequency(this);
} // Save
/// <summary>
/// Update a Frequency
/// </summary>
public int Update()
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.UpdateFrequency(this);
} // Save
/// <summary>
/// Fetch a Frequency
/// </summary>
public Frequency Fetch(string id)
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.FetchFrequency(id);
} // Fetch
#endregion
#region Static Methods
/// <summary>
/// Fetch a Frequency By MaintenanceScheduleId
/// </summary>
public static FrequencyCollection FetchByMaintenanceScheduleId(string id)
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.FetchByMaintenanceScheduleId(id);
} // FetchByMaintenanceScheduleId
/// <summary>
/// Create New Frequency
/// </summary>
/// <param name="_id">String: Id value for Frequency</param>
/// <param name="_maintenanceScheduleId">String: Maintenance Schedule Id value for Frequency</param>
/// <param name="_isStrict">bool: Is Strict value for Frequency</param>
/// <param name="_value">int: Value value for Frequency</param>
/// <param name="_unit">String: Unit value for Frequency</param>
public static Frequency CreateNewFrequency(String _id, String _maintenanceScheduleId, bool _isStrict, int _value, String _unit)
{
Frequency newFrequency = new Frequency( _id, _maintenanceScheduleId, _isStrict, _value, _unit);
if (newFrequency.Save()==0)
return newFrequency;
else
return null;
} // CreateNewFrequency
/// <summary>
/// Delete Frequency
/// </summary>
/// <param name="_id">String</param>
public static bool DeleteFrequency(String _id)
{
FrequencyData dataLayer = new FrequencyData();
return dataLayer.DeleteFrequency(_id);
} // DeleteFrequency
#endregion
} // class Frequency
} // Sample.Objects.BusinessLogic
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software Architect with 20++ years of software design and development experience with a strong hold in Object-Oriented software engineering using UML with Design Patterns. Architected and developed several industrial software packages and passed through full software development life-cycle. Currently managing a small group of developers, developing management software for the agriculture industry.