本文整理汇总了C#中DCFactory.SetCommit方法的典型用法代码示例。如果您正苦于以下问题:C# DCFactory.SetCommit方法的具体用法?C# DCFactory.SetCommit怎么用?C# DCFactory.SetCommit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCFactory
的用法示例。
在下文中一共展示了DCFactory.SetCommit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddWebServiceLog
public static void AddWebServiceLog(DateTime searchDate, string partNumber, string manufacturer, string clientIP, string ClientID)
{
using (var dc = new DCFactory<LogDataContext>())
{
dc.DataContext.ExecuteCommand(
"insert into SearchSparePartsWebServiceLog (SearchDate,PartNumber,Manufacturer,ClientIP, ClientID) values ({0},{1},{2},{3},{4})",
searchDate, partNumber, manufacturer, clientIP, ClientID);
dc.SetCommit();
}
}
示例2: AddLog
public static void AddLog( DateTime searchDate, string partNumber, string clientIP )
{
using (var dc = new DCFactory<LogDataContext>())
{
dc.DataContext.ExecuteCommand(
"insert into SearchSparePartsLog (SearchDate,PartNumber,ClientIP) values ({0},{1},{2})",
searchDate, partNumber, clientIP );
dc.SetCommit();
}
}
示例3: btnSave_Click
protected void btnSave_Click( object sender, EventArgs e )
{
using (var DC = new DCFactory<StoreDataContext>())
{
try
{
byte newPrc = Convert.ToByte(txtPrcExcessPriceConfig.Text);
DC.DataContext.spUpdUSPrcExcessPrice(SiteContext.Current.User.UserId, newPrc);
phSaveOK.Visible = true;
DC.SetCommit();
}
catch
{
phSaveError.Visible = true;
}
}
}
示例4: _listView_ItemCommand
protected void _listView_ItemCommand(object sender, ListViewCommandEventArgs e)
{
var row = e.Item.Controls[1].Controls[0];
var o = ((DropDownList)row.FindControl("_StatusBoxList")).SelectedValue;
var oID = ((HtmlInputHidden)row.FindControl("OrderLineID")).Value;
int i;
byte StatusID;
if (int.TryParse(oID, out i) && byte.TryParse(o, out StatusID))
{
using (var ctxStore = new DCFactory<StoreDataContext>())
{
OrderLine CurOrderLine = ctxStore.DataContext.OrderLines.Where(x => x.OrderLineID == i).FirstOrDefault();
CurOrderLine.ChangeLiteStatus(StatusID);
CurOrderLine.CurrentStatusDate = DateTime.Today;
ctxStore.DataContext.SubmitChanges();
ctxStore.SetCommit();
// var pos = Array.IndexOf(CurrentOrderLines, CurrentOrderLines.Where(x => x.OrderLineID == i).FirstOrDefault() );
//CurrentOrderLines[pos].CurrentStatus = StatusID; // Класть сюда весь объект нельзя, так как он будет использоваться после диспоузинга датаконтекста
}
}
}
示例5: SaveStatusChanges
public void SaveStatusChanges()
{
var mas = SavedStatuses.Value.Split(';');
if (mas.Length > 1)
{
using (var ctxStore = new DCFactory<StoreDataContext>())
{
foreach (var pair in mas)
{
var curPair = pair.Split(',');
int i;
byte StatusID;
if (int.TryParse(curPair[0], out i) && byte.TryParse(curPair[1], out StatusID))
{
OrderLine CurOrderLine = ctxStore.DataContext.OrderLines.Where(x => x.OrderLineID == i).FirstOrDefault();
CurOrderLine.ChangeLiteStatus(StatusID);
CurOrderLine.CurrentStatusDate = DateTime.Today;
ctxStore.DataContext.SubmitChanges();
ctxStore.SetCommit();
}
}
CurrentOrderLines = null;
}
}
}
示例6: AcceptOnlineAccessOffer
public static string AcceptOnlineAccessOffer(Guid maintUid, string username, string password, Boolean expiredAllow)
{
//var maintEntry = GetEntry(maintUid, expiredAllow);
//if (maintEntry.EntryPurpose != UserMaintEntryPurpose.ActivateClient && maintEntry.EntryPurpose != UserMaintEntryPurpose.ExistingClientWebAccess ||
// string.IsNullOrEmpty(maintEntry.ClientID))
// throw new BLException("Некорректное состояние регистрационных данных");
//var regData = maintEntry.RegistrationData;
//if(regData == null || string.IsNullOrEmpty(regData.Email))
// throw new BLException("Некорректное состояние регистрационных данных");
//if (UserDac.GetUserByClientId(maintEntry.ClientID) != null && !string.IsNullOrEmpty(UserDac.GetUserByClientId(maintEntry.ClientID).Username))
// throw new BLException("Учетная запись сайта уже существует для данного клиента");
var maintEntry = GetEntry(maintUid, expiredAllow);
if (maintEntry.EntryPurpose != UserMaintEntryPurpose.ExistingClientWebAccess && !maintEntry.UserID.HasValue)
throw new BLException("Некорректное состояние регистрационных данных");
var regData = maintEntry.RegistrationDataExt;
if (regData == null || string.IsNullOrEmpty(regData.Email))
throw new BLException("Некорректное состояние регистрационных данных");
if (!string.IsNullOrEmpty(UserDac.GetUserByUserId(maintEntry.UserID.Value).Username))
throw new BLException("Учетная запись сайта уже существует для данного клиента");
string clientId = UserDac.GetUserByUserId(maintEntry.UserID.Value).AcctgID;
using(var mtx = new DCFactory<StoreDataContext>(System.Data.IsolationLevel.ReadCommitted,false, null, true))
{
mtx.DataContext.spUpdUsersNamePswd( /*maintEntry.ClientID*/clientId, username, password.GetMD5Hash());
//UserDac.AddUser(
// new User
// {
// Username = username,
// Password = password.GetMD5Hash(),
// Role = SecurityRole.Client,
// AcctgID = maintEntry.ClientID
// },
// mtx.DataContext );
UserMaintDac.DeleteEntry(maintEntry.EntryUid, mtx.DataContext);
mtx.DataContext.spUpdUserEmail(maintEntry.ClientID, maintEntry.RegistrationData.Email);
mtx.SetCommit();
}
//Здесь возращаем не maintEntry.ClientId, а clientId, так как он еще не заполнен в UserMaintEntries
return clientId;
}
示例7: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
using (var dc = new DCFactory<StoreDataContext>())
{
//dc.DataContext.Log = new DebuggerWriter();
var user = dc.DataContext.Users.Where(x => x.UserID == data.Profile.UserId).FirstOrDefault();
user.ClientGroup = int.Parse(_clientGroupName.SelectedValue);
data.Profile.ClientGroup = (RmsAuto.Acctg.ClientGroup)(int.Parse(_clientGroupName.SelectedValue));
user.IsChanged = true;
user.IsChecked = chbIsChecked.Checked;
data.Profile.IsChecked = chbIsChecked.Checked;
//if (data.Profile.Category == ClientCategory.PhysicalIP)
//{
data.Profile.ClientName = txtClientName.Text;//_ClientNameIP.Text;
//}
// dc.DataContext.SubmitChanges();
data.Profile.ContactPersonSurname = _ContactLastName.Text;
data.Profile.ContactPersonName = _ContactFirstName.Text;
// _ContactMiddleName.Text = data.Profile.ContactMiddleName;
data.Profile.ContactPersonPhone = _ContactPhone.Text;
data.Profile.ContactPersonExtPhone = _ContactExtPhone.Text;
data.Profile.ContactPersonFax = _ContactFax.Text;
// data.Profile.ScheduleOfice = _ScheduleOfice.Text;
//data.Profile.ScheduleStock = _ScheduleStock.Text;
data.Profile.ShippingAddress = _ShippingAddress.Text;
data.Profile.ScopeType = _ScopeType.Text;
data.Profile.DiscountCardNumber = _DiscountCardNumber.Text;
data.Profile.HowKnow = _HowKnow.Text;
data.Profile.ContactPosition = _ContactPosition.Text;
data.Profile.DirectorLastName = _txtDirectorLastName.Text;
data.Profile.DirectorFirstName = _txtDirectorFirstName.Text;
//DiscountCardNumber = _discountCardNumber.Value,
//INN = (ClientCategory == ClientCategory.PhysicalIP ? _txtINNPIP.Text : _txtINNLegal.Text),
data.Profile.BankAddress = _txtBankAddress.Text;
data.Profile.CompanyName = txtClientName.Text;
data.Profile.BankName = _txtBankName.Text;
data.Profile.IBAN = _txtIBAN.Text;
data.Profile.SWIFT = _txtSWIFT.Text;
data.Profile.DirectorName = _txtDirectorFirstName.Text;
data.Profile.DirectorSurname = _txtDirectorLastName.Text;
data.Profile.CorrespondentBankName = _txtCorrespondentBankName.Text;
data.Profile.CorrespondentIBAN = _txtCorrespondentIBAN.Text;
data.Profile.CorrespondentSWIFT = _txtCorrespondentSWIFT.Text;
data.Profile.CorrespondentBankAddress = _txtCorrespondentBankAddrss.Text;
//using (dcCommonDataContext DC = new dcCommonDataContext())
//{
// var bank = DC.spSelBankInfoByBIC(_txtIBAN.Text).FirstOrDefault();
// if (bank != null)
// {
// bank.BankInfo_Acc = _BankKS.Text;
// bank.BankInfo_Name = _BankName.Text;
// }
// else
// {
// _BankBIC.Text = "Неверный БИК";
// }
//}
//data.Profile.BalanceManLastName = _txtBalanceManLastName.Text;
//data.Profile.BalanceManFirstName = _tctBalanceManFirstName.Text;
//data.Profile.BalanceManMiddleName = _txtBalanceManMiddleName.Text;
//data.Profile.BalanceManPhone = _txtBalanceManPhone.Text;
//data.Profile.BalanceManPosition = _txtBalanceManPosition.Text;
//data.Profile.BalanceManEmail = _txtBalanceManEmail.Text;
data.Profile.Email = _Email.Text;
//data.Profile.DirectorPosition = _txtDirectorPosition.Text;
dc.DataContext.spUpdUsersLight(data.Profile.AcctgId, data.Profile.ClientName, data.Profile.Email, (byte)data.Profile.TradingVolume, (byte)data.Profile.Category,
data.Profile.CountryID, data.Profile.RegionID, data.Profile.Locality, data.Profile.ContactPersonSurname, data.Profile.ContactPersonName, "" /*data.Profile.ContactMiddleName*/,
data.Profile.ContactPersonPhone, data.Profile.ContactPersonExtPhone, data.Profile.ScopeType, data.Profile.HowKnow, data.Profile.ManagerId, "", data.Profile.IsChecked, data.Profile.IsRestricted,
(int)data.Profile.ClientGroup, data.Profile.PrepaymentPercent, data.Profile.PersonalMarkup, data.Profile.ContactPersonFax, data.Profile.ScheduleOfice, data.Profile.ScheduleStock, data.Profile.ShippingAddress,
data.Profile.RmsStoreId, data.Profile.DiscountCardNumber, data.Profile.ContactPersonPosition, data.Profile.LegalName, data.Profile.INN, data.Profile.OGRNIP, data.Profile.KPP, data.Profile.OGRN,
data.Profile.NDSAggent, data.Profile.OficialAddress, data.Profile.RealAddress, data.Profile.Account, data.Profile.BankBIC, data.Profile.BankINN, data.Profile.DirectorPosition,
data.Profile.DirectorLastName, data.Profile.DirectorFirstName, data.Profile.DirectorMiddleName, data.Profile.BalanceManPosition,
data.Profile.BalanceManLastName, data.Profile.BalanceManFirstName, data.Profile.BalanceManMiddleName,
data.Profile.BalanceManPhone, data.Profile.BalanceManEmail, data.Profile.ReclamationPeriod);
dc.SetCommit();
}
//TODO сделать возможность в фабрике управлять connection string: чтобы иметь возможность выставить свойство MultipleActiveResultSet (MARS)
// для того чтобы сделать оба действия в транзакции см. выше и ниже
using (var dc = new DCFactory<StoreDataContext>(false))
{
string query = @"exec dbo.spLightUpdAutoOrder {0}, {1}";
dc.DataContext.ExecuteCommand(query, SiteContext.Current.CurrentClient.Profile.UserId, false /* chbIsAutoOrder.Checked */);
}
using (var dc = new DCFactory<StoreDataContext>(false))
{
string query = @"exec dbo.spLightUpdClientName {0}, {1}";
//.........这里部分代码省略.........
示例8: _listView_ItemCommand
protected void _listView_ItemCommand(object sender, ListViewCommandEventArgs e)
{
var row = e.Item.Controls[1].Controls[0];
var o = ((DropDownList)row.FindControl("_StatusBoxList")).SelectedValue;
var oID = ((HyperLink)row.FindControl("_orderLink")).Text.Split(' ')[1].TrimStart('№');
byte i;
byte StatusID;
if (byte.TryParse(oID, out i) && byte.TryParse(o, out StatusID))
{
using (var ctxStore = new DCFactory<StoreDataContext>())
{
List<OrderLine> OrderLinesLoaded = ctxStore.DataContext.OrderLines.Where(x => x.OrderID == i).ToList();
foreach (OrderLine ordln in OrderLinesLoaded)
{
ordln.CurrentStatus = StatusID;
ordln.CurrentStatusDate = DateTime.Today;
ctxStore.DataContext.SubmitChanges();
ctxStore.SetCommit();
}
}
}
}