838 lines
19 KiB
C#
838 lines
19 KiB
C#
///////////////////////////////////////////////////////////
|
|
// Rate.cs
|
|
// Implementation of Class Rate
|
|
// CSLA type: Editable Child
|
|
// Created on: 07-Jun-2004 8:41:32 AM
|
|
// Object design: Joyce
|
|
// Coded: John 12-Jul-2004
|
|
// Re-coded: as editable child by John Nov 11 2004
|
|
///////////////////////////////////////////////////////////
|
|
using System;
|
|
using System.Data;
|
|
using CSLA.Data;
|
|
using GZTW.Data;
|
|
using CSLA;
|
|
using System.Threading;
|
|
using CSLA.Security;
|
|
|
|
|
|
namespace GZTW.AyaNova.BLL {
|
|
/// <summary>
|
|
/// Service / Travel rates to bill to client
|
|
/// </summary>
|
|
[Serializable]
|
|
public class Rate : BusinessBase {
|
|
|
|
|
|
#region Attributes
|
|
private bool bReadOnly;
|
|
private Guid mID;
|
|
private string mName=null;
|
|
private SmartDate mCreated;
|
|
private SmartDate mModified;
|
|
private bool mActive;
|
|
private Guid mCreator;
|
|
private Guid mModifier;
|
|
private string mDescription="";
|
|
|
|
|
|
private string mAccountNumber="";
|
|
private decimal mCost;
|
|
private decimal mCharge;
|
|
private RateTypes mRateType;
|
|
private Guid mRateUnitChargeDescriptionID=Guid.Empty;
|
|
private Guid mClientGroupID=Guid.Empty;
|
|
|
|
private bool mContractRate;
|
|
|
|
//case 58
|
|
private Guid mRegionID;
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Private constructor to prevent direct instantiation
|
|
/// </summary>
|
|
private Rate()
|
|
{
|
|
MarkAsChild();
|
|
//Set to read / write initially so that properties
|
|
//can be set
|
|
bReadOnly=false;
|
|
|
|
//New ID
|
|
mID = Guid.NewGuid();
|
|
//pre-break the rule
|
|
Name="";
|
|
RateType=RateTypes.Service;
|
|
Active=true;
|
|
|
|
//Set record history to defaults
|
|
mCreated = new SmartDate(DBUtil.CurrentWorkingDateTime);
|
|
mModified=new SmartDate();
|
|
mCreator=Guid.Empty;
|
|
mModifier=Guid.Empty;
|
|
|
|
mContractRate=false;
|
|
|
|
//Built-in "Default" region
|
|
mRegionID = Region.DefaultRegionID;//case 58
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Business properties
|
|
/// <summary>
|
|
/// Get internal id number Read only property because it's set internally, not
|
|
/// externally
|
|
/// </summary>
|
|
public Guid ID
|
|
{
|
|
get
|
|
{
|
|
return mID;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get created date
|
|
///
|
|
///
|
|
/// </summary>
|
|
public string Created
|
|
{
|
|
get
|
|
{
|
|
return mCreated.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get modified date
|
|
///
|
|
///
|
|
/// </summary>
|
|
public string Modified
|
|
{
|
|
get
|
|
{
|
|
return mModified.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get user record ID of person who created this record
|
|
///
|
|
///
|
|
/// </summary>
|
|
public Guid Creator
|
|
{
|
|
get
|
|
{
|
|
return mCreator;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get user ID of person who modified this record
|
|
///
|
|
///
|
|
/// </summary>
|
|
public Guid Modifier
|
|
{
|
|
get
|
|
{
|
|
return mModifier;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set/get Rate name
|
|
/// </summary>
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return mName;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mName!=value)
|
|
{
|
|
mName = value;
|
|
|
|
BrokenRules.Assert("NameRequired","Error.Object.RequiredFieldEmpty,Rate.Label.Name","Name",value.Length==0);
|
|
|
|
BrokenRules.Assert("NameLength",
|
|
"Error.Object.FieldLengthExceeded255,Rate.Label.Name","Name",value.Length>255);
|
|
|
|
MarkDirty();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get /set active status
|
|
/// </summary>
|
|
public bool Active
|
|
{
|
|
get
|
|
{
|
|
return mActive;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mActive!=value)
|
|
{
|
|
mActive = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Short description of rate displayed to user
|
|
/// </summary>
|
|
public string Description
|
|
{
|
|
get
|
|
{
|
|
return mDescription;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mDescription!=value)
|
|
{
|
|
mDescription = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Get/set optional accounting number for rate
|
|
/// </summary>
|
|
public string AccountNumber
|
|
{
|
|
get
|
|
{
|
|
return mAccountNumber;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mAccountNumber!=value)
|
|
{
|
|
mAccountNumber = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// get/set internal cost of rate
|
|
/// </summary>
|
|
public decimal Cost
|
|
{
|
|
get
|
|
{
|
|
return mCost;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mCost!=value)
|
|
{
|
|
mCost = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// get/set amount to charge client for rate
|
|
/// </summary>
|
|
public decimal Charge
|
|
{
|
|
get
|
|
{
|
|
return mCharge;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mCharge!=value)
|
|
{
|
|
mCharge = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <see cref="RateTypes"/> type of rate
|
|
/// </summary>
|
|
public RateTypes RateType
|
|
{
|
|
get
|
|
{
|
|
return mRateType;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mRateType!=value)
|
|
{
|
|
mRateType = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// GUID of <see cref="ClientGroup"/> this rate is only available for
|
|
/// Default is null
|
|
/// Null indicates avaialble to all clientgroups.
|
|
/// </summary>
|
|
public Guid ClientGroupID
|
|
{
|
|
get
|
|
{
|
|
return mClientGroupID;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mClientGroupID!=value)
|
|
{
|
|
mClientGroupID = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// ID of <see cref="RateUnitChargeDescription"/>
|
|
/// </summary>
|
|
public Guid RateUnitChargeDescriptionID
|
|
{
|
|
get
|
|
{
|
|
return mRateUnitChargeDescriptionID;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mRateUnitChargeDescriptionID!=value)
|
|
{
|
|
mRateUnitChargeDescriptionID = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// If true then only shows for contract holders
|
|
/// If false always displays
|
|
/// </summary>
|
|
public bool ContractRate
|
|
{
|
|
get
|
|
{
|
|
return mContractRate;
|
|
}
|
|
set
|
|
{
|
|
if(bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if(mContractRate!=value)
|
|
{
|
|
mContractRate = value;
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Limit to specific <see cref="Region"/> or available to all regions using <see cref="Region.DefaultRegionID"/>
|
|
/// </summary>
|
|
public Guid RegionID
|
|
{
|
|
get
|
|
{
|
|
return mRegionID;
|
|
}
|
|
set
|
|
{
|
|
if (bReadOnly)
|
|
ThrowSetError();
|
|
else
|
|
{
|
|
if (mRegionID != value)
|
|
{
|
|
mRegionID = value;
|
|
BrokenRules.Assert("RegionIDRequired",
|
|
"Error.Object.RequiredFieldEmpty,O.Region",
|
|
"RegionID", value == Guid.Empty);
|
|
MarkDirty();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Throw an error when a read only user
|
|
/// tries to set a property
|
|
/// (this should normally never be called unless someone is using the developer api since the UI
|
|
/// should prevent it from happening initially)
|
|
/// </summary>
|
|
private void ThrowSetError()
|
|
{
|
|
throw new System.Security.SecurityException
|
|
(
|
|
string.Format
|
|
(
|
|
LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToChange"),
|
|
LocalizedTextTable.GetLocalizedTextDirect("O.Rate")
|
|
)
|
|
);
|
|
}
|
|
#endregion
|
|
|
|
#region System.Object overrides
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public override string ToString()
|
|
{
|
|
return "Rate" + mID.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
/// <returns></returns>
|
|
public override bool Equals(Object obj)
|
|
{
|
|
if ( obj == null || GetType ( ) != obj.GetType ( ) ) return false;
|
|
Rate c=(Rate)obj;
|
|
return mID==c.mID;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public override int GetHashCode()
|
|
{
|
|
return ("Rate"+mID).GetHashCode();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Searching
|
|
|
|
/// <summary>
|
|
/// Returns a search result object based on search terms
|
|
/// for the ID specified
|
|
/// </summary>
|
|
/// <param name="ID"></param>
|
|
/// <param name="searchTerms"></param>
|
|
/// <returns></returns>
|
|
public static SearchResult GetSearchResult(Guid ID, string[]searchTerms)
|
|
{
|
|
|
|
|
|
if(AyaBizUtils.Right("Object.Rate")<(int)SecurityLevelTypes.ReadOnly)
|
|
return new SearchResult();
|
|
|
|
SearchResult sr=new SearchResult();
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
SafeDataReader dr = null;
|
|
try
|
|
{
|
|
dr=DBUtil.GetReaderFromSQLString(
|
|
|
|
"SELECT aRegionID, aCreated, aModified, aCreator, aModifier, aName, " +
|
|
"aDescription, AACCOUNTNUMBER FROM aRate WHERE (aID " +
|
|
"= @ID)"
|
|
,ID);
|
|
|
|
if(!dr.Read())
|
|
return new SearchResult();//DBUtil.ThrowFetchError("SearchResult for RateID: " + ID.ToString());
|
|
|
|
if (!AyaBizUtils.InYourRegion(dr.GetGuid("aRegionID"))) return new SearchResult();//case 58
|
|
|
|
sr.Description=dr.GetString("aName");
|
|
|
|
sb.Append(sr.Description);
|
|
|
|
sb.Append(" ");
|
|
sb.Append(dr.GetString("aDescription"));
|
|
|
|
sb.Append(" ");
|
|
sb.Append(dr.GetString("AACCOUNTNUMBER"));
|
|
|
|
sr.Created=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
|
sr.Modified=DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
|
sr.Creator=dr.GetGuid("aCreator");
|
|
sr.Modifier=dr.GetGuid("aModifier");
|
|
|
|
|
|
|
|
|
|
}
|
|
finally
|
|
{
|
|
if(dr!=null) dr.Close();
|
|
}
|
|
|
|
|
|
|
|
|
|
//Formulate results
|
|
ExtractAndRank er = new ExtractAndRank();
|
|
er.Process(sb.ToString().Trim(),searchTerms);
|
|
sr.Extract=er.Extract;
|
|
sr.Rank=er.Ranking;
|
|
sr.AncestorRootObjectID=ID;
|
|
sr.AncestorRootObjectType=RootObjectTypes.Rate;
|
|
|
|
return sr;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Static methods
|
|
/// <summary>
|
|
/// Create new Rate
|
|
/// </summary>
|
|
internal static Rate NewItem()
|
|
{
|
|
|
|
|
|
if(AyaBizUtils.Right("Object.Rate")>(int)SecurityLevelTypes.ReadOnly)
|
|
return new Rate();
|
|
else
|
|
throw new System.Security.SecurityException(
|
|
string.Format(
|
|
LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToCreate"),
|
|
LocalizedTextTable.GetLocalizedTextDirect("O.Rate")));
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fetch
|
|
/// </summary>
|
|
/// <param name="dr"></param>
|
|
/// <returns></returns>
|
|
internal static Rate GetItem(SafeDataReader dr)
|
|
{
|
|
|
|
if(AyaBizUtils.Right("Object.Rate")>(int)SecurityLevelTypes.NoAccess)
|
|
{
|
|
Rate child = new Rate();
|
|
child.Fetch(dr);
|
|
return child;
|
|
}
|
|
else
|
|
throw new System.Security.SecurityException(
|
|
string.Format(
|
|
LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToRetrieve"),
|
|
LocalizedTextTable.GetLocalizedTextDirect("O.Rate")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check for the existance of a Rate
|
|
/// in the database by ID OR by Name
|
|
/// </summary>
|
|
/// <param name="ID">Guid of Rate</param>
|
|
/// <param name="Name">Name of Rate</param>
|
|
public static bool Exists(Guid ID, string Name)
|
|
{
|
|
//Case 500
|
|
//return ExistsHelper.GetExists(ID,Name);
|
|
return RateExistanceChecker.RateExists(ID, Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Retrieve internal ID from name.
|
|
///
|
|
/// </summary>
|
|
/// <param name="Name">Text value</param>
|
|
/// <returns>Guid ID value or Guid.Empty if no match</returns>
|
|
public static Guid GetIDFromName(string Name)
|
|
{
|
|
return GuidFetcher.GetItem("ARATE", "ANAME", Name);
|
|
}
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
|
|
/// <summary>
|
|
/// Populate this object from the values in the datareader passed to it
|
|
/// </summary>
|
|
/// <param name="dr"></param>
|
|
private void Fetch(SafeDataReader dr)
|
|
{
|
|
//Standard fields
|
|
mID=dr.GetGuid("aID");
|
|
mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
|
|
mModified=DBUtil.ToLocal(dr.GetSmartDate("aModified"));
|
|
mCreator=dr.GetGuid("aCreator");
|
|
mModifier=dr.GetGuid("aModifier");
|
|
|
|
//Rate fields
|
|
Active=dr.GetBoolean("AACTIVE");
|
|
|
|
//Important: use property not internal field
|
|
//so that initial broken rule is unbroken on fetch
|
|
Name=dr.GetString("aName");
|
|
|
|
mDescription=dr.GetString("aDescription");
|
|
mAccountNumber=dr.GetString("AACCOUNTNUMBER");
|
|
mClientGroupID=dr.GetGuid("aClientGroupID");
|
|
mCost=dr.GetDecimal("aCost");
|
|
mCharge=dr.GetDecimal("aCharge");
|
|
mRateType=(RateTypes)dr.GetInt16("aRateType");
|
|
mRateUnitChargeDescriptionID=dr.GetGuid("aRateUnitChargeDescriptionID");
|
|
|
|
mContractRate=dr.GetBoolean("aContractRate");
|
|
|
|
//case 58
|
|
mRegionID = dr.GetGuid("aRegionID");
|
|
|
|
//Get access rights level
|
|
bReadOnly=AyaBizUtils.Right("Object.Rate")<(int)SecurityLevelTypes.ReadWrite;
|
|
|
|
MarkOld();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="tr"></param>
|
|
internal void Update(IDbTransaction tr)
|
|
{
|
|
//No need to update if there is nothing changed
|
|
if(!this.IsDirty) return;
|
|
|
|
// If not a new record, check if record was modified
|
|
//by another user since original retrieval:
|
|
if(!IsNew)
|
|
DBUtil.CheckSafeToUpdate(this.mModified.Date,this.mID,"aRate");
|
|
|
|
#region Delete
|
|
if(IsDeleted)
|
|
{
|
|
if(!IsNew)
|
|
{
|
|
//Delete object and child objects
|
|
DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aRate WHERE aID = @ID;");
|
|
cmDelete.AddInParameter("@ID",DbType.Guid,this.mID);
|
|
DBUtil.DB.ExecuteNonQuery(cmDelete, tr);
|
|
DBUtil.RemoveKeywords(tr,RootObjectTypes.Rate,this.mID);
|
|
//-----------------------------
|
|
}
|
|
MarkNew();
|
|
return;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Add / Update
|
|
|
|
//get modification time temporarily, if update succeeds then
|
|
//set to this time
|
|
System.DateTime dtModified = DBUtil.CurrentWorkingDateTime;
|
|
|
|
DBCommandWrapper cm = null;
|
|
if(IsNew)//Add or update?
|
|
cm=DBUtil.GetCommandFromSQL(
|
|
"INSERT INTO aRate (aID, AACTIVE, aName, aDescription, " +
|
|
"AACCOUNTNUMBER, aCost, aCharge, aRateType, aRateUnitChargeDescriptionID, " +
|
|
"aClientGroupID, aCreated,aModified,aCreator, " +
|
|
"aModifier, aContractRate, aRegionID) VALUES (@ID,@Active,@Name, " +
|
|
"@Description,@AccountNumber,@Cost,@Charge,@RateType, " +
|
|
"@RateUnitChargeDescriptionID,@ClientGroupID, " +
|
|
"@Created,@Modified,@CurrentUserID,@CurrentUserID, @ContractRate, @RegionID)"
|
|
);
|
|
else
|
|
cm=DBUtil.GetCommandFromSQL(
|
|
"UPDATE aRate SET aID=@ID, AACTIVE=@Active, aName=@Name, " +
|
|
"aDescription=@Description, AACCOUNTNUMBER=@AccountNumber, " +
|
|
"aCost=@Cost, aCharge=@Charge, aRateType=@RateType, " +
|
|
"aRateUnitChargeDescriptionID=@RateUnitChargeDescriptionID, " +
|
|
"aClientGroupID=@ClientGroupID, " +
|
|
"aRegionID=@RegionID, " +
|
|
"aContractRate=@ContractRate, aModifier=@CurrentUserID, " +
|
|
" aModified=@Modified WHERE aID=@ID"
|
|
);
|
|
|
|
|
|
//Rate fields
|
|
cm.AddInParameter("@Active",DbType.Boolean,mActive);
|
|
cm.AddLargeStringInParameter("@Description",mDescription);
|
|
cm.AddInParameter("@Name",DbType.String,mName);
|
|
//cm.AddInParameter("@CurrentUserID",DbType.Guid,CurrentUserID);
|
|
cm.AddInParameter("@AccountNumber",DbType.String,mAccountNumber);
|
|
cm.AddInParameter("@ClientGroupID",DbType.Guid,mClientGroupID);
|
|
cm.AddInParameter("@Cost",DbType.Decimal,mCost);
|
|
cm.AddInParameter("@Charge",DbType.Decimal,mCharge);
|
|
cm.AddInParameter("@RateType",DbType.Int16,(int)mRateType);
|
|
cm.AddInParameter("@RateUnitChargeDescriptionID",DbType.Guid,mRateUnitChargeDescriptionID);
|
|
cm.AddInParameter("@ContractRate",DbType.Boolean,mContractRate);
|
|
cm.AddInParameter("@RegionID", DbType.Guid, mRegionID);//case 58
|
|
|
|
//Standard fields
|
|
cm.AddInParameter("@ID",DbType.Guid,this.mID);
|
|
cm.AddInParameter("@CurrentUserID",DbType.Guid, CurrentUserID);
|
|
cm.AddInParameter("@Created",DbType.DateTime, DBUtil.ToUTC(mCreated.Date));
|
|
cm.AddInParameter("@Modified",DbType.DateTime, DBUtil.ToUTC(dtModified));
|
|
|
|
|
|
DBUtil.DB.ExecuteNonQuery(cm, tr);
|
|
|
|
//Process keywords
|
|
DBUtil.ProcessKeywords(tr,this.mID,RootObjectTypes.Rate,IsNew,AyaBizUtils.Break(false,
|
|
mName,mDescription,mAccountNumber
|
|
));
|
|
|
|
|
|
MarkOld();//db is now synched with object
|
|
//Successful update so
|
|
//change modification time to match
|
|
this.mModified.Date=dtModified;
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Exists
|
|
//Case 500
|
|
//[Serializable(), System.ComponentModel.Browsable(false)]
|
|
// public class ExistsHelper
|
|
//{
|
|
// bool _Exists = false;
|
|
// Guid _ID;
|
|
// string _Name;
|
|
// public ExistsHelper(Guid ID, string Name)
|
|
// {
|
|
// _ID=ID;
|
|
// _Name=Name;
|
|
// }
|
|
|
|
// public static bool GetExists(Guid ID, string Name)
|
|
// { //todo fix for 425
|
|
// ExistsHelper e=new ExistsHelper(ID,Name);
|
|
// DataPortal.Update(e);
|
|
// return e._Exists;
|
|
// }
|
|
|
|
// public void DataPortal_Update()
|
|
// {
|
|
// if(_Name!=null && _Name!="")
|
|
// {
|
|
// DBCommandWrapper dbCommandWrapper = DBUtil.DB.GetSqlStringCommandWrapper(
|
|
// "SELECT aID FROM aRate WHERE " +
|
|
// "(aName = @ANAME)"
|
|
// );
|
|
// dbCommandWrapper.AddInParameter("@ANAME",DbType.String,_Name);
|
|
// if(DBUtil.ToGuid(DBUtil.DB.ExecuteScalar(dbCommandWrapper))==Guid.Empty)
|
|
// this._Exists=false;
|
|
// else
|
|
// this._Exists=true;
|
|
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// if(DBUtil.ToGuid(DBUtil.GetScalarFromSQLString(
|
|
// "SELECT aID FROM aRate WHERE " +
|
|
// "(aID = @ID)",_ID
|
|
// ))==Guid.Empty)
|
|
// this._Exists=false;
|
|
// else
|
|
// this._Exists=true;
|
|
// }
|
|
// }
|
|
|
|
//}
|
|
|
|
#endregion
|
|
|
|
}//end Rate
|
|
|
|
}//end namespace GZTW.AyaNova.BLL |