本文整理汇总了C#中Dbconn.CommitTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# Dbconn.CommitTransaction方法的具体用法?C# Dbconn.CommitTransaction怎么用?C# Dbconn.CommitTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dbconn
的用法示例。
在下文中一共展示了Dbconn.CommitTransaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// 删除系统权限信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM");
try
{
string strAuthorization_ID = m_request.Tables[0].Rows[0]["Authorization_ID"].ToString();
m_request.Tables[0].Columns.Remove("Authorization_ID");
ArrayList listTable = new ArrayList();
listTable.Add("MDM_System_Authorization");
listTable.Add("MDM_System_Menu_AUZ");
conn.BeginTransaction();
conn.TableLock(listTable);
if (strAuthorization_ID != "")
{
string strWhere = " Authorization_ID=" + strAuthorization_ID;
conn.Delete("MDM_System_Authorization", strWhere);
conn.Delete("MDM_System_Menu_AUZ", strWhere);
}
conn.CommitTransaction();
return true;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例2: Execute
/// <summary>
/// 编辑系统属性信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM");
try
{
string strProperty_ID = m_request.Tables[0].Rows[0]["Property_ID"].ToString();
m_request.Tables[0].Columns.Remove("Property_ID");
ArrayList listTable = new ArrayList();
listTable.Add("MDM_System_Property");
conn.BeginTransaction();
conn.TableLock(listTable);
if (strProperty_ID == "")
{
conn.Insert("MDM_System_Property", m_request.Tables[0]);
}
else
{
string strWhere = " Property_ID=" + strProperty_ID;
conn.Update("MDM_System_Property", m_request.Tables[0], strWhere);
}
conn.CommitTransaction();
return true;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例3: Execute
/// <summary>
/// 编辑WS信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("WSRR");
try
{
if(m_request == null
|| m_request.Tables.Count==0
|| m_request.Tables[0].Rows.Count == 0)
{
return true;
}
string strParam_ID = m_request.Tables[0].Rows[0]["Param_ID"].ToString();
ArrayList listTable = new ArrayList();
listTable.Add("WS_Param");
conn.BeginTransaction();
conn.TableLock(listTable);
string strWhere = " Param_ID = '" + strParam_ID + "'";
conn.Delete("WS_Param", strWhere);
conn.CommitTransaction();
return true;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例4: GetData
/// <summary>
/// EnvoTemplates信息的CRUD
/// </summary>
/// <returns></returns>
public DataSet GetData()
{
DataSet ds_Return = new DataSet();
string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
if (strXML == "")
{
throw new Exception("XML不能为空");
}
string strTemplate_ID = m_request.Tables[0].Rows[0]["Template_ID"].ToString();
if (strTemplate_ID == "")
{
throw new Exception("Template_ID不能为空");
}
DataSet ds = Common.Common.GetDSByExcelXML(strXML);
DataTable dt_OPTYPE = ds.Tables["OPTYPE"];
Dbconn conn = new Dbconn("HZY_SDK");
if (dt_OPTYPE.Rows[0][0].ToString().ToUpper() == "INSERT")
{
bool bResult = true;
DataTable dt = new DataTable();
dt.Columns.Add("Template_ID");
dt.Rows.Add(new object[] { strTemplate_ID });
Commom_Ds.SetUpdateInfo(dt, hzyMessage);
conn.BeginTransaction();
bResult = conn.Insert("Log_ViewTemlpates", dt);
conn.ExcuteQuerryByTran("UPDATE EnvoTemplates set ViewCount=ViewCount+1 where Template_ID=" + strTemplate_ID);
conn.CommitTransaction();
if (bResult)
{
dt_EditResult.Rows.Add(new object[] { true, "修改成功" });
}
else
{
dt_EditResult.Rows.Add(new object[] { false, "修改失败" });
}
ds_Return.Tables.Add(dt_EditResult);
}
return ds_Return;
}
示例5: GetData
public DataSet GetData()
{
Dbconn conn = new Dbconn("WSRR");
string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
DataTable dt_EditResult = new dsCommon.dtResultDataTable();
DataSet dsRequest = new DataSet();
DataSet ds_Return = new DataSet();
dsRequest = Common.Common.GetDSByExcelXML(strXML);
DataTable dt_OPTYPE = dsRequest.Tables["OPTYPE"];
DataTable dt_LIST = dsRequest.Tables["LIST"];
for (int i = 0; i < dt_OPTYPE.Rows.Count; i++)
{
//获取用户权限信息
if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET")
{
string strUserName = dt_LIST.Rows[0]["UserName"].ToString();
string strSQL = @"
SELECT DISTINCT
T1.[AUZID]
,T1.[AUZName]
,0 AS Authorization_ID_F
, CASE WHEN T2.USERNAME IS NULL THEN '0'
ELSE '1' END HavaFlag
FROM [WSRR_Manage].[F01_CERT].[AUZ] T1 WITH ( NOLOCK )
LEFT JOIN [WSRR_Manage].[F01_CERT].[UserAUZ] T2 WITH ( NOLOCK ) ON T1.AUZID=T2.AUZID
AND [email protected]";
ds_Return = conn.GetDataSet(strSQL, new string[] { strUserName });
}
//更新用户权限
else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "UPDATE")
{
string strUserName = dt_LIST.Rows[0]["UserName"].ToString();
conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[UserAUZ]");//锁定表
conn.BeginTransaction();
//1.删除该用户的所有权限
string strWhere = " UserName=" + strUserName;
bool deleteFlag = conn.Delete("[WSRR_Manage].[F01_CERT].[UserAUZ]", strWhere);
//2.新增勾选的权限
bool insertFlag = conn.Insert("[WSRR_Manage].[F01_CERT].[UserAUZ]", dt_LIST);
conn.CommitTransaction();
//删除操作和插入操作都正确的情况下
if (deleteFlag && insertFlag)
{
dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新成功!" });
}
else
{
dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新失败!" });
}
ds_Return.Tables.Add(dt_EditResult);
}
}
return ds_Return;
}
示例6: Execute
public Boolean Execute()
{
bool bReturn = true;
string strMessage = "";
try
{
Dbconn conn_DRP_EC = new Dbconn("DRP_EC");
string strDepotID = "";
DataTable dt = conn_DRP_EC.GetDataTable(@"
SELECT [CfgValue]
FROM [DRP_EC].[dbo].[Config]
WHERE Type='StockSync_DRPToWCS'
AND CfgName='Depot'
");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (strDepotID != "")
{
strDepotID += ",";
}
strDepotID += "'" + dt.Rows[i]["CfgValue"].ToString() + "'";
}
string strSQL = @"
SELECT clothingid AS SKU ,
SUM(k_num) AS totalInventory
FROM dbo.j_stock WITH(NOLOCK)
WHERE depotid in (" + strDepotID + @")
GROUP BY clothingid
HAVING SUM(k_num)>0
";
DataTable dt1 = m_conn.GetDataTable(strSQL);
conn_DRP_EC.BeginTransaction();
conn_DRP_EC.InsertBYSQLBC("Put_SkuStock", dt1);
conn_DRP_EC.CommitTransaction();
return bReturn;
}
catch (Exception ex)
{
m_conn.RollbackTransaction();
bReturn = false;
strMessage = ex.ToString();
throw ex;
}
finally
{
//HZY.COM.Common.Log.WirteLogWS(bReturn.ToString() + strMessage,null);
}
}
示例7: GetData
public DataSet GetData()
{
DataSet ds_Return = null;
Dbconn conn = new Dbconn("WSRR_Log");
conn.BeginTransaction();
conn.LockTableList.Add("Log_CallByXML");
conn.LockTableList.Add("Log_CallByXML_His");
string time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss.fff");
DataSet ds = conn.GetDataSetInTrans(@" SELECT
*,
NULL AS ElapsedTime,
NULL AS WS_ID,
NULL AS Session_ID,
NULL AS AppSN
FROM Log_CallByXML WHERE Log_Time<'" + time + "'");
conn.ExcuteQuerryByTran("INSERT INTO Log_CallByXML_HIS SELECT * FROM Log_CallByXML WHERE Log_Time<'" + time + "'");
conn.CommitTransaction();
//开始分析
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string strXML = ds.Tables[0].Rows[i]["XmlInput"].ToString();
string strWS_ID = "";
string strSession_ID = "";
string strAppSN = "";
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strXML);
XmlNode xml = xmlDoc.DocumentElement;
strAppSN = xml.Attributes["App"].Value;
strWS_ID = xml.Attributes["WSID"].Value;
strSession_ID = xml.Attributes["SessionID"].Value;
xml = null;
xmlDoc = null;
}
catch (Exception)
{
}
//ds.Tables[0].Rows
}
return ds_Return;
}
示例8: Execute
/// <summary>
/// 获取系统环境信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM");
try
{
string strEnv_ID = m_request.Tables[0].Rows[0]["Env_ID"].ToString();
string strEnv_SN = m_request.Tables[0].Rows[0]["Env_SN"].ToString();
m_request.Tables[0].Columns.Remove("Env_ID");
ArrayList listTable = new ArrayList();
listTable.Add("MDM_System_Env");
conn.BeginTransaction();
conn.TableLock(listTable);
//核对环境简称是否存在
string strSQL = "SELECT 1 AS a FROM MDM_System_Env where Env_SN='" + strEnv_SN + "'";
if(strEnv_ID != "")
{
strSQL += " AND Env_ID !=" + strEnv_ID;
}
DataTable dtTemp = conn.GetDataTableInTrans(strSQL);
if (dtTemp.Rows.Count > 0)
{
throw new Exception(strEnv_SN + "已存在!");
}
if (strEnv_ID == "")
{
conn.Insert("MDM_System_Env", m_request.Tables[0]);
}
else
{
string strWhere = " Env_ID=" + strEnv_ID;
conn.Update("MDM_System_Env", m_request.Tables[0], strWhere);
}
conn.CommitTransaction();
return true;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例9: Execute
/// <summary>
/// 供销售日报使用
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn_PLM_AS = new Dbconn("F22GP_ForSalesPlan");
DataSet ds = conn_PLM_AS.GetDataSet(
@" SELECT 94 AS Env_ID , --HZY_Sale_Report
null AS VexSSONewID ,
b.userid AS App_UserName ,
RIGHT(sys.fn_VarBinToHexStr(hashbytes('MD5', CONVERT(VARCHAR(100), b.password))), 32) AS App_Password ,
b.password AS App_PasswordSrc ,
b.username AS App_UserName_CN ,
GETDATE() Chang_Password_Time ,
1 Checked ,
'system' Check_User ,
GETDATE() Check_Time ,
GETDATE() Createtime ,
GETDATE() Updatetime
FROM j_depot a ,
j_user b
WHERE a.depotid = b.depotid
AND a.m_type = 11
");
Dbconn connMDM = new Dbconn("VexSSO");
try
{
ArrayList tableList = new ArrayList();
connMDM.BeginTransaction();
tableList.Add("MDM_System_User");
connMDM.TableLock(tableList);
//删除数据
connMDM.ExcuteQuerryByTran(@"DELETE FROM MDM_System_User WHERE ENV_ID=94");
connMDM.InsertBYSQLBC("MDM_System_User", ds.Tables[0]);
connMDM.CommitTransaction();
return true;
}
catch
{
connMDM.RollbackTransaction();
throw;
}
}
示例10: Execute
/// <summary>
/// 编辑系统属性值信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM");
try
{
string strSystem_ID = m_request.Tables[0].Rows[0]["System_ID"].ToString();
string strSystem_Code = m_request.Tables[0].Rows[0]["System_Code"].ToString();
DataTable dt_Add = new DataTable();
dt_Add.Columns.Add("System_ID");
dt_Add.Columns.Add("System_Code");
dt_Add.Columns.Add("Property_ID");
dt_Add.Columns.Add("Property_Text");
for (int i = 2; i < m_request.Tables[0].Columns.Count; i++)
{
string strValue = m_request.Tables[0].Rows[0][i].ToString();
if (strValue != "")
{
dt_Add.Rows.Add(new object[] { strSystem_ID, strSystem_Code, m_request.Tables[0].Columns[i].ToString(),strValue});
}
}
ArrayList listTable = new ArrayList();
listTable.Add("MDM_System_Property_info");
conn.BeginTransaction();
conn.TableLock(listTable);
string strWhere = " System_ID=" + strSystem_ID;
conn.Delete("MDM_System_Property_info", strWhere);
conn.InsertBYSQLBC("MDM_System_Property_info", dt_Add);
conn.CommitTransaction();
return true;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例11: Execute
/// <summary>
/// 删除任务参数信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM"); //创建连接类
try
{
if (m_request == null
|| m_request.Tables.Count == 0
|| m_request.Tables[0].Rows.Count == 0)
{
return true;
}
string strParam_ID = m_request.Tables[0].Rows[0]["param_id"].ToString(); //获取参数Param_ID
string strTASK_ID = m_request.Tables[0].Rows[0]["task_id"].ToString(); //获取参数Task_ID
ArrayList listTable = new ArrayList();
listTable.Add("WS_SchedulingParam");
conn.BeginTransaction(); //开启事务
conn.TableLock(listTable); //锁表WS_SchedulingParam
string strWhere = " Param_ID = '" + strParam_ID + "'"; //创建where语句
conn.Delete("WS_SchedulingParam", strWhere); //删除参数
//更新主表
DataTable dtScheduling = new DataTable();
dtScheduling.Columns.Add("UpdateTime");
DataRow drScheduling = dtScheduling.NewRow();
drScheduling["UpdateTime"] = DateTime.Now;
dtScheduling.Rows.Add(drScheduling);
string strSchedulingWhere = " 1=1 AND TASK_ID = '" + strTASK_ID + "'";
conn.Update("WS_Scheduling", dtScheduling, strSchedulingWhere); //更新数据
conn.CommitTransaction(); //提交事务
return true;
}
catch
{
conn.RollbackTransaction(); //回滚
throw;
}
}
示例12: Execute
/// <summary>
/// 删除任务信息
/// </summary>
/// <returns></returns>
public bool Execute()
{
Dbconn conn = new Dbconn("MDM");
try
{
if (m_request == null
|| m_request.Tables.Count == 0
|| m_request.Tables[0].Rows.Count == 0)
{
return true;
}
string strTASK_ID = m_request.Tables[0].Rows[0]["task_id"].ToString(); //获取参数TASK_ID
ArrayList listTable = new ArrayList();
listTable.Add("WS_Scheduling");
conn.BeginTransaction(); //事物事务
conn.TableLock(listTable); //锁表WS_Scheduling
DataTable dt_Add = new DataTable() ;
dt_Add.Columns.Add("IsDeleted");
dt_Add.Columns.Add("Enabled");
dt_Add.Columns.Add("UpdateUser");
dt_Add.Columns.Add("UpdateTime");
DataRow dr = dt_Add.NewRow();
dr["IsDeleted"] = "True"; //将删除标志设为“True”
dr["Enabled"] = "False"; //将可用标志设为“False”
dr["UpdateTime"]=DateTime.Now; //更新时间设为当前时间
dr["UpdateUser"] = hzyMessage.User_Name; //设置更新者
dt_Add.Rows.Add(dr);
string strWhere = " TASK_ID = '" + strTASK_ID + "'";
conn.Update("WS_Scheduling", dt_Add, strWhere); //更新操作
conn.CommitTransaction(); //提交事务
return true;
}
catch
{
conn.RollbackTransaction(); //回滚
throw;
}
}
示例13: Execute
/// <summary>
/// 对CFG_RequestType的CRUD,为Easyui专用
/// </summary>
/// <returns></returns>
public bool Execute()
{
DateTime time = DateTime.Now;
Dbconn conn = new Dbconn("VexSSO");
conn.LockTableList.Add("SSO_Login");
conn.BeginTransaction();
conn.TableLock();
string strSQL = @"
UPDATE dbo.SSO_Login
SET Logout_Time='" + time.ToString("yyyy-MM-dd HH:mm:ss.fff")+ @"',
MARK='SYSTEM'
WHERE Last_Request_Time<='" + time.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss.fff") + @"'
AND Logout_Time IS NULL
";
conn.ExcuteQuerryByTran(strSQL);
conn.CommitTransaction();
return true ;
}
示例14: Execute
public bool Execute()
{
Dbconn conn = new Dbconn("AM");
Dbconn connMDM = new Dbconn("VexSSO");
conn.BeginTransaction();
connMDM.BeginTransaction();
try
{
DataSet ds = conn.GetDataSet(
@"
DECLARE @maxid AS BINARY(10);
SELECT t1.[__$start_lsn] AS LogID,
t1.[__$seqval] ,
t1.[__$operation] OprationType ,
t1.CN_ID ,
t1.CN_LOGIN ,
t1.CN_USER_NAME ,
t1.CN_PASSWORD ,
Convert(int,t1.CN_ISDELETE) as CN_ISDELETE ,
Convert(int,t1.CN_DISABLED) as CN_DISABLED
INTO #tmp
FROM [cdc].[dbo_TN_SYS_EM_USER_CT] t1 ,
[M01_CONF].[S01_Sync] t2
WHERE 1=1
AND t1.[__$start_lsn]> ISNULL(t2.MaxStart_lsn,0x00023FE600000FBF0004)
AND t2.SyncName='MDM数据获取'
AND t1.[__$update_mask] !=0x00004000
AND t1.[__$update_mask] !=0x00800000
AND t1.[__$update_mask] !=0x00804000
SELECT @maxid=MAX(LogID)
FROM #tmp
if(@maxid is not null)
begin
UPDATE [M01_CONF].[S01_Sync] SET [email protected]
WHERE SyncName='MDM数据获取'
end
select * from #tmp
order by [LogID] ASC,[__$seqval] ASC ,[OprationType] ASC
");
string strSQL = "";
Byte[] strMaxID = null;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
strMaxID = (Byte[])ds.Tables[0].Rows[i]["LogID"];
string strCN_LOGIN = ds.Tables[0].Rows[i]["CN_LOGIN"].ToString();
string strCN_PASSWORD = ds.Tables[0].Rows[i]["CN_PASSWORD"].ToString();
string strCN_ISDELETE = ds.Tables[0].Rows[i]["CN_ISDELETE"].ToString();
string strOprationType = ds.Tables[0].Rows[i]["OprationType"].ToString();
if (strOprationType == "1" || strOprationType == "4") //添加或者更新
{
if (connMDM.GetDataTableRowCount("select 1 as a from MDM_Employees where [email protected]", new string[] { strCN_LOGIN }) == 0)
{
strSQL = @"INSERT INTO MDM_Employees (Name,SSO_UserName,SSO_Password,Leave_Flag,IsActived)
Values(@param0,@param1,@param2,@param3,'1')";
}
else
{
strSQL = @"update MDM_Employees
SET [email protected],[email protected]
WHERE [email protected]
";
}
connMDM.ExcuteQuerryByTran(strSQL, new string[] { strCN_LOGIN, strCN_LOGIN, strCN_PASSWORD, strCN_ISDELETE });
}
else if (strOprationType == "2" || strOprationType == "3") //删除
{
strSQL = @"update MDM_Employees
SET [email protected]
WHERE [email protected]";
connMDM.ExcuteQuerryByTran(strSQL, new string[] { "1", strCN_LOGIN });
}
}
if (strMaxID != null)
{
strSQL = "UPDATE M01_CONF.S01_Sync SET [email protected],LastSyncTime=getdate() WHERE SyncName='MDM数据获取'";
conn.ExcuteQuerryByTran(strSQL, new object[] { strMaxID });
}
conn.CommitTransaction();
connMDM.CommitTransaction();
return true;
}
catch
{
//.........这里部分代码省略.........
示例15: GetData
//.........这里部分代码省略.........
}
else
{
strCode = "0";
}
if (!dt.Columns.Contains("PRA_LmDt"))
{
dt.Columns.Add("PRA_LmDt");
}
if (!dt.Columns.Contains("PRA_UptNo"))
{
dt.Columns.Add("PRA_UptNo");
}
// if (!dt.Columns.Contains("PRA_Status"))
// {
// dt.Columns.Add("PRA_Status");
// }
// dt.Rows[0]["PRA_Status"] = '0';
dt.Rows[0]["PRA_LmDt"] = DateTime.Now;
dt.Rows[0]["PRA_UptNo"] = strCode;
}
conn.Update("B02_Bill.PRA_ArrivalPlan", dt, "PRA_ArrivalPlanId='" + ds.Tables["LIST"].Rows[i]["PRA_ArrivalPlanId"].ToString() + @"'");
}
else //add
{
string PRA_ArrivalPlanId = Guid.NewGuid().ToString();
if (!dt.Columns.Contains("PRA_ArrivalPlanId"))
{
dt.Columns.Add("PRA_ArrivalPlanId");
}
// if (!dt.Columns.Contains("PRA_Status"))
// {
// dt.Columns.Add("PRA_Status");
// }
if (!dt.Columns.Contains("PRA_RgDt"))
{
dt.Columns.Add("PRA_RgDt");
}
if (!dt.Columns.Contains("PRA_LmDt"))
{
dt.Columns.Add("PRA_LmDt");
}
if (!dt.Columns.Contains("PRA_UptNo"))
{
dt.Columns.Add("PRA_UptNo");
}
dt.Rows[0]["PRA_ArrivalPlanId"] = PRA_ArrivalPlanId;
dt.Rows[0]["PRA_RgDt"] = DateTime.Now;
dt.Rows[0]["PRA_LmDt"] = DateTime.Now;
dt.Rows[0]["PRA_UptNo"] = '0';
// dt.Rows[0]["PRA_Status"] = '0';
conn.Insert("B02_Bill.PRA_ArrivalPlan", dt);
}
}
}
conn.CommitTransaction();
ds_Return = Common.Common.GetRequestDataSet(new string[] { "Result" }, new string[] { "true" });
}
catch
{
conn.RollbackTransaction();
//事物结束
throw;
}
}
return ds_Return;
}
catch
{
throw;
}
}