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.

1525 lines
70 KiB
C#

12 months ago
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using DSWeb.Models;
using DSWeb.DataAccess;
namespace DSWeb.EntityDA
{
public class CompanyDA
{
//company
private const string PARM_COMPANY_GID = "@gid";
private const string PARM_COMPANY_NAME = "@name";
private const string PARM_COMPANY_CODE_NAME = "@code_name";
//user_company
private const string PARM_USER_COMPANY_USER_ID = "@user_id";
private const string SQL_SELECT_COMPANY_ALL = " SELECT GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE,BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD FROM company order by NAME";
private const string SQL_SELECT_COMPANY_BYGID = " SELECT GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE, "
+ " BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER, "
+ " MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD FROM company WHERE GID = @gid ";
private const string SQL_SELECT_COMPANY_BY_CODENAME = " SELECT GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE, "
+ " BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER, "
+ " MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD FROM company WHERE CODENAME = @CODENAME and ISDISABLE=0 and ISDELETED=0";
private const string SQL_SELECT_COMPANY_BY_USERID = " SELECT A.GID,A.CODENAME,A.NAME,A.FULLNAME,A.ENNAME,A.ADDRESS,A.ENADDRESS,A.POSTCODE,A.OFFICEPHONE,A.FAX,A.EMAIL,A.WEBSITEURL,A.LICENSECODE,A.TAXCODE, "
+ " A.BillRises,A.ChequePayable,A.PRTHEADXML1,A.PRTHEADXML2,A.PRTHEADXML3,A.PRTHEADXML4,A.PRTHEADXML5,A.CREATEUSER,A.CREATETIME,A.MODIFIEDUSER, "
+ " A.MODIFIEDTIME,A.ISDELETED,A.ISDISABLE,A.PARENTID,A.LOGO,A.BANKSHEAD FROM company as A INNER JOIN user_company as B ON A.GID = B.COMPANYID "
+ " INNER JOIN [user] as C ON B.USERID = C.GID WHERE C.GID = @user_id ";
private const string SQL_SELECT_COMPANY_BY_NAME = " SELECT GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE, "
+ " BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER, "
+ " MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD FROM company WHERE NAME = @name ";
private const string SQL_SELECT_COMPANY_BY_CODE_NAME = " SELECT GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE, "
+ " BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER, "
+ " MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD,LOCALCURR,WORKFLOWMSG FROM company WHERE CODENAME = @code_name ";
private const string SQL_SELECT_COMPANY_TOP1 = " SELECT top 1 GID,CODENAME,NAME,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE,BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD FROM company order by NAME";
private string strSqlInsertInfo = "insert into [company](GID,CODENAME,[NAME],FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE,BillRises,ChequePayable,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,CREATEUSER,MODIFIEDUSER,ISDELETED,ISDISABLE,PARENTID,LOGO,BANKSHEAD) values(@GID,@CODENAME,@NAME,@FULLNAME,@ENNAME,@ADDRESS,@ENADDRESS,@POSTCODE,@OFFICEPHONE,@FAX,@EMAIL,@WEBSITEURL,@LICENSECODE,@TAXCODE,@BillRises,@ChequePayable,@PRTHEADXML1,@PRTHEADXML2,@PRTHEADXML3,@PRTHEADXML4,@PRTHEADXML5,@CREATEUSER,@MODIFIEDUSER,@ISDELETED,@ISDISABLE,@PARENTID,@LOGO,@BANKSHEAD)";
private string strSqlUpdateInfo = "update [company] set CODENAME=@CODENAME,NAME=@NAME,FULLNAME=@FULLNAME,ENNAME=@ENNAME,ADDRESS=@ADDRESS,ENADDRESS=@ENADDRESS,POSTCODE=@POSTCODE,OFFICEPHONE=@OFFICEPHONE,FAX=@FAX,EMAIL=@EMAIL,WEBSITEURL=@WEBSITEURL,LICENSECODE=@LICENSECODE,TAXCODE=@TAXCODE,BillRises=@BillRises,ChequePayable=@ChequePayable,PRTHEADXML1=@PRTHEADXML1,PRTHEADXML2=@PRTHEADXML2,PRTHEADXML3=@PRTHEADXML3,PRTHEADXML4=@PRTHEADXML4,PRTHEADXML5=@PRTHEADXML5,CREATEUSER=@CREATEUSER,MODIFIEDUSER=@MODIFIEDUSER,ISDELETED=@ISDELETED,ISDISABLE=@ISDISABLE,PARENTID=@PARENTID,LOGO=@LOGO,MODIFIEDTIME=GETDATE(),BANKSHEAD=@BANKSHEAD where GID=@GID";
#region 获取所有公司信息
/// <summary>
/// 获取所有公司信息
/// </summary>
/// <returns>List<CompanyEntity></returns>
public IList<CompanyEntity> GetAllCompany()
{
IList<CompanyEntity> companyEntites = new List<CompanyEntity>();
CompanyEntity compEntity = null;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_ALL, null))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
companyEntites.Add(compEntity);
}
}
catch (Exception execError)
{
throw execError;
}
}
return companyEntites;
}
#endregion
#region 根据公司CODENAME获取公司信息
/// <summary>
/// 根据公司GID获取公司信息
/// </summary>
/// <param name="strGid"></param>
/// <returns></returns>
public CompanyEntity GetCompanyByCODENAME(string strCODENAME)
{
CompanyEntity compEntity = null;
SqlParameter parm = new SqlParameter("@CODENAME", SqlDbType.VarChar, 10);
parm.Value = strCODENAME;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BY_CODENAME, parm))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return compEntity;
}
#endregion
#region 根据公司GID获取公司信息
/// <summary>
/// 根据公司GID获取公司信息
/// </summary>
/// <param name="strGid"></param>
/// <returns></returns>
public CompanyEntity GetCompanyByID(string strGid)
{
CompanyEntity compEntity = null;
SqlParameter parm = new SqlParameter(PARM_COMPANY_GID, SqlDbType.VarChar, 36);
parm.Value = strGid;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BYGID, parm))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return compEntity;
}
#endregion
#region 根据公司NAME获取公司信息
/// <summary>
/// 根据公司NAME获取公司信息
/// </summary>
/// <param name="strGid"></param>
/// <returns></returns>
public CompanyEntity GetCompanyByNameNoLogoImg(string tempName)
{
CompanyEntity compEntity = null;
SqlParameter parm = new SqlParameter(PARM_COMPANY_NAME, SqlDbType.VarChar, 150);
parm.Value = tempName;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BY_NAME, parm))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return compEntity;
}
#endregion
#region 根据公司CodeName获取公司信息
/// <summary>
/// 根据公司CodeName获取公司信息
/// </summary>
/// <param name="tempCodeName">公司CodeName</param>
/// <returns></returns>
public CompanyEntity GetCompanyByCodeNameNoLogoImg(string tempCodeName)
{
CompanyEntity compEntity = null;
SqlParameter parm = new SqlParameter(PARM_COMPANY_CODE_NAME, SqlDbType.VarChar, 10);
parm.Value = tempCodeName;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BY_CODE_NAME, parm))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
if (!sqlRead.IsDBNull(30))
{
compEntity.LOCALCURR = sqlRead.GetString(30);
if (compEntity.LOCALCURR == "") compEntity.LOCALCURR = "RMB";
}
else compEntity.LOCALCURR = "RMB";
if (!sqlRead.IsDBNull(31))
{
compEntity.WORKFLOWMSG = sqlRead.GetString(31);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return compEntity;
}
#endregion
#region 根据公司GID获取公司信息
/// <summary>
/// 根据公司GID获取公司信息
/// </summary>
/// <param name="strGid"></param>
/// <returns></returns>
public CompanyEntity GetCompanyTop1()
{
CompanyEntity compEntity = null;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_TOP1, null))
{
try
{
while (sqlRead.Read())
{
compEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
compEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
compEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
compEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
compEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
compEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
compEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
compEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
compEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
compEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
compEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
compEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
compEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
compEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
compEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
compEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
compEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
compEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
compEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
compEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
compEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
compEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
compEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
compEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
compEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
compEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
compEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
compEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
compEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
compEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
compEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return compEntity;
}
#endregion
#region 根据用户GID获取用户公司信息
/// <summary>
/// 根据用户GID获取用户公司信息
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <returns>返回CompanyEntity公司实体类</returns>
public CompanyEntity GetCompanyByUserID(string tempUserID)
{
CompanyEntity companyEntity = null;
SqlParameter parm = new SqlParameter(PARM_USER_COMPANY_USER_ID, SqlDbType.VarChar, 36);
parm.Value = tempUserID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BY_USERID, parm))
{
try
{
while (sqlRead.Read())
{
companyEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
companyEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
companyEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
companyEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
companyEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
companyEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
companyEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
companyEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
companyEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
companyEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
companyEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
companyEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
companyEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
companyEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
companyEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
companyEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
companyEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
companyEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
companyEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
companyEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
companyEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
companyEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
companyEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
companyEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
companyEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
companyEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
companyEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
companyEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
companyEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
companyEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
companyEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return companyEntity;
}
#endregion
#region 根据用户GID获取用户公司信息(无LOGO信息)
/// <summary>
/// 根据用户GID获取用户公司信息(无LOGO信息)
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <returns>返回CompanyEntity公司实体类</returns>
public CompanyEntity GetCompanyByUserIDNoLogoImg(string tempUserID)
{
CompanyEntity companyEntity = null;
SqlParameter parm = new SqlParameter(PARM_USER_COMPANY_USER_ID, SqlDbType.VarChar, 36);
parm.Value = tempUserID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_COMPANY_BY_USERID, parm))
{
try
{
while (sqlRead.Read())
{
companyEntity = new CompanyEntity();
if (!sqlRead.IsDBNull(0))
{
companyEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
companyEntity.CODENAME = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
companyEntity.NAME = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
companyEntity.FULLNAME = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
companyEntity.ENNAME = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
companyEntity.ADDRESS = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
companyEntity.ENADDRESS = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
companyEntity.POSTCODE = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
companyEntity.OFFICEPHONE = sqlRead.GetString(8);
}
if (!sqlRead.IsDBNull(9))
{
companyEntity.FAX = sqlRead.GetString(9);
}
if (!sqlRead.IsDBNull(10))
{
companyEntity.EMAIL = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
companyEntity.WEBSITEURL = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
companyEntity.LICENSECODE = sqlRead.GetString(12);
}
if (!sqlRead.IsDBNull(13))
{
companyEntity.TAXCODE = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
companyEntity.BillRises = sqlRead.GetString(14);
}
if (!sqlRead.IsDBNull(15))
{
companyEntity.ChequePayable = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
companyEntity.PRTHEADXML1 = sqlRead.GetString(16);
}
if (!sqlRead.IsDBNull(17))
{
companyEntity.PRTHEADXML2 = sqlRead.GetString(17);
}
if (!sqlRead.IsDBNull(18))
{
companyEntity.PRTHEADXML3 = sqlRead.GetString(18);
}
if (!sqlRead.IsDBNull(19))
{
companyEntity.PRTHEADXML4 = sqlRead.GetString(19);
}
if (!sqlRead.IsDBNull(20))
{
companyEntity.PRTHEADXML5 = sqlRead.GetString(20);
}
if (!sqlRead.IsDBNull(21))
{
companyEntity.CREATEUSER = sqlRead.GetString(21);
}
if (!sqlRead.IsDBNull(22))
{
companyEntity.CreateTime = sqlRead.GetDateTime(22);
}
if (!sqlRead.IsDBNull(23))
{
companyEntity.MODIFIEDUSER = sqlRead.GetString(23);
}
if (!sqlRead.IsDBNull(24))
{
companyEntity.MODIFIEDTIME = sqlRead.GetDateTime(24);
}
if (!sqlRead.IsDBNull(25))
{
companyEntity.ISDELETED = sqlRead.GetBoolean(25);
}
if (!sqlRead.IsDBNull(26))
{
companyEntity.ISDISABLE = sqlRead.GetBoolean(26);
}
if (!sqlRead.IsDBNull(27))
{
companyEntity.PARENTID = sqlRead.GetString(27);
}
if (!sqlRead.IsDBNull(28))
{
companyEntity.LOGO = (byte[])sqlRead.GetSqlBinary(28);
}
if (!sqlRead.IsDBNull(29))
{
companyEntity.BANKSHEAD = sqlRead.GetString(29);
}
}
}
catch (Exception execError)
{
throw execError;
}
}
return companyEntity;
}
#endregion
/// <summary>
/// 插入信息
/// </summary>
/// <param name="CompanyEntity">实体类</param>
/// <returns>值为1插入数据正常,-1操作异常</returns>
public int InserInfo(CompanyEntity infoEntity)
{
int iResult = 0;
//获取参数
SqlParameter[] parms = GetInsertParms();
parms[0].Value = infoEntity.GID;//惟一编号
parms[1].Value = infoEntity.CODENAME;//公司代码名
parms[2].Value = infoEntity.NAME;//公司简称
parms[3].Value = infoEntity.FULLNAME;//公司全称
parms[4].Value = infoEntity.ENNAME;//公司英文名称
parms[5].Value = infoEntity.ADDRESS;//公司联络地址
parms[6].Value = infoEntity.ENADDRESS;//公司英文地址
parms[7].Value = infoEntity.POSTCODE;//邮政编码
parms[8].Value = infoEntity.OFFICEPHONE;//公司办公电话
parms[9].Value = infoEntity.FAX;//传真号码
parms[10].Value = infoEntity.EMAIL;//电子邮箱
parms[11].Value = infoEntity.WEBSITEURL;//公司网址
parms[12].Value = infoEntity.LICENSECODE;//工商登记号
parms[13].Value = infoEntity.TAXCODE;//税务登记号
parms[14].Value = infoEntity.BillRises;//发票抬头
parms[15].Value = infoEntity.ChequePayable;//支票抬头
parms[16].Value = infoEntity.PRTHEADXML1;//打印抬头1
parms[17].Value = infoEntity.PRTHEADXML2;//打印抬头2
parms[18].Value = infoEntity.PRTHEADXML3;//打印抬头3
parms[19].Value = infoEntity.PRTHEADXML4;//打印抬头4
parms[20].Value = infoEntity.PRTHEADXML5;//打印抬头5
parms[21].Value = infoEntity.CREATEUSER;//创建人gid
parms[22].Value = infoEntity.MODIFIEDUSER;//更新人gid
parms[23].Value = infoEntity.ISDELETED;//是否删除
parms[24].Value = infoEntity.ISDISABLE;//是否被禁用
parms[25].Value = infoEntity.PARENTID;//父公司GID
parms[26].Value = infoEntity.LOGO;//徽标
parms[27].Value = infoEntity.BANKSHEAD;//徽标
//parms[26].Value = infoEntity.MODIFIEDTIME;//更新时间
//parms[27].Value = infoEntity.CREATETIME;//创建时间
strSqlInsertInfo = String.Format(strSqlInsertInfo);
//
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlInsertInfo, parms);
if (existVal > 0)
{
iResult = 1;
//
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('插入op_seae海运业务信息表','插入操作','BSNO=" + infoEntity.BSNO + "','" + strUserID + "')";
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
/// <summary>
/// 更新信息
/// </summary>
/// <param name="CompanyEntity">实体类</param>
/// <returns>值为1更新数据正常,-1操作异常</returns>
public int UpdateInfo(CompanyEntity infoEntity)
{
int iResult = 0;
//获取参数
SqlParameter[] parms = GetUpdateParms();
parms[0].Value = infoEntity.GID;//惟一编号
parms[1].Value = infoEntity.CODENAME;//公司代码名
parms[2].Value = infoEntity.NAME;//公司简称
parms[3].Value = infoEntity.FULLNAME;//公司全称
parms[4].Value = infoEntity.ENNAME;//公司英文名称
parms[5].Value = infoEntity.ADDRESS;//公司联络地址
parms[6].Value = infoEntity.ENADDRESS;//公司英文地址
parms[7].Value = infoEntity.POSTCODE;//邮政编码
parms[8].Value = infoEntity.OFFICEPHONE;//公司办公电话
parms[9].Value = infoEntity.FAX;//传真号码
parms[10].Value = infoEntity.EMAIL;//电子邮箱
parms[11].Value = infoEntity.WEBSITEURL;//公司网址
parms[12].Value = infoEntity.LICENSECODE;//工商登记号
parms[13].Value = infoEntity.TAXCODE;//税务登记号
parms[14].Value = infoEntity.BillRises;//发票抬头
parms[15].Value = infoEntity.ChequePayable;//支票抬头
parms[16].Value = infoEntity.PRTHEADXML1;//打印抬头1
parms[17].Value = infoEntity.PRTHEADXML2;//打印抬头2
parms[18].Value = infoEntity.PRTHEADXML3;//打印抬头3
parms[19].Value = infoEntity.PRTHEADXML4;//打印抬头4
parms[20].Value = infoEntity.PRTHEADXML5;//打印抬头5
parms[21].Value = infoEntity.CREATEUSER;//创建人gid
parms[22].Value = infoEntity.MODIFIEDUSER;//更新人gid
parms[23].Value = infoEntity.ISDELETED;//是否删除
parms[24].Value = infoEntity.ISDISABLE;//是否被禁用
parms[25].Value = infoEntity.PARENTID;//父公司GID
parms[26].Value = infoEntity.LOGO;//徽标
parms[27].Value = infoEntity.BANKSHEAD;//徽标
//parms[27].Value = infoEntity.MODIFIEDTIME;//更新时间
//parms[27].Value = infoEntity.CREATETIME;//创建时间
//
//string strMODIFIEDTIME = infoEntity.MODIFIEDTIME.ToString().IndexOf("0001")>-1 ? "null" : "'" + infoEntity.MODIFIEDTIME.ToString() + "'";
//string strMODIFIEDTIME_name = "MODIFIEDTIME="; //strETA.Equals("") ? "" : "ETA=";
//
strSqlUpdateInfo = String.Format(strSqlUpdateInfo);//, strMODIFIEDTIME_name, strMODIFIEDTIME);
//
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlUpdateInfo, parms);
if (existVal > 0)
{
iResult = 1;
//
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('更新op_seae海运业务信息表','更新操作','BSNO=" + infoEntity.BSNO + "','" + strUserID + "')";
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
#region 生成插入语句参数
/// <summary>
/// 生成插入语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetInsertParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@GID",SqlDbType.VarChar,36),//惟一编号
new SqlParameter("@CODENAME",SqlDbType.VarChar,50),//公司代码名
new SqlParameter("@NAME",SqlDbType.VarChar,150),//公司简称
new SqlParameter("@FULLNAME",SqlDbType.VarChar,150),//公司全称
new SqlParameter("@ENNAME",SqlDbType.VarChar,150),//公司英文名称
new SqlParameter("@ADDRESS",SqlDbType.VarChar,100),//公司联络地址
new SqlParameter("@ENADDRESS",SqlDbType.VarChar,100),//公司英文地址
new SqlParameter("@POSTCODE",SqlDbType.VarChar,50),//邮政编码
new SqlParameter("@OFFICEPHONE",SqlDbType.VarChar,50),//公司办公电话
new SqlParameter("@FAX",SqlDbType.VarChar,50),//传真号码
new SqlParameter("@EMAIL",SqlDbType.VarChar,100),//电子邮箱
new SqlParameter("@WEBSITEURL",SqlDbType.VarChar,150),//公司网址
new SqlParameter("@LICENSECODE",SqlDbType.VarChar,30),//工商登记号
new SqlParameter("@TAXCODE",SqlDbType.VarChar,30),//税务登记号
new SqlParameter("@BillRises",SqlDbType.VarChar,60),//发票抬头
new SqlParameter("@ChequePayable",SqlDbType.VarChar,60),//支票抬头
new SqlParameter("@PRTHEADXML1",SqlDbType.VarChar,1024),//打印抬头1
new SqlParameter("@PRTHEADXML2",SqlDbType.VarChar,1024),//打印抬头2
new SqlParameter("@PRTHEADXML3",SqlDbType.VarChar,1024),//打印抬头3
new SqlParameter("@PRTHEADXML4",SqlDbType.VarChar,1024),//打印抬头4
new SqlParameter("@PRTHEADXML5",SqlDbType.VarChar,1024),//打印抬头5
new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人gid
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//更新人gid
new SqlParameter("@ISDELETED",SqlDbType.Bit),//是否删除
new SqlParameter("@ISDISABLE",SqlDbType.Bit),//是否被禁用
new SqlParameter("@PARENTID",SqlDbType.VarChar,36),//父公司GID
new SqlParameter("@LOGO",SqlDbType.Binary),//徽标
new SqlParameter("@BANKSHEAD",SqlDbType.VarChar,3)//
//new SqlParameter("@MODIFIEDTIME",SqlDbType.datetime),//更新时间
//new SqlParameter("@CREATETIME",SqlDbType.datetime),//创建时间
};
return parms;
}
#endregion
#region 生成更新语句参数
/// <summary>
/// 生成更新语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetUpdateParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@GID",SqlDbType.VarChar,36),//惟一编号
new SqlParameter("@CODENAME",SqlDbType.VarChar,50),//公司代码名
new SqlParameter("@NAME",SqlDbType.VarChar,150),//公司简称
new SqlParameter("@FULLNAME",SqlDbType.VarChar,150),//公司全称
new SqlParameter("@ENNAME",SqlDbType.VarChar,150),//公司英文名称
new SqlParameter("@ADDRESS",SqlDbType.VarChar,100),//公司联络地址
new SqlParameter("@ENADDRESS",SqlDbType.VarChar,100),//公司英文地址
new SqlParameter("@POSTCODE",SqlDbType.VarChar,50),//邮政编码
new SqlParameter("@OFFICEPHONE",SqlDbType.VarChar,50),//公司办公电话
new SqlParameter("@FAX",SqlDbType.VarChar,50),//传真号码
new SqlParameter("@EMAIL",SqlDbType.VarChar,100),//电子邮箱
new SqlParameter("@WEBSITEURL",SqlDbType.VarChar,150),//公司网址
new SqlParameter("@LICENSECODE",SqlDbType.VarChar,30),//工商登记号
new SqlParameter("@TAXCODE",SqlDbType.VarChar,30),//税务登记号
new SqlParameter("@BillRises",SqlDbType.VarChar,60),//发票抬头
new SqlParameter("@ChequePayable",SqlDbType.VarChar,60),//支票抬头
new SqlParameter("@PRTHEADXML1",SqlDbType.VarChar,1024),//打印抬头1
new SqlParameter("@PRTHEADXML2",SqlDbType.VarChar,1024),//打印抬头2
new SqlParameter("@PRTHEADXML3",SqlDbType.VarChar,1024),//打印抬头3
new SqlParameter("@PRTHEADXML4",SqlDbType.VarChar,1024),//打印抬头4
new SqlParameter("@PRTHEADXML5",SqlDbType.VarChar,1024),//打印抬头5
new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人gid
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//更新人gid
new SqlParameter("@ISDELETED",SqlDbType.Bit),//是否删除
new SqlParameter("@ISDISABLE",SqlDbType.Bit),//是否被禁用
new SqlParameter("@PARENTID",SqlDbType.VarChar,36),//父公司GID
new SqlParameter("@LOGO",SqlDbType.Binary),//徽标
new SqlParameter("@BANKSHEAD",SqlDbType.VarChar,3)//
//new SqlParameter("@MODIFIEDTIME",SqlDbType.DateTime),//更新时间
//new SqlParameter("@CREATETIME",SqlDbType.datetime),//创建时间
};
return parms;
}
#endregion
#region 返回数据集 公司表company信息
/// <summary>
/// 返回 公司表company信息
/// </summary>
/// <returns></returns>
public DataSet GetCompanySQL(string strSQL)
{
string str = "select * from [company] where 1=1 " + strSQL;
DataSet DS = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, str);
try
{
if (DS.Tables[0].Rows.Count <= 0)
{
DS = null;
}
}
catch
{
DS = null;
}
return DS;
}
#endregion
#region 返回数据集 公司表company信息
/// 返回 公司表company删除
/// </summary>
/// <returns></returns>
/// <summary>
public String GetCompanyDel(string strGid, string strUserID)
{
string alt = "";
string str = "update company set ISDELETED=1 where Gid='" + strGid + "'";
bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str);
if (bl == false)
{
alt = "公司表company删除操作出错";
return alt;
}
else
{
//string str1 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('删除公司表company的信息','更新操作','" + str + "','" + strUserID + "')";
//bool bl1 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str1);
}
return alt;
}
#endregion
}
}