本文整理汇总了C#中SQLHandler.GetTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHandler.GetTransaction方法的具体用法?C# SQLHandler.GetTransaction怎么用?C# SQLHandler.GetTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLHandler
的用法示例。
在下文中一共展示了SQLHandler.GetTransaction方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveServiceItem
public void SaveServiceItem(AspxCommonInfo aspxCommonObj, int categoryId, List<ServiceItemInfo> serviceInfo)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction)sqlH.GetTransaction();
try
{
AspxServiceProvider.SaveServiceItem(aspxCommonObj, categoryId, serviceInfo, tran);
tran.Commit();
}
catch (Exception e)
{
tran.Rollback();
throw e;
}
}
示例2: SaveCartPricingRule
public static int SaveCartPricingRule(CartPricingRuleInfo objCartPriceRule, AspxCommonInfo aspxCommonObj, List<int> parentID)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction)sqlH.GetTransaction();
try
{
int cartPriceRuleID = -1;
cartPriceRuleID = AspxCartPriceRuleProvider.CartPriceRuleAdd(objCartPriceRule.CartPriceRule, tran, aspxCommonObj);
AspxCartPriceRuleProvider.RuleConditionAdd(objCartPriceRule.LstRuleCondition, cartPriceRuleID, parentID, tran, aspxCommonObj);
foreach (CartPriceRuleRole cartPriceRuleRole in objCartPriceRule.LstCartPriceRuleRoles)
{
cartPriceRuleRole.CartPriceRuleID = cartPriceRuleID;
AspxCartPriceRuleProvider.CartPriceRuleRoleAdd(cartPriceRuleRole, tran, aspxCommonObj);
}
//foreach (CartPriceRuleStore cartPriceRuleStore in objCartPriceRule.LstCartPriceRuleStores)
//{
// cartPriceRuleStore.CartPriceRuleID = cartPriceRuleID;
// AspxCartPriceRuleProvider.CartPriceRuleStoreAdd(cartPriceRuleStore, tran, aspxCommonObj);
//}
tran.Commit();
return cartPriceRuleID;
}
catch (SqlException sqlEX)
{
tran.Rollback();
throw new ArgumentException(sqlEX.Message);
}
catch (Exception ex)
{
tran.Rollback();
throw ex;
}
}
示例3: AddModuleWebInfo
public static void AddModuleWebInfo(List<ModuleWebInfo> list)
{
string sp = "[dbo].[usp_ModuleWebInfoDelete]";
SQLHandler sagesql = new SQLHandler();
DbTransaction transaction = sagesql.GetTransaction();
try
{
sagesql.ExecuteNonQuery(sp);
sp = "[dbo].[usp_ModuleWebInfoAdd]";
foreach (ModuleWebInfo Obj in list)
{
List<KeyValuePair<string, object>> ParamCollInput = new List<KeyValuePair<string, object>>();
ParamCollInput.Add(new KeyValuePair<string, object>("@ModuleID", Obj.ModuleID));
ParamCollInput.Add(new KeyValuePair<string, object>("@ModuleName", Obj.ModuleName));
ParamCollInput.Add(new KeyValuePair<string, object>("@ReleaseDate", Obj.ReleaseDate));
ParamCollInput.Add(new KeyValuePair<string, object>("@Description", Obj.Description));
ParamCollInput.Add(new KeyValuePair<string, object>("@Version", Obj.Version));
ParamCollInput.Add(new KeyValuePair<string, object>("@DownloadUrl", Obj.DownloadUrl));
sagesql.ExecuteNonQuery(sp, ParamCollInput);
}
sagesql.CommitTransaction(transaction);
}
catch (Exception ex)
{
sagesql.RollbackTransaction(transaction);
throw ex;
}
}
示例4: AddOrderDetails
public void AddOrderDetails(OrderDetailsCollection orderData)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction)sqlH.GetTransaction();
//AspxCommerceSession sn = new AspxCommerceSession();
if (orderData.ObjOrderDetails.InvoiceNumber == null || orderData.ObjOrderDetails.InvoiceNumber == "")
{
orderData.ObjOrderDetails.InvoiceNumber = DateTime.Now.ToString("yyyyMMddhhmmss");
}
try
{
AspxOrderDetails ObjOrderDetails = new AspxOrderDetails();
int billingAddressID = 0;
int shippingAddressId = 0;
int orderID = 0;
if (orderData.ObjOrderDetails.IsMultipleCheckOut == false)
{
if (orderData.ObjBillingAddressInfo.IsBillingAsShipping == true)
{
if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0 &&
int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
{
int addressID = ObjOrderDetails.AddAddress(orderData, tran);
billingAddressID = ObjOrderDetails.AddBillingAddress(orderData, tran, addressID);
shippingAddressId = ObjOrderDetails.AddShippingAddress(orderData, tran, addressID);
}
}
else
{
if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0)
billingAddressID = ObjOrderDetails.AddBillingAddress(orderData, tran);
if (int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
{
if (!orderData.ObjOrderDetails.IsDownloadable)
{
shippingAddressId = ObjOrderDetails.AddShippingAddress(orderData, tran);
}
}
}
}
int paymentMethodID = ObjOrderDetails.AddPaymentInfo(orderData, tran);
if (billingAddressID > 0)
{
orderID = ObjOrderDetails.AddOrder(orderData, tran, billingAddressID, paymentMethodID);
//sn.SetSessionVariable("OrderID", orderID);
SetSessionVariable("OrderID", orderID);
orderData.ObjOrderDetails.OrderID = orderID;
SetSessionVariable("OrderCollection", orderData);
}
else
{
orderID = ObjOrderDetails.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodID);
//sn.SetSessionVariable("OrderID", orderID);
SetSessionVariable("OrderID", orderID);
orderData.ObjOrderDetails.OrderID = orderID;
SetSessionVariable("OrderCollection", orderData);
}
if (shippingAddressId > 0)
ObjOrderDetails.AddOrderItems(orderData, tran, orderID, shippingAddressId);
else
ObjOrderDetails.AddOrderItemsList(orderData, tran, orderID);
tran.Commit();
}
catch (SqlException sqlEX)
{
throw new ArgumentException(sqlEX.Message);
}
catch (Exception ex)
{
tran.Rollback();
throw ex;
}
}
示例5: AddUpdatePages
public void AddUpdatePages(PageEntity objPage)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction();
try
{
List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>(
"@PageID", objPage.PageID),
new KeyValuePair<string, object>(
"@PageOrder", objPage.PageOrder),
new KeyValuePair<string, object>(
"@PageName", objPage.PageName.ToString()),
new KeyValuePair<string, object>(
"@IsVisible", objPage.IsVisible),
new KeyValuePair<string, object>(
"@ParentID", objPage.ParentID),
new KeyValuePair<string, object>(
"@IconFile", objPage.IconFile.ToString()),
new KeyValuePair<string, object>(
"@DisableLink", objPage.DisableLink),
new KeyValuePair<string, object>(
"@Title", objPage.Title.ToString()),
new KeyValuePair<string, object>(
"@Description", objPage.Description.ToString()),
new KeyValuePair<string, object>(
"@KeyWords", objPage.KeyWords.ToString()),
new KeyValuePair<string, object>(
"@Url", objPage.Url.ToString()),
new KeyValuePair<string, object>(
"@StartDate", objPage.StartDate.ToString()),
new KeyValuePair<string, object>(
"@EndDate", objPage.EndDate.ToString()),
new KeyValuePair<string, object>(
"@RefreshInterval",
objPage.RefreshInterval),
new KeyValuePair<string, object>(
"@PageHeadText",
objPage.PageHeadText.ToString()),
new KeyValuePair<string, object>(
"@IsSecure", objPage.IsSecure),
new KeyValuePair<string, object>(
"@IsActive", objPage.IsActive),
new KeyValuePair<string, object>(
"@IsShowInFooter",
objPage.IsShowInFooter),
new KeyValuePair<string, object>(
"@IsRequiredPage",
objPage.IsRequiredPage),
new KeyValuePair<string, object>(
"@BeforeID", objPage.BeforeID),
new KeyValuePair<string, object>(
"@AfterID", objPage.AfterID),
new KeyValuePair<string, object>(
"@PortalID", objPage.PortalID),
new KeyValuePair<string, object>(
"@AddedBy", objPage.AddedBy.ToString()),
new KeyValuePair<string, object>(
"@IsAdmin", objPage.IsAdmin),
};
int pageID = 0;
pageID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "sp_AddUpdatePage", ParaMeterCollection, "@InsertedPageID");
if (pageID > 0)
{
// objPage.PortalID = objPage.PortalID == -1 ? 1 : objPage.PortalID;
AddUpdatePagePermission(objPage.LstPagePermission, tran, pageID, objPage.PortalID, objPage.AddedBy, objPage.IsAdmin);
if (!objPage.IsAdmin)
{
if (objPage.Mode == "A")
{
MenuPageUpdate(objPage.MenuList, tran, pageID);
}
}
if (objPage.MenuList != "0")
{
AddUpdateSelectedMenu(objPage.MenuList, tran, pageID, objPage.ParentID, objPage.Mode, objPage.Caption, objPage.PortalID, objPage.UpdateLabel);
}
}
tran.Commit();
}
catch (SqlException sqlEx)
{
tran.Rollback();
throw sqlEx;
}
catch (Exception ex)
{
throw ex;
}
}
示例6: AddMenuPermission
/// <summary>
/// Connect to database and add menu permissions.
/// </summary>
/// <param name="lstMenuPermissions">List of MenuPermissionInfo class.</param>
/// <param name="MenuID">MenuID</param>
/// <param name="PortalID">PortalID</param>
public static void AddMenuPermission(List<MenuPermissionInfo> lstMenuPermissions, int MenuID, int PortalID)
{
SQLHandler sagesql = new SQLHandler();
SqlTransaction tran = (SqlTransaction)sagesql.GetTransaction();
try
{
string sp = "[dbo].[usp_MenuMgrMenuPermissionDelete]";
List<KeyValuePair<string, object>> ParaMeterColl = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>("@MenuID",
MenuID),
new KeyValuePair<string, object>("@PortalID",
PortalID)
};
sagesql.ExecuteNonQuery(tran, CommandType.StoredProcedure, sp,
ParaMeterColl);
foreach (MenuPermissionInfo menu in lstMenuPermissions)
{
List<KeyValuePair<string, object>> ParamCollInput = new List<KeyValuePair<string, object>>();
ParamCollInput.Add(new KeyValuePair<string, object>("@MenuID", MenuID));
ParamCollInput.Add(new KeyValuePair<string, object>("@PermissionID", menu.PermissionID));
ParamCollInput.Add(new KeyValuePair<string, object>("@AllowAccess", menu.AllowAccess));
ParamCollInput.Add(new KeyValuePair<string, object>("@RoleId", menu.RoleID == null ? Guid.Empty : new Guid(menu.RoleID)));
ParamCollInput.Add(new KeyValuePair<string, object>("@UserName", menu.Username));
ParamCollInput.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
sagesql.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_MenuMgrAddMenuPermission]", ParamCollInput);
}
tran.Commit();
}
catch (Exception)
{
tran.Rollback();
throw;
}
}
示例7: AddNewMenu
/// <summary>
/// Connect to database and add new menu.
/// </summary>
/// <param name="lstMenuPermissions">List of menu permission.</param>
/// <param name="MenuName">Menu name.</param>
/// <param name="MenuType">Menu type.</param>
/// <param name="IsDefault">true for default menu.</param>
/// <param name="PortalID">PortalID</param>
public static void AddNewMenu(List<MenuPermissionInfo> lstMenuPermissions, string MenuName, string MenuType, bool IsDefault, int PortalID)
{
string sp = "[dbo].[usp_MenuMgrAddNewMenu]";
SQLHandler sagesql = new SQLHandler();
int MenuID = 0;
SqlTransaction tran = (SqlTransaction)sagesql.GetTransaction();
try
{
List<KeyValuePair<string, object>> ParamCollInput = new List<KeyValuePair<string, object>>();
ParamCollInput.Add(new KeyValuePair<string, object>("@MenuName", MenuName));
ParamCollInput.Add(new KeyValuePair<string, object>("@MenuType", MenuType));
ParamCollInput.Add(new KeyValuePair<string, object>("@IsDefault", IsDefault));
ParamCollInput.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
MenuID = sagesql.ExecuteNonQuery(sp, ParamCollInput, "@MenuID");
foreach (MenuPermissionInfo menu in lstMenuPermissions)
{
List<KeyValuePair<string, object>> ParamColl = new List<KeyValuePair<string, object>>();
ParamColl.Add(new KeyValuePair<string, object>("@MenuID", MenuID));
ParamColl.Add(new KeyValuePair<string, object>("@PermissionID", menu.PermissionID));
ParamColl.Add(new KeyValuePair<string, object>("@AllowAccess", menu.AllowAccess));
ParamColl.Add(new KeyValuePair<string, object>("@RoleId", menu.RoleID == null ? Guid.Empty : new Guid(menu.RoleID)));
ParamColl.Add(new KeyValuePair<string, object>("@UserName", menu.Username));
ParamColl.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
sagesql.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_MenuMgrAddMenuPermission]", ParamColl);
}
tran.Commit();
}
catch (Exception)
{
throw;
}
}
示例8: AddOrderDetails
public int AddOrderDetails(OrderDetailsCollection orderData)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction)sqlH.GetTransaction();
//AspxCommerceSession sn = new AspxCommerceSession();
orderData.Coupons = CheckOutSessions.Get<List<CouponSession>>("CouponSession");
if (orderData.ObjOrderDetails.InvoiceNumber == null || orderData.ObjOrderDetails.InvoiceNumber == "")
{
orderData.ObjOrderDetails.InvoiceNumber = DateTime.Now.ToString("yyyyMMddhhmmss");
}
try
{
int billingAddressID = 0;
int shippingAddressId = 0;
int orderID = 0;
if (orderData.ObjOrderDetails.IsMultipleCheckOut == false)
{
if (int.Parse(orderData.ObjBillingAddressInfo.AddressID) == 0 &&
int.Parse(orderData.ObjShippingAddressInfo.AddressID) == 0)
{
billingAddressID = AspxOrderController.AddBillingAddress(orderData, tran);
if (!orderData.ObjOrderDetails.IsShippingAddressRequired)
{
shippingAddressId = AspxOrderController.AddShippingAddress(orderData, tran);
}
}
else
{
billingAddressID = AspxOrderController.AddBillingAddress(orderData, tran, int.Parse(orderData.ObjBillingAddressInfo.AddressID));
if (!orderData.ObjOrderDetails.IsDownloadable && !orderData.ObjOrderDetails.IsShippingAddressRequired)
{
shippingAddressId = AspxOrderController.AddShippingAddress(orderData, tran, int.Parse(orderData.ObjShippingAddressInfo.AddressID));
}
}
}
int paymentMethodID = AspxOrderController.AddPaymentInfo(orderData, tran);
if (billingAddressID > 0)
{
orderID = AspxOrderController.AddOrder(orderData, tran, billingAddressID, paymentMethodID);
//sn.SetSessionVariable("OrderID", orderID);
SetSessionVariable("OrderID", orderID);
orderData.ObjOrderDetails.OrderID = orderID;
SetSessionVariable("OrderCollection", orderData);
}
else
{
orderID = AspxOrderController.AddOrderWithMultipleCheckOut(orderData, tran, paymentMethodID);
//sn.SetSessionVariable("OrderID", orderID);
SetSessionVariable("OrderID", orderID);
orderData.ObjOrderDetails.OrderID = orderID;
SetSessionVariable("OrderCollection", orderData);
}
foreach (OrderTaxInfo item in orderData.ObjOrderTaxInfo)
{
int itemID = item.ItemID;
int taxManageRuleID = item.TaxManageRuleID;
decimal taxSubTotal = item.TaxSubTotal;
int storeID = item.StoreID;
int portalID = item.PortalID;
string addedBy = item.AddedBy;
string costVariantValueIDs = item.CostVariantsValueIDs;
OrderTaxRuleMapping(itemID, orderID, taxManageRuleID, taxSubTotal, storeID, portalID, addedBy, costVariantValueIDs);
}
if (shippingAddressId > 0)
AspxOrderController.AddOrderItems(orderData, tran, orderID, shippingAddressId);
else
AspxOrderController.AddOrderItemsList(orderData, tran, orderID);
//add every paymentgateway
// GiftCardController.IssueGiftCard(orderData.LstOrderItemsInfo, orderData.ObjCommonInfo.StoreID,
// orderData.ObjCommonInfo.PortalID,orderData.ObjCommonInfo.AddedBy, orderData.ObjCommonInfo.CultureName);
tran.Commit();
return orderID;
}
catch (SqlException sqlEX)
{
throw new ArgumentException(sqlEX.Message);
}
catch (Exception ex)
{
tran.Rollback();
throw ex;
}
}
示例9: SaveCartPricingRule
public int SaveCartPricingRule(CartPricingRuleInfo objCartPriceRule, Int32 storeID, Int32 portalID, string userName, string culture, object parentID)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction) sqlH.GetTransaction();
PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider();
try
{
int cartPriceRuleID = -1;
cartPriceRuleID = priceRuleSqlProvider.CartPriceRuleAdd(objCartPriceRule.CartPriceRule, tran, portalID,userName, culture);
priceRuleSqlProvider.RuleConditionAdd(objCartPriceRule.lstRuleCondition,cartPriceRuleID,parentID, tran, portalID, userName,culture);
foreach (CartPriceRuleRole cartPriceRuleRole in objCartPriceRule.lstCartPriceRuleRoles)
{
cartPriceRuleRole.CartPriceRuleID = cartPriceRuleID;
priceRuleSqlProvider.CartPriceRuleRoleAdd(cartPriceRuleRole, tran, portalID, userName,culture);
}
foreach (CartPriceRuleStore cartPriceRuleStore in objCartPriceRule.lstCartPriceRuleStores)
{
cartPriceRuleStore.CartPriceRuleID = cartPriceRuleID;
priceRuleSqlProvider.CartPriceRuleStoreAdd(cartPriceRuleStore, tran, portalID, userName,culture);
}
tran.Commit();
return cartPriceRuleID;
}
catch (SqlException sqlEX)
{
tran.Rollback();
throw new ArgumentException(sqlEX.Message);
}
catch (Exception ex)
{
tran.Rollback();
throw ex;
}
}
示例10: AddOrderDetails
public void AddOrderDetails(OrderDetailsCollection OrderData)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran;
tran = (SqlTransaction)sqlH.GetTransaction();
WcfSession sn = new WcfSession();
try
{
ASPXOrderDetails objOrderDetails = new ASPXOrderDetails();
int billingAddressID = 0;
int shippingAddressId = 0;
int orderID = 0;
if (OrderData.objOrderDetails.IsMultipleCheckOut == false)
{
if (OrderData.objBillingAddressInfo.IsBillingAsShipping == true)
{
if (int.Parse(OrderData.objBillingAddressInfo.AddressID) == 0 &&
int.Parse(OrderData.objShippingAddressInfo.AddressID) == 0)
{
int addressID = objOrderDetails.AddAddress(OrderData, tran);
billingAddressID = objOrderDetails.AddBillingAddress(OrderData, tran, addressID);
shippingAddressId = objOrderDetails.AddShippingAddress(OrderData, tran, addressID);
}
}
else
{
if (int.Parse(OrderData.objBillingAddressInfo.AddressID) == 0)
billingAddressID = objOrderDetails.AddBillingAddress(OrderData, tran);
if (int.Parse(OrderData.objShippingAddressInfo.AddressID) == 0)
shippingAddressId = objOrderDetails.AddShippingAddress(OrderData, tran);
}
}
int paymentMethodID = objOrderDetails.AddPaymentInfo(OrderData, tran);
if (billingAddressID > 0)
{
orderID = objOrderDetails.AddOrder(OrderData, tran, billingAddressID, paymentMethodID);
sn.SetSessionVariable("OrderID", orderID);
}
else
{
orderID = objOrderDetails.AddOrderWithMultipleCheckOut(OrderData, tran, paymentMethodID);
sn.SetSessionVariable("OrderID", orderID);
}
if (shippingAddressId > 0)
objOrderDetails.AddOrderItems(OrderData, tran, orderID, shippingAddressId);
else
objOrderDetails.AddOrderItemsList(OrderData, tran, orderID);
tran.Commit();
}
catch (SqlException sqlEX)
{
throw new ArgumentException(sqlEX.Message);
}
catch (Exception ex)
{
tran.Rollback();
throw ex;
}
}
示例11: UpdateUserModule
public static void UpdateUserModule(UserModuleInfo module)
{
SQLHandler sqlH = new SQLHandler();
SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction();
try
{
List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>(
"@UserModuleID", module.UserModuleID),
new KeyValuePair<string, object>(
"@ModuleDefID", module.ModuleDefID),
new KeyValuePair<string, object>(
"@UserModuleTitle", module.UserModuleTitle),
new KeyValuePair<string, object>(
"@AllPages", module.AllPages),
new KeyValuePair<string, object>(
"@ShowInPages", module.ShowInPages),
new KeyValuePair<string, object>(
"@InheritViewPermissions", module.InheritViewPermissions),
new KeyValuePair<string, object>(
"@IsActive", module.IsActive),
new KeyValuePair<string, object>(
"@AddedOn", DateTime.Now),
new KeyValuePair<string, object>(
"@PortalID", module.PortalID),
new KeyValuePair<string, object>(
"@AddedBy", module.PortalID),
new KeyValuePair<string, object>(
"@SEOName", module.SEOName),
new KeyValuePair<string,object>(
"@IsHandheld",module.IsHandheld),
new KeyValuePair<string,object>(
"@SuffixClass",module.SuffixClass),
new KeyValuePair<string,object>(
"@HeaderText",module.HeaderText),
new KeyValuePair<string,object>(
"@ShowHeaderText",module.ShowHeaderText)
};
sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "[dbo].[usp_UserModulesUpdate]", ParaMeterCollection);
if (module.InheritViewPermissions)
{
UpdateUserModuleInheritedPermission(module.PageID, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID);
}
else
{
UpdateUserModulePermission(module.LSTUserModulePermission, tran, module.UserModuleID, module.PortalID, module.AddedBy, module.ModuleDefID);
}
tran.Commit();
}
catch (SqlException sqlEx)
{
tran.Rollback();
throw sqlEx;
}
catch (Exception ex)
{
throw ex;
}
}