本文整理汇总了C#中Connection.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.Commit方法的具体用法?C# Connection.Commit怎么用?C# Connection.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.Commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
List<OPoint> pointList = TablesLogic.tPoint.LoadList(
TablesLogic.tPoint.ReadingDay == DateTime.Today.Day &
TablesLogic.tPoint.IsActive == 1 &
(TablesLogic.tPoint.LastReminderDate ==null |
TablesLogic.tPoint.LastReminderDate.Date() < DateTime.Today.Date));
List<Guid> userIdList = new List<Guid>();
foreach (OPoint point in pointList)
{
if (point.ReminderUser1 != null)
{
if (!userIdList.Contains((Guid)point.ReminderUser1.ObjectID))
{
userIdList.Add((Guid)point.ReminderUser1.ObjectID);
SendEmail(point.ReminderUser1);
}
}
if (point.ReminderUser2 != null)
{
if (!userIdList.Contains((Guid)point.ReminderUser2.ObjectID))
{
userIdList.Add((Guid)point.ReminderUser2.ObjectID);
SendEmail(point.ReminderUser2);
}
}
if (point.ReminderUser3 != null)
{
if (!userIdList.Contains((Guid)point.ReminderUser3.ObjectID))
{
userIdList.Add((Guid)point.ReminderUser3.ObjectID);
SendEmail(point.ReminderUser3);
}
}
if (point.ReminderUser4 != null)
{
if (!userIdList.Contains((Guid)point.ReminderUser4.ObjectID))
{
userIdList.Add((Guid)point.ReminderUser4.ObjectID);
SendEmail(point.ReminderUser4);
}
}
using (Connection c = new Connection())
{
point.LastReminderDate = DateTime.Today;
point.Save();
c.Commit();
}
}
}
示例2: Migarate
public override void Migarate()
{
base.Migarate();
DataTable dt = GetDatasource();
Hashtable catalogs = new Hashtable();
using (Connection c = new Connection())
{
List<OCatalogue> list = TablesLogic.tCatalogue.LoadList(TablesLogic.tCatalogue.IsCatalogueItem == 0);
foreach (OCatalogue catalog in list)
catalogs[catalog.Path] = catalog;
}
foreach (DataRow dr in dt.Rows)
{
string catalogueType = Convert.ToString(dr[map["CatalogType"]]);
string[] catalogueTypes = catalogueType.Split(',');
string previousPath = "";
string path = "";
for (int i = 0; i < catalogueTypes.Length; i++)
{
previousPath = path;
path += (i > 0 ? " > " : "") + catalogueTypes[i];
if (catalogs[path] == null)
{
using (Connection c = new Connection())
{
// Create a new catalog folder and save it.
//
OCatalogue newCatalog = TablesLogic.tCatalogue.Create();
newCatalog.ObjectName = catalogueTypes[i];
newCatalog.IsCatalogueItem = 0;
// Find the parent.
//
OCatalogue parentCatalog = catalogs[previousPath] as OCatalogue;
if (parentCatalog != null)
newCatalog.ParentID = parentCatalog.ObjectID;
newCatalog.IsSharedAcrossAllStores = 1;
newCatalog.Save();
catalogs[path] = newCatalog;
c.Commit();
}
}
}
}
}
示例3: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
List<OContractReminder> reminders = TablesLogic.tContractReminder.LoadList(
TablesLogic.tContractReminder.IsReminderSent != 1 &
TablesLogic.tContractReminder.ReminderDate <= DateTime.Today.Date);
List<Guid> userIdList = new List<Guid>();
foreach (OContractReminder re in reminders)
{
if (re.Contract.Reminder1User != null)
{
if (!userIdList.Contains((Guid)re.Contract.Reminder1UserID))
{
userIdList.Add((Guid)re.Contract.Reminder1UserID);
SendEmail(re, re.Contract.Reminder1User);
}
}
if (re.Contract.Reminder2User != null)
{
if (!userIdList.Contains((Guid)re.Contract.Reminder2UserID))
{
userIdList.Add((Guid)re.Contract.Reminder2UserID);
SendEmail(re, re.Contract.Reminder2User);
}
}
if (re.Contract.Reminder3User != null)
{
if (!userIdList.Contains((Guid)re.Contract.Reminder3UserID))
{
userIdList.Add((Guid)re.Contract.Reminder3UserID);
SendEmail(re, re.Contract.Reminder3User);
}
}
if (re.Contract.Reminder4User != null)
{
if (!userIdList.Contains((Guid)re.Contract.Reminder4UserID))
{
userIdList.Add((Guid)re.Contract.Reminder4UserID);
SendEmail(re, re.Contract.Reminder4User);
}
}
using (Connection c = new Connection())
{
re.IsReminderSent = 1;
re.Save();
c.Commit();
}
}
}
示例4: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
List<OEquipmentReminder> reminders = TablesLogic.tEquipmentReminder.LoadList(
TablesLogic.tEquipmentReminder.IsReminderSent != 1 &
TablesLogic.tEquipmentReminder.ReminderDate <= DateTime.Today.Date);
List<Guid> userIdList = new List<Guid>();
foreach (OEquipmentReminder re in reminders)
{
if (re.Equipment.ReminderUser1 != null)
{
if (!userIdList.Contains((Guid)re.Equipment.ReminderUser1ID))
{
userIdList.Add((Guid)re.Equipment.ReminderUser1ID);
SendEmail(re, re.Equipment.ReminderUser1);
}
}
if (re.Equipment.ReminderUser2 != null)
{
if (!userIdList.Contains((Guid)re.Equipment.ReminderUser2ID))
{
userIdList.Add((Guid)re.Equipment.ReminderUser2ID);
SendEmail(re, re.Equipment.ReminderUser2);
}
}
if (re.Equipment.ReminderUser3 != null)
{
if (!userIdList.Contains((Guid)re.Equipment.ReminderUser3ID))
{
userIdList.Add((Guid)re.Equipment.ReminderUser3ID);
SendEmail(re, re.Equipment.ReminderUser3);
}
}
if (re.Equipment.ReminderUser4 != null)
{
if (!userIdList.Contains((Guid)re.Equipment.ReminderUser4ID))
{
userIdList.Add((Guid)re.Equipment.ReminderUser4ID);
SendEmail(re, re.Equipment.ReminderUser4);
}
}
using (Connection c = new Connection())
{
re.IsReminderSent = 1;
re.Save();
c.Commit();
}
}
}
示例5: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
List<OContract> listContract = TablesLogic.tContract.LoadList(
TablesLogic.tContract.ContractEndDate < DateTime.Now &
TablesLogic.tContract.CurrentActivity.ObjectName == "InProgress");
using (Connection c = new Connection())
{
foreach (OContract contract in listContract)
{
try
{
contract.SaveAndTransit("Expire");
}
catch (Exception ex)
{ }
}
c.Commit();
}
}
示例6: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
List<OWork> ListOfWork = TablesLogic.tWork.LoadList(
TablesLogic.tWork.IsDeleted == 0 &
TablesLogic.tWork.CurrentActivity.IsDeleted == 0 &
TablesLogic.tWork.CurrentActivity.ObjectName == "PendingExecution" &
TablesLogic.tWork.NotifyWorkTechnician == 1 &
TablesLogic.tWork.IsPendingExecutionNotified != 1 &
TablesLogic.tWork.ScheduledStartDateTime < DateTime.Now
);
foreach (OWork W in ListOfWork)
{
using (Connection c = new Connection())
{
W.NotifyTechnicianPendingExecution();
W.Save();
c.Commit();
}
}
}
示例7: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
String connAmos = System.Configuration.ConfigurationManager.AppSettings["AmosStagging"].ToString();
String connLive = System.Configuration.ConfigurationManager.AppSettings["database"].ToString();
List<OReading> readingList = TablesLogic.tReading.LoadList(
TablesLogic.tReading.BillToAMOSStatus==1);
foreach (OReading reading in readingList)
{
//SqlParameter accID = new SqlParameter("@", );
//Connection.ExecuteNonQuery(connLive, "insert", accID);
using (Connection c = new Connection())
{
reading.BillToAMOSStatus = 2;
reading.Save();
c.Commit();
}
}
}
示例8: Execute
/// <summary>
/// Executes the service.
/// </summary>
public void Execute()
{
// Tries to grab a lock. If it fails, simply just quit and
// wait from the next run.
//
// This helps to prevent re-entry of the patrolling service
// should the server suddenly runs into a serious CPU load.
//
if (Monitor.TryEnter(SyncRoot))
{
try
{
DateTime dtnow = DateTime.Now;
RefreshApplicationServiceSettings();
OBackgroundServiceRun servicerun = applicationSettingService.BackgroundServiceRun;
if (servicerun == null)
{
using (Connection c = new Connection())
{
servicerun = TablesLogic.tBackgroundServiceRun.Create();
servicerun.ServiceName = applicationSettingService.ServiceName;
servicerun.NextRunDateTime = dtnow;
servicerun.Save();
c.Commit();
}
}
if (servicerun.CurrentStatus == (int)BackgroundServiceCurrentStatus.Running || (servicerun.CurrentStatus == (int)BackgroundServiceCurrentStatus.Stopped && servicerun.NextRunDateTime <= dtnow))
{
using (Connection c = new Connection())
{
servicerun.LastRunStartDateTime = DateTime.Now;
servicerun.LastRunCompleteDateTime = null;
servicerun.CurrentStatus = (int)BackgroundServiceCurrentStatus.Running;
servicerun.LastRunErrorMessage = "";
servicerun.NextRunDateTime = null;
servicerun.Save();
c.Commit();
}
LogEvent("Service executing...");
OnExecute();
//log and update successful
LogEvent("Service successfully Executed");
RefreshApplicationServiceSettings();
UpdateBackgroundServiceRun((int)BackgroundServiceLastRunStatus.Succeeded, (int)BackgroundServiceCurrentStatus.Stopped, "");
//update next run time
UpdateBackgroundServiceRunNextRun();
}
}
catch (Exception ex)
{
//log and update fail
LogException("Unable to execute service: ", ex);
RefreshApplicationServiceSettings();
UpdateBackgroundServiceRun((int)BackgroundServiceLastRunStatus.Failed, (int)BackgroundServiceCurrentStatus.Stopped, ex.ToString());
//update next run time
UpdateBackgroundServiceRunNextRun();
}
finally
{
Monitor.Exit(SyncRoot);
}
}
}
示例9: ApproveTask
/// <summary>
/// Approves this task.
/// <para></para>
/// This method is called only by the ApproveTask activity
/// in a workflow and should not be called directly by the
/// developer.
/// </summary>
/// <returns></returns>
public void ApproveTask()
{
using (Connection c = new Connection())
{
this.Save();
c.Commit();
}
}
示例10: RejectTask
/// <summary>
/// Rejects this task.
/// <para></para>
/// This method is called only by the RejectTask activity
/// in a workflow and should not be called directly by the
/// developer.
/// </summary>
/// <returns></returns>
public void RejectTask()
{
using (Connection c = new Connection())
{
this.CurrentActivity.CurrentApprovalLevel = null;
this.Save();
c.Commit();
}
}
示例11: ReSyncRFQ
//End Nguyen Quoc Phuong 13-Dec-2012
//Nguyen Quoc Phuong 13-Dec-2012
private void ReSyncRFQ()
{
List<ORequestForQuotation> RFQs = TablesLogic.tRequestForQuotation.LoadList(TablesLogic.tRequestForQuotation.CRVSyncError != (int)EnumCRVTenderRFQSyncError.SUCCEED
& TablesLogic.tRequestForQuotation.CRVSyncErrorNoOfTries < MAX_TRY_NO_RFQ
& TablesLogic.tRequestForQuotation.GroupRequestForQuotationID == null);
foreach (ORequestForQuotation rfq in RFQs)
{
if (rfq.CRVSyncError == null)
{
rfq.CRVSyncError = (int)EnumCRVTenderRFQSyncError.SUCCEED;
rfq.CRVSyncErrorNoOfTries = 0;
using (Connection c = new Connection())
{
rfq.Save();
c.Commit();
}
continue;
}
if (rfq.CRVSyncError == (int)EnumCRVTenderRFQSyncError.SUBMIT_FOR_APPROVE)
{
if (!string.IsNullOrEmpty(rfq.SystemCode))
{
string SystemCode = rfq.SystemCode;
OCRVTenderService CRVTenderService = new OCRVTenderService(OApplicationSetting.Current.CRVTenderServiceURL);
int? ReleaseStatus = CRVTenderService.ConfirmCRVSerialUsage(
SystemCode,
rfq.CRVSerialNumber,
false);
if (ReleaseStatus != (int)EnumCRVTenderSerialNumberStatus.SUCCESSFUL)
{
rfq.CRVSyncErrorNoOfTries = rfq.CRVSyncErrorNoOfTries + 1;
if (rfq.CRVSyncErrorNoOfTries == MAX_TRY_NO_RFQ)
rfq.SendMessage(ReleaseCRVTenderErrorTemplate, TablesLogic.tUser.Load(rfq.CreatedUserID));
}
else
{
rfq.CRVSyncError = (int)EnumCRVTenderRFQSyncError.SUCCEED;
rfq.CRVSyncErrorNoOfTries = 0;
}
}
else
{
rfq.CRVSyncErrorNoOfTries = rfq.CRVSyncErrorNoOfTries + 1;
if (rfq.CRVSyncErrorNoOfTries == MAX_TRY_NO_RFQ)
rfq.SendMessage(ReleaseCRVTenderErrorTemplate, TablesLogic.tUser.Load(rfq.CreatedUserID));
}
using (Connection c = new Connection())
{
rfq.Save();
c.Commit();
}
continue;
}
if (rfq.CRVSyncError == (int)EnumCRVTenderRFQSyncError.SUBMIT_FOR_APPROVE_REJECT)
{
try
{
rfq.CRVTenderApproveRFQFromReject();
rfq.CRVSyncError = (int)EnumCRVTenderRFQSyncError.SUCCEED;
rfq.CRVSyncErrorNoOfTries = 0;
}
catch
{
rfq.CRVSyncErrorNoOfTries = rfq.CRVSyncErrorNoOfTries + 1;
if (rfq.CRVSyncErrorNoOfTries == MAX_TRY_NO_RFQ)
rfq.SendMessage(CRVTenderRFQSubmitForApprovalFromRejectErrorTemplate, TablesLogic.tUser.Load(rfq.CreatedUserID));
}
using (Connection c = new Connection())
{
rfq.Save();
c.Commit();
}
continue;
}
if (rfq.CRVSyncError == (int)EnumCRVTenderRFQSyncError.AWARD)
{
int? status = rfq.CRVTenderAwardedRFQ();
int? updateCRVVendorStatus = rfq.CRVTenderAwardedRFQUpdateCRVVendor();
if (status != (int)EnumCRVUpdateGroupProcurementInfoStatus.SUCCESSFUL || updateCRVVendorStatus != (int)EnumCRVUpdateTenderVendorAwardStatus.SUCCESSFUL)
{
rfq.CRVSyncErrorNoOfTries = rfq.CRVSyncErrorNoOfTries + 1;
if (rfq.CRVSyncErrorNoOfTries == MAX_TRY_NO_RFQ)
rfq.SendMessage(UpdateCRVGroupProcurementInfoErrorTemplate, TablesLogic.tUser.Load(rfq.CreatedUserID));
}
else
{
rfq.CRVSyncError = (int)EnumCRVTenderRFQSyncError.SUCCEED;
rfq.CRVSyncErrorNoOfTries = 0;
}
using (Connection c = new Connection())
{
rfq.Save();
c.Commit();
}
continue;
}
//.........这里部分代码省略.........
示例12: SavePersonalizationBlob
/// <summary>
/// Saves the personalization data into the database.
/// </summary>
/// <param name="webPartManager"></param>
/// <param name="path"></param>
/// <param name="userName"></param>
/// <param name="dataBlob"></param>
protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
{
using (Connection c = new Connection())
{
userName = Workflow.CurrentUser.UserBase.LoginName;
OUserWebPartsPersonalization p = OUserWebPartsPersonalization.GetPersonalization("", path, userName);
if (p == null)
p = TablesLogic.tUserWebPartsPersonalization.Create();
p.ApplicationName = "";
p.Path = path;
p.UserName = userName;
p.Bytes = dataBlob;
p.Save();
c.Commit();
}
}
示例13: OnExecute
//.........这里部分代码省略.........
{
errorMsg = appendErrorMsg(errorMsg, e.Message);
String emailAdd = OApplicationSetting.Current.EmailForAMOSFailure;
OMessage.SendMail(emailAdd, OApplicationSetting.Current.EmailForAMOSFailure, instancename + ": " + "Read Master Service Error", "Reading Data From " + instancename + ": " + errorMsg);//tessa update 08 Oct 2012
}
#endregion
#region Process ChargeType
foreach (DataRow dr in chargeTypeTable.Rows)
{
try
{
OChargeType chargeType = null;
if (dr["charge_id"].ToString() != "")
{
using (Connection conn = new Connection())
{
chargeType = TablesLogic.tChargeType.Load(TablesLogic.tChargeType.AmosChargeID == dr["charge_id"].ToString() &
TablesLogic.tChargeType.AMOSInstanceID == instancename);//tessa update 08 Oct 2012
if (chargeType == null)
chargeType = TablesLogic.tChargeType.Create();
chargeType.AmosChargeID = Convert.ToInt32(dr["charge_id"].ToString());
chargeType.ObjectName = dr["charge_name"].ToString();
chargeType.AmosAssetTypeID = Convert.ToInt32(dr["asset_type_id"].ToString());
chargeType.updatedOn = Convert.ToDateTime(dr["charge_updatedon"]);
chargeType.FromAmos = 1;
//tessa update 08 Oct 2012 to specify instance name;
chargeType.AMOSInstanceID = instancename;
chargeType.Save();
conn.Commit();
}
}
}
catch (Exception e)
{
errorMsg = appendErrorMsg(errorMsg, e.Message);
String emailAdd = OApplicationSetting.Current.EmailForAMOSFailure;
OMessage.SendMail(emailAdd, OApplicationSetting.Current.EmailForAMOSFailure, instancename + ": " + "Read Master Service Error", "Process ChargeType: " + errorMsg);//tessa update 08 Oct 2012
}
}
#endregion
#region Process Organisation
for (int i = 0; i < orgTable.Rows.Count; i++)
{
DataRow dr = orgTable.Rows[i];
// 2010.05.31
// Optimized by pre-loading up to 200 records
// at one go.
//
if (i % 200 == 0)
{
ArrayList ids = new ArrayList();
for (int j = 0; j < 200 && j + i < orgTable.Rows.Count; j++)
ids.Add(orgTable.Rows[j + i]["org_id"]);
List<OUser> users = TablesLogic.tUser.LoadList(
TablesLogic.tUser.AmosOrgID.In(ids) &
示例14: CreateWork
public string CreateWork(String objectID, String WONumber, String location, String createdby, String createddate, String status, String workdescription, String typeofwork,
String typeofservice, String typeofproblem, String scheduledstart, String scheduledend, int ischargeable)
{
using (Connection c = new Connection())
{
LogicLayer.Workflow.CurrentUser = LogicLayer.TablesLogic.tUser.Load(TablesLogic.tUser.ObjectName == createdby);
LogicLayer.OWork newWork = LogicLayer.TablesLogic.tWork.Create();
newWork.ObjectNumber = WONumber;
OLocation loc = TablesLogic.tLocation.Load(TablesLogic.tLocation.ObjectName == "6 Battery Road");
if (loc != null)
newWork.LocationID = loc.ObjectID;
newWork.WorkDescription = workdescription;
OCode tow = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == typeofwork);
OCode tos = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == typeofservice);
OCode top = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == typeofproblem);
if (tow != null)
newWork.TypeOfWorkID = tow.ObjectID;
if (tos != null)
newWork.TypeOfWorkID = tos.ObjectID;
if (top != null)
newWork.TypeOfWorkID = top.ObjectID;
newWork.ScheduledStartDateTime = Convert.ToDateTime(scheduledstart);
newWork.ScheduledEndDateTime = Convert.ToDateTime(scheduledend);
newWork.IsChargedToCaller = ischargeable;
newWork.SaveAndTransit("SaveAsDraft");
c.Commit();
}
return "";
}
示例15: OnExecute
/// <summary>
/// Executes the service.
/// </summary>
public override void OnExecute()
{
DateTime now = DateTime.Now;
using (Connection c = new Connection())
{
// Gets all the list of positions that are due to be added
// to user's accounts.
//
List<OUserDelegatedPosition> delegatedPositions =
TablesLogic.tUserDelegatedPosition.LoadList(
TablesLogic.tUserDelegatedPosition.DelegatedByUserID != null &
(TablesLogic.tUserDelegatedPosition.AssignedFlag == (int)EnumPositionAssignedFlag.NotAssigned &
TablesLogic.tUserDelegatedPosition.StartDate !=null &
TablesLogic.tUserDelegatedPosition.StartDate < now) |
(TablesLogic.tUserDelegatedPosition.EndDate != null &
TablesLogic.tUserDelegatedPosition.EndDate < now));
List<Guid> userIds = new List<Guid>();
foreach (OUserDelegatedPosition p in delegatedPositions)
{
if (p.StartDate != null && p.StartDate <= now)
p.AssignedFlag = (int)EnumPositionAssignedFlag.Assigned;
if (p.EndDate != null && p.EndDate <= now)
p.AssignedFlag = (int)EnumPositionAssignedFlag.Overdue;
if (p.AssignedFlag == (int)EnumPositionAssignedFlag.Overdue)
p.Deactivate();
else
p.Save();
userIds.Add(p.UserID.Value);
}
// Gets all the list of positions that are due to be removed
// from user's accounts.
//
List<OUserPermanentPosition> permanentPositions =
TablesLogic.tUserPermanentPosition.LoadList(
(TablesLogic.tUserPermanentPosition.AssignedFlag == (int)EnumPositionAssignedFlag.NotAssigned &
TablesLogic.tUserPermanentPosition.StartDate !=null &
TablesLogic.tUserPermanentPosition.StartDate < now) |
(TablesLogic.tUserPermanentPosition.EndDate != null &
TablesLogic.tUserPermanentPosition.EndDate < now));
foreach (OUserPermanentPosition p in permanentPositions)
{
if (p.StartDate != null && p.StartDate <= now)
p.AssignedFlag = (int)EnumPositionAssignedFlag.Assigned;
if (p.EndDate != null && p.EndDate <= now)
p.AssignedFlag = (int)EnumPositionAssignedFlag.Overdue;
if (p.AssignedFlag == (int)EnumPositionAssignedFlag.Overdue)
p.Deactivate();
else
p.Save();
userIds.Add(p.UserID.Value);
}
// Then, load up all affected users and
// perform the activation of the positions.
//
OUser.ActivateAndSaveCurrentPositions(userIds);
c.Commit();
}
}