| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006 |
- using CallCenterApi.DB;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CallCenterApi.DAL
- {
- /// <summary>
- /// 数据访问类:T_Cus_CustomerBase
- /// </summary>
- public partial class T_Cus_CustomerBase
- {
- public T_Cus_CustomerBase()
- { }
- #region BasicMethod
- /// <summary>
- /// 得到最大ID
- /// </summary>
- public int GetMaxId()
- {
- return DbHelperSQL.GetMaxID("F_CustomerId", "T_Cus_CustomerBase");
- }
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(int F_CustomerId)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select count(1) from T_Cus_CustomerBase WITH(NOLOCK)");
- strSql.Append(" where F_CustomerId=@F_CustomerId");
- SqlParameter[] parameters = {
- new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
- };
- parameters[0].Value = F_CustomerId;
- return DbHelperSQL.Exists(strSql.ToString(), parameters);
- }
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public int Add(CallCenterApi.Model.T_Cus_CustomerBase model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("insert into T_Cus_CustomerBase(");
- strSql.Append("F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID)");
- strSql.Append(" values (");
- strSql.Append("@F_CustomerName,@F_CustomerCode,@F_CustomerEName,@F_CustomerPym,@F_Layer,@F_CustomerLayer,@F_CategoryId,@F_TradeId,@F_RegionId,@F_IndustryId,@F_Address,@F_Url,@F_Telephone,@F_Mobile,@F_Fax,@F_Email,@F_Website,@F_PostCode,@F_ScaleResume,@F_BusinessProfile,@F_BusinessLicenseID,@F_TaxID,@F_OpeningBank,@F_BankAccount,@F_LegalRepresentative,@F_LegalRepresentativeCardID,@F_Nature,@F_Kind,@F_CustomerType,@F_MainProduct,@F_CustomerFrom,@F_TrackInfo,@F_TrackState,@F_ImportDegree,@F_IntentProduct,@F_CreateBy,@F_CreatedOn,@F_ModifyBy,@F_ModifiedOn,@F_DeleteFlag,@F_StatusCode,@F_ServiceDept,@F_ChargeName,@F_ChargeTelephone,@F_Province,@F_ProductLine,@F_ChargeDept,@F_AfterSaleName,@F_CustomerNature,@F_CustomerClass,@F_CustomerIndustry,@F_RelationShipClass,@F_CurrentVersion,@F_SystemStartTime,@F_QualityGuaranteeEndTime,@F_AfterSaleTelephone,@F_Notes,@F_SystemType,@F_City,@F_CustomerStatus,@F_DeviceCount,@F_MaintenanceType,@F_ERPCustomerCode,@F_ServiceDeptID,@F_ProductLineID,@F_AfterSaleNameID,@F_CustomerNatureID,@F_CustomerClassID,@F_RelationShipClassID,@F_CityID)");
- strSql.Append(";select @@IDENTITY");
- SqlParameter[] parameters = {
- new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
- new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
- new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
- new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
- new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
- new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
- new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
- new SqlParameter("@F_TradeId", SqlDbType.Int,4),
- new SqlParameter("@F_RegionId", SqlDbType.Int,4),
- new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
- new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
- new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Email", SqlDbType.VarChar,200),
- new SqlParameter("@F_Website", SqlDbType.VarChar,200),
- new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
- new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
- new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
- new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
- new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
- new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
- new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
- new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
- new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
- new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
- new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
- new SqlParameter("@F_MainProduct", SqlDbType.Text),
- new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
- new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
- new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
- new SqlParameter("@F_IntentProduct", SqlDbType.Text),
- new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
- new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
- new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
- new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
- new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
- new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
- new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
- new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
- new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
- new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
- new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
- new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
- new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
- new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
- new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
- new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
- new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
- new SqlParameter("@F_City", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
- new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
- new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
- new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
- new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
- new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
- new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
- new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
- new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
- new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
- new SqlParameter("@F_CityID", SqlDbType.Int,4)};
- parameters[0].Value = model.F_CustomerName;
- parameters[1].Value = model.F_CustomerCode;
- parameters[2].Value = model.F_CustomerEName;
- parameters[3].Value = model.F_CustomerPym;
- parameters[4].Value = model.F_Layer;
- parameters[5].Value = model.F_CustomerLayer;
- parameters[6].Value = model.F_CategoryId;
- parameters[7].Value = model.F_TradeId;
- parameters[8].Value = model.F_RegionId;
- parameters[9].Value = model.F_IndustryId;
- parameters[10].Value = model.F_Address;
- parameters[11].Value = model.F_Url;
- parameters[12].Value = model.F_Telephone;
- parameters[13].Value = model.F_Mobile;
- parameters[14].Value = model.F_Fax;
- parameters[15].Value = model.F_Email;
- parameters[16].Value = model.F_Website;
- parameters[17].Value = model.F_PostCode;
- parameters[18].Value = model.F_ScaleResume;
- parameters[19].Value = model.F_BusinessProfile;
- parameters[20].Value = model.F_BusinessLicenseID;
- parameters[21].Value = model.F_TaxID;
- parameters[22].Value = model.F_OpeningBank;
- parameters[23].Value = model.F_BankAccount;
- parameters[24].Value = model.F_LegalRepresentative;
- parameters[25].Value = model.F_LegalRepresentativeCardID;
- parameters[26].Value = model.F_Nature;
- parameters[27].Value = model.F_Kind;
- parameters[28].Value = model.F_CustomerType;
- parameters[29].Value = model.F_MainProduct;
- parameters[30].Value = model.F_CustomerFrom;
- parameters[31].Value = model.F_TrackInfo;
- parameters[32].Value = model.F_TrackState;
- parameters[33].Value = model.F_ImportDegree;
- parameters[34].Value = model.F_IntentProduct;
- parameters[35].Value = model.F_CreateBy;
- parameters[36].Value = model.F_CreatedOn;
- parameters[37].Value = model.F_ModifyBy;
- parameters[38].Value = model.F_ModifiedOn;
- parameters[39].Value = model.F_DeleteFlag;
- parameters[40].Value = model.F_StatusCode;
- parameters[41].Value = model.F_ServiceDept;
- parameters[42].Value = model.F_ChargeName;
- parameters[43].Value = model.F_ChargeTelephone;
- parameters[44].Value = model.F_Province;
- parameters[45].Value = model.F_ProductLine;
- parameters[46].Value = model.F_ChargeDept;
- parameters[47].Value = model.F_AfterSaleName;
- parameters[48].Value = model.F_CustomerNature;
- parameters[49].Value = model.F_CustomerClass;
- parameters[50].Value = model.F_CustomerIndustry;
- parameters[51].Value = model.F_RelationShipClass;
- parameters[52].Value = model.F_CurrentVersion;
- parameters[53].Value = model.F_SystemStartTime;
- parameters[54].Value = model.F_QualityGuaranteeEndTime;
- parameters[55].Value = model.F_AfterSaleTelephone;
- parameters[56].Value = model.F_Notes;
- parameters[57].Value = model.F_SystemType;
- parameters[58].Value = model.F_City;
- parameters[59].Value = model.F_CustomerStatus;
- parameters[60].Value = model.F_DeviceCount;
- parameters[61].Value = model.F_MaintenanceType;
- parameters[62].Value = model.F_ERPCustomerCode;
- parameters[63].Value = model.F_ServiceDeptID;
- parameters[64].Value = model.F_ProductLineID;
- parameters[65].Value = model.F_AfterSaleNameID;
- parameters[66].Value = model.F_CustomerNatureID;
- parameters[67].Value = model.F_CustomerClassID;
- parameters[68].Value = model.F_RelationShipClassID;
- parameters[69].Value = model.F_CityID;
- object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
- if (obj == null)
- {
- return 0;
- }
- else
- {
- return Convert.ToInt32(obj);
- }
- }
- /// <summary>
- /// 判断来电单位是否存在
- /// </summary>
- /// <returns></returns>
- public bool LDdepExist(string lddep)
- {
- bool lddepexists = false;
- List<string> dep = null;
- string str = "select distinct F_CustomerIndustry from T_Cus_CustomerBase WITH(NOLOCK)";
- DataSet ds = DbHelperSQL.Query(str);
- if (ds != null && ds.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- if (!string.IsNullOrEmpty(dr[0].ToString()))
- {
- dep.Add(dr[0].ToString());
- }
- }
- if (dep.Contains(lddep))
- lddepexists = true;
- }
- return lddepexists;
- }
- /// <summary>
- /// 获取来电单位
- /// </summary>
- /// <returns></returns>
- public List<string> GetLDdep()
- {
- List<string> lddep = new List<string>();
- string str = "select distinct F_CustomerIndustry,F_RelationShipClass from T_Cus_CustomerBase WITH(NOLOCK) where F_DeleteFlag=0 and ((F_CustomerIndustry <> '') or (F_RelationShipClass <> ''))";
- DataSet ds = DbHelperSQL.Query(str);
- if (ds != null && ds.Tables[0].Rows.Count > 0)
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
- {
- string ldname = dr[i].ToString();
- if (!string.IsNullOrEmpty(ldname) && !lddep.Contains(ldname))
- {
- lddep.Add(ldname);
- }
- }
- }
- }
- return lddep;
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(CallCenterApi.Model.T_Cus_CustomerBase model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("update T_Cus_CustomerBase set ");
- strSql.Append("F_CustomerName=@F_CustomerName,");
- strSql.Append("F_CustomerCode=@F_CustomerCode,");
- strSql.Append("F_CustomerEName=@F_CustomerEName,");
- strSql.Append("F_CustomerPym=@F_CustomerPym,");
- strSql.Append("F_Layer=@F_Layer,");
- strSql.Append("F_CustomerLayer=@F_CustomerLayer,");
- strSql.Append("F_CategoryId=@F_CategoryId,");
- strSql.Append("F_TradeId=@F_TradeId,");
- strSql.Append("F_RegionId=@F_RegionId,");
- strSql.Append("F_IndustryId=@F_IndustryId,");
- strSql.Append("F_Address=@F_Address,");
- strSql.Append("F_Url=@F_Url,");
- strSql.Append("F_Telephone=@F_Telephone,");
- strSql.Append("F_Mobile=@F_Mobile,");
- strSql.Append("F_Fax=@F_Fax,");
- strSql.Append("F_Email=@F_Email,");
- strSql.Append("F_Website=@F_Website,");
- strSql.Append("F_PostCode=@F_PostCode,");
- strSql.Append("F_ScaleResume=@F_ScaleResume,");
- strSql.Append("F_BusinessProfile=@F_BusinessProfile,");
- strSql.Append("F_BusinessLicenseID=@F_BusinessLicenseID,");
- strSql.Append("F_TaxID=@F_TaxID,");
- strSql.Append("F_OpeningBank=@F_OpeningBank,");
- strSql.Append("F_BankAccount=@F_BankAccount,");
- strSql.Append("F_LegalRepresentative=@F_LegalRepresentative,");
- strSql.Append("F_LegalRepresentativeCardID=@F_LegalRepresentativeCardID,");
- strSql.Append("F_Nature=@F_Nature,");
- strSql.Append("F_Kind=@F_Kind,");
- strSql.Append("F_CustomerType=@F_CustomerType,");
- strSql.Append("F_MainProduct=@F_MainProduct,");
- strSql.Append("F_CustomerFrom=@F_CustomerFrom,");
- strSql.Append("F_TrackInfo=@F_TrackInfo,");
- strSql.Append("F_TrackState=@F_TrackState,");
- strSql.Append("F_ImportDegree=@F_ImportDegree,");
- strSql.Append("F_IntentProduct=@F_IntentProduct,");
- strSql.Append("F_CreateBy=@F_CreateBy,");
- strSql.Append("F_CreatedOn=@F_CreatedOn,");
- strSql.Append("F_ModifyBy=@F_ModifyBy,");
- strSql.Append("F_ModifiedOn=@F_ModifiedOn,");
- strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
- strSql.Append("F_StatusCode=@F_StatusCode,");
- strSql.Append("F_ServiceDept=@F_ServiceDept,");
- strSql.Append("F_ChargeName=@F_ChargeName,");
- strSql.Append("F_ChargeTelephone=@F_ChargeTelephone,");
- strSql.Append("F_Province=@F_Province,");
- strSql.Append("F_ProductLine=@F_ProductLine,");
- strSql.Append("F_ChargeDept=@F_ChargeDept,");
- strSql.Append("F_AfterSaleName=@F_AfterSaleName,");
- strSql.Append("F_CustomerNature=@F_CustomerNature,");
- strSql.Append("F_CustomerClass=@F_CustomerClass,");
- strSql.Append("F_CustomerIndustry=@F_CustomerIndustry,");
- strSql.Append("F_RelationShipClass=@F_RelationShipClass,");
- strSql.Append("F_CurrentVersion=@F_CurrentVersion,");
- strSql.Append("F_SystemStartTime=@F_SystemStartTime,");
- strSql.Append("F_QualityGuaranteeEndTime=@F_QualityGuaranteeEndTime,");
- strSql.Append("F_AfterSaleTelephone=@F_AfterSaleTelephone,");
- strSql.Append("F_Notes=@F_Notes,");
- strSql.Append("F_SystemType=@F_SystemType,");
- strSql.Append("F_City=@F_City,");
- strSql.Append("F_CustomerStatus=@F_CustomerStatus,");
- strSql.Append("F_DeviceCount=@F_DeviceCount,");
- strSql.Append("F_MaintenanceType=@F_MaintenanceType,");
- strSql.Append("F_ERPCustomerCode=@F_ERPCustomerCode,");
- strSql.Append("F_ServiceDeptID=@F_ServiceDeptID,");
- strSql.Append("F_ProductLineID=@F_ProductLineID,");
- strSql.Append("F_AfterSaleNameID=@F_AfterSaleNameID,");
- strSql.Append("F_CustomerNatureID=@F_CustomerNatureID,");
- strSql.Append("F_CustomerClassID=@F_CustomerClassID,");
- strSql.Append("F_RelationShipClassID=@F_RelationShipClassID,");
- strSql.Append("F_CityID=@F_CityID");
- strSql.Append(" where F_CustomerId=@F_CustomerId");
- SqlParameter[] parameters = {
- new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
- new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
- new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
- new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
- new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
- new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
- new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
- new SqlParameter("@F_TradeId", SqlDbType.Int,4),
- new SqlParameter("@F_RegionId", SqlDbType.Int,4),
- new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
- new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
- new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
- new SqlParameter("@F_Email", SqlDbType.VarChar,200),
- new SqlParameter("@F_Website", SqlDbType.VarChar,200),
- new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
- new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
- new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
- new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
- new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
- new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
- new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
- new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
- new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
- new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
- new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
- new SqlParameter("@F_MainProduct", SqlDbType.Text),
- new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
- new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
- new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
- new SqlParameter("@F_IntentProduct", SqlDbType.Text),
- new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
- new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
- new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
- new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
- new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
- new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
- new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
- new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
- new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
- new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
- new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
- new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
- new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
- new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
- new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
- new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
- new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
- new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
- new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
- new SqlParameter("@F_City", SqlDbType.NVarChar,10),
- new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
- new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
- new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
- new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
- new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
- new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
- new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
- new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
- new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
- new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
- new SqlParameter("@F_CityID", SqlDbType.Int,4),
- new SqlParameter("@F_CustomerId", SqlDbType.Int,4)};
- parameters[0].Value = model.F_CustomerName;
- parameters[1].Value = model.F_CustomerCode;
- parameters[2].Value = model.F_CustomerEName;
- parameters[3].Value = model.F_CustomerPym;
- parameters[4].Value = model.F_Layer;
- parameters[5].Value = model.F_CustomerLayer;
- parameters[6].Value = model.F_CategoryId;
- parameters[7].Value = model.F_TradeId;
- parameters[8].Value = model.F_RegionId;
- parameters[9].Value = model.F_IndustryId;
- parameters[10].Value = model.F_Address;
- parameters[11].Value = model.F_Url;
- parameters[12].Value = model.F_Telephone;
- parameters[13].Value = model.F_Mobile;
- parameters[14].Value = model.F_Fax;
- parameters[15].Value = model.F_Email;
- parameters[16].Value = model.F_Website;
- parameters[17].Value = model.F_PostCode;
- parameters[18].Value = model.F_ScaleResume;
- parameters[19].Value = model.F_BusinessProfile;
- parameters[20].Value = model.F_BusinessLicenseID;
- parameters[21].Value = model.F_TaxID;
- parameters[22].Value = model.F_OpeningBank;
- parameters[23].Value = model.F_BankAccount;
- parameters[24].Value = model.F_LegalRepresentative;
- parameters[25].Value = model.F_LegalRepresentativeCardID;
- parameters[26].Value = model.F_Nature;
- parameters[27].Value = model.F_Kind;
- parameters[28].Value = model.F_CustomerType;
- parameters[29].Value = model.F_MainProduct;
- parameters[30].Value = model.F_CustomerFrom;
- parameters[31].Value = model.F_TrackInfo;
- parameters[32].Value = model.F_TrackState;
- parameters[33].Value = model.F_ImportDegree;
- parameters[34].Value = model.F_IntentProduct;
- parameters[35].Value = model.F_CreateBy;
- parameters[36].Value = model.F_CreatedOn;
- parameters[37].Value = model.F_ModifyBy;
- parameters[38].Value = model.F_ModifiedOn;
- parameters[39].Value = model.F_DeleteFlag;
- parameters[40].Value = model.F_StatusCode;
- parameters[41].Value = model.F_ServiceDept;
- parameters[42].Value = model.F_ChargeName;
- parameters[43].Value = model.F_ChargeTelephone;
- parameters[44].Value = model.F_Province;
- parameters[45].Value = model.F_ProductLine;
- parameters[46].Value = model.F_ChargeDept;
- parameters[47].Value = model.F_AfterSaleName;
- parameters[48].Value = model.F_CustomerNature;
- parameters[49].Value = model.F_CustomerClass;
- parameters[50].Value = model.F_CustomerIndustry;
- parameters[51].Value = model.F_RelationShipClass;
- parameters[52].Value = model.F_CurrentVersion;
- parameters[53].Value = model.F_SystemStartTime;
- parameters[54].Value = model.F_QualityGuaranteeEndTime;
- parameters[55].Value = model.F_AfterSaleTelephone;
- parameters[56].Value = model.F_Notes;
- parameters[57].Value = model.F_SystemType;
- parameters[58].Value = model.F_City;
- parameters[59].Value = model.F_CustomerStatus;
- parameters[60].Value = model.F_DeviceCount;
- parameters[61].Value = model.F_MaintenanceType;
- parameters[62].Value = model.F_ERPCustomerCode;
- parameters[63].Value = model.F_ServiceDeptID;
- parameters[64].Value = model.F_ProductLineID;
- parameters[65].Value = model.F_AfterSaleNameID;
- parameters[66].Value = model.F_CustomerNatureID;
- parameters[67].Value = model.F_CustomerClassID;
- parameters[68].Value = model.F_RelationShipClassID;
- parameters[69].Value = model.F_CityID;
- parameters[70].Value = model.F_CustomerId;
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- public bool Delete(int F_CustomerId)
- {
- StringBuilder strSql = new StringBuilder();
- //strSql.Append("delete from T_Cus_CustomerBase ");
- strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
- strSql.Append(" where F_CustomerId=@F_CustomerId");
- SqlParameter[] parameters = {
- new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
- };
- parameters[0].Value = F_CustomerId;
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 批量删除数据
- /// </summary>
- public bool DeleteList(string F_CustomerIdlist)
- {
- StringBuilder strSql = new StringBuilder();
- //strSql.Append("delete from T_Cus_CustomerBase ");
- strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
- strSql.Append(" where F_CustomerId in (" + F_CustomerIdlist + ") ");
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public CallCenterApi.Model.T_Cus_CustomerBase GetModel(int F_CustomerId)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select top 1 F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID from T_Cus_CustomerBase WITH(NOLOCK) ");
- strSql.Append(" where F_CustomerId=@F_CustomerId");
- SqlParameter[] parameters = {
- new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
- };
- parameters[0].Value = F_CustomerId;
- CallCenterApi.Model.T_Cus_CustomerBase model = new CallCenterApi.Model.T_Cus_CustomerBase();
- DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
- if (ds.Tables[0].Rows.Count > 0)
- {
- return DataRowToModel(ds.Tables[0].Rows[0]);
- }
- else
- {
- return null;
- }
- }
- /// <summary>
- /// 通过电话获得客户实体
- /// </summary>
- /// <param name="F_Mobile">电话号码</param>
- /// <returns></returns>
- public CallCenterApi.Model.T_Cus_CustomerBase GetModel(string F_Mobile)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select top 1 * from T_Cus_CustomerBase WITH(NOLOCK)");
- strSql.Append(" where F_Telephone=@F_Mobile");
- SqlParameter[] parameters = {
- new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200)
- };
- parameters[0].Value = F_Mobile;
- CallCenterApi.Model.T_Cus_CustomerBase model = new CallCenterApi.Model.T_Cus_CustomerBase();
- DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
- if (ds.Tables[0].Rows.Count > 0)
- {
- return DataRowToModel(ds.Tables[0].Rows[0]);
- }
- else
- {
- return null;
- }
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public CallCenterApi.Model.T_Cus_CustomerBase DataRowToModel(DataRow row)
- {
- CallCenterApi.Model.T_Cus_CustomerBase model = new CallCenterApi.Model.T_Cus_CustomerBase();
- if (row != null)
- {
- if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
- {
- model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
- }
- if (row["F_CustomerName"] != null)
- {
- model.F_CustomerName = row["F_CustomerName"].ToString();
- }
- if (row["F_CustomerCode"] != null)
- {
- model.F_CustomerCode = row["F_CustomerCode"].ToString();
- }
- if (row["F_CustomerEName"] != null)
- {
- model.F_CustomerEName = row["F_CustomerEName"].ToString();
- }
- if (row["F_CustomerPym"] != null)
- {
- model.F_CustomerPym = row["F_CustomerPym"].ToString();
- }
- if (row["F_Layer"] != null && row["F_Layer"].ToString() != "")
- {
- model.F_Layer = int.Parse(row["F_Layer"].ToString());
- }
- if (row["F_CustomerLayer"] != null)
- {
- model.F_CustomerLayer = row["F_CustomerLayer"].ToString();
- }
- if (row["F_CategoryId"] != null && row["F_CategoryId"].ToString() != "")
- {
- model.F_CategoryId = int.Parse(row["F_CategoryId"].ToString());
- }
- if (row["F_TradeId"] != null && row["F_TradeId"].ToString() != "")
- {
- model.F_TradeId = int.Parse(row["F_TradeId"].ToString());
- }
- if (row["F_RegionId"] != null && row["F_RegionId"].ToString() != "")
- {
- model.F_RegionId = int.Parse(row["F_RegionId"].ToString());
- }
- if (row["F_IndustryId"] != null && row["F_IndustryId"].ToString() != "")
- {
- model.F_IndustryId = int.Parse(row["F_IndustryId"].ToString());
- }
- if (row["F_Address"] != null)
- {
- model.F_Address = row["F_Address"].ToString();
- }
- if (row["F_Url"] != null)
- {
- model.F_Url = row["F_Url"].ToString();
- }
- if (row["F_Telephone"] != null)
- {
- model.F_Telephone = row["F_Telephone"].ToString();
- }
- if (row["F_Mobile"] != null)
- {
- model.F_Mobile = row["F_Mobile"].ToString();
- }
- if (row["F_Fax"] != null)
- {
- model.F_Fax = row["F_Fax"].ToString();
- }
- if (row["F_Email"] != null)
- {
- model.F_Email = row["F_Email"].ToString();
- }
- if (row["F_Website"] != null)
- {
- model.F_Website = row["F_Website"].ToString();
- }
- if (row["F_PostCode"] != null)
- {
- model.F_PostCode = row["F_PostCode"].ToString();
- }
- if (row["F_ScaleResume"] != null)
- {
- model.F_ScaleResume = row["F_ScaleResume"].ToString();
- }
- if (row["F_BusinessProfile"] != null)
- {
- model.F_BusinessProfile = row["F_BusinessProfile"].ToString();
- }
- if (row["F_BusinessLicenseID"] != null)
- {
- model.F_BusinessLicenseID = row["F_BusinessLicenseID"].ToString();
- }
- if (row["F_TaxID"] != null)
- {
- model.F_TaxID = row["F_TaxID"].ToString();
- }
- if (row["F_OpeningBank"] != null)
- {
- model.F_OpeningBank = row["F_OpeningBank"].ToString();
- }
- if (row["F_BankAccount"] != null)
- {
- model.F_BankAccount = row["F_BankAccount"].ToString();
- }
- if (row["F_LegalRepresentative"] != null)
- {
- model.F_LegalRepresentative = row["F_LegalRepresentative"].ToString();
- }
- if (row["F_LegalRepresentativeCardID"] != null)
- {
- model.F_LegalRepresentativeCardID = row["F_LegalRepresentativeCardID"].ToString();
- }
- if (row["F_Nature"] != null)
- {
- model.F_Nature = row["F_Nature"].ToString();
- }
- if (row["F_Kind"] != null)
- {
- model.F_Kind = row["F_Kind"].ToString();
- }
- if (row["F_CustomerType"] != null && row["F_CustomerType"].ToString() != "")
- {
- model.F_CustomerType = int.Parse(row["F_CustomerType"].ToString());
- }
- if (row["F_MainProduct"] != null)
- {
- model.F_MainProduct = row["F_MainProduct"].ToString();
- }
- if (row["F_CustomerFrom"] != null)
- {
- model.F_CustomerFrom = row["F_CustomerFrom"].ToString();
- }
- if (row["F_TrackInfo"] != null)
- {
- model.F_TrackInfo = row["F_TrackInfo"].ToString();
- }
- if (row["F_TrackState"] != null)
- {
- model.F_TrackState = row["F_TrackState"].ToString();
- }
- if (row["F_ImportDegree"] != null)
- {
- model.F_ImportDegree = row["F_ImportDegree"].ToString();
- }
- if (row["F_IntentProduct"] != null)
- {
- model.F_IntentProduct = row["F_IntentProduct"].ToString();
- }
- if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
- {
- model.F_CreateBy = int.Parse(row["F_CreateBy"].ToString());
- }
- if (row["F_CreatedOn"] != null && row["F_CreatedOn"].ToString() != "")
- {
- model.F_CreatedOn = DateTime.Parse(row["F_CreatedOn"].ToString());
- }
- if (row["F_ModifyBy"] != null && row["F_ModifyBy"].ToString() != "")
- {
- model.F_ModifyBy = int.Parse(row["F_ModifyBy"].ToString());
- }
- if (row["F_ModifiedOn"] != null && row["F_ModifiedOn"].ToString() != "")
- {
- model.F_ModifiedOn = DateTime.Parse(row["F_ModifiedOn"].ToString());
- }
- if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
- {
- model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
- }
- if (row["F_StatusCode"] != null && row["F_StatusCode"].ToString() != "")
- {
- model.F_StatusCode = int.Parse(row["F_StatusCode"].ToString());
- }
- if (row["F_ServiceDept"] != null)
- {
- model.F_ServiceDept = row["F_ServiceDept"].ToString();
- }
- if (row["F_ChargeName"] != null)
- {
- model.F_ChargeName = row["F_ChargeName"].ToString();
- }
- if (row["F_ChargeTelephone"] != null)
- {
- model.F_ChargeTelephone = row["F_ChargeTelephone"].ToString();
- }
- if (row["F_Province"] != null)
- {
- model.F_Province = row["F_Province"].ToString();
- }
- if (row["F_ProductLine"] != null)
- {
- model.F_ProductLine = row["F_ProductLine"].ToString();
- }
- if (row["F_ChargeDept"] != null)
- {
- model.F_ChargeDept = row["F_ChargeDept"].ToString();
- }
- if (row["F_AfterSaleName"] != null)
- {
- model.F_AfterSaleName = row["F_AfterSaleName"].ToString();
- }
- if (row["F_CustomerNature"] != null)
- {
- model.F_CustomerNature = row["F_CustomerNature"].ToString();
- }
- if (row["F_CustomerClass"] != null)
- {
- model.F_CustomerClass = row["F_CustomerClass"].ToString();
- }
- if (row["F_CustomerIndustry"] != null)
- {
- model.F_CustomerIndustry = row["F_CustomerIndustry"].ToString();
- }
- if (row["F_RelationShipClass"] != null)
- {
- model.F_RelationShipClass = row["F_RelationShipClass"].ToString();
- }
- if (row["F_CurrentVersion"] != null)
- {
- model.F_CurrentVersion = row["F_CurrentVersion"].ToString();
- }
- if (row["F_SystemStartTime"] != null && row["F_SystemStartTime"].ToString() != "")
- {
- model.F_SystemStartTime = DateTime.Parse(row["F_SystemStartTime"].ToString());
- }
- if (row["F_QualityGuaranteeEndTime"] != null && row["F_QualityGuaranteeEndTime"].ToString() != "")
- {
- model.F_QualityGuaranteeEndTime = DateTime.Parse(row["F_QualityGuaranteeEndTime"].ToString());
- }
- if (row["F_AfterSaleTelephone"] != null)
- {
- model.F_AfterSaleTelephone = row["F_AfterSaleTelephone"].ToString();
- }
- if (row["F_Notes"] != null)
- {
- model.F_Notes = row["F_Notes"].ToString();
- }
- if (row["F_SystemType"] != null)
- {
- model.F_SystemType = row["F_SystemType"].ToString();
- }
- if (row["F_City"] != null)
- {
- model.F_City = row["F_City"].ToString();
- }
- if (row["F_CustomerStatus"] != null)
- {
- model.F_CustomerStatus = row["F_CustomerStatus"].ToString();
- }
- if (row["F_DeviceCount"] != null && row["F_DeviceCount"].ToString() != "")
- {
- model.F_DeviceCount = int.Parse(row["F_DeviceCount"].ToString());
- }
- if (row["F_MaintenanceType"] != null)
- {
- model.F_MaintenanceType = row["F_MaintenanceType"].ToString();
- }
- if (row["F_ERPCustomerCode"] != null)
- {
- model.F_ERPCustomerCode = row["F_ERPCustomerCode"].ToString();
- }
- if (row["F_ServiceDeptID"] != null && row["F_ServiceDeptID"].ToString() != "")
- {
- model.F_ServiceDeptID = int.Parse(row["F_ServiceDeptID"].ToString());
- }
- if (row["F_ProductLineID"] != null && row["F_ProductLineID"].ToString() != "")
- {
- model.F_ProductLineID = int.Parse(row["F_ProductLineID"].ToString());
- }
- if (row["F_AfterSaleNameID"] != null && row["F_AfterSaleNameID"].ToString() != "")
- {
- model.F_AfterSaleNameID = int.Parse(row["F_AfterSaleNameID"].ToString());
- }
- if (row["F_CustomerNatureID"] != null && row["F_CustomerNatureID"].ToString() != "")
- {
- model.F_CustomerNatureID = int.Parse(row["F_CustomerNatureID"].ToString());
- }
- if (row["F_CustomerClassID"] != null && row["F_CustomerClassID"].ToString() != "")
- {
- model.F_CustomerClassID = int.Parse(row["F_CustomerClassID"].ToString());
- }
- if (row["F_RelationShipClassID"] != null && row["F_RelationShipClassID"].ToString() != "")
- {
- model.F_RelationShipClassID = int.Parse(row["F_RelationShipClassID"].ToString());
- }
- if (row["F_CityID"] != null && row["F_CityID"].ToString() != "")
- {
- model.F_CityID = int.Parse(row["F_CityID"].ToString());
- }
- }
- return model;
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public DataSet GetList(string strWhere)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID ");
- strSql.Append(" FROM T_Cus_CustomerBase WITH(NOLOCK) ");
- if (strWhere.Trim() != "")
- {
- strSql.Append(" where " + strWhere);
- }
- strSql.Append(" ORDER BY F_CreatedOn DESC ");
- return DbHelperSQL.Query(strSql.ToString());
- }
- /// <summary>
- /// 获得前几行数据
- /// </summary>
- public DataSet GetList(int Top, string strWhere, string filedOrder)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select ");
- if (Top > 0)
- {
- strSql.Append(" top " + Top.ToString());
- }
- strSql.Append(" F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID ");
- strSql.Append(" FROM T_Cus_CustomerBase WITH(NOLOCK) ");
- if (strWhere.Trim() != "")
- {
- strSql.Append(" where " + strWhere);
- }
- strSql.Append(" order by " + filedOrder);
- return DbHelperSQL.Query(strSql.ToString());
- }
- /// <summary>
- /// 获取记录总数
- /// </summary>
- public int GetRecordCount(string strWhere)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select count(1) FROM T_Cus_CustomerBase WITH(NOLOCK) ");
- if (strWhere.Trim() != "")
- {
- strSql.Append(" where " + strWhere);
- }
- object obj = DbHelperSQL.GetSingle(strSql.ToString());
- if (obj == null)
- {
- return 0;
- }
- else
- {
- return Convert.ToInt32(obj);
- }
- }
- /// <summary>
- /// 分页获取数据列表
- /// </summary>
- public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT * FROM ( ");
- strSql.Append(" SELECT ROW_NUMBER() OVER (");
- if (!string.IsNullOrEmpty(orderby.Trim()))
- {
- strSql.Append("order by T." + orderby);
- }
- else
- {
- strSql.Append("order by T.F_CustomerId desc");
- }
- strSql.Append(")AS Row, T.* from T_Cus_CustomerBase T WITH(NOLOCK) ");
- if (!string.IsNullOrEmpty(strWhere.Trim()))
- {
- strSql.Append(" WHERE " + strWhere);
- }
- strSql.Append(" ) TT");
- strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
- return DbHelperSQL.Query(strSql.ToString());
- }
- /*
- /// <summary>
- /// 分页获取数据列表
- /// </summary>
- public DataSet GetList(int PageSize,int PageIndex,string strWhere)
- {
- SqlParameter[] parameters = {
- new SqlParameter("@tblName", SqlDbType.VarChar, 255),
- new SqlParameter("@fldName", SqlDbType.VarChar, 255),
- new SqlParameter("@PageSize", SqlDbType.Int),
- new SqlParameter("@PageIndex", SqlDbType.Int),
- new SqlParameter("@IsReCount", SqlDbType.Bit),
- new SqlParameter("@OrderType", SqlDbType.Bit),
- new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
- };
- parameters[0].Value = "T_Cus_CustomerBase";
- parameters[1].Value = "F_CustomerId";
- parameters[2].Value = PageSize;
- parameters[3].Value = PageIndex;
- parameters[4].Value = 0;
- parameters[5].Value = 0;
- parameters[6].Value = strWhere;
- return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
- }*/
- #endregion BasicMethod
- #region ExtensionMethod
- #endregion ExtensionMethod
- }
- }
|