/////////////////////////////////////////////////////////// // WorkorderItemLabor.cs // Implementation of Class WorkorderItemLabor // CSLA type: Editable Child // Created on: 07-Jun-2004 8:41:48 AM // Object design: Joyce // Coded: John 21-July-2004 /////////////////////////////////////////////////////////// using System; using System.Data; using CSLA.Data; using GZTW.Data; using CSLA; using System.Threading; using CSLA.Security; namespace GZTW.AyaNova.BLL { /// /// Labor object for object's collection /// [Serializable] public class WorkorderItemLabor : BusinessBase { #region Attributes private bool bReadOnly; private Guid mID; private SmartDate mCreated; private SmartDate mModified; private Guid mCreator; private Guid mModifier; private Guid mWorkorderItemID; private Guid mUserID; private SmartDate mServiceStartDate; private SmartDate mServiceStopDate; private Guid mServiceRateID; private string mServiceDetails=""; private decimal mServiceRateQuantity; private decimal mNoChargeQuantity; //------------------ private Guid mServiceBankID; private Guid mTaxRateSaleID; #endregion #region Constructor /// /// Private constructor to prevent direct instantiation /// private WorkorderItemLabor() { //Set to read / write initially so that properties //can be set bReadOnly=false; //Child object MarkAsChild(); //New ID mID = Guid.NewGuid(); if (AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan > 0)//case 816 { mServiceStartDate = new SmartDate(DBUtil.CurrentWorkingDateTime); mServiceStopDate = new SmartDate(DBUtil.CurrentWorkingDateTime.AddMinutes(AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan)); mServiceRateQuantity = (decimal)(mServiceStopDate.Date - mServiceStartDate.Date).TotalHours; } else { mServiceStartDate = new SmartDate(); mServiceStopDate = new SmartDate(); } //Set record history to defaults mCreated = new SmartDate(DBUtil.CurrentWorkingDateTime); mModified=new SmartDate(); mCreator=Guid.Empty; mModifier=Guid.Empty; mServiceBankID=Guid.Empty; mTaxRateSaleID=AyaBizUtils.GlobalSettings.TaxRateSaleID; } #endregion #region Business properties /// /// Applies this labor entry to service bank /// and sets ServiceBankID /// /// Populate TypeAndID object (the client or unit or headoffice) /// Rate currency per unit for banked currency calcs /// Descriptive text to enter in service bank /// (255 char - the localized text length of O.WorkorderItemLabor which is inserted automatically before description) public void ApplyToServiceBank(TypeAndID tid, decimal ServiceRate, string Description) { if(mServiceBankID!=Guid.Empty) throw new System.ApplicationException (LocalizedTextTable.GetLocalizedTextDirect("WorkorderItemLabor.Label.UI.ReBankWarning")); ServiceBank s = ServiceBank.NewItem(); s.AppliesToRootObjectID=tid.ID; s.AppliesToRootObjectType=tid.RootObjectType; s.Currency=-(ServiceRate*this.mServiceRateQuantity); s.Incidents=-1; s.Hours=-(this.mServiceRateQuantity); s.Description=LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderItemLabor") + " ("+Description+")"; s.EffectiveDate=this.mServiceStopDate.DBValue; s.SourceRootObjectID=this.ID; s.SourceRootObjectType=RootObjectTypes.WorkorderItemLabor; s.Save(); mServiceBankID=s.ID; MarkDirty(); } //case 1975 /// /// Determines automaticaly the most correct service rate and /// the most correct object's bank to apply this /// labor entry to and does so. /// /// NOTE: silently returns regardless if banking was done or /// if nothing to bank or no bankable object is found or there is already a service bank ID set /// (there is no exception thrown in these logical non-bankable conditions) /// /// Callers who need to confirm can check ServiceBankID after this method call which /// will be set if bank entry was made otherwise it will remain Guid.Empty /// /// Parent workorder (required for autodiscovery of bank and rate) public void ApplyToServiceBankAuto(Workorder w) { TypeAndID bankableObject = w.BankableResolved(mWorkorderItemID); if (bankableObject == null || bankableObject.RootObjectType == RootObjectTypes.Nothing) return; if (mServiceRateID == Guid.Empty) return; if (mServiceRateQuantity == 0) return; if (mServiceBankID != Guid.Empty) return; RatePickList.RatePickListInfo theRate = RatePickList.GetListOfOneSpecificRate(mServiceRateID)[0]; decimal dCharge = theRate.Charge; //case 1190 //Check if already banked Guid gPriorBank = ServiceBankCheckAlreadyBanked.GetBankID(mID, RootObjectTypes.WorkorderItemLabor); if (gPriorBank != Guid.Empty) { //case 1189 flag the labor record ApplyServiceBankID(gPriorBank); } else ApplyToServiceBank(bankableObject, dCharge, LocalizedTextTable.GetLocalizedTextDirect("O.Workorder") + " " + w.WorkorderService.ServiceNumber.ToString()); } //case 1189 /// /// Used to resolve an issue that can arise when a user applys to service bank but then doesn't save workorder /// Won't actually bank because it's already banked but will tag this record with the correct /// service bank ID from the prior banking /// /// ID is retrieve by using the methods in ServiceBankCheckAlreadyBanked class /// /// public void ApplyServiceBankID(Guid serviceBankID) { if (mServiceBankID != serviceBankID) { mServiceBankID = serviceBankID; MarkDirty(); } } /// /// UI convenience property (read only) /// public bool IsBanked { get { return mServiceBankID != Guid.Empty; } } /// /// ID of service bank record created from this labor record /// Is set when apply service bank is called /// public Guid ServiceBankID { get { return mServiceBankID; } } /// /// Get internal id number Read only property because it's set internally, not /// externally /// public Guid ID { get { return mID; } } /// /// Get created date /// /// /// public string Created { get { return mCreated.ToString(); } } /// /// Get modified date /// /// /// public string Modified { get { return mModified.ToString(); } } /// /// Get user record ID of person who created this record /// /// /// public Guid Creator { get { return mCreator; } } /// /// Get user ID of person who modified this record /// /// /// public Guid Modifier { get { return mModifier; } } /// /// who performed the labor /// public Guid UserID { get { return mUserID; } set { if(bReadOnly) ThrowSetError(); else { if(mUserID!=value) { mUserID = value; MarkDirty(); } } } } /// /// Quantity to be billed /// public decimal ServiceRateQuantity { get { return mServiceRateQuantity; } set { if(bReadOnly) ThrowSetError(); else { if(mServiceRateQuantity!=value) { mServiceRateQuantity = value; MarkDirty(); } } } } /// /// Free quantity for tracking and reporting purposes /// public decimal NoChargeQuantity { get { return mNoChargeQuantity; } set { if(bReadOnly) ThrowSetError(); else { if(mNoChargeQuantity!=value) { mNoChargeQuantity = value; MarkDirty(); } } } } /// /// Start date / time of service (DBValue) /// public object ServiceStartDate { get { return mServiceStartDate.DBValue; } set { if(bReadOnly) ThrowSetError(); else { if (!AyaBizUtils.SmartDateEquals(mServiceStartDate, value)) //Case 298 { mServiceStartDate.DBValue = value; //autocomplete time if (!mServiceStartDate.IsEmpty && mServiceStopDate.IsEmpty && (AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan != 0)) mServiceStopDate.Date = mServiceStartDate.Date.AddMinutes(AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan);//case 816 //not empty Start date is not valid without stop date BrokenRules.Assert("ServiceStopDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStopDate","ServiceStartDate",!mServiceStartDate.IsEmpty && mServiceStopDate.IsEmpty); //Is stop date valid now? BrokenRules.Assert("ServiceStartDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStartDate","ServiceStopDate",!mServiceStopDate.IsEmpty && mServiceStartDate.IsEmpty); if(!mServiceStopDate.IsEmpty&&!mServiceStartDate.IsEmpty) { BrokenRules.Assert("ServiceStartDateBeforeStopDate","Error.Object.StartDateAfterEndDate", "ServiceStartDate",mServiceStartDate.CompareTo(mServiceStopDate)>-1); } MarkDirty(); } } } } /// /// End date / time of service (DBValue) /// public object ServiceStopDate { get { return mServiceStopDate.DBValue; } set { if(bReadOnly) ThrowSetError(); else { if (!AyaBizUtils.SmartDateEquals(mServiceStopDate, value)) //Case 298 { mServiceStopDate.DBValue = value; //autocomplete time if (!mServiceStopDate.IsEmpty && mServiceStartDate.IsEmpty && (AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan != 0)) mServiceStartDate.Date = mServiceStopDate.Date.AddMinutes(-AyaBizUtils.GlobalSettings.LaborSchedUserDfltTimeSpan);//case 816 //Not empty Stop date is not valid without start date BrokenRules.Assert("ServiceStartDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStartDate","ServiceStopDate",!mServiceStopDate.IsEmpty && mServiceStartDate.IsEmpty); //Rule needs to be checked here even though it's to do with start date because it can be broken //there but can only be unbroken here so it needs to be checked in both places... //Is start date valid now? BrokenRules.Assert("ServiceStopDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStopDate","ServiceStartDate",!mServiceStartDate.IsEmpty && mServiceStopDate.IsEmpty); if(!mServiceStopDate.IsEmpty&&!mServiceStartDate.IsEmpty) { //this is working code from scheduled user //BrokenRules.Assert("StartDateBeforeStopDate", "Error.Object.StartDateAfterEndDate", // "StartDate", mStartDate.CompareTo(mStopDate) > -1); //originally it was this before working on case 2013 //BrokenRules.Assert("ServiceStartDateBeforeStopDate","Error.Object.StartDateAfterEndDate,ServiceStartDate", // mServiceStartDate.CompareTo(mServiceStopDate)>-1); BrokenRules.Assert("ServiceStartDateBeforeStopDate", "Error.Object.StartDateAfterEndDate","ServiceStartDate", mServiceStartDate.CompareTo(mServiceStopDate) > -1); } MarkDirty(); } } } } #region PM accessible versions of start and stop date internal DateTime dtServiceStartDate { get { return mServiceStartDate.Date; } set { if(mServiceStartDate.Date!=value) { mServiceStartDate.Date = value; //not empty Start date is not valid without stop date BrokenRules.Assert("ServiceStopDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStopDate","ServiceStartDate",!mServiceStartDate.IsEmpty && mServiceStopDate.IsEmpty); //Is stop date valid now? BrokenRules.Assert("ServiceStartDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStartDate","ServiceStopDate",!mServiceStopDate.IsEmpty && mServiceStartDate.IsEmpty); if(!mServiceStopDate.IsEmpty&&!mServiceStartDate.IsEmpty) { BrokenRules.Assert("ServiceStartDateBeforeStopDate","Error.Object.StartDateAfterEndDate", "ServiceStartDate",mServiceStartDate.CompareTo(mServiceStopDate)>-1); } MarkDirty(); } } } internal DateTime dtServiceStopDate { get { return mServiceStopDate.Date; } set { if(mServiceStopDate.Date!=value) { mServiceStopDate.Date = value; //Not empty Stop date is not valid without start date BrokenRules.Assert("ServiceStartDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStartDate","ServiceStopDate",!mServiceStopDate.IsEmpty && mServiceStartDate.IsEmpty); //Rule needs to be checked here even though it's to do with start date because it can be broken //there but can only be unbroken here so it needs to be checked in both places... //Is start date valid now? BrokenRules.Assert("ServiceStopDateRequired","Error.Object.RequiredFieldEmpty,WorkorderItemLabor.Label.ServiceStopDate","ServiceStartDate",!mServiceStartDate.IsEmpty && mServiceStopDate.IsEmpty); if(!mServiceStopDate.IsEmpty&&!mServiceStartDate.IsEmpty) { BrokenRules.Assert("ServiceStartDateBeforeStopDate","Error.Object.StartDateAfterEndDate,ServiceStartDate",mServiceStartDate.CompareTo(mServiceStopDate)>-1); } MarkDirty(); } } } #endregion pm accessible /// /// ID of /// public Guid ServiceRateID { get { return mServiceRateID; } set { if(bReadOnly) ThrowSetError(); else { if(mServiceRateID!=value) { mServiceRateID = value; MarkDirty(); } } } } /// /// Details of service performed, prints on reports given to customers /// public string ServiceDetails { get { return mServiceDetails; } set { if(bReadOnly) ThrowSetError(); else { if(mServiceDetails!=value) { mServiceDetails = value; MarkDirty(); } } } } /// /// Guid ID of parent object /// public Guid WorkorderItemID { get { return mWorkorderItemID; } // set // { // if(bReadOnly) // ThrowSetError(); // else // { // if(mWorkorderItemID!=value) // { // mWorkorderItemID = value; // MarkDirty(); // // } // } // } } /// /// ID /// public Guid TaxRateSaleID { get { return mTaxRateSaleID; } set { if(bReadOnly) ThrowSetError(); else { if(mTaxRateSaleID!=value) { mTaxRateSaleID = value; MarkDirty(); } } } } /// /// Called by parent collection object /// when called in turn by workorder object that is read only due to /// security or closed or service completed /// /// Either true or the rights allowed for the current user public void SetReadOnly(bool RO) { bReadOnly=RO; } /// /// 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) /// private void ThrowSetError() { throw new System.Security.SecurityException ( string.Format ( LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToChange"), LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderItemLabor") ) ); } #endregion #region Searching /// /// Returns a search result object based on search terms /// for the ID specified /// /// /// /// public static SearchResult GetSearchResult(Guid ID, string[]searchTerms) { //case 1387 if (Workorder.RightsToWorkorder(WorkorderIDFetcher.GetWorkorderByRelative(RootObjectTypes.WorkorderItemLabor, ID)) < SecurityLevelTypes.ReadOnly) return new SearchResult(); SearchResult sr=new SearchResult(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); SafeDataReader dr = null; try { //Case 88 changes //"SELECT aID, aCreator, aModifier, aCreated, aModified, aServiceDetails " + // "FROM aWorkorderItemLabor WHERE (aID " + // "= @ID)" dr=DBUtil.GetReaderFromSQLString( "SELECT AWORKORDERITEMLABOR.aID, AWORKORDERITEMLABOR.aCreator, " + " AWORKORDERITEMLABOR.aModifier, AWORKORDERITEMLABOR.aCreated, " + " AWORKORDERITEMLABOR.aModified, AWORKORDERITEMLABOR.aServiceDetails, " + "AWORKORDERSERVICE.ASERVICENUMBER, " + " AWORKORDERQUOTE.AQUOTENUMBER, AWORKORDERPREVENTIVEMAINTENANCE.APREVENTIVEMAINTENANCENUMBER, " + " ACLIENT.ANAME AS ACLIENTNAME, aClient.aRegionID AS ACLIENTREGION, AWORKORDER.aWorkorderType " + "FROM AWORKORDERITEMLABOR INNER JOIN AWORKORDERITEM " + "ON AWORKORDERITEMLABOR.AWORKORDERITEMID = AWORKORDERITEM.AID " + "LEFT OUTER " + "JOIN AWORKORDER ON AWORKORDERITEM.AWORKORDERID = " + "AWORKORDER.AID LEFT OUTER JOIN ACLIENT ON AWORKORDER.ACLIENTID " + "= ACLIENT.AID LEFT OUTER JOIN AWORKORDERPREVENTIVEMAINTENANCE " + "ON AWORKORDER.AID = " + "AWORKORDERPREVENTIVEMAINTENANCE.AWORKORDERID LEFT OUTER JOIN " + "AWORKORDERQUOTE ON AWORKORDER.AID = AWORKORDERQUOTE.AWORKORDERID " + "LEFT OUTER JOIN AWORKORDERSERVICE " + "ON AWORKORDER.AID = AWORKORDERSERVICE.AWORKORDERID " + "WHERE (AWORKORDERITEMLABOR.aID = @ID)" ,ID); if(!dr.Read()) return new SearchResult();//DBUtil.ThrowFetchError("SearchResult for WorkorderItemLaborID: " + ID.ToString()); if (!AyaBizUtils.InYourRegion(dr.GetGuid("ACLIENTREGION"))) return new SearchResult();//case 58 //Case 88 parse out workorder type and prepare description field accordingly WorkorderTypes workorderType = (WorkorderTypes)dr.GetInt16("aWorkorderType"); switch (workorderType) { case WorkorderTypes.Service: sr.Description = LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderService") + " " + dr.GetInt32("aServiceNumber").ToString() + " " + dr.GetString("ACLIENTNAME"); break; case WorkorderTypes.Quote: sr.Description = LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderQuote") + " " + dr.GetInt32("AQUOTENUMBER").ToString() + " " + dr.GetString("ACLIENTNAME"); break; case WorkorderTypes.PreventiveMaintenance: sr.Description = LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderPreventiveMaintenance") + " " + dr.GetInt32("APREVENTIVEMAINTENANCENUMBER").ToString() + " " + dr.GetString("ACLIENTNAME"); break; } // sr.Description=""; sb.Append(dr.GetString("aServiceDetails")); 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.WorkorderItemLabor; return sr; } #endregion #region System.object overrides /// /// /// /// public override string ToString() { return "WorkorderItemLabor" + mID.ToString(); } /// /// /// /// /// public override bool Equals(Object obj) { if ( obj == null || GetType ( ) != obj.GetType ( ) ) return false; WorkorderItemLabor c=(WorkorderItemLabor)obj; return mID==c.mID; } /// /// /// /// public override int GetHashCode() { return ("WorkorderItemLabor"+mID).GetHashCode(); } #endregion #region Static methods /// /// New item /// /// /// internal static WorkorderItemLabor NewItem(WorkorderItem obj) { //case 1387 if (AyaBizUtils.IsGenerator || ((obj.mHeaderRights > SecurityLevelTypes.ReadOnly) && (AyaBizUtils.Right("Object.WorkorderItemLabor") > (int)SecurityLevelTypes.ReadOnly))) { WorkorderItemLabor child = new WorkorderItemLabor(); child.mWorkorderItemID=obj.ID; return child; } else throw new System.Security.SecurityException( string.Format( LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToCreate"), LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderItemLabor"))); } /// /// Get Item /// /// /// /// internal static WorkorderItemLabor GetItem(SafeDataReader dr, WorkorderItem obj) { //case 1387 if ((obj.mHeaderRights > SecurityLevelTypes.NoAccess) && (AyaBizUtils.Right("Object.WorkorderItemLabor") > (int)SecurityLevelTypes.NoAccess)) { WorkorderItemLabor child = new WorkorderItemLabor(); child.Fetch(dr); return child; } else throw new System.Security.SecurityException( string.Format( LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToRetrieve"), LocalizedTextTable.GetLocalizedTextDirect("O.WorkorderItemLabor"))); } #endregion #region DAL DATA ACCESS #region Fetch /// /// /// /// protected void Fetch(SafeDataReader dr) { //Standard fields mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated")); mModified=DBUtil.ToLocal(dr.GetSmartDate("aModified")); mCreator=dr.GetGuid("aCreator"); mModifier=dr.GetGuid("aModifier"); mID=dr.GetGuid("aID"); //WorkorderItemLabor fields mNoChargeQuantity=dr.GetDecimal("aNoChargeQuantity"); mServiceDetails=dr.GetString("aServiceDetails"); mServiceRateID=dr.GetGuid("aServiceRateID"); mServiceRateQuantity=dr.GetDecimal("aServiceRateQuantity"); //Important: use property not internal field //for properties with rules mServiceStartDate=DBUtil.ToLocal(dr.GetSmartDate("aServiceStartDate")); mServiceStopDate=DBUtil.ToLocal(dr.GetSmartDate("aServiceStopDate")); mUserID=dr.GetGuid("aUserID"); mWorkorderItemID=dr.GetGuid("aWorkorderItemID"); mServiceBankID=dr.GetGuid("aServiceBankID"); mTaxRateSaleID=dr.GetGuid("aTaxRateSaleID"); //Get access rights level bReadOnly=AyaBizUtils.Right("Object.WorkorderItemLabor")<(int)SecurityLevelTypes.ReadWrite; MarkOld(); } #endregion fetch #region Add / Update /// /// Update child /// /// /// internal void Update(WorkorderItem obj,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.CheckSafeToUpdateInsideTransaction(this.mModified.Date,this.mID,"aWorkorderItemLabor",tr);//case 1960 //DBUtil.CheckSafeToUpdate(this.mModified.Date, this.mID, "aWorkorderItemLabor");//was this before case 1960 #region Delete if(IsDeleted) { if(!IsNew) { //Make a reversing entry in the service bank if(this.mServiceBankID!=Guid.Empty) ServiceBank.ReverseItem(mServiceBankID,tr); DBCommandWrapper cmDelete = DBUtil.GetCommandFromSQL("DELETE FROM aWorkorderItemLabor WHERE aID=@ID;"); cmDelete.AddInParameter("@ID",DbType.Guid,this.mID); DBUtil.DB.ExecuteNonQuery(cmDelete, tr); DBUtil.RemoveKeywords(tr,RootObjectTypes.WorkorderItemLabor,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 aWorkorderItemLabor (aWorkorderItemID, aID, " + "aUserID, aServiceStartDate, aServiceStopDate, " + "aServiceRateID, aServiceDetails, aServiceRateQuantity, " + "aNoChargeQuantity, aCreated,aModified,aCreator,aModifier, aServiceBankID, aTaxRateSaleID) " + "VALUES (@WorkorderItemID,@ID,@UserID, " + "@ServiceStartDate,@ServiceStopDate, @ServiceRateID, " + "@ServiceDetails,@ServiceRateQuantity,@NoChargeQuantity, " + "@Created,@Modified,@CurrentUserID,@CurrentUserID,@ServiceBankID,@TaxRateSaleID)" ); else cm=DBUtil.GetCommandFromSQL( "UPDATE aWorkorderItemLabor SET aWorkorderItemID=@WorkorderItemID, " + "aID=@ID, aUserID=@UserID, aServiceStartDate=@ServiceStartDate, " + "aServiceStopDate=@ServiceStopDate, " + "aServiceRateID=@ServiceRateID, aServiceDetails=@ServiceDetails, " + "aServiceRateQuantity=@ServiceRateQuantity, " + "aNoChargeQuantity=@NoChargeQuantity, " + "aModifier=@CurrentUserID, aModified=@Modified, " + "aServiceBankID=@ServiceBankID, aTaxRateSaleID=@TaxRateSaleID WHERE " + "aID=@ID" ); //WorkorderItemLabor specific cm.AddInParameter("@ID",DbType.Guid,mID); cm.AddInParameter("@WorkorderItemID",DbType.Guid,mWorkorderItemID); cm.AddInParameter("@NoChargeQuantity",DbType.Decimal,mNoChargeQuantity); cm.AddLargeStringInParameter("@ServiceDetails",mServiceDetails); cm.AddInParameter("@ServiceRateID",DbType.Guid,mServiceRateID); cm.AddInParameter("@ServiceRateQuantity",DbType.Decimal,mServiceRateQuantity); cm.AddInParameter("@ServiceStartDate",DbType.DateTime,DBUtil.ToUTC(mServiceStartDate).DBValue); cm.AddInParameter("@ServiceStopDate",DbType.DateTime,DBUtil.ToUTC(mServiceStopDate).DBValue); cm.AddInParameter("@UserID",DbType.Guid,mUserID); cm.AddInParameter("@ServiceBankID",DbType.Guid,mServiceBankID); cm.AddInParameter("@TaxRateSaleID",DbType.Guid,mTaxRateSaleID); //standard parameters 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.WorkorderItemLabor,IsNew,AyaBizUtils.Break(false,mServiceDetails)); MarkOld();//db is now synched with object //Successful update so //change modification time to match this.mModified.Date=dtModified; #endregion } #endregion add / update #endregion }//end WorkorderItemLabor }//end namespace GZTW.AyaNova.BLL