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.
880 lines
57 KiB
C#
880 lines
57 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using DSWeb.MvcShipping.Models.MsCompanys;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using HcUtility.Comm;
|
|
using System.Data.SqlClient;
|
|
using DSWeb.DataAccess;
|
|
using System.IO;
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsCompanysDAL
|
|
{
|
|
public class MsCompanysDAL
|
|
{
|
|
#region 查询
|
|
static public List<MsCompanysEntity> GetDataList(string strPath, string strPhotoPath, string strCondition, string userid, string usercode, string companyid, string sort = null)
|
|
{
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
{
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strCondition = strCondition + " and " + rangstr;
|
|
}
|
|
else
|
|
{
|
|
strCondition = rangstr;
|
|
}
|
|
}
|
|
//
|
|
String strSql = "SELECT *,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=[company].MODIFIEDUSER) FROM [company] ";
|
|
strSql = strSql + " where (ISDELETED=0 or ISDELETED is null) "; //and (ISDISABLE=0 or ISDISABLE is null)
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql += " and " + strCondition;
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql += " order by " + sortstring;
|
|
}
|
|
else
|
|
{
|
|
strSql += " order by [CODENAME],[NAME]";
|
|
}
|
|
return SetData(strPath, strPhotoPath, strSql);
|
|
}
|
|
|
|
static public string GetDataListStr(string strCondition, string userid, string usercode, string companyid, string sort = null)
|
|
{
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
{
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strCondition = strCondition + " and " + rangstr;
|
|
}
|
|
else
|
|
{
|
|
strCondition = rangstr;
|
|
}
|
|
}
|
|
//
|
|
String strSql = "SELECT *,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=[company].MODIFIEDUSER) FROM [company] where (ISDELETED=0 or ISDELETED is null) and (ISDISABLE=0 or ISDISABLE is null)";
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql += " and " + strCondition;
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql += " order by " + sortstring;
|
|
}
|
|
else
|
|
{
|
|
strSql += " order by [CODENAME],[NAME]";
|
|
}
|
|
return strSql.ToString();
|
|
}
|
|
|
|
static public MsCompanysEntity GetData(string strPath, string strPhotoPath, string strCondition)
|
|
{
|
|
String strSql = "SELECT *,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=[company].MODIFIEDUSER) FROM [company] where (ISDELETED=0 or ISDELETED is null) ";//and (ISDISABLE=0 or ISDISABLE is null)
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql += " and " + strCondition;
|
|
}
|
|
var list = SetData(strPath, strPhotoPath, strSql);
|
|
if (list.Count > 0)
|
|
{
|
|
return list[0];
|
|
}
|
|
return new MsCompanysEntity();
|
|
}
|
|
|
|
static public List<MsCompanysEntity> GetNoPicDataList(string strCondition)
|
|
{
|
|
//
|
|
String strSql = "SELECT *,CODENAME + '-' + NAME AS CodeAndName,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=[company].MODIFIEDUSER) FROM [company] ";
|
|
strSql = strSql + " where (ISDELETED=0 or ISDELETED is null) "; //and (ISDISABLE=0 or ISDISABLE is null)
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql += " and " + strCondition;
|
|
}
|
|
|
|
strSql += " order by [CODENAME],[NAME]";
|
|
|
|
return SetNoPicData(strSql);
|
|
}
|
|
|
|
static public MsCompanysEntity GetNoPicData(string strCondition)
|
|
{
|
|
String strSql = "SELECT *,CODENAME + '-' + NAME AS CodeAndName,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=[company].MODIFIEDUSER) FROM [company] where (ISDELETED=0 or ISDELETED is null) and (ISDISABLE=0 or ISDISABLE is null)";
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql += " and " + strCondition;
|
|
}
|
|
var list = SetNoPicData(strSql);
|
|
if (list.Count > 0)
|
|
{
|
|
return list[0];
|
|
}
|
|
return new MsCompanysEntity();
|
|
}
|
|
|
|
private static List<MsCompanysEntity> SetData(string strPath,string strPhotoPath, String strSql)
|
|
{
|
|
var headList = new List<MsCompanysEntity>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
MsCompanysEntity data = new MsCompanysEntity();
|
|
#region Set DB data to Object
|
|
data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//GID
|
|
|
|
data.CODENAME = (reader["CODENAME"] == null ? "" : Convert.ToString(reader["CODENAME"]));//CODENAME
|
|
data.NAME = (reader["NAME"] == null ? "" : Convert.ToString(reader["NAME"]));//NAME
|
|
data.FULLNAME = (reader["FULLNAME"] == null ? "" : Convert.ToString(reader["FULLNAME"]));//FULLNAME
|
|
data.ENNAME = (reader["ENNAME"] == null ? "" : Convert.ToString(reader["ENNAME"]));//公司英文名称
|
|
data.ADDRESS = (reader["ADDRESS"] == null ? "" : Convert.ToString(reader["ADDRESS"]));//ADDRESS
|
|
data.ENADDRESS = (reader["ENADDRESS"] == null ? "" : Convert.ToString(reader["ENADDRESS"]));//公司英文地址
|
|
data.POSTCODE = (reader["POSTCODE"] == null ? "" : Convert.ToString(reader["POSTCODE"]));//POSTCODE
|
|
data.OFFICEPHONE = (reader["OFFICEPHONE"] == null ? "" : Convert.ToString(reader["OFFICEPHONE"]));//OFFICEPHONE
|
|
data.FAX = (reader["FAX"] == null ? "" : Convert.ToString(reader["FAX"]));//FAX
|
|
data.EMAIL = (reader["EMAIL"] == null ? "" : Convert.ToString(reader["EMAIL"]));//EMAIL
|
|
data.WEBSITEURL = (reader["WEBSITEURL"] == null ? "" : Convert.ToString(reader["WEBSITEURL"]));//WEBSITEURL
|
|
data.LICENSECODE = (reader["LICENSECODE"] == null ? "" : Convert.ToString(reader["LICENSECODE"]));//LICENSECODE
|
|
data.TAXCODE = (reader["TAXCODE"] == null ? "" : Convert.ToString(reader["TAXCODE"]));//TAXCODE
|
|
data.CREATEUSER = (reader["CREATEUSER"] == null ? "" : Convert.ToString(reader["CREATEUSER"]));//CREATEUSER
|
|
if (reader["CREATETIME"] != DBNull.Value)
|
|
data.CREATETIME = Convert.ToDateTime(reader["CREATETIME"]);
|
|
data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//更新人gid
|
|
if (reader["MODIFIEDTIME"] != DBNull.Value)
|
|
data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]);
|
|
data.ISDELETED = (reader["ISDELETED"] == null ? false : Convert.ToBoolean(reader["ISDELETED"]));//ISDELETED
|
|
data.ISDISABLE = (reader["ISDISABLE"] == null ? false : Convert.ToBoolean(reader["ISDISABLE"]));//ISDISABLE
|
|
data.PARENTID = (reader["PARENTID"] == null ? "" : Convert.ToString(reader["PARENTID"]));//PARENTID
|
|
data.BILLRISES = (reader["BILLRISES"] == null ? "" : Convert.ToString(reader["BILLRISES"]));//发票抬头
|
|
data.CHEQUEPAYABLE = (reader["CHEQUEPAYABLE"] == null ? "" : Convert.ToString(reader["CHEQUEPAYABLE"]));//支票抬头
|
|
data.PRTHEADXML1 = (reader["PRTHEADXML1"] == null ? "" : Convert.ToString(reader["PRTHEADXML1"]));//打印抬头1
|
|
data.PRTHEADXML2 = (reader["PRTHEADXML2"] == null ? "" : Convert.ToString(reader["PRTHEADXML2"]));//打印抬头2
|
|
data.PRTHEADXML3 = (reader["PRTHEADXML3"] == null ? "" : Convert.ToString(reader["PRTHEADXML3"]));//打印抬头3
|
|
data.PRTHEADXML4 = (reader["PRTHEADXML4"] == null ? "" : Convert.ToString(reader["PRTHEADXML4"]));//打印抬头4
|
|
data.PRTHEADXML5 = (reader["PRTHEADXML5"] == null ? "" : Convert.ToString(reader["PRTHEADXML5"]));//打印抬头5
|
|
data.BANKSHEAD = (reader["BANKSHEAD"] == null ? "" : Convert.ToString(reader["BANKSHEAD"]));//BANKSHEAD
|
|
data.GPSUser = (reader["GPSUser"] == null ? "" : Convert.ToString(reader["GPSUser"]));//GPSUser
|
|
data.GPSPassWord = (reader["GPSPassWord"] == null ? "" : Convert.ToString(reader["GPSPassWord"]));//GPSPassWord
|
|
data.ORGANIZATIONCODE = (reader["ORGANIZATIONCODE"] == null ? "" : Convert.ToString(reader["ORGANIZATIONCODE"]));
|
|
data.MODIFIEDUSERNAME = (reader["MODIFIEDUSERNAME"] == null ? "" : Convert.ToString(reader["MODIFIEDUSERNAME"]));//更改人
|
|
data.LOGO = null;//徽标
|
|
if (reader["LOGO"] != DBNull.Value)
|
|
{
|
|
data.LOGO = (byte[])reader["LOGO"];//徽标
|
|
}
|
|
data.LOGOURL = getLOGO(data.LOGO, data.GID, strPath, strPhotoPath); ;//徽标
|
|
data.LOCALCURR = (reader["LOCALCURR"] == null ? "" : Convert.ToString(reader["LOCALCURR"]));//本地货币
|
|
data.WORKFLOWMSG = (reader["WORKFLOWMSG"] == null ? "" : Convert.ToString(reader["WORKFLOWMSG"]));//是否消息提示
|
|
|
|
data.DISPATCHURL = Convert.ToString(reader["DISPATCHURL"]);
|
|
data.APPCODE = Convert.ToString(reader["APPCODE"]);
|
|
data.APPKEY = Convert.ToString(reader["APPKEY"]);
|
|
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
private static List<MsCompanysEntity> SetNoPicData(String strSql)
|
|
{
|
|
var headList = new List<MsCompanysEntity>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
MsCompanysEntity data = new MsCompanysEntity();
|
|
#region Set DB data to Object
|
|
data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//GID
|
|
data.CodeAndName = Convert.ToString(reader["CodeAndName"]);
|
|
data.CODENAME = (reader["CODENAME"] == null ? "" : Convert.ToString(reader["CODENAME"]));//CODENAME
|
|
data.NAME = (reader["NAME"] == null ? "" : Convert.ToString(reader["NAME"]));//NAME
|
|
data.FULLNAME = (reader["FULLNAME"] == null ? "" : Convert.ToString(reader["FULLNAME"]));//FULLNAME
|
|
data.ENNAME = (reader["ENNAME"] == null ? "" : Convert.ToString(reader["ENNAME"]));//公司英文名称
|
|
data.ADDRESS = (reader["ADDRESS"] == null ? "" : Convert.ToString(reader["ADDRESS"]));//ADDRESS
|
|
data.ENADDRESS = (reader["ENADDRESS"] == null ? "" : Convert.ToString(reader["ENADDRESS"]));//公司英文地址
|
|
data.POSTCODE = (reader["POSTCODE"] == null ? "" : Convert.ToString(reader["POSTCODE"]));//POSTCODE
|
|
data.OFFICEPHONE = (reader["OFFICEPHONE"] == null ? "" : Convert.ToString(reader["OFFICEPHONE"]));//OFFICEPHONE
|
|
data.FAX = (reader["FAX"] == null ? "" : Convert.ToString(reader["FAX"]));//FAX
|
|
data.EMAIL = (reader["EMAIL"] == null ? "" : Convert.ToString(reader["EMAIL"]));//EMAIL
|
|
data.WEBSITEURL = (reader["WEBSITEURL"] == null ? "" : Convert.ToString(reader["WEBSITEURL"]));//WEBSITEURL
|
|
data.LICENSECODE = (reader["LICENSECODE"] == null ? "" : Convert.ToString(reader["LICENSECODE"]));//LICENSECODE
|
|
data.TAXCODE = (reader["TAXCODE"] == null ? "" : Convert.ToString(reader["TAXCODE"]));//TAXCODE
|
|
data.CREATEUSER = (reader["CREATEUSER"] == null ? "" : Convert.ToString(reader["CREATEUSER"]));//CREATEUSER
|
|
if (reader["CREATETIME"] != DBNull.Value)
|
|
data.CREATETIME = Convert.ToDateTime(reader["CREATETIME"]);
|
|
data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//更新人gid
|
|
if (reader["MODIFIEDTIME"] != DBNull.Value)
|
|
data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]);
|
|
data.ISDELETED = (reader["ISDELETED"] == null ? false : Convert.ToBoolean(reader["ISDELETED"]));//ISDELETED
|
|
data.ISDISABLE = (reader["ISDISABLE"] == null ? false : Convert.ToBoolean(reader["ISDISABLE"]));//ISDISABLE
|
|
data.PARENTID = (reader["PARENTID"] == null ? "" : Convert.ToString(reader["PARENTID"]));//PARENTID
|
|
data.BILLRISES = (reader["BILLRISES"] == null ? "" : Convert.ToString(reader["BILLRISES"]));//发票抬头
|
|
data.CHEQUEPAYABLE = (reader["CHEQUEPAYABLE"] == null ? "" : Convert.ToString(reader["CHEQUEPAYABLE"]));//支票抬头
|
|
data.PRTHEADXML1 = (reader["PRTHEADXML1"] == null ? "" : Convert.ToString(reader["PRTHEADXML1"]));//打印抬头1
|
|
data.PRTHEADXML2 = (reader["PRTHEADXML2"] == null ? "" : Convert.ToString(reader["PRTHEADXML2"]));//打印抬头2
|
|
data.PRTHEADXML3 = (reader["PRTHEADXML3"] == null ? "" : Convert.ToString(reader["PRTHEADXML3"]));//打印抬头3
|
|
data.PRTHEADXML4 = (reader["PRTHEADXML4"] == null ? "" : Convert.ToString(reader["PRTHEADXML4"]));//打印抬头4
|
|
data.PRTHEADXML5 = (reader["PRTHEADXML5"] == null ? "" : Convert.ToString(reader["PRTHEADXML5"]));//打印抬头5
|
|
data.BANKSHEAD = (reader["BANKSHEAD"] == null ? "" : Convert.ToString(reader["BANKSHEAD"]));//BANKSHEAD
|
|
data.GPSUser = (reader["GPSUser"] == null ? "" : Convert.ToString(reader["GPSUser"]));//GPSUser
|
|
data.GPSPassWord = (reader["GPSPassWord"] == null ? "" : Convert.ToString(reader["GPSPassWord"]));//GPSPassWord
|
|
data.ORGANIZATIONCODE = (reader["ORGANIZATIONCODE"] == null ? "" : Convert.ToString(reader["ORGANIZATIONCODE"]));
|
|
data.MODIFIEDUSERNAME = (reader["MODIFIEDUSERNAME"] == null ? "" : Convert.ToString(reader["MODIFIEDUSERNAME"]));//更改人
|
|
data.DBNAME = Convert.ToString(reader["DBNAME"]);
|
|
data.LOCALCURR = (reader["LOCALCURR"] == null ? "" : Convert.ToString(reader["LOCALCURR"]));//本地货币
|
|
data.WORKFLOWMSG = (reader["WORKFLOWMSG"] == null ? "" : Convert.ToString(reader["WORKFLOWMSG"]));//是否消息提示
|
|
if (reader["CLOSEETDDAY"] != DBNull.Value)
|
|
data.CLOSEETDDAY = Convert.ToDateTime(reader["CLOSEETDDAY"]).ToString("yyyy-MM-dd");//到港日期
|
|
data.DISPATCHURL = Convert.ToString(reader["DISPATCHURL"]);
|
|
data.APPCODE = Convert.ToString(reader["APPCODE"]);
|
|
data.APPKEY = Convert.ToString(reader["APPKEY"]);
|
|
data.DTALKDEPTID = Convert.ToString(reader["DTALKDEPTID"]);
|
|
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
|
|
protected static string getLOGO(byte[] photo,string sGID,string strPath,string strPhotoPath)
|
|
{
|
|
//图片路径
|
|
//string strPath = "../../images/logo/" + sGID.Trim() + ".gif";
|
|
//string strPhotoPath = Server.MapPath(strPath);
|
|
if (sGID.Trim() != "" && photo!=null)
|
|
{
|
|
strPath = strPath.Replace("noImage", sGID.Trim());
|
|
strPhotoPath = strPhotoPath.Replace("noImage", sGID.Trim());
|
|
//保存图片文件
|
|
BinaryWriter bw = new BinaryWriter(File.Open(strPhotoPath, FileMode.OpenOrCreate));
|
|
bw.Write(photo);
|
|
bw.Close();
|
|
}
|
|
//显示图片
|
|
return strPath;
|
|
}
|
|
#endregion
|
|
|
|
#region Rang权限范围
|
|
public static string GetRangDAStr(string tb, string userid, string username, string companyid)
|
|
{
|
|
string str = "";
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT");
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE");
|
|
strSql.Append(" from VW_User_Authority");
|
|
strSql.Append(" where [NAME]='modCompanys' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
string visiblerange = "4";
|
|
string operaterange = "4";
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
break;
|
|
}
|
|
reader.Close();
|
|
}
|
|
if (visiblerange == "4")//无
|
|
{
|
|
str = " 1<0";
|
|
}
|
|
else if (visiblerange == "3")//个人
|
|
{
|
|
str = " 1<0";
|
|
}
|
|
else if (visiblerange == "2")//部门
|
|
{
|
|
str = " 1<0";
|
|
}
|
|
else if (visiblerange == "1")//公司
|
|
{
|
|
str = " GID='" + companyid + "'";
|
|
}
|
|
else if (visiblerange == "0")//全部
|
|
{
|
|
str = " 1=1 ";
|
|
}
|
|
return str;
|
|
}
|
|
#endregion
|
|
|
|
#region 添加日志
|
|
public static DBResult setLog(MsCompanysEntity modeldata, string strUserID)
|
|
{
|
|
DBResult result = new DBResult();
|
|
if (modeldata == null)
|
|
{
|
|
result.Success = false;
|
|
result.Message = "没有输入任何需要修改的数据";
|
|
return result;
|
|
}
|
|
//
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
{
|
|
try
|
|
{
|
|
string strSql = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('删除信息','更新操作','" + modeldata.NAME + " 添加删除标志','" + strUserID + "')";
|
|
int existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql.ToString(), null);
|
|
sqlTran.Commit();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
sqlTran.Rollback();
|
|
result.Success = false;
|
|
result.Message = "操作出现错误,请重试或联系系统管理员";
|
|
return result;
|
|
}
|
|
}
|
|
result.Success = true;
|
|
result.Message = "操作数据成功";
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
public static DBResult Save(MsCompanysEntity headData)
|
|
{
|
|
DBResult result = new DBResult();
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
{
|
|
try
|
|
{
|
|
if (headData.DbOperationType == DbOperationType.DbotIns)
|
|
{
|
|
if (headData.LOGO == null)
|
|
{
|
|
#region 插入
|
|
const string strSql = @"insert into company(GID,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,CODENAME,ISDELETED,ISDISABLE,PARENTID,BILLRISES,CHEQUEPAYABLE,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,NAME,BANKSHEAD,GPSUser,GPSPassWord,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,ORGANIZATIONCODE,LOCALCURR,WORKFLOWMSG,APPCODE,DISPATCHURL,APPKEY)
|
|
values (@GID,@FAX,@EMAIL,@WEBSITEURL,@LICENSECODE,@TAXCODE,@CREATEUSER,@CREATETIME,@MODIFIEDUSER,@MODIFIEDTIME,@CODENAME,@ISDELETED,@ISDISABLE,@PARENTID,@BILLRISES,@CHEQUEPAYABLE,@PRTHEADXML1,@PRTHEADXML2,@PRTHEADXML3,@PRTHEADXML4,@PRTHEADXML5,@NAME,@BANKSHEAD,@GPSUser,@GPSPassWord
|
|
,@FULLNAME,@ENNAME,@ADDRESS,@ENADDRESS,@POSTCODE,@OFFICEPHONE,@ORGANIZATIONCODE,@LOCALCURR,@WORKFLOWMSG,@APPCODE,@DISPATCHURL,@APPKEY)";
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
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("@LOGO", SqlDbType.Image) ,
|
|
new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@CODENAME", SqlDbType.VarChar,10) ,
|
|
new SqlParameter("@ISDELETED", SqlDbType.Bit,1) ,
|
|
new SqlParameter("@ISDISABLE", SqlDbType.Bit,1) ,
|
|
new SqlParameter("@PARENTID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@BILLRISES", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@CHEQUEPAYABLE", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@PRTHEADXML1", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML2", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML3", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML4", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML5", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@NAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@BANKSHEAD", SqlDbType.VarChar,3) ,
|
|
new SqlParameter("@GPSUser", SqlDbType.VarChar,20) ,
|
|
new SqlParameter("@GPSPassWord", SqlDbType.VarChar,20) ,
|
|
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("@ORGANIZATIONCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@LOCALCURR", SqlDbType.VarChar,30),
|
|
new SqlParameter("@WORKFLOWMSG", SqlDbType.VarChar,1),
|
|
new SqlParameter("@APPCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@DISPATCHURL", SqlDbType.VarChar,300),
|
|
new SqlParameter("@APPKEY", SqlDbType.VarChar,50)
|
|
};
|
|
parameters[0].Value = headData.GID;
|
|
parameters[1].Value = headData.FAX;
|
|
parameters[2].Value = headData.EMAIL;
|
|
parameters[3].Value = headData.WEBSITEURL;
|
|
parameters[4].Value = headData.LICENSECODE;
|
|
parameters[5].Value = headData.TAXCODE;
|
|
//parameters[6].Value = headData.LOGO;
|
|
parameters[6].Value = headData.CREATEUSER;
|
|
parameters[7].Value = headData.CREATETIME;
|
|
parameters[8].Value = headData.MODIFIEDUSER;
|
|
parameters[9].Value = headData.MODIFIEDTIME;
|
|
parameters[10].Value = headData.CODENAME;
|
|
parameters[11].Value = headData.ISDELETED;
|
|
parameters[12].Value = headData.ISDISABLE;
|
|
parameters[13].Value = headData.PARENTID;
|
|
parameters[14].Value = headData.BILLRISES;
|
|
parameters[15].Value = headData.CHEQUEPAYABLE;
|
|
parameters[16].Value = headData.PRTHEADXML1;
|
|
parameters[17].Value = headData.PRTHEADXML2;
|
|
parameters[18].Value = headData.PRTHEADXML3;
|
|
parameters[19].Value = headData.PRTHEADXML4;
|
|
parameters[20].Value = headData.PRTHEADXML5;
|
|
parameters[21].Value = headData.NAME;
|
|
parameters[22].Value = headData.BANKSHEAD;
|
|
parameters[23].Value = headData.GPSUser;
|
|
parameters[24].Value = headData.GPSPassWord;
|
|
parameters[25].Value = headData.FULLNAME;
|
|
parameters[26].Value = headData.ENNAME;
|
|
parameters[27].Value = headData.ADDRESS;
|
|
parameters[28].Value = headData.ENADDRESS;
|
|
parameters[29].Value = headData.POSTCODE;
|
|
parameters[30].Value = headData.OFFICEPHONE;
|
|
parameters[31].Value = headData.ORGANIZATIONCODE;
|
|
parameters[32].Value = headData.LOCALCURR;
|
|
parameters[33].Value = headData.WORKFLOWMSG;
|
|
parameters[34].Value = headData.APPCODE;
|
|
parameters[35].Value = headData.DISPATCHURL;
|
|
parameters[36].Value = headData.APPKEY;
|
|
#endregion
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parameters);
|
|
}
|
|
else
|
|
{
|
|
#region 插入
|
|
const string strSql = @"insert into company(GID,FAX,EMAIL,WEBSITEURL,LICENSECODE,TAXCODE,LOGO,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,CODENAME,ISDELETED,ISDISABLE,PARENTID,BILLRISES,CHEQUEPAYABLE,PRTHEADXML1,PRTHEADXML2,PRTHEADXML3,PRTHEADXML4,PRTHEADXML5,NAME,BANKSHEAD,GPSUser,GPSPassWord,FULLNAME,ENNAME,ADDRESS,ENADDRESS,POSTCODE,OFFICEPHONE,ORGANIZATIONCODE,LOCALCURR,WORKFLOWMSG,APPCODE,DISPATCHURL,APPKEY) values (@GID,@FAX,@EMAIL,@WEBSITEURL,@LICENSECODE,@TAXCODE,@LOGO,@CREATEUSER,@CREATETIME,@MODIFIEDUSER,@MODIFIEDTIME,@CODENAME,@ISDELETED,@ISDISABLE,@PARENTID,@BILLRISES,@CHEQUEPAYABLE,@PRTHEADXML1,@PRTHEADXML2,@PRTHEADXML3,@PRTHEADXML4,@PRTHEADXML5,@NAME,@BANKSHEAD,@GPSUser,@GPSPassWord,@FULLNAME,@ENNAME,@ADDRESS,@ENADDRESS,@POSTCODE,@OFFICEPHONE,@ORGANIZATIONCODE,@LOCALCURR,@WORKFLOWMSG,@APPCODE,@DISPATCHURL,@APPKEY)";
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
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("@LOGO", SqlDbType.Image) ,
|
|
new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@CODENAME", SqlDbType.VarChar,10) ,
|
|
new SqlParameter("@ISDELETED", SqlDbType.Bit,1) ,
|
|
new SqlParameter("@ISDISABLE", SqlDbType.Bit,1) ,
|
|
new SqlParameter("@PARENTID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@BILLRISES", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@CHEQUEPAYABLE", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@PRTHEADXML1", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML2", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML3", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML4", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML5", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@NAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@BANKSHEAD", SqlDbType.VarChar,3) ,
|
|
new SqlParameter("@GPSUser", SqlDbType.VarChar,20) ,
|
|
new SqlParameter("@GPSPassWord", SqlDbType.VarChar,20) ,
|
|
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("@ORGANIZATIONCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@LOCALCURR", SqlDbType.VarChar,30),
|
|
new SqlParameter("@WORKFLOWMSG", SqlDbType.VarChar,30),
|
|
new SqlParameter("@APPCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@DISPATCHURL", SqlDbType.VarChar,300),
|
|
new SqlParameter("@APPKEY", SqlDbType.VarChar,50)
|
|
};
|
|
parameters[0].Value = headData.GID;
|
|
parameters[1].Value = headData.FAX;
|
|
parameters[2].Value = headData.EMAIL;
|
|
parameters[3].Value = headData.WEBSITEURL;
|
|
parameters[4].Value = headData.LICENSECODE;
|
|
parameters[5].Value = headData.TAXCODE;
|
|
parameters[6].Value = headData.LOGO;
|
|
parameters[7].Value = headData.CREATEUSER;
|
|
parameters[8].Value = headData.CREATETIME;
|
|
parameters[9].Value = headData.MODIFIEDUSER;
|
|
parameters[10].Value = headData.MODIFIEDTIME;
|
|
parameters[11].Value = headData.CODENAME;
|
|
parameters[12].Value = headData.ISDELETED;
|
|
parameters[13].Value = headData.ISDISABLE;
|
|
parameters[14].Value = headData.PARENTID;
|
|
parameters[15].Value = headData.BILLRISES;
|
|
parameters[16].Value = headData.CHEQUEPAYABLE;
|
|
parameters[17].Value = headData.PRTHEADXML1;
|
|
parameters[18].Value = headData.PRTHEADXML2;
|
|
parameters[19].Value = headData.PRTHEADXML3;
|
|
parameters[20].Value = headData.PRTHEADXML4;
|
|
parameters[21].Value = headData.PRTHEADXML5;
|
|
parameters[22].Value = headData.NAME;
|
|
parameters[23].Value = headData.BANKSHEAD;
|
|
parameters[24].Value = headData.GPSUser;
|
|
parameters[25].Value = headData.GPSPassWord;
|
|
parameters[26].Value = headData.FULLNAME;
|
|
parameters[27].Value = headData.ENNAME;
|
|
parameters[28].Value = headData.ADDRESS;
|
|
parameters[29].Value = headData.ENADDRESS;
|
|
parameters[30].Value = headData.POSTCODE;
|
|
parameters[31].Value = headData.OFFICEPHONE;
|
|
parameters[32].Value = headData.ORGANIZATIONCODE;
|
|
parameters[33].Value = headData.LOCALCURR;
|
|
parameters[34].Value = headData.WORKFLOWMSG;
|
|
parameters[35].Value = headData.APPCODE;
|
|
parameters[36].Value = headData.DISPATCHURL;
|
|
parameters[37].Value = headData.APPKEY;
|
|
#endregion
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parameters);
|
|
}
|
|
}
|
|
else if (headData.DbOperationType == DbOperationType.DbotUpd)
|
|
{
|
|
if (headData.LOGO == null)
|
|
{
|
|
#region 更新
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update [company] set ");
|
|
//strSql.Append(" GID = @GID , ");
|
|
strSql.Append(" FAX = @FAX , ");
|
|
strSql.Append(" EMAIL = @EMAIL , ");
|
|
strSql.Append(" WEBSITEURL = @WEBSITEURL , ");
|
|
strSql.Append(" LICENSECODE = @LICENSECODE , ");
|
|
strSql.Append(" TAXCODE = @TAXCODE , ");
|
|
//strSql.Append(" LOGO = @LOGO , ");
|
|
//strSql.Append(" CREATEUSER = @CREATEUSER , ");
|
|
//strSql.Append(" CREATETIME = @CREATETIME , ");
|
|
strSql.Append(" MODIFIEDUSER = @MODIFIEDUSER , ");
|
|
strSql.Append(" MODIFIEDTIME = @MODIFIEDTIME , ");
|
|
strSql.Append(" CODENAME = @CODENAME , ");
|
|
//strSql.Append(" ISDELETED = @ISDELETED , ");
|
|
strSql.Append(" ISDISABLE = @ISDISABLE , ");
|
|
//strSql.Append(" PARENTID = @PARENTID , ");
|
|
strSql.Append(" BILLRISES = @BILLRISES , ");
|
|
strSql.Append(" CHEQUEPAYABLE = @CHEQUEPAYABLE , ");
|
|
strSql.Append(" PRTHEADXML1 = @PRTHEADXML1 , ");
|
|
strSql.Append(" PRTHEADXML2 = @PRTHEADXML2 , ");
|
|
strSql.Append(" PRTHEADXML3 = @PRTHEADXML3 , ");
|
|
strSql.Append(" PRTHEADXML4 = @PRTHEADXML4 , ");
|
|
strSql.Append(" PRTHEADXML5 = @PRTHEADXML5 , ");
|
|
strSql.Append(" [NAME] = @NAME , ");
|
|
strSql.Append(" BANKSHEAD = @BANKSHEAD , ");
|
|
//strSql.Append(" GPSUser = @GPSUser , ");
|
|
//strSql.Append(" GPSPassWord = @GPSPassWord , ");
|
|
strSql.Append(" FULLNAME = @FULLNAME , ");
|
|
strSql.Append(" ENNAME = @ENNAME , ");
|
|
strSql.Append(" ADDRESS = @ADDRESS , ");
|
|
strSql.Append(" ENADDRESS = @ENADDRESS , ");
|
|
strSql.Append(" POSTCODE = @POSTCODE , ");
|
|
strSql.Append(" OFFICEPHONE = @OFFICEPHONE , ");
|
|
strSql.Append(" ORGANIZATIONCODE = @ORGANIZATIONCODE, ");
|
|
strSql.Append(" LOCALCURR= @LOCALCURR, ");
|
|
strSql.Append(" WORKFLOWMSG= @WORKFLOWMSG, ");
|
|
strSql.Append(" APPCODE= @APPCODE, ");
|
|
strSql.Append(" DISPATCHURL= @DISPATCHURL, ");
|
|
strSql.Append(" APPKEY= @APPKEY ");
|
|
strSql.Append(" where GID=@GID ");
|
|
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
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("@LOGO", SqlDbType.Image) ,
|
|
//new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
//new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@CODENAME", SqlDbType.VarChar,10) ,
|
|
//new SqlParameter("@ISDELETED", SqlDbType.Bit,1) ,
|
|
new SqlParameter("@ISDISABLE", SqlDbType.Bit,1) ,
|
|
//new SqlParameter("@PARENTID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@BILLRISES", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@CHEQUEPAYABLE", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@PRTHEADXML1", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML2", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML3", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML4", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML5", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@NAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@BANKSHEAD", SqlDbType.VarChar,3) ,
|
|
//new SqlParameter("@GPSUser", SqlDbType.VarChar,20) ,
|
|
//new SqlParameter("@GPSPassWord", SqlDbType.VarChar,20) ,
|
|
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("@ORGANIZATIONCODE", SqlDbType.VarChar,50) ,
|
|
new SqlParameter("@LOCALCURR", SqlDbType.VarChar,30),
|
|
new SqlParameter("@WORKFLOWMSG", SqlDbType.VarChar,1),
|
|
new SqlParameter("@APPCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@DISPATCHURL", SqlDbType.VarChar,300),
|
|
new SqlParameter("@APPKEY", SqlDbType.VarChar,50)
|
|
};
|
|
parameters[0].Value = headData.GID;
|
|
parameters[1].Value = headData.FAX;
|
|
parameters[2].Value = headData.EMAIL;
|
|
parameters[3].Value = headData.WEBSITEURL;
|
|
parameters[4].Value = headData.LICENSECODE;
|
|
parameters[5].Value = headData.TAXCODE;
|
|
//parameters[6].Value = headData.LOGO;
|
|
//parameters[7].Value = headData.CREATEUSER;
|
|
//parameters[8].Value = headData.CREATETIME;
|
|
parameters[6].Value = headData.MODIFIEDUSER;
|
|
parameters[7].Value = headData.MODIFIEDTIME;
|
|
parameters[8].Value = headData.CODENAME;
|
|
//parameters[9].Value = headData.ISDELETED;
|
|
parameters[9].Value = headData.ISDISABLE;
|
|
//parameters[14].Value = headData.PARENTID;
|
|
parameters[10].Value = headData.BILLRISES;
|
|
parameters[11].Value = headData.CHEQUEPAYABLE;
|
|
parameters[12].Value = headData.PRTHEADXML1;
|
|
parameters[13].Value = headData.PRTHEADXML2;
|
|
parameters[14].Value = headData.PRTHEADXML3;
|
|
parameters[15].Value = headData.PRTHEADXML4;
|
|
parameters[16].Value = headData.PRTHEADXML5;
|
|
parameters[17].Value = headData.NAME;
|
|
parameters[18].Value = headData.BANKSHEAD;
|
|
//parameters[24].Value = headData.GPSUser;
|
|
//parameters[25].Value = headData.GPSPassWord;
|
|
parameters[19].Value = headData.FULLNAME;
|
|
parameters[20].Value = headData.ENNAME;
|
|
parameters[21].Value = headData.ADDRESS;
|
|
parameters[22].Value = headData.ENADDRESS;
|
|
parameters[23].Value = headData.POSTCODE;
|
|
parameters[24].Value = headData.OFFICEPHONE;
|
|
parameters[25].Value = headData.ORGANIZATIONCODE;
|
|
parameters[26].Value = headData.LOCALCURR;
|
|
parameters[27].Value = headData.WORKFLOWMSG;
|
|
parameters[28].Value = headData.APPCODE;
|
|
parameters[29].Value = headData.DISPATCHURL;
|
|
parameters[30].Value = headData.APPKEY;
|
|
#endregion
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql.ToString(), parameters);
|
|
}
|
|
else
|
|
{
|
|
#region 更新
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("update [company] set ");
|
|
//strSql.Append(" GID = @GID , ");
|
|
strSql.Append(" FAX = @FAX , ");
|
|
strSql.Append(" EMAIL = @EMAIL , ");
|
|
strSql.Append(" WEBSITEURL = @WEBSITEURL , ");
|
|
strSql.Append(" LICENSECODE = @LICENSECODE , ");
|
|
strSql.Append(" TAXCODE = @TAXCODE , ");
|
|
strSql.Append(" LOGO = @LOGO , ");
|
|
//strSql.Append(" CREATEUSER = @CREATEUSER , ");
|
|
//strSql.Append(" CREATETIME = @CREATETIME , ");
|
|
strSql.Append(" MODIFIEDUSER = @MODIFIEDUSER , ");
|
|
strSql.Append(" MODIFIEDTIME = @MODIFIEDTIME , ");
|
|
strSql.Append(" CODENAME = @CODENAME , ");
|
|
//strSql.Append(" ISDELETED = @ISDELETED , ");
|
|
//strSql.Append(" ISDISABLE = @ISDISABLE , ");
|
|
//strSql.Append(" PARENTID = @PARENTID , ");
|
|
strSql.Append(" BILLRISES = @BILLRISES , ");
|
|
strSql.Append(" CHEQUEPAYABLE = @CHEQUEPAYABLE , ");
|
|
strSql.Append(" PRTHEADXML1 = @PRTHEADXML1 , ");
|
|
strSql.Append(" PRTHEADXML2 = @PRTHEADXML2 , ");
|
|
strSql.Append(" PRTHEADXML3 = @PRTHEADXML3 , ");
|
|
strSql.Append(" PRTHEADXML4 = @PRTHEADXML4 , ");
|
|
strSql.Append(" PRTHEADXML5 = @PRTHEADXML5 , ");
|
|
strSql.Append(" [NAME] = @NAME , ");
|
|
strSql.Append(" BANKSHEAD = @BANKSHEAD , ");
|
|
//strSql.Append(" GPSUser = @GPSUser , ");
|
|
//strSql.Append(" GPSPassWord = @GPSPassWord , ");
|
|
strSql.Append(" FULLNAME = @FULLNAME , ");
|
|
strSql.Append(" ENNAME = @ENNAME , ");
|
|
strSql.Append(" ADDRESS = @ADDRESS , ");
|
|
strSql.Append(" ENADDRESS = @ENADDRESS , ");
|
|
strSql.Append(" POSTCODE = @POSTCODE , ");
|
|
strSql.Append(" OFFICEPHONE = @OFFICEPHONE , ");
|
|
strSql.Append(" ORGANIZATIONCODE = @ORGANIZATIONCODE, ");
|
|
strSql.Append(" LOCALCURR = @LOCALCURR, ");
|
|
strSql.Append(" WORKFLOWMSG = @WORKFLOWMSG, ");
|
|
strSql.Append(" APPCODE= @APPCODE, ");
|
|
strSql.Append(" DISPATCHURL= @DISPATCHURL, ");
|
|
strSql.Append(" APPKEY= @APPKEY ");
|
|
strSql.Append(" where GID=@GID ");
|
|
|
|
SqlParameter[] parameters = {
|
|
new SqlParameter("@GID", SqlDbType.VarChar,36) ,
|
|
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("@LOGO", SqlDbType.Image) ,
|
|
//new SqlParameter("@CREATEUSER", SqlDbType.VarChar,36) ,
|
|
//new SqlParameter("@CREATETIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@MODIFIEDUSER", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@MODIFIEDTIME", SqlDbType.DateTime) ,
|
|
new SqlParameter("@CODENAME", SqlDbType.VarChar,10) ,
|
|
//new SqlParameter("@ISDELETED", SqlDbType.Bit,1) ,
|
|
//new SqlParameter("@ISDISABLE", SqlDbType.Bit,1) ,
|
|
//new SqlParameter("@PARENTID", SqlDbType.VarChar,36) ,
|
|
new SqlParameter("@BILLRISES", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@CHEQUEPAYABLE", SqlDbType.VarChar,60) ,
|
|
new SqlParameter("@PRTHEADXML1", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML2", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML3", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML4", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@PRTHEADXML5", SqlDbType.VarChar,1024) ,
|
|
new SqlParameter("@NAME", SqlDbType.VarChar,150) ,
|
|
new SqlParameter("@BANKSHEAD", SqlDbType.VarChar,3) ,
|
|
//new SqlParameter("@GPSUser", SqlDbType.VarChar,20) ,
|
|
//new SqlParameter("@GPSPassWord", SqlDbType.VarChar,20) ,
|
|
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("@ORGANIZATIONCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@LOCALCURR", SqlDbType.VarChar,30),
|
|
new SqlParameter("@WORKFLOWMSG", SqlDbType.VarChar,1),
|
|
new SqlParameter("@APPCODE", SqlDbType.VarChar,50),
|
|
new SqlParameter("@DISPATCHURL", SqlDbType.VarChar,300),
|
|
new SqlParameter("@APPKEY", SqlDbType.VarChar,50)
|
|
};
|
|
parameters[0].Value = headData.GID;
|
|
parameters[1].Value = headData.FAX;
|
|
parameters[2].Value = headData.EMAIL;
|
|
parameters[3].Value = headData.WEBSITEURL;
|
|
parameters[4].Value = headData.LICENSECODE;
|
|
parameters[5].Value = headData.TAXCODE;
|
|
parameters[6].Value = headData.LOGO;
|
|
//parameters[7].Value = headData.CREATEUSER;
|
|
//parameters[8].Value = headData.CREATETIME;
|
|
parameters[7].Value = headData.MODIFIEDUSER;
|
|
parameters[8].Value = headData.MODIFIEDTIME;
|
|
parameters[9].Value = headData.CODENAME;
|
|
//parameters[12].Value = headData.ISDELETED;
|
|
//parameters[13].Value = headData.ISDISABLE;
|
|
//parameters[14].Value = headData.PARENTID;
|
|
parameters[10].Value = headData.BILLRISES;
|
|
parameters[11].Value = headData.CHEQUEPAYABLE;
|
|
parameters[12].Value = headData.PRTHEADXML1;
|
|
parameters[13].Value = headData.PRTHEADXML2;
|
|
parameters[14].Value = headData.PRTHEADXML3;
|
|
parameters[15].Value = headData.PRTHEADXML4;
|
|
parameters[16].Value = headData.PRTHEADXML5;
|
|
parameters[17].Value = headData.NAME;
|
|
parameters[18].Value = headData.BANKSHEAD;
|
|
//parameters[24].Value = headData.GPSUser;
|
|
//parameters[25].Value = headData.GPSPassWord;
|
|
parameters[19].Value = headData.FULLNAME;
|
|
parameters[20].Value = headData.ENNAME;
|
|
parameters[21].Value = headData.ADDRESS;
|
|
parameters[22].Value = headData.ENADDRESS;
|
|
parameters[23].Value = headData.POSTCODE;
|
|
parameters[24].Value = headData.OFFICEPHONE;
|
|
parameters[25].Value = headData.ORGANIZATIONCODE;
|
|
parameters[26].Value = headData.LOCALCURR;
|
|
parameters[27].Value = headData.WORKFLOWMSG;
|
|
parameters[28].Value = headData.APPCODE;
|
|
parameters[29].Value = headData.DISPATCHURL;
|
|
parameters[30].Value = headData.APPKEY;
|
|
#endregion
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql.ToString(), parameters);
|
|
}
|
|
}
|
|
|
|
sqlTran.Commit();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
sqlTran.Rollback();
|
|
result.Success = false;
|
|
result.Message = "操作错误,请重试!";
|
|
return result;
|
|
}
|
|
finally
|
|
{
|
|
SqlHelper.CloseConnection();
|
|
}
|
|
}
|
|
result.Success = true;
|
|
result.Message = "操作成功";
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
public static DBResult Delete(MsCompanysEntity headData)
|
|
{
|
|
DBResult result = new DBResult();
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
string strSql = "SELECT top 1 LINKID as CORPID from sys_bank where LINKID in ('" + headData.GID + "') group by LINKID";
|
|
string strCORPID = T_ALL_DA.GetStrSQL("CORPID", strSql);
|
|
if (strCORPID.Trim() != "")
|
|
{
|
|
result.Success = false;
|
|
result.Message = "企业拥有银行信息,请先删除!";
|
|
return result;
|
|
}
|
|
//
|
|
strSql = "SELECT top 1 LINKID as CORPID from sys_dept where LINKID in ('" + headData.GID + "') group by LINKID";
|
|
strCORPID = T_ALL_DA.GetStrSQL("CORPID", strSql);
|
|
if (strCORPID.Trim() != "")
|
|
{
|
|
result.Success = false;
|
|
result.Message = "企业拥有部门信息,请先删除!";
|
|
return result;
|
|
}
|
|
//
|
|
strSql = "SELECT top 1 CORPID from VW_Settlement where CORPID in ('" + headData.GID + "') group by CORPID";
|
|
strCORPID = T_ALL_DA.GetStrSQL("CORPID", strSql);
|
|
if (strCORPID.Trim() != "")
|
|
{
|
|
result.Success = false;
|
|
result.Message = "企业拥有业务信息,请先删除!";
|
|
return result;
|
|
}
|
|
//
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (var conn = db.CreateConnection())
|
|
{
|
|
conn.Open();
|
|
var tran = conn.BeginTransaction();
|
|
try
|
|
{
|
|
//var cmdDelete = db.GetSqlStringCommand("delete from [company] where GID='" + headData.GID + "'");
|
|
var cmdDelete = db.GetSqlStringCommand("update [company] set ISDELETED=1 where GID='" + headData.GID + "'");
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
tran.Commit();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
tran.Rollback();
|
|
result.Success = false;
|
|
result.Message = "删除出现错误,请重试";
|
|
return result;
|
|
}
|
|
}
|
|
result.Success = true;
|
|
result.Message = "操作成功";
|
|
return result;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|