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 { /// /// 数据访问类:T_Vis_DXOTelphone /// public partial class T_Vis_DXOTelphone { public T_Vis_DXOTelphone() { } #region BasicMethod /// /// 增加一条数据 /// public int Add(CallCenterApi.Model.T_Vis_DXOTelphone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_Vis_DXOTelphone("); strSql.Append("F_CardDate,F_CardType,F_CardAmount,F_MaintainUser,F_ComLocations,F_Grade,F_Reciver,F_RepairTimes,F_FirstInDate,F_LastMileage,F_LastOutDate,F_Years,F_InsuranceC,F_InsuranceDate,F_Storefront,F_License,F_Numbers,F_brand,F_CarType,F_Contacts,F_khMobile,F_khPhone,F_PreLoss,F_WoOrder,F_usePlace,F_khInfor,F_lossReason,F_hanleMode,F_LVDate,F_LVContent,F_LVType,F_VisDate,F_VisContent,F_VisType,F_VisUser,F_VisUserID,F_VisDate1,F_VisContent1,F_VisType1,F_VisUser1,F_VisUserID1,F_VisDate2,F_VisContent2,F_VisType2,F_VisUser2,F_VisUserID2,F_VisDate3,F_VisContent3,F_VisType3,F_VisUser3,F_VisUserID3,F_insertDate,F_insertUser,F_insertUserID,F_liableP,F_hjUser,F_hjUserID,F_hjDate,F_ISCall,F_CallRes,F_CallResID,F_ISCallRes,F_ISVis,F_FileID)"); strSql.Append(" values ("); strSql.Append("@F_CardDate,@F_CardType,@F_CardAmount,@F_MaintainUser,@F_ComLocations,@F_Grade,@F_Reciver,@F_RepairTimes,@F_FirstInDate,@F_LastMileage,@F_LastOutDate,@F_Years,@F_InsuranceC,@F_InsuranceDate,@F_Storefront,@F_License,@F_Numbers,@F_brand,@F_CarType,@F_Contacts,@F_khMobile,@F_khPhone,@F_PreLoss,@F_WoOrder,@F_usePlace,@F_khInfor,@F_lossReason,@F_hanleMode,@F_LVDate,@F_LVContent,@F_LVType,@F_VisDate,@F_VisContent,@F_VisType,@F_VisUser,@F_VisUserID,@F_VisDate1,@F_VisContent1,@F_VisType1,@F_VisUser1,@F_VisUserID1,@F_VisDate2,@F_VisContent2,@F_VisType2,@F_VisUser2,@F_VisUserID2,@F_VisDate3,@F_VisContent3,@F_VisType3,@F_VisUser3,@F_VisUserID3,@F_insertDate,@F_insertUser,@F_insertUserID,@F_liableP,@F_hjUser,@F_hjUserID,@F_hjDate,@F_ISCall,@F_CallRes,@F_CallResID,@F_ISCallRes,@F_ISVis,@F_FileID)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@F_CardDate", SqlDbType.NVarChar,250), new SqlParameter("@F_CardType", SqlDbType.NVarChar,250), new SqlParameter("@F_CardAmount", SqlDbType.NVarChar,250), new SqlParameter("@F_MaintainUser", SqlDbType.NVarChar,250), new SqlParameter("@F_ComLocations", SqlDbType.NVarChar,250), new SqlParameter("@F_Grade", SqlDbType.NChar,10), new SqlParameter("@F_Reciver", SqlDbType.NVarChar,250), new SqlParameter("@F_RepairTimes", SqlDbType.NChar,10), new SqlParameter("@F_FirstInDate", SqlDbType.NVarChar,250), new SqlParameter("@F_LastMileage", SqlDbType.NVarChar,250), new SqlParameter("@F_LastOutDate", SqlDbType.NVarChar,250), new SqlParameter("@F_Years", SqlDbType.NVarChar,250), new SqlParameter("@F_InsuranceC", SqlDbType.NVarChar,250), new SqlParameter("@F_InsuranceDate", SqlDbType.NVarChar,250), new SqlParameter("@F_Storefront", SqlDbType.NVarChar,250), new SqlParameter("@F_License", SqlDbType.NVarChar,250), new SqlParameter("@F_Numbers", SqlDbType.NVarChar,250), new SqlParameter("@F_brand", SqlDbType.NVarChar,250), new SqlParameter("@F_CarType", SqlDbType.NVarChar,250), new SqlParameter("@F_Contacts", SqlDbType.NVarChar,250), new SqlParameter("@F_khMobile", SqlDbType.NVarChar,250), new SqlParameter("@F_khPhone", SqlDbType.NVarChar,250), new SqlParameter("@F_PreLoss", SqlDbType.NVarChar,250), new SqlParameter("@F_WoOrder", SqlDbType.NVarChar,250), new SqlParameter("@F_usePlace", SqlDbType.NVarChar,250), new SqlParameter("@F_khInfor", SqlDbType.NText), new SqlParameter("@F_lossReason", SqlDbType.NVarChar,500), new SqlParameter("@F_hanleMode", SqlDbType.NVarChar,250), new SqlParameter("@F_LVDate", SqlDbType.NVarChar,250), new SqlParameter("@F_LVContent", SqlDbType.NVarChar,250), new SqlParameter("@F_LVType", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate", SqlDbType.DateTime), new SqlParameter("@F_VisContent", SqlDbType.NText), new SqlParameter("@F_VisType", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent1", SqlDbType.NText), new SqlParameter("@F_VisType1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent2", SqlDbType.NText), new SqlParameter("@F_VisType2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent3", SqlDbType.NText), new SqlParameter("@F_VisType3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID3", SqlDbType.NVarChar,250), new SqlParameter("@F_insertDate", SqlDbType.DateTime), new SqlParameter("@F_insertUser", SqlDbType.NVarChar,250), new SqlParameter("@F_insertUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_liableP", SqlDbType.NVarChar,250), new SqlParameter("@F_hjUser", SqlDbType.NVarChar,250), new SqlParameter("@F_hjUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_hjDate", SqlDbType.DateTime), new SqlParameter("@F_ISCall", SqlDbType.Int,4), new SqlParameter("@F_CallRes", SqlDbType.NVarChar,250), new SqlParameter("@F_CallResID", SqlDbType.Int,4), new SqlParameter("@F_ISCallRes", SqlDbType.Int,4), new SqlParameter("@F_ISVis", SqlDbType.Int,4), new SqlParameter("@F_FileID", SqlDbType.Int,4)}; parameters[0].Value = model.F_CardDate; parameters[1].Value = model.F_CardType; parameters[2].Value = model.F_CardAmount; parameters[3].Value = model.F_MaintainUser; parameters[4].Value = model.F_ComLocations; parameters[5].Value = model.F_Grade; parameters[6].Value = model.F_Reciver; parameters[7].Value = model.F_RepairTimes; parameters[8].Value = model.F_FirstInDate; parameters[9].Value = model.F_LastMileage; parameters[10].Value = model.F_LastOutDate; parameters[11].Value = model.F_Years; parameters[12].Value = model.F_InsuranceC; parameters[13].Value = model.F_InsuranceDate; parameters[14].Value = model.F_Storefront; parameters[15].Value = model.F_License; parameters[16].Value = model.F_Numbers; parameters[17].Value = model.F_brand; parameters[18].Value = model.F_CarType; parameters[19].Value = model.F_Contacts; parameters[20].Value = model.F_khMobile; parameters[21].Value = model.F_khPhone; parameters[22].Value = model.F_PreLoss; parameters[23].Value = model.F_WoOrder; parameters[24].Value = model.F_usePlace; parameters[25].Value = model.F_khInfor; parameters[26].Value = model.F_lossReason; parameters[27].Value = model.F_hanleMode; parameters[28].Value = model.F_LVDate; parameters[29].Value = model.F_LVContent; parameters[30].Value = model.F_LVType; parameters[31].Value = model.F_VisDate; parameters[32].Value = model.F_VisContent; parameters[33].Value = model.F_VisType; parameters[34].Value = model.F_VisUser; parameters[35].Value = model.F_VisUserID; parameters[36].Value = model.F_VisDate1; parameters[37].Value = model.F_VisContent1; parameters[38].Value = model.F_VisType1; parameters[39].Value = model.F_VisUser1; parameters[40].Value = model.F_VisUserID1; parameters[41].Value = model.F_VisDate2; parameters[42].Value = model.F_VisContent2; parameters[43].Value = model.F_VisType2; parameters[44].Value = model.F_VisUser2; parameters[45].Value = model.F_VisUserID2; parameters[46].Value = model.F_VisDate3; parameters[47].Value = model.F_VisContent3; parameters[48].Value = model.F_VisType3; parameters[49].Value = model.F_VisUser3; parameters[50].Value = model.F_VisUserID3; parameters[51].Value = model.F_insertDate; parameters[52].Value = model.F_insertUser; parameters[53].Value = model.F_insertUserID; parameters[54].Value = model.F_liableP; parameters[55].Value = model.F_hjUser; parameters[56].Value = model.F_hjUserID; parameters[57].Value = model.F_hjDate; parameters[58].Value = model.F_ISCall; parameters[59].Value = model.F_CallRes; parameters[60].Value = model.F_CallResID; parameters[61].Value = model.F_ISCallRes; parameters[62].Value = model.F_ISVis; parameters[63].Value = model.F_FileID; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 0; } else { return Convert.ToInt32(obj); } } /// /// 更新一条数据 /// public bool Update(CallCenterApi.Model.T_Vis_DXOTelphone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Vis_DXOTelphone set "); strSql.Append("F_CardDate=@F_CardDate,"); strSql.Append("F_CardType=@F_CardType,"); strSql.Append("F_CardAmount=@F_CardAmount,"); strSql.Append("F_MaintainUser=@F_MaintainUser,"); strSql.Append("F_ComLocations=@F_ComLocations,"); strSql.Append("F_Grade=@F_Grade,"); strSql.Append("F_Reciver=@F_Reciver,"); strSql.Append("F_RepairTimes=@F_RepairTimes,"); strSql.Append("F_FirstInDate=@F_FirstInDate,"); strSql.Append("F_LastMileage=@F_LastMileage,"); strSql.Append("F_LastOutDate=@F_LastOutDate,"); strSql.Append("F_Years=@F_Years,"); strSql.Append("F_InsuranceC=@F_InsuranceC,"); strSql.Append("F_InsuranceDate=@F_InsuranceDate,"); strSql.Append("F_Storefront=@F_Storefront,"); strSql.Append("F_License=@F_License,"); strSql.Append("F_Numbers=@F_Numbers,"); strSql.Append("F_brand=@F_brand,"); strSql.Append("F_CarType=@F_CarType,"); strSql.Append("F_Contacts=@F_Contacts,"); strSql.Append("F_khMobile=@F_khMobile,"); strSql.Append("F_khPhone=@F_khPhone,"); strSql.Append("F_PreLoss=@F_PreLoss,"); strSql.Append("F_WoOrder=@F_WoOrder,"); strSql.Append("F_usePlace=@F_usePlace,"); strSql.Append("F_khInfor=@F_khInfor,"); strSql.Append("F_lossReason=@F_lossReason,"); strSql.Append("F_hanleMode=@F_hanleMode,"); strSql.Append("F_LVDate=@F_LVDate,"); strSql.Append("F_LVContent=@F_LVContent,"); strSql.Append("F_LVType=@F_LVType,"); strSql.Append("F_VisDate=@F_VisDate,"); strSql.Append("F_VisContent=@F_VisContent,"); strSql.Append("F_VisType=@F_VisType,"); strSql.Append("F_VisUser=@F_VisUser,"); strSql.Append("F_VisUserID=@F_VisUserID,"); strSql.Append("F_VisDate1=@F_VisDate1,"); strSql.Append("F_VisContent1=@F_VisContent1,"); strSql.Append("F_VisType1=@F_VisType1,"); strSql.Append("F_VisUser1=@F_VisUser1,"); strSql.Append("F_VisUserID1=@F_VisUserID1,"); strSql.Append("F_VisDate2=@F_VisDate2,"); strSql.Append("F_VisContent2=@F_VisContent2,"); strSql.Append("F_VisType2=@F_VisType2,"); strSql.Append("F_VisUser2=@F_VisUser2,"); strSql.Append("F_VisUserID2=@F_VisUserID2,"); strSql.Append("F_VisDate3=@F_VisDate3,"); strSql.Append("F_VisContent3=@F_VisContent3,"); strSql.Append("F_VisType3=@F_VisType3,"); strSql.Append("F_VisUser3=@F_VisUser3,"); strSql.Append("F_VisUserID3=@F_VisUserID3,"); strSql.Append("F_insertDate=@F_insertDate,"); strSql.Append("F_insertUser=@F_insertUser,"); strSql.Append("F_insertUserID=@F_insertUserID,"); strSql.Append("F_liableP=@F_liableP,"); strSql.Append("F_hjUser=@F_hjUser,"); strSql.Append("F_hjUserID=@F_hjUserID,"); strSql.Append("F_hjDate=@F_hjDate,"); strSql.Append("F_ISCall=@F_ISCall,"); strSql.Append("F_CallRes=@F_CallRes,"); strSql.Append("F_CallResID=@F_CallResID,"); strSql.Append("F_ISCallRes=@F_ISCallRes,"); strSql.Append("F_ISVis=@F_ISVis,"); strSql.Append("F_FileID=@F_FileID"); strSql.Append(" where F_DVoID=@F_DVoID"); SqlParameter[] parameters = { new SqlParameter("@F_CardDate", SqlDbType.NVarChar,250), new SqlParameter("@F_CardType", SqlDbType.NVarChar,250), new SqlParameter("@F_CardAmount", SqlDbType.NVarChar,250), new SqlParameter("@F_MaintainUser", SqlDbType.NVarChar,250), new SqlParameter("@F_ComLocations", SqlDbType.NVarChar,250), new SqlParameter("@F_Grade", SqlDbType.NChar,10), new SqlParameter("@F_Reciver", SqlDbType.NVarChar,250), new SqlParameter("@F_RepairTimes", SqlDbType.NChar,10), new SqlParameter("@F_FirstInDate", SqlDbType.NVarChar,250), new SqlParameter("@F_LastMileage", SqlDbType.NVarChar,250), new SqlParameter("@F_LastOutDate", SqlDbType.NVarChar,250), new SqlParameter("@F_Years", SqlDbType.NVarChar,250), new SqlParameter("@F_InsuranceC", SqlDbType.NVarChar,250), new SqlParameter("@F_InsuranceDate", SqlDbType.NVarChar,250), new SqlParameter("@F_Storefront", SqlDbType.NVarChar,250), new SqlParameter("@F_License", SqlDbType.NVarChar,250), new SqlParameter("@F_Numbers", SqlDbType.NVarChar,250), new SqlParameter("@F_brand", SqlDbType.NVarChar,250), new SqlParameter("@F_CarType", SqlDbType.NVarChar,250), new SqlParameter("@F_Contacts", SqlDbType.NVarChar,250), new SqlParameter("@F_khMobile", SqlDbType.NVarChar,250), new SqlParameter("@F_khPhone", SqlDbType.NVarChar,250), new SqlParameter("@F_PreLoss", SqlDbType.NVarChar,250), new SqlParameter("@F_WoOrder", SqlDbType.NVarChar,250), new SqlParameter("@F_usePlace", SqlDbType.NVarChar,250), new SqlParameter("@F_khInfor", SqlDbType.NText), new SqlParameter("@F_lossReason", SqlDbType.NVarChar,500), new SqlParameter("@F_hanleMode", SqlDbType.NVarChar,250), new SqlParameter("@F_LVDate", SqlDbType.NVarChar,250), new SqlParameter("@F_LVContent", SqlDbType.NVarChar,250), new SqlParameter("@F_LVType", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate", SqlDbType.DateTime), new SqlParameter("@F_VisContent", SqlDbType.NText), new SqlParameter("@F_VisType", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent1", SqlDbType.NText), new SqlParameter("@F_VisType1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID1", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent2", SqlDbType.NText), new SqlParameter("@F_VisType2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID2", SqlDbType.NVarChar,250), new SqlParameter("@F_VisDate3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisContent3", SqlDbType.NText), new SqlParameter("@F_VisType3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUser3", SqlDbType.NVarChar,250), new SqlParameter("@F_VisUserID3", SqlDbType.NVarChar,250), new SqlParameter("@F_insertDate", SqlDbType.DateTime), new SqlParameter("@F_insertUser", SqlDbType.NVarChar,250), new SqlParameter("@F_insertUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_liableP", SqlDbType.NVarChar,250), new SqlParameter("@F_hjUser", SqlDbType.NVarChar,250), new SqlParameter("@F_hjUserID", SqlDbType.NVarChar,250), new SqlParameter("@F_hjDate", SqlDbType.DateTime), new SqlParameter("@F_ISCall", SqlDbType.Int,4), new SqlParameter("@F_CallRes", SqlDbType.NVarChar,250), new SqlParameter("@F_CallResID", SqlDbType.Int,4), new SqlParameter("@F_ISCallRes", SqlDbType.Int,4), new SqlParameter("@F_ISVis", SqlDbType.Int,4), new SqlParameter("@F_FileID", SqlDbType.Int,4), new SqlParameter("@F_DVoID", SqlDbType.Int,4)}; parameters[0].Value = model.F_CardDate; parameters[1].Value = model.F_CardType; parameters[2].Value = model.F_CardAmount; parameters[3].Value = model.F_MaintainUser; parameters[4].Value = model.F_ComLocations; parameters[5].Value = model.F_Grade; parameters[6].Value = model.F_Reciver; parameters[7].Value = model.F_RepairTimes; parameters[8].Value = model.F_FirstInDate; parameters[9].Value = model.F_LastMileage; parameters[10].Value = model.F_LastOutDate; parameters[11].Value = model.F_Years; parameters[12].Value = model.F_InsuranceC; parameters[13].Value = model.F_InsuranceDate; parameters[14].Value = model.F_Storefront; parameters[15].Value = model.F_License; parameters[16].Value = model.F_Numbers; parameters[17].Value = model.F_brand; parameters[18].Value = model.F_CarType; parameters[19].Value = model.F_Contacts; parameters[20].Value = model.F_khMobile; parameters[21].Value = model.F_khPhone; parameters[22].Value = model.F_PreLoss; parameters[23].Value = model.F_WoOrder; parameters[24].Value = model.F_usePlace; parameters[25].Value = model.F_khInfor; parameters[26].Value = model.F_lossReason; parameters[27].Value = model.F_hanleMode; parameters[28].Value = model.F_LVDate; parameters[29].Value = model.F_LVContent; parameters[30].Value = model.F_LVType; parameters[31].Value = model.F_VisDate; parameters[32].Value = model.F_VisContent; parameters[33].Value = model.F_VisType; parameters[34].Value = model.F_VisUser; parameters[35].Value = model.F_VisUserID; parameters[36].Value = model.F_VisDate1; parameters[37].Value = model.F_VisContent1; parameters[38].Value = model.F_VisType1; parameters[39].Value = model.F_VisUser1; parameters[40].Value = model.F_VisUserID1; parameters[41].Value = model.F_VisDate2; parameters[42].Value = model.F_VisContent2; parameters[43].Value = model.F_VisType2; parameters[44].Value = model.F_VisUser2; parameters[45].Value = model.F_VisUserID2; parameters[46].Value = model.F_VisDate3; parameters[47].Value = model.F_VisContent3; parameters[48].Value = model.F_VisType3; parameters[49].Value = model.F_VisUser3; parameters[50].Value = model.F_VisUserID3; parameters[51].Value = model.F_insertDate; parameters[52].Value = model.F_insertUser; parameters[53].Value = model.F_insertUserID; parameters[54].Value = model.F_liableP; parameters[55].Value = model.F_hjUser; parameters[56].Value = model.F_hjUserID; parameters[57].Value = model.F_hjDate; parameters[58].Value = model.F_ISCall; parameters[59].Value = model.F_CallRes; parameters[60].Value = model.F_CallResID; parameters[61].Value = model.F_ISCallRes; parameters[62].Value = model.F_ISVis; parameters[63].Value = model.F_FileID; parameters[64].Value = model.F_DVoID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } /// /// 删除一条数据 /// public bool Delete(int F_DVoID) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from T_Vis_DXOTelphone "); strSql.Append(" where F_DVoID=@F_DVoID"); SqlParameter[] parameters = { new SqlParameter("@F_DVoID", SqlDbType.Int,4) }; parameters[0].Value = F_DVoID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } /// /// 批量删除数据 /// public bool DeleteList(string F_DVoIDlist) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from T_Vis_DXOTelphone "); strSql.Append(" where F_DVoID in (" + F_DVoIDlist + ") "); int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } } /// /// 得到一个对象实体 /// public CallCenterApi.Model.T_Vis_DXOTelphone GetModel(int F_DVoID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 F_DVoID,F_CardDate,F_CardType,F_CardAmount,F_MaintainUser,F_ComLocations,F_Grade,F_Reciver,F_RepairTimes,F_FirstInDate,F_LastMileage,F_LastOutDate,F_Years,F_InsuranceC,F_InsuranceDate,F_Storefront,F_License,F_Numbers,F_brand,F_CarType,F_Contacts,F_khMobile,F_khPhone,F_PreLoss,F_WoOrder,F_usePlace,F_khInfor,F_lossReason,F_hanleMode,F_LVDate,F_LVContent,F_LVType,F_VisDate,F_VisContent,F_VisType,F_VisUser,F_VisUserID,F_VisDate1,F_VisContent1,F_VisType1,F_VisUser1,F_VisUserID1,F_VisDate2,F_VisContent2,F_VisType2,F_VisUser2,F_VisUserID2,F_VisDate3,F_VisContent3,F_VisType3,F_VisUser3,F_VisUserID3,F_insertDate,F_insertUser,F_insertUserID,F_liableP,F_hjUser,F_hjUserID,F_hjDate,F_ISCall,F_CallRes,F_CallResID,F_ISCallRes,F_ISVis,F_FileID from T_Vis_DXOTelphone "); strSql.Append(" where F_DVoID=@F_DVoID"); SqlParameter[] parameters = { new SqlParameter("@F_DVoID", SqlDbType.Int,4) }; parameters[0].Value = F_DVoID; CallCenterApi.Model.T_Vis_DXOTelphone model = new CallCenterApi.Model.T_Vis_DXOTelphone(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } } /// /// 得到一个对象实体 /// public CallCenterApi.Model.T_Vis_DXOTelphone DataRowToModel(DataRow row) { CallCenterApi.Model.T_Vis_DXOTelphone model = new CallCenterApi.Model.T_Vis_DXOTelphone(); if (row != null) { if (row["F_DVoID"] != null && row["F_DVoID"].ToString() != "") { model.F_DVoID = int.Parse(row["F_DVoID"].ToString()); } if (row["F_CardDate"] != null) { model.F_CardDate = row["F_CardDate"].ToString(); } if (row["F_CardType"] != null) { model.F_CardType = row["F_CardType"].ToString(); } if (row["F_CardAmount"] != null) { model.F_CardAmount = row["F_CardAmount"].ToString(); } if (row["F_MaintainUser"] != null) { model.F_MaintainUser = row["F_MaintainUser"].ToString(); } if (row["F_ComLocations"] != null) { model.F_ComLocations = row["F_ComLocations"].ToString(); } if (row["F_Grade"] != null) { model.F_Grade = row["F_Grade"].ToString(); } if (row["F_Reciver"] != null) { model.F_Reciver = row["F_Reciver"].ToString(); } if (row["F_RepairTimes"] != null) { model.F_RepairTimes = row["F_RepairTimes"].ToString(); } if (row["F_FirstInDate"] != null) { model.F_FirstInDate = row["F_FirstInDate"].ToString(); } if (row["F_LastMileage"] != null) { model.F_LastMileage = row["F_LastMileage"].ToString(); } if (row["F_LastOutDate"] != null) { model.F_LastOutDate = row["F_LastOutDate"].ToString(); } if (row["F_Years"] != null) { model.F_Years = row["F_Years"].ToString(); } if (row["F_InsuranceC"] != null) { model.F_InsuranceC = row["F_InsuranceC"].ToString(); } if (row["F_InsuranceDate"] != null) { model.F_InsuranceDate = row["F_InsuranceDate"].ToString(); } if (row["F_Storefront"] != null) { model.F_Storefront = row["F_Storefront"].ToString(); } if (row["F_License"] != null) { model.F_License = row["F_License"].ToString(); } if (row["F_Numbers"] != null) { model.F_Numbers = row["F_Numbers"].ToString(); } if (row["F_brand"] != null) { model.F_brand = row["F_brand"].ToString(); } if (row["F_CarType"] != null) { model.F_CarType = row["F_CarType"].ToString(); } if (row["F_Contacts"] != null) { model.F_Contacts = row["F_Contacts"].ToString(); } if (row["F_khMobile"] != null) { model.F_khMobile = row["F_khMobile"].ToString(); } if (row["F_khPhone"] != null) { model.F_khPhone = row["F_khPhone"].ToString(); } if (row["F_PreLoss"] != null) { model.F_PreLoss = row["F_PreLoss"].ToString(); } if (row["F_WoOrder"] != null) { model.F_WoOrder = row["F_WoOrder"].ToString(); } if (row["F_usePlace"] != null) { model.F_usePlace = row["F_usePlace"].ToString(); } if (row["F_khInfor"] != null) { model.F_khInfor = row["F_khInfor"].ToString(); } if (row["F_lossReason"] != null) { model.F_lossReason = row["F_lossReason"].ToString(); } if (row["F_hanleMode"] != null) { model.F_hanleMode = row["F_hanleMode"].ToString(); } if (row["F_LVDate"] != null) { model.F_LVDate = row["F_LVDate"].ToString(); } if (row["F_LVContent"] != null) { model.F_LVContent = row["F_LVContent"].ToString(); } if (row["F_LVType"] != null) { model.F_LVType = row["F_LVType"].ToString(); } if (row["F_VisDate"] != null && row["F_VisDate"].ToString() != "") { model.F_VisDate = DateTime.Parse(row["F_VisDate"].ToString()); } if (row["F_VisContent"] != null) { model.F_VisContent = row["F_VisContent"].ToString(); } if (row["F_VisType"] != null) { model.F_VisType = row["F_VisType"].ToString(); } if (row["F_VisUser"] != null) { model.F_VisUser = row["F_VisUser"].ToString(); } if (row["F_VisUserID"] != null) { model.F_VisUserID = row["F_VisUserID"].ToString(); } if (row["F_VisDate1"] != null) { model.F_VisDate1 = row["F_VisDate1"].ToString(); } if (row["F_VisContent1"] != null) { model.F_VisContent1 = row["F_VisContent1"].ToString(); } if (row["F_VisType1"] != null) { model.F_VisType1 = row["F_VisType1"].ToString(); } if (row["F_VisUser1"] != null) { model.F_VisUser1 = row["F_VisUser1"].ToString(); } if (row["F_VisUserID1"] != null) { model.F_VisUserID1 = row["F_VisUserID1"].ToString(); } if (row["F_VisDate2"] != null) { model.F_VisDate2 = row["F_VisDate2"].ToString(); } if (row["F_VisContent2"] != null) { model.F_VisContent2 = row["F_VisContent2"].ToString(); } if (row["F_VisType2"] != null) { model.F_VisType2 = row["F_VisType2"].ToString(); } if (row["F_VisUser2"] != null) { model.F_VisUser2 = row["F_VisUser2"].ToString(); } if (row["F_VisUserID2"] != null) { model.F_VisUserID2 = row["F_VisUserID2"].ToString(); } if (row["F_VisDate3"] != null) { model.F_VisDate3 = row["F_VisDate3"].ToString(); } if (row["F_VisContent3"] != null) { model.F_VisContent3 = row["F_VisContent3"].ToString(); } if (row["F_VisType3"] != null) { model.F_VisType3 = row["F_VisType3"].ToString(); } if (row["F_VisUser3"] != null) { model.F_VisUser3 = row["F_VisUser3"].ToString(); } if (row["F_VisUserID3"] != null) { model.F_VisUserID3 = row["F_VisUserID3"].ToString(); } if (row["F_insertDate"] != null && row["F_insertDate"].ToString() != "") { model.F_insertDate = DateTime.Parse(row["F_insertDate"].ToString()); } if (row["F_insertUser"] != null) { model.F_insertUser = row["F_insertUser"].ToString(); } if (row["F_insertUserID"] != null) { model.F_insertUserID = row["F_insertUserID"].ToString(); } if (row["F_liableP"] != null) { model.F_liableP = row["F_liableP"].ToString(); } if (row["F_hjUser"] != null) { model.F_hjUser = row["F_hjUser"].ToString(); } if (row["F_hjUserID"] != null) { model.F_hjUserID = row["F_hjUserID"].ToString(); } if (row["F_hjDate"] != null && row["F_hjDate"].ToString() != "") { model.F_hjDate = DateTime.Parse(row["F_hjDate"].ToString()); } if (row["F_ISCall"] != null && row["F_ISCall"].ToString() != "") { model.F_ISCall = int.Parse(row["F_ISCall"].ToString()); } if (row["F_CallRes"] != null) { model.F_CallRes = row["F_CallRes"].ToString(); } if (row["F_CallResID"] != null && row["F_CallResID"].ToString() != "") { model.F_CallResID = int.Parse(row["F_CallResID"].ToString()); } if (row["F_ISCallRes"] != null && row["F_ISCallRes"].ToString() != "") { model.F_ISCallRes = int.Parse(row["F_ISCallRes"].ToString()); } if (row["F_ISVis"] != null && row["F_ISVis"].ToString() != "") { model.F_ISVis = int.Parse(row["F_ISVis"].ToString()); } if (row["F_FileID"] != null && row["F_FileID"].ToString() != "") { model.F_FileID = int.Parse(row["F_FileID"].ToString()); } } return model; } /// /// 获得数据列表 /// public DataSet GetList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select F_DVoID,F_CardDate,F_CardType,F_CardAmount,F_MaintainUser,F_ComLocations,F_Grade,F_Reciver,F_RepairTimes,F_FirstInDate,F_LastMileage,F_LastOutDate,F_Years,F_InsuranceC,F_InsuranceDate,F_Storefront,F_License,F_Numbers,F_brand,F_CarType,F_Contacts,F_khMobile,F_khPhone,F_PreLoss,F_WoOrder,F_usePlace,F_khInfor,F_lossReason,F_hanleMode,F_LVDate,F_LVContent,F_LVType,F_VisDate,F_VisContent,F_VisType,F_VisUser,F_VisUserID,F_VisDate1,F_VisContent1,F_VisType1,F_VisUser1,F_VisUserID1,F_VisDate2,F_VisContent2,F_VisType2,F_VisUser2,F_VisUserID2,F_VisDate3,F_VisContent3,F_VisType3,F_VisUser3,F_VisUserID3,F_insertDate,F_insertUser,F_insertUserID,F_liableP,F_hjUser,F_hjUserID,F_hjDate,F_ISCall,F_CallRes,F_CallResID,F_ISCallRes,F_ISVis,F_FileID "); strSql.Append(" FROM T_Vis_DXOTelphone "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } return DbHelperSQL.Query(strSql.ToString()); } /// /// 获得前几行数据 /// 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_DVoID,F_CardDate,F_CardType,F_CardAmount,F_MaintainUser,F_ComLocations,F_Grade,F_Reciver,F_RepairTimes,F_FirstInDate,F_LastMileage,F_LastOutDate,F_Years,F_InsuranceC,F_InsuranceDate,F_Storefront,F_License,F_Numbers,F_brand,F_CarType,F_Contacts,F_khMobile,F_khPhone,F_PreLoss,F_WoOrder,F_usePlace,F_khInfor,F_lossReason,F_hanleMode,F_LVDate,F_LVContent,F_LVType,F_VisDate,F_VisContent,F_VisType,F_VisUser,F_VisUserID,F_VisDate1,F_VisContent1,F_VisType1,F_VisUser1,F_VisUserID1,F_VisDate2,F_VisContent2,F_VisType2,F_VisUser2,F_VisUserID2,F_VisDate3,F_VisContent3,F_VisType3,F_VisUser3,F_VisUserID3,F_insertDate,F_insertUser,F_insertUserID,F_liableP,F_hjUser,F_hjUserID,F_hjDate,F_ISCall,F_CallRes,F_CallResID,F_ISCallRes,F_ISVis,F_FileID "); strSql.Append(" FROM T_Vis_DXOTelphone "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" order by " + filedOrder); return DbHelperSQL.Query(strSql.ToString()); } /// /// 获取记录总数 /// public int GetRecordCount(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) FROM T_Vis_DXOTelphone "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } object obj = DbHelperSQL.GetSingle(strSql.ToString()); if (obj == null) { return 0; } else { return Convert.ToInt32(obj); } } /// /// 分页获取数据列表 /// 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_DVoID desc"); } strSql.Append(")AS Row, T.* from T_Vis_DXOTelphone T "); 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()); } #endregion BasicMethod #region ExtensionMethod /// /// 呼叫状态更新 /// /// public bool UpdateHJ(int telid, int uid, string uname, int resid, string res) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Vis_DXOTelphone set "); strSql.Append("F_ISCall=1,"); strSql.Append("F_CallResID=@F_CallResID,"); strSql.Append("F_CallRes=@F_CallRes,"); strSql.Append("F_hjDate=GetDate(),"); strSql.Append("F_hjUser=@F_CallUserName,"); strSql.Append("F_hjUserID=@F_CallUserID"); strSql.Append(" where F_DVoID=@F_DVoID"); SqlParameter[] parameters = { new SqlParameter("@F_CallResID", SqlDbType.Int,4), new SqlParameter("@F_CallRes", SqlDbType.VarChar,50), new SqlParameter("@F_CallUserName", SqlDbType.VarChar,50), new SqlParameter("@F_CallUserID", SqlDbType.Int,4), new SqlParameter("@F_DVoID", SqlDbType.Int,4)}; parameters[0].Value = resid; parameters[1].Value = res; parameters[2].Value = uname; parameters[3].Value = uid; parameters[4].Value = telid; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } /// /// 回访更新 /// /// public bool UpdateHF(int telid, bool isres, int resid, string res, int uid, string uname, string vistype, string viscontent, int isvis) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Vis_DXOTelphone set "); strSql.Append("F_VisContent=@F_VisContent,"); strSql.Append("F_VisType=@F_VisType,"); strSql.Append("F_ISCallRes=@F_ISCallRes,"); strSql.Append("F_CallResID=@F_CallResID,"); strSql.Append("F_CallRes=@F_CallRes,"); strSql.Append("F_ISVis=@F_ISVis,"); strSql.Append("F_VisDate=GetDate(),"); strSql.Append("F_VisUser=@F_VisUserName,"); strSql.Append("F_VisUserID=@F_VisUserID"); strSql.Append(" where F_DVoID=@F_DVoID"); SqlParameter[] parameters = { new SqlParameter("@F_VisContent", SqlDbType.VarChar,50), new SqlParameter("@F_VisType", SqlDbType.VarChar,50), new SqlParameter("@F_ISCallRes", SqlDbType.Bit), new SqlParameter("@F_CallResID", SqlDbType.Int,4), new SqlParameter("@F_CallRes", SqlDbType.VarChar,50), new SqlParameter("@F_ISVis", SqlDbType.Int,4), new SqlParameter("@F_VisUserName", SqlDbType.VarChar,50), new SqlParameter("@F_VisUserID", SqlDbType.Int,4), new SqlParameter("@F_DVoID", SqlDbType.Int,4)}; parameters[0].Value = viscontent; parameters[1].Value = vistype; parameters[2].Value = isres; parameters[3].Value = resid; parameters[4].Value = res; parameters[5].Value = isvis; parameters[6].Value = uname; parameters[7].Value = uid; parameters[8].Value = telid; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } } public DataSet GetListExpt(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append("F_CardDate,F_CardType,F_CardAmount,F_MaintainUser,F_ComLocations,F_Grade,F_Reciver,F_RepairTimes,"); strSql.Append("F_FirstInDate, F_LastMileage, F_LastOutDate, F_Years, F_InsuranceC, F_InsuranceDate, F_Storefront,"); strSql.Append("F_License, F_Numbers, F_brand, F_CarType, F_Contacts, F_khMobile, F_khPhone, F_PreLoss, F_WoOrder, F_usePlace, F_khInfor, F_lossReason, F_hanleMode, "); strSql.Append("F_liableP,F_VisDate,F_VisContent,F_VisType,F_VisUser,F_insertDate,F_hjDate,"); strSql.Append("case F_ISCall when 1 then '已呼叫' else '未呼叫' end F_CallState,"); strSql.Append("case F_ISCallRes when 1 then '已接通' else '未接通' end F_CallResState, F_CallRes"); strSql.Append(" FROM T_Vis_DXOTelphone "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } return DbHelperSQL.Query(strSql.ToString()); } /// /// 根据文件删除 /// public bool DeleteListByFileID(string FileID) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from T_Vis_DXOTelphone "); strSql.Append(" where F_Fileid =" + FileID + " "); int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } } #endregion ExtensionMethod } }