You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/EntityDA/CompanyAttributeDA.cs

52 lines
2.2 KiB
C#

3 years ago
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Generic;
using WebSqlHelper;
namespace DSWeb.EntityDA
{
public class CompanyAttributeDA
{
//company_attribute
private const string PARM_COMPANY_ATTRIBUTE_GID = "@gid";
private const string PARM_COMPANY_ATTRIBUTE_COMPANY_ID = "@company_id";
private const string PARM_COMPANY_ATTRIBUTE_ATTRIBUTE_ID = "@attribute_id";
private const string PARM_COMPANY_ATTRIBUTE_VALUE = "@value";
private const string PARM_COMPANY_ATTRIBUTE_CREATE_USER = "@create_user";
private const string PARM_COMPANY_ATTRIBUTE_CREATE_TIME = "@create_time";
private const string PARM_COMPANY_ATTRIBUTE_MODIFIED_USER = "@modified_user";
private const string PARM_COMPANY_ATTRIBUTE_MODIFIED_TIME = "@modified_time";
private const string PARM_COMPANY_ATTRIBUTE_IS_DELETE = "@is_delete";
private const string PARM_COMPANY_ATTRIBUTE_DELETE_USER = "@delete_user";
private const string PARM_COMPANY_ATTRIBUTE_DELETE_TIME = "@delete_time";
//attribute
private const string PARM_ATTRIBUTE_NAME = "@name";
private const string SQL_SELECT_COMPANY_ATTRIBUTE_VALUE = " SELECT VALUE FROM attribute AS A INNER JOIN company_attribute AS B ON A.GID = B.ATTRIBUTEID WHERE A.NAME = @name AND B.COMPANYID = @company_id ";
public string GetCompanyAttributeValue(string tempCompanyID,string tempAttributeName)
{
string strResult = "";
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
SqlParameter[] parms = new SqlParameter[] {
new SqlParameter(PARM_ATTRIBUTE_NAME,SqlDbType.VarChar,50),
new SqlParameter(PARM_COMPANY_ATTRIBUTE_COMPANY_ID,SqlDbType.VarChar,36)
};
parms[0].Value = tempAttributeName;
parms[1].Value = tempCompanyID;
strResult = (String)SqlHelper.ExecuteScalar(conn, CommandType.Text, SQL_SELECT_COMPANY_ATTRIBUTE_VALUE, parms) as string ?? "";
}
return strResult;
}
}
}