本文整理汇总了C#中Dbconn.GetDataTableFirstValue方法的典型用法代码示例。如果您正苦于以下问题:C# Dbconn.GetDataTableFirstValue方法的具体用法?C# Dbconn.GetDataTableFirstValue怎么用?C# Dbconn.GetDataTableFirstValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dbconn
的用法示例。
在下文中一共展示了Dbconn.GetDataTableFirstValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMerchatCode
public string GetMerchatCode(string strBody_Id_0001, Dbconn conn, string strParentID)
{
string strCode = "";
string str = "";
if (strParentID != "")
{
//查找上级加盟商的最大值
str = conn.GetDataTableFirstValue(@"SELECT MAX(加盟商编码) FROM MDM_Market2.dbo.V_L0006
WHERE 父加盟商='" + strParentID + "'").ToString();
if (str == "")
{
//检查加盟商是否存在
str = conn.GetDataTableFirstValue(@"SELECT MAX(加盟商编码) FROM MDM_Market2.dbo.V_L0006
WHERE 加盟商编码='" + strParentID + "'").ToString();
if (str == "")
{
throw new Exception("父加盟商不正确");
}
strCode = strParentID + "1";
}
else if (str.Length != 5)
{
throw new Exception("父加盟商不正确");
}
else
{
strCode = strParentID + Convert.ToInt32(str.Substring(4, 1) + 1).ToString();
if (strCode.Length == 6)
{
throw new Exception(strParentID + "的二级加盟商不允许超过10个,请联系IT部");
}
}
}
else
{
str = conn.GetDataTableFirstValue(@"SELECT MAX(加盟商编码) FROM MDM_Market2.dbo.V_L0006
WHERE body_id_0001='" + strBody_Id_0001 + "'").ToString();
if (str == "")
{
str = conn.GetDataTableFirstValue(@"SELECT 公司前缀 FROM MDM_Market2.dbo.V_0001
WHERE body_id='" + strBody_Id_0001 + "'").ToString();
if (str == "")
{
throw new Exception("公司的前缀没有设置,请先设置公司前缀");
}
strCode = str.Substring(0, 1) + "0000";
}
else
{
strCode = str.Substring(0, 1) + (Convert.ToInt32(str.Substring(1)) + 1).ToString("0000");
}
}
return strCode;
}
示例2: GetData
//.........这里部分代码省略.........
int nSeq_ID = Convert.ToInt32(dt.Rows[0]["Seq_Index"]);
//判断是否已经进行后续的审批
string strSql = "SELECT '1' as A from Check_List WHERE Check_Type='" + dt.Rows[0]["Check_Type"].ToString() + @"'
AND Key_ID='" + dt.Rows[0]["Key_ID"].ToString() + @"'
AND Check_Result is not null
AND Seq_Index>" + nSeq_ID.ToString() + "";
if (conn.GetDataTableRowCount(strSql) > 0)
{
throw new Exception("下一道的流程已经审批,本次审批不能再做修改!");
}
dtCheckList.Rows[0]["Check_User"] = strCheck_User;
dtCheckList.Rows[0]["Check_Date"] = DateTime.Now;
dtCheckList.Rows[0]["Check_Result"] = strCheck_Result;
dtCheckList.Rows[0]["Remark"] = strCheck_RemarK;
dtCheckList.Rows[0]["updateTime"] = DateTime.Now;
ArrayList listTable = new ArrayList();
listTable.Add("Check_List");
try
{
conn.BeginTransaction();
conn.TableLock(listTable);
//判断数据是否为最新数据
strSql = "SELECT timestamps+0 as timestamps from " + strRequestTableName
+ " WHERE Deleted=0 AND " + strKeyColumn + "='" + strKey_Value + "'";
string strTimestamps = conn.GetDataTableFirstValue(strSql).ToString();
if (strTimestamps != ds.Tables["LIST"].Rows[0]["timestamps"].ToString())
{
throw new Exception("原申请单数据已被修改,请刷新后重试!");
}
//dt.Columns.Remove("timestamps");
conn.Update("Check_List", dtCheckList, "ID='" + strCheck_ID + "'");
string[] strColumn = new string[3];
string[] strValue = new string[3];
strColumn[0] = "Check_Type";
strColumn[1] = "Seq_Name";
strColumn[2] = "Key_ID";
strValue[0] = dt.Rows[0]["Check_Type"].ToString();
strValue[1] = dt.Rows[0]["Seq_Name"].ToString();
strValue[2] = dt.Rows[0]["Key_ID"].ToString();
DataSet requestDs = Common.Common.GetRequestDataSet(strColumn, strValue);
ITSM_Check_List_Edit checkListEdit = new ITSM_Check_List_Edit();
checkListEdit.Conn = conn;
checkListEdit.ListAMSendList = listAMSendList;
checkListEdit.Request = requestDs;
checkListEdit.Execute();
if (strCheck_Result != "同意")
{
//更新原表的状态为已驳回
strSql = "UPDATE " + strRequestTableName + " SET State='已驳回' WHERE Deleted=0 AND " + strKeyColumn + "='" + strKey_Value + "'";
conn.ExcuteQuerryByTran(strSql);
}
示例3: UpdateFullText
public static void UpdateFullText(string pstrWSID, Dbconn pconn)
{
string strSQL = @"
DECLARE @cols NVARCHAR(MAX)
SET @cols = ''
SELECT @cols = @cols + 'convert(varchar(1000),isnull(' + name
+ ',''''),21)+'' ''+'
FROM syscolumns
WHERE ( id = ( SELECT id
FROM sysobjects
WHERE ( name = 'WS0E_WSExtDoc' )
) )
SELECT @cols as A
";
string strInfoColumns = pconn.GetDataTableFirstValue(strSQL).ToString();
strSQL = strInfoColumns.Substring(0, strInfoColumns.Length - 1);
strSQL = "SELECT " + strSQL + " FROM [B01_MDM].[WS0E_WSExtDoc] WHERE [email protected]";
string strValue = pconn.GetDataTableFirstValue(strSQL, new string[] { pstrWSID }).ToString();
strSQL = @"
DECLARE @cols NVARCHAR(MAX)
SET @cols = ''
SELECT @cols = @cols + 'convert(varchar(1000),isnull(' + name
+ ',''''),21)+'' ''+'
FROM syscolumns
WHERE ( id = ( SELECT id
FROM sysobjects
WHERE ( name = 'WS0M_WSMethodDoc' )
) )
SELECT @cols as A
";
string strFunctionColumns = pconn.GetDataTableFirstValue(strSQL).ToString();
strSQL = "SELECT " + strFunctionColumns.Substring(0, strFunctionColumns.Length - 1) + " AS A FROM [B01_MDM].[WS0M_WSMethodDoc] WHERE [email protected]";
DataTable dt = pconn.GetDataTable(strSQL, new string[] { pstrWSID });
for (int i = 0; i < dt.Rows.Count; i++)
{
strValue += " " + dt.Rows[i]["A"].ToString();
}
strSQL = " SELECT 1 AS A FROM [B05_RPT].[WS0V_WSMethodView] WHERE [email protected]";
if (pconn.GetDataTableRowCount(strSQL, new string[] { pstrWSID }) == 1)
{
pconn.ExcuteQuerryByTran("UPDATE [B05_RPT].[WS0V_WSMethodView] SET [email protected] WHERE [email protected]", new string[] { strValue, pstrWSID });
}
else
{
pconn.ExcuteQuerryByTran("INSERT INTO [B05_RPT].[WS0V_WSMethodView](fulltext,WSID)Values(@Param0,@PARAM1)", new string[] { strValue, pstrWSID });
}
}
示例4: GetStoreCode
private string GetStoreCode(string str加盟商Body_id,Dbconn conn)
{
string strReturn = "";
string strMaxCode = "";
if (m_MaxCodeName.Contains(str加盟商Body_id))
{
strMaxCode = m_MaxCode[m_MaxCodeName.IndexOf(str加盟商Body_id)].ToString();
}
else
{
strMaxCode = conn.GetDataTableFirstValue(@"
SELECT MAX(t2.Value_Text) AS code
FROM dbo.MDM_L0013_B t1
LEFT JOIN dbo.MDM_0006_E t2 ON t1.Body_ID_0006 = t2.Body_ID
WHERE Body_ID_0010 = '" + str加盟商Body_id + @"' AND Property_ID IN (
SELECT Property_ID
FROM dbo.Lib_ExdPropertyList
WHERE Class_Name = '0006' AND Property_Name = '店铺ID' )
").ToString();
if (strMaxCode == "")
{
//根据加盟商名称获取加盟商编号
string str加盟商编号 = conn.GetDataTableFirstValue(@"
SELECT Value_Text FROM dbo.MDM_0010_E
WHERE Body_ID='" + str加盟商Body_id + @"'
AND Property_ID IN (
SELECT Property_ID FROM dbo.Lib_ExdPropertyList
WHERE Class_Name='0010'
AND Property_Name='加盟商编码'
)
").ToString();
if (str加盟商编号.Length == 5)
{
strMaxCode = str加盟商编号 + "000";
}
else //二级加盟商
{
strMaxCode = str加盟商编号 + "00";
}
}
}
strReturn = strMaxCode.Substring(0, 5) + (Convert.ToInt32(strMaxCode.Substring(5)) + 1).ToString().PadLeft(3, '0');
if (m_MaxCodeName.Contains(str加盟商Body_id))
{
m_MaxCode[m_MaxCodeName.IndexOf(str加盟商Body_id)] = strReturn;
}
else
{
m_MaxCodeName.Add(str加盟商Body_id);
m_MaxCode.Add(strReturn);
}
return strReturn;
}
示例5: GetData
/// <summary>
/// 根据MDM销售大区来编辑Entity
/// </summary>
/// <returns></returns>
public DataSet GetData()
{
Dbconn conn = new Dbconn("MDM_Master");
try
{
string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
string strEntityCode = "0018";
string strMarketTableName = "SaleArea_For_FM";
DataSet ds = Common.Common.GetDSByExcelXML(strXML);
//获取销售大区的所有属性
MDM_Entity_Market_PropertyList clsPropertyList = new MDM_Entity_Market_PropertyList();
clsPropertyList.Request = Common.Common.GetRequestDataSet(new string[2] { "Entity", "MarketTableName" }, new string[2] { strEntityCode, strMarketTableName });
DataTable dt_PropertyList = clsPropertyList.GetData().Tables[0];
//修改销售大区数据
DataTable dtSaleArea = new DataTable(strEntityCode);
dtSaleArea.Namespace = "CN"; //定义表达方式
DataTable dtSaleAreaLink = new DataTable("L0014");
dtSaleAreaLink.Namespace = "CN"; //定义表达方式
dtSaleAreaLink.Columns.Add("Body_ID");
dtSaleAreaLink.Columns.Add("Body_ID_0008");
dtSaleAreaLink.Columns.Add("Body_ID_0018");
bool bCreateTable = true;
for (int i = 0; i < ds.Tables["LIST"].Rows.Count; i++)
{
DataRow dr = dtSaleArea.NewRow();
DataRow drLink = dtSaleAreaLink.NewRow();
//drLink["body_ID"] = ds.Tables["LIST"].Rows[i]["body_ID"].ToString();
drLink["Body_ID_0008"] = ds.Tables["LIST"].Rows[i]["Body_ID_0008"].ToString();
if (drLink["Body_ID_0008"].ToString() == "")
{
throw new Exception("店铺品牌的Body_ID不能为空!");
}
dtSaleAreaLink.Rows.Add(drLink);
if (bCreateTable)
{
dtSaleArea.Columns.Add("body_ID");
}
dr["body_ID"] = ds.Tables["LIST"].Rows[i]["body_ID_0018"].ToString();
for (int j = 0; j < ds.Tables["LIST"].Columns.Count; j++)
{
string strColumnName = ds.Tables["LIST"].Columns[j].ColumnName;
//如果修改的列是属于品牌信息的话,要对品牌的Entity进行修改
DataRow[] drList = dt_PropertyList.Select("Table_Property_Name = '" + strColumnName + "'");
if (drList.Length > 0)
{
string strPorpertyname = drList[0]["Porperty_Name"].ToString();
if (bCreateTable)
{
dtSaleArea.Columns.Add(strPorpertyname);
}
dr[strPorpertyname] = ds.Tables["LIST"].Rows[i][j].ToString();
}
}
dtSaleArea.Rows.Add(dr);
bCreateTable = false;
}
DataSet dsRequest = new DataSet();
dsRequest.Tables.Add(dtSaleArea);
MDM_Entity_Edit cls_Entity_Edit = new MDM_Entity_Edit();
cls_Entity_Edit.Request = dsRequest;
cls_Entity_Edit.GetDataByRequestDs = true;
cls_Entity_Edit.Execute();
ArrayList listBody_0018 = cls_Entity_Edit.BodyID; //获取品牌的BODYID
//修改LINK数据
for (int i = 0; i < listBody_0018.Count; i++)
{
dtSaleAreaLink.Rows[i]["Body_ID_0018"] = listBody_0018[i].ToString();
//到表里查找Link的BodyID
string strSQL = "SELECT Body_ID FROM MDM_L0014_B WHERE Body_ID_0018='" + listBody_0018[i].ToString() + "'";
string strLinkBodyID = conn.GetDataTableFirstValue(strSQL).ToString();
//.........这里部分代码省略.........
示例6: Execute
public bool Execute()
{
string strEnv_ID = "";
string strEnv_SN = "HZY_CMT";
Dbconn conn_HZY_SBS = new Dbconn("F22GP_ForSalesPlan");
DataSet ds = conn_HZY_SBS.GetDataSet(
@" SELECT
--98 AS Env_ID ,
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 ,
CASE WHEN b.dptype <> 0 THEN ISNULL(a.depotid,'') + '_' + d_name ELSE b.username END AS App_UserName_CN ,
GETDATE() Chang_Password_Time ,
1 Checked ,
'system' Check_User ,
GETDATE() Check_Time ,
GETDATE() Createtime ,
GETDATE() Updatetime,
0 as oprationFlag
FROM
j_user b
LEFT JOIN j_depot a ON a.depotid = b.depotid
");
Dbconn connMDM = new Dbconn("VexSSO");
try
{
ArrayList tableList = new ArrayList();
connMDM.BeginTransaction();
tableList.Add("MDM_System_User");
connMDM.TableLock(tableList);
strEnv_ID = connMDM.GetDataTableFirstValue("SELECT [Env_ID] FROM [MDM_System_Env] WHERE Env_SN='" + strEnv_SN + "'").ToString();
DataTable dtMDM = connMDM.GetDataTable(@"
SELECT [App_UserID]
,[Env_ID]
,[VexSSONewID]
,[App_UserName]
,[App_Password]
,[App_PasswordSrc]
,[App_UserName_CN]
,[Chang_Password_Time]
,[Checked]
,[Check_User]
,[Check_Time]
,[Createtime]
,[Updatetime]
FROM [dbo].[MDM_System_User]
WHERE Env_ID='" + strEnv_ID + @"'
");
DataTable dtMDMUpdate = dtMDM.Clone();
DataTable dtMDMInsert = dtMDM.Clone();
DataTable dtMDMDelete = dtMDM.Clone();
for (int i = 0; i < dtMDM.Rows.Count; i++)
{
string strApp_UserName = dtMDM.Rows[i]["App_UserName"].ToString();
DataRow[] dr = ds.Tables[0].Select("App_UserName='" + strApp_UserName + "'");
if (dr.Length > 0)
{
dtMDM.Rows[i]["App_Password"] = dr[0]["App_Password"];
dtMDM.Rows[i]["App_PasswordSrc"] = dr[0]["App_PasswordSrc"];
dtMDM.Rows[i]["App_UserName_CN"] = dr[0]["App_UserName_CN"];
dtMDMUpdate.ImportRow(dtMDM.Rows[i]);
dr[0]["oprationFlag"] = "1";
}
else
{
dtMDMDelete.ImportRow(dtMDM.Rows[i]);
}
}
DataRow[] drInsert = ds.Tables[0].Select("oprationFlag=0");
for (int i = 0; i < drInsert.Length; i++)
{
DataRow dr = dtMDMInsert.NewRow();
dr["Env_ID"] = strEnv_ID;
dr["VexSSONewID"] = drInsert[i]["VexSSONewID"];
dr["App_UserName"] = drInsert[i]["App_UserName"];
dr["App_Password"] = drInsert[i]["App_Password"];
dr["App_PasswordSrc"] = drInsert[i]["App_PasswordSrc"];
dr["App_UserName_CN"] = drInsert[i]["App_UserName_CN"];
dr["Chang_Password_Time"] = drInsert[i]["Chang_Password_Time"];
dr["Checked"] = drInsert[i]["Checked"];
dr["Check_User"] = drInsert[i]["Check_User"];
dr["Check_Time"] = drInsert[i]["Check_Time"];
dr["Createtime"] = drInsert[i]["Createtime"];
dr["Updatetime"] = drInsert[i]["Updatetime"];
dtMDMInsert.Rows.Add(dr);
}
//.........这里部分代码省略.........
示例7: Execute
public bool Execute()
{
string strEnv_ID = "";
string strEnv_SN = "EP_PLMFZ";
Dbconn conn_PLM_AS = new Dbconn("PLM_AS");
DataSet ds = conn_PLM_AS.GetDataSet(
@" SELECT
--44 as Env_ID,
null as VexSSONewID,
username as App_UserName,
RIGHT(sys.fn_VarBinToHexStr(hashbytes('MD5', convert(vARCHAR(100),PASSWORD))), 32) as App_Password,
PASSWORD as App_PasswordSrc,
userNameC as App_UserName_CN,
getdate() Chang_Password_Time ,
1 Checked ,
'system' Check_User ,
getdate() Check_Time ,
getdate() Createtime ,
getdate() Updatetime,
0 as oprationFlag
FROM PLMAss.dbo.USERINFO u
");
Dbconn connMDM = new Dbconn("VexSSO");
try
{
ArrayList tableList = new ArrayList();
connMDM.BeginTransaction();
tableList.Add("MDM_System_User");
connMDM.TableLock(tableList);
strEnv_ID = connMDM.GetDataTableFirstValue("SELECT [Env_ID] FROM [MDM_System_Env] WHERE Env_SN='" + strEnv_SN + "'").ToString();
DataTable dtMDM = connMDM.GetDataTable(@"
SELECT [App_UserID]
,[Env_ID]
,[VexSSONewID]
,[App_UserName]
,[App_Password]
,[App_PasswordSrc]
,[App_UserName_CN]
,[Chang_Password_Time]
,[Checked]
,[Check_User]
,[Check_Time]
,[Createtime]
,[Updatetime]
FROM [dbo].[MDM_System_User]
WHERE Env_ID='" + strEnv_ID + @"'
");
DataTable dtMDMUpdate = dtMDM.Clone();
DataTable dtMDMInsert = dtMDM.Clone();
DataTable dtMDMDelete = dtMDM.Clone();
for (int i = 0; i < dtMDM.Rows.Count; i++)
{
string strApp_UserName = dtMDM.Rows[i]["App_UserName"].ToString();
DataRow[] dr = ds.Tables[0].Select("App_UserName='" + strApp_UserName + "'");
if (dr.Length > 0)
{
dtMDM.Rows[i]["App_Password"] = dr[0]["App_Password"];
dtMDM.Rows[i]["App_PasswordSrc"] = dr[0]["App_PasswordSrc"];
dtMDM.Rows[i]["App_UserName_CN"] = dr[0]["App_UserName_CN"];
dtMDMUpdate.ImportRow(dtMDM.Rows[i]);
dr[0]["oprationFlag"] = "1";
}
else
{
dtMDMDelete.ImportRow(dtMDM.Rows[i]);
}
}
DataRow[] drInsert = ds.Tables[0].Select("oprationFlag=0");
for (int i = 0; i < drInsert.Length; i++)
{
DataRow dr = dtMDMInsert.NewRow();
dr["Env_ID"] = strEnv_ID;
dr["VexSSONewID"] = drInsert[i]["VexSSONewID"];
dr["App_UserName"] = drInsert[i]["App_UserName"];
dr["App_Password"] = drInsert[i]["App_Password"];
dr["App_PasswordSrc"] = drInsert[i]["App_PasswordSrc"];
dr["App_UserName_CN"] = drInsert[i]["App_UserName_CN"];
dr["Chang_Password_Time"] = drInsert[i]["Chang_Password_Time"];
dr["Checked"] = drInsert[i]["Checked"];
dr["Check_User"] = drInsert[i]["Check_User"];
dr["Check_Time"] = drInsert[i]["Check_Time"];
dr["Createtime"] = drInsert[i]["Createtime"];
dr["Updatetime"] = drInsert[i]["Updatetime"];
dtMDMInsert.Rows.Add(dr);
}
//.........这里部分代码省略.........
示例8: GetData
public DataSet GetData()
{
try
{
DataSet ds = new DataSet();
DataSet ds_Return = new DataSet();
string strXML = "";
strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
ds = Common.Common.GetDSByExcelXML(strXML);
DataTable dtOPTYPE = ds.Tables["OPTYPE"];
DataTable dtList = ds.Tables["List"];
var strzt = dtList.Rows[0]["zt"].ToString();//获取帐套
conn = new Dbconn("PLM_AS_" + strzt);
if (dtOPTYPE.Rows[0][0].ToString().ToUpper() == "SendAM".ToUpper())
{
string strProductName = dtList.Rows[0]["ProductName"].ToString();
string strUserPost = conn.GetDataTableFirstValue(@"
SELECT UserPost
FROM Userinfo
WHERE username = @Param0
", new string[] { m_hzyMessage.User_Name }).ToString();
string strUserNameC = conn.GetDataTableFirstValue(@"
SELECT UserNameC
FROM Userinfo
WHERE username = @Param0
", new string[] { m_hzyMessage.User_Name }).ToString();
string strSQL = @"
SELECT Designer,DesignerId,OrderSeason,producttype,part, brand FROM dbo.FLEXPLMProduct
WHERE [email protected]"
;
DataTable dt = conn.GetDataTable(strSQL, new string[] { strProductName });
for (int i = 0; i < dt.Rows.Count; i++)
{
string strContent = @"{6}你好:{0}于{1}变更了设计号为{2}的款式信息,变更后信息为:
<p> 设计号:{2}<p>
<p> 订货会季节:{3}<p>
<p> 款式类型:{4}<p>
<p> 款式类别:{5}<p>
<p> 请及时跟踪!<p>
";
string strDesigner = dt.Rows[i]["Designer"].ToString();
string strBrand = dt.Rows[i]["brand"].ToString();
if (strDesigner != strUserNameC)
{
string strContentSend = string.Format(strContent, new string[] { strUserNameC, DateTime.Now.ToString("yyyy年MM月dd日"),
dt.Rows[i]["DesignerId"].ToString(),
dt.Rows[i]["OrderSeason"].ToString(),
dt.Rows[i]["producttype"].ToString(),
dt.Rows[i]["part"].ToString() ,
strDesigner});
if (Common.Common.m_RouteCode != null && Common.Common.m_RouteCode.ToUpper() == "PROD")
{
AM.AMSendMsg.Send("AM", "PLMAS", strDesigner, "PLM系统", strContentSend, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
else
{
AM.AMSendMsg.Send("AM", "PLMAS", "马卫清", "PLM系统", strContentSend, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
}
DataTable dt1 = conn.GetDataTable(@"
SELECT UserNameC FROM dbo.USERINFO
WHERE UserPost='版师助理'
AND [email protected]
", new string[] { strBrand });
for (int j = 0; j < dt1.Rows.Count; j++)
{
strDesigner = dt1.Rows[j][0].ToString();
string strContentSend = string.Format(strContent, new string[] { strUserNameC, DateTime.Now.ToString("yyyy年MM月dd日"),
dt.Rows[i]["DesignerId"].ToString(),
dt.Rows[i]["OrderSeason"].ToString(),
dt.Rows[i]["producttype"].ToString(),
dt.Rows[i]["part"].ToString(),
strDesigner });
//正式库
if (Common.Common.m_RouteCode != null && Common.Common.m_RouteCode.ToUpper() == "PROD")
{
AM.AMSendMsg.Send("AM", "PLMAS", strDesigner, "PLM系统", strContentSend, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
else//其他系统
{
AM.AMSendMsg.Send("AM", "PLMAS", "卞磊", "PLM系统", strContentSend, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//.........这里部分代码省略.........
示例9: isnull
public string Get拓展类型Changed(string strBody_Id_0006, string str拓展类型, Dbconn conn)
{
string strDepotName = conn.GetDataTableFirstValue(@"SELECT 店铺ID +' '+ isnull(店铺名称,'') as 店铺名称 FROM MDM_Market2.dbo.MKT_0006
WHERE body_id='" + strBody_Id_0006 + @"'
AND 拓展类型 <> '" + str拓展类型 + "'").ToString();
return strDepotName;
}
示例10: Getdata
private void Getdata()
{
string strConnstr = ConfigurationManager.AppSettings["ConnectionString_POS"];
Dbconn conn = new Dbconn(strConnstr,true);
string strPhone = this.txtPhone.Text;
if (strPhone.Trim() != "")
{
string strName = conn.GetDataTableFirstValue(@"SELECT vipname as 姓名, mobtel as 手机号, vipcode as 卡号 FROM vip_user WHERE [email protected] OR [email protected]", new string[] { strPhone }).ToString();
this.lblName.Text = strName;
DataSet ds = conn.GetDataSet(@"SELECT b.ticketid AS 券号 ,
a.sums AS 面值 ,
CASE ISNULL(b.getsure,0)WHEN 0 THEN '否' ELSE '是' END AS 是否使用 ,
b.crdate AS 创建日期 ,
b.verifycode AS 验证码,a.mobtel, a.vipcode, a.vipid
FROM vip_user a
INNER JOIN vip_ticket b ON a.vipid = b.vipid
WHERE b.tictypeid = '31'
AND ([email protected] OR [email protected])
ORDER BY b.crdate DESC
", new string[] { strPhone });
RpList.DataSource = ds.Tables[0];
RpList.DataBind();
if (ds.Tables[0].Rows.Count == 0)
{
this.lblMessage.Text = "<font color='red'>没有查询到手机号/卡号为" + strPhone + "的相关信息,请重试</font>";
}
else
{
this.lblMessage.Text = "";
}
}
else
{
this.lblMessage.Text = "";
RpList.DataSource = new DataTable();
RpList.DataBind();
}
}
示例11: GetData
/// <summary>
/// 根据MDM国家区域信息来编辑Entity
/// </summary>
/// <returns></returns>
public DataSet GetData()
{
Dbconn conn = new Dbconn("MDM_Master");
try
{
string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
DataSet ds = Common.Common.GetDSByExcelXML(strXML);
GetEntityCode(ds);
if (m_EntityCode_S == "")
{
return new DataSet();
}
ds.Tables["LIST"].Columns.Remove("type");
//获所有属性
MDM_Entity_Market_PropertyList clsPropertyList = new MDM_Entity_Market_PropertyList();
clsPropertyList.Request = Common.Common.GetRequestDataSet(new string[2] { "Entity", "MarketTableName" }, new string[2] { m_EntityCode_S, m_MKTTableName });
DataTable dt_PropertyList = clsPropertyList.GetData().Tables[0];
//修改国家数据
string strUpdateXML = "<table Entity=\"" + m_EntityCode_S + "\" Expression=\"CN\">";
for (int i = 0; i < ds.Tables["LIST"].Rows.Count; i++)
{
strUpdateXML += "<row>";
strUpdateXML += "<body_ID>" + ds.Tables["LIST"].Rows[i]["body_ID_" + m_EntityCode_S].ToString() + "</body_ID>";
for (int j = 0; j < ds.Tables["LIST"].Columns.Count; j++)
{
string strColumnName = ds.Tables["LIST"].Columns[j].ColumnName;
//如果修改的列是属于国家信息的话,要对洲的Entity进行修改
DataRow[] drList = dt_PropertyList.Select("Table_Property_Name = '" + strColumnName + "'");
if (drList.Length > 0)
{
string strPorpertyname = drList[0]["Porperty_Name"].ToString();
strUpdateXML += "<" + strPorpertyname + ">" + ds.Tables["LIST"].Rows[i][j].ToString() + "</" + strPorpertyname + ">";
}
}
strUpdateXML += "</row>";
}
strUpdateXML += "</table>";
MDM_Entity_Edit cls_Entity_Edit = new MDM_Entity_Edit();
cls_Entity_Edit.Request = Common.Common.GetRequestDataSet(new string[1] { "XML" }, new string[1] { strUpdateXML });
cls_Entity_Edit.Execute();
ArrayList alBodyID = cls_Entity_Edit.BodyID;
//修改国家与洲的Link
strUpdateXML = "<table Entity=\"" + m_LinkEntityCode + "\" Expression=\"CN\">";
for (int i = 0; i < ds.Tables["LIST"].Rows.Count; i++)
{
//获取国家的bodyid
string strBodyID = alBodyID[i].ToString();
//到表里查找Link的BodyID
string strSQL = "SELECT Body_ID FROM MDM_" + m_LinkEntityCode + "_B WHERE Body_ID_" + m_EntityCode_S + "='" + strBodyID + "'";
string strLinkBodyID = conn.GetDataTableFirstValue(strSQL).ToString();
strUpdateXML += "<row>";
strUpdateXML += "<body_ID>" + strLinkBodyID + "</body_ID>";
strUpdateXML += "<body_ID_" + m_EntityCode_S + ">" + strBodyID + "</body_ID_" + m_EntityCode_S + ">";
strUpdateXML += "<body_ID_" + m_EntityCode_P + ">" + ds.Tables["LIST"].Rows[i]["body_ID_" + m_EntityCode_P].ToString() + "</body_ID_" + m_EntityCode_P + ">";
strUpdateXML += "</row>";
}
strUpdateXML += "</table>";
cls_Entity_Edit.Request = Common.Common.GetRequestDataSet(new string[1] { "XML" }, new string[1] { strUpdateXML });
cls_Entity_Edit.Execute();
return Common.Common.GetRequestDataSet(new string[1] { "result" }, new string[1] { "true" });
}
catch
{
throw;
}
}
示例12: GetData
public DataSet GetData()
{
try
{
DataSet ds = new DataSet();
DataSet ds_Return = new DataSet();
string strXML = "";
strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
ds = Common.Common.GetDSByExcelXML(strXML);
DataTable dtOPTYPE = ds.Tables["OPTYPE"];
DataTable dtList = ds.Tables["List"];
var strzt = dtList.Rows[0]["zt"].ToString();//获取帐套
conn = new Dbconn("PLM_AS_" + strzt);
if (dtOPTYPE.Rows[0][0].ToString().ToUpper() == "GETComboxBySession".ToUpper())
{
string strUserPost = conn.GetDataTableFirstValue(@"
SELECT UserPost
FROM Userinfo
WHERE username = @Param0
", new string[] { m_hzyMessage.User_Name }).ToString();
string strSQL = "";
if (strUserPost == "管理员")
{
strSQL = @"
SELECT UserNameC
FROM Userinfo
WHERE UserPost = '设计师'";
}
else if (strUserPost == "设计师" || strUserPost == "版师助理")
{
strSQL = @"
SELECT UserNameC
FROM Userinfo
WHERE OwnedBrand IN (
SELECT OwnedBrand FROM Userinfo
WHERE [email protected]
)
and UserPost = '设计师'
";
}
else
{
strSQL = @"
SELECT UserNameC
FROM Userinfo
WHERE [email protected]";
}
ds_Return = conn.GetDataSet(strSQL, new string[] { m_hzyMessage.User_Name });
}
return ds_Return;
}
catch
{
conn.RollbackTransaction();
throw;
}
}
示例13: Execute
public bool Execute()
{
string strEnv_SN = "Present";
string strEnv_ID = "";
Dbconn conn_EHR = new Dbconn("EHR");
DataSet ds = conn_EHR.GetDataSet(
@"
SELECT NULL AS VexSSONewID ,
t2.C_PASSWORD [App_Password],
t2.C_PASSWORD App_PasswordSrc,
t1.C_CODE App_UserName,
t1.C_NAME App_UserName_CN,
GETDATE() Chang_Password_Time ,
1 Checked ,
'system' Check_User ,
GETDATE() Check_Time ,
GETDATE() Createtime ,
GETDATE() Updatetime ,
0 AS oprationFlag
FROM ehr.TB_INF_EMPLOYEE t1
LEFT JOIN ehr.TB_SYS_USER t2 ON t1.C_OID = t2.C_EMPLOYEEID
WHERE t1.C_EMPLOYEESTATUS!=3
");
Dbconn connMDM = new Dbconn("VexSSO");
try
{
ArrayList tableList = new ArrayList();
connMDM.BeginTransaction();
tableList.Add("MDM_System_User");
connMDM.TableLock(tableList);
strEnv_ID = connMDM.GetDataTableFirstValue("SELECT [Env_ID] FROM [MDM_System_Env] WHERE Env_SN='" + strEnv_SN + "'").ToString();
DataTable dtMDM = connMDM.GetDataTable(@"
SELECT [App_UserID]
,[Env_ID]
,[VexSSONewID]
,[App_UserName]
,[App_Password]
,[App_PasswordSrc]
,[App_UserName_CN]
,[Chang_Password_Time]
,[Checked]
,[Check_User]
,[Check_Time]
,[Createtime]
,[Updatetime]
FROM [dbo].[MDM_System_User]
WHERE Env_ID='" + strEnv_ID + @"'");
DataTable dtMDMUpdate = dtMDM.Clone();
DataTable dtMDMInsert = dtMDM.Clone();
DataTable dtMDMDelete = dtMDM.Clone();
for (int i = 0; i < dtMDM.Rows.Count; i++)
{
string strApp_UserName = dtMDM.Rows[i]["App_UserName"].ToString();
DataRow[] dr = ds.Tables[0].Select("App_UserName='" + strApp_UserName + "'");
if (dr.Length > 0)
{
dtMDM.Rows[i]["App_Password"] = dr[0]["App_Password"];
dtMDM.Rows[i]["App_PasswordSrc"] = dr[0]["App_PasswordSrc"];
dtMDM.Rows[i]["App_UserName_CN"] = dr[0]["App_UserName_CN"];
dtMDMUpdate.ImportRow(dtMDM.Rows[i]);
dr[0]["oprationFlag"] = "1";
}
else
{
dtMDMDelete.ImportRow(dtMDM.Rows[i]);
}
}
DataRow[] drInsert = ds.Tables[0].Select("oprationFlag=0");
for (int i = 0; i < drInsert.Length; i++)
{
DataRow dr = dtMDMInsert.NewRow();
dr["Env_ID"] = strEnv_ID;
dr["VexSSONewID"] = drInsert[i]["VexSSONewID"];
dr["App_UserName"] = drInsert[i]["App_UserName"];
dr["App_Password"] = drInsert[i]["App_Password"];
dr["App_PasswordSrc"] = drInsert[i]["App_PasswordSrc"];
dr["App_UserName_CN"] = drInsert[i]["App_UserName_CN"];
dr["Chang_Password_Time"] = drInsert[i]["Chang_Password_Time"];
dr["Checked"] = drInsert[i]["Checked"];
dr["Check_User"] = drInsert[i]["Check_User"];
dr["Check_Time"] = drInsert[i]["Check_Time"];
dr["Createtime"] = drInsert[i]["Createtime"];
dr["Updatetime"] = drInsert[i]["Updatetime"];
dtMDMInsert.Rows.Add(dr);
}
if (dtMDMDelete.Rows.Count > 0)
{
for (int i = 0; i < dtMDMDelete.Rows.Count; i++)
{
string strWhere = "App_UserID='" + dtMDMDelete.Rows[i]["App_UserID"] + "'";
//.........这里部分代码省略.........
示例14: 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 strWS_ID = m_request.Tables[0].Rows[0]["WS_ID"].ToString();
string strWS_Name = m_request.Tables[0].Rows[0]["WS_Name"].ToString();
ArrayList listTable = new ArrayList();
listTable.Add("WS");
conn.BeginTransaction();
conn.TableLock(listTable);
string strWhere = " WS_Name='" + strWS_Name + "'";
if (strWS_ID != "")
{
strWhere += " AND WS_ID != '"+strWS_ID+"'";
}
//判断是否已经存在
int nRow = conn.GetDataTableRowCount("SELECT 'A' as A FROM WS WHERE " + strWhere, new string[0]);
if (nRow > 0)
{
throw new Exception(strWS_Name + "已经存在,不能更新");
}
DSWSRR.WSDataTable dt_Add = new DSWSRR.WSDataTable();
dt_Add.PrimaryKey = null;
dt_Add.Columns["WS_ID"].DataType = typeof(string);
string strWS_IDSrc = "";
if (m_request.Tables[0].Columns.Contains("WS_IDSrc"))
{
strWS_IDSrc = m_request.Tables[0].Rows[0]["WS_IDSrc"].ToString();
}
DataRow dr = dt_Add.NewRow();
for (int i = 0; i < dt_Add.Columns.Count-4; i++)
{
if (dt_Add.Columns[i].ColumnName == "WS_Host")
{
string strENV = ConfigurationManager.AppSettings["WSRR_ENV"];
if (strENV.ToLower() == "prod")
{
dr[i] = m_request.Tables[0].Rows[0]["WS_Host_Prod"].ToString();
}
else
{
dr[i] = m_request.Tables[0].Rows[0]["WS_Host_Test"].ToString();
}
}
else
{
dr[i] = m_request.Tables[0].Rows[0][dt_Add.Columns[i].ColumnName].ToString();
}
}
dt_Add.Rows.Add(dr);
if (strWS_ID == "") //如果为空,说明是复制数据
{
dt_Add.Columns.Remove("Update_User");
dt_Add.Columns.Remove("Update_Time");
strWS_ID = conn.GetDataTableFirstValue("SELECT NEWID() as ID").ToString();
dt_Add.Rows[0]["WS_ID"] = strWS_ID;
conn.Insert("WS", dt_Add);
//添加参数表的信息
DataTable dtParam = conn.GetDataTable("SELECT * FROM WS_Param WHERE WS_ID='" + strWS_IDSrc + "'");
//更新WSID
for (int i = 0; i < dtParam.Rows.Count; i++)
{
dtParam.Rows[i]["WS_ID"] = strWS_ID;
}
dtParam.Columns.Remove("Param_ID");
conn.Insert("WS_Param", dtParam);
}
else
{
//.........这里部分代码省略.........
示例15: GetData
//.........这里部分代码省略.........
if (clsCheck.Execute() == false)
{
throw new Exception("Body_id_0016信息不正确!");
}
//核对L0010是否存在
clsCheck.hzyMessage = this.hzyMessage;
clsCheck.MDMClass = strMDM_LinkClass;
clsCheck.Body_ID = strBody_id_L0011;
clsCheck.Conn = conn;
if (clsCheck.Execute() == false)
{
throw new Exception("Body_id_L0011信息不正确!");
}
}
else
{
throw new Exception("传入的参数有误,如果反复出现,请重新登录!");
}
clsBody.MDMClass = strMDM_LinkClass;
clsBody.BodyID = strBody_id_L0011;
clsBody.LinkBodyIDList = strBody_id_0015 + "," + strBody_id_0016;
clsBody.Execute();
strBody_id_L0011 = clsBody.BodyID;
//处理0015的实体
for (int k = 0; k < dt_List.Columns.Count; k++)
{
string strColumnName = dt_List.Columns[k].ColumnName;
if (dtPorperty.Select("Property_Name='" + strColumnName + "'").Length == 0)
{
continue;
}
MDM2_EntityPropertyValue_Edit clsProperty = new MDM2_EntityPropertyValue_Edit();
clsProperty.Conn = conn;
clsProperty.hzyMessage = hzyMessage;
clsProperty.MDMClass = strMDM_Class;
clsProperty.ExpressionName = "CN";
clsProperty.PropertyName = strColumnName;
clsProperty.BodyID = strBody_id_0016;
clsProperty.PropertyValue = dt_List.Rows[j][k].ToString();
if (clsProperty.Execute() == false)
{
throw new Exception("修改失败," + clsProperty.Message);
}
}
}
}
else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "DELETE")
{
for (int rowIndex = 0; rowIndex < dt_List.Rows.Count; rowIndex++)
{
string strBody_id_L0011 = dt_List.Rows[rowIndex]["body_id"].ToString();
string strBody_ID_0016 = conn.GetDataTableFirstValue("select body_id_0016 from MDM_L0011_B where [email protected]", new string[1] { strBody_id_L0011 }).ToString();
MDM2_EntityDeleteBodyID_Edit clsDelete = new MDM2_EntityDeleteBodyID_Edit();
clsDelete.Conn = conn;
clsDelete.hzyMessage = hzyMessage;
//删除行政区实体的数据
if (strBody_ID_0016 != "")
{
clsDelete.MDMClass = strMDM_Class;
clsDelete.BodyID = strBody_ID_0016;
if (clsDelete.Execute() == false)
{
throw new Exception("删除失败。");
}
}
//删除Link数据
clsDelete.MDMClass = strMDM_LinkClass;
clsDelete.BodyID = strBody_id_L0011;
if (clsDelete.Execute() == false)
{
throw new Exception("删除失败。");
}
}
}
}
dt_EditResult.Rows.Add(new object[] { true, "操作成功" });
ds_Return.Tables.Add(dt_EditResult);
conn.CommitTransaction();
return ds_Return;
}
catch
{
conn.RollbackTransaction();
throw;
}
}