| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- using HySoft.DBUtility;
- using System.Data.SqlClient;
- namespace HySoft.BaseCallCenter.DAL
- {
- //T_Fax_SentFax
- public partial class T_Fax_SentFax
- {
- public bool Exists(int FaxID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select count(1) from T_Fax_SentFax");
- strSql.Append(" where ");
- strSql.Append(" FaxID = @FaxID ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4) };
- parameters[0].Value = FaxID;
- return DbHelperSQL.Exists(strSql.ToString(), parameters);
- }
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public void Add(Model.T_Fax_SentFax model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("insert into T_Fax_SentFax(");
- strSql.Append("FaxID,SendTime,LastSentTime,CurSentCount,MaxSendCount,Info,FileState,State,F_UserID,F_CustomerID,F_Name,TelNum,F_FaxCode,WebFilePath,FileName,FilePath,TifFilePath,FileSize,FileType,Remark,CommitTime");
- strSql.Append(") values (");
- strSql.Append("@FaxID,@SendTime,@LastSentTime,@CurSentCount,@MaxSendCount,@Info,@FileState,@State,@F_UserID,@F_CustomerID,@F_Name,@TelNum,@F_FaxCode,@WebFilePath,@FileName,@FilePath,@TifFilePath,@FileSize,@FileType,@Remark,@CommitTime");
- strSql.Append(") ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4) ,
- new SqlParameter("@SendTime", SqlDbType.DateTime) ,
- new SqlParameter("@LastSentTime", SqlDbType.DateTime) ,
- new SqlParameter("@CurSentCount", SqlDbType.Int,4) ,
- new SqlParameter("@MaxSendCount", SqlDbType.Int,4) ,
- new SqlParameter("@Info", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileState", SqlDbType.Int,4) ,
- new SqlParameter("@State", SqlDbType.Int,4) ,
- new SqlParameter("@F_UserID", SqlDbType.Int,4) ,
- new SqlParameter("@F_CustomerID", SqlDbType.Int,4) ,
- new SqlParameter("@F_Name", SqlDbType.NVarChar,50) ,
- new SqlParameter("@TelNum", SqlDbType.VarChar,20) ,
- new SqlParameter("@F_FaxCode", SqlDbType.VarChar,20) ,
- new SqlParameter("@WebFilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileName", SqlDbType.VarChar,50) ,
- new SqlParameter("@FilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@TifFilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileSize", SqlDbType.Int,4) ,
- new SqlParameter("@FileType", SqlDbType.VarChar,20) ,
- new SqlParameter("@Remark", SqlDbType.VarChar,200) ,
- new SqlParameter("@CommitTime", SqlDbType.DateTime)
-
- };
- parameters[0].Value = model.FaxID;
- parameters[1].Value = model.SendTime;
- parameters[2].Value = model.LastSentTime;
- parameters[3].Value = model.CurSentCount;
- parameters[4].Value = model.MaxSendCount;
- parameters[5].Value = model.Info;
- parameters[6].Value = model.FileState;
- parameters[7].Value = model.State;
- parameters[8].Value = model.F_UserID;
- parameters[9].Value = model.F_CustomerID;
- parameters[10].Value = model.F_Name;
- parameters[11].Value = model.TelNum;
- parameters[12].Value = model.F_FaxCode;
- parameters[13].Value = model.WebFilePath;
- parameters[14].Value = model.FileName;
- parameters[15].Value = model.FilePath;
- parameters[16].Value = model.TifFilePath;
- parameters[17].Value = model.FileSize;
- parameters[18].Value = model.FileType;
- parameters[19].Value = model.Remark;
- parameters[20].Value = model.CommitTime;
- DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- }
- /// <summary>
- /// 重新发送
- /// </summary>
- /// <param name="arrFaxID">发送的ID</param>
- /// <returns></returns>
- public int ReSend(string arrFaxID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("insert into T_Fax_SendFaxTask(");
- strSql.Append("TelNum,FilePath,TifFilePath,FileSize,FileType,Remark,CommitTime,SendTime,LastSentTime,CurSentCount,MaxSendCount,Info,FileState,State,F_UserID,F_CustomerID,F_Name,FileName)");
- strSql.Append(" select TelNum,FilePath,TifFilePath,FileSize,FileType,Remark,getdate(),getdate(),null,0,MaxSendCount,'',FileState,0,F_UserID,F_CustomerID,F_Name,FileName ");
- strSql.Append(" from T_Fax_SentFax ");
- if (arrFaxID.IndexOf(",") == -1)
- {
- strSql.Append(" where FaxID = " + arrFaxID);
- }
- else
- {
- strSql.Append(" where FaxID in (" + arrFaxID + ") ");
- }
- return DbHelperSQL.ExecuteSql(strSql.ToString());
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public bool Update(Model.T_Fax_SentFax model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("update T_Fax_SentFax set ");
- strSql.Append(" FaxID = @FaxID , ");
- strSql.Append(" SendTime = @SendTime , ");
- strSql.Append(" LastSentTime = @LastSentTime , ");
- strSql.Append(" CurSentCount = @CurSentCount , ");
- strSql.Append(" MaxSendCount = @MaxSendCount , ");
- strSql.Append(" Info = @Info , ");
- strSql.Append(" FileState = @FileState , ");
- strSql.Append(" State = @State , ");
- strSql.Append(" F_UserID = @F_UserID , ");
- strSql.Append(" F_CustomerID = @F_CustomerID , ");
- strSql.Append(" F_Name = @F_Name , ");
- strSql.Append(" TelNum = @TelNum , ");
- strSql.Append(" F_FaxCode = @F_FaxCode , ");
- strSql.Append(" WebFilePath = @WebFilePath , ");
- strSql.Append(" FileName = @FileName , ");
- strSql.Append(" FilePath = @FilePath , ");
- strSql.Append(" TifFilePath = @TifFilePath , ");
- strSql.Append(" FileSize = @FileSize , ");
- strSql.Append(" FileType = @FileType , ");
- strSql.Append(" Remark = @Remark , ");
- strSql.Append(" CommitTime = @CommitTime ");
- strSql.Append(" where FaxID=@FaxID ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4) ,
- new SqlParameter("@SendTime", SqlDbType.DateTime) ,
- new SqlParameter("@LastSentTime", SqlDbType.DateTime) ,
- new SqlParameter("@CurSentCount", SqlDbType.Int,4) ,
- new SqlParameter("@MaxSendCount", SqlDbType.Int,4) ,
- new SqlParameter("@Info", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileState", SqlDbType.Int,4) ,
- new SqlParameter("@State", SqlDbType.Int,4) ,
- new SqlParameter("@F_UserID", SqlDbType.Int,4) ,
- new SqlParameter("@F_CustomerID", SqlDbType.Int,4) ,
- new SqlParameter("@F_Name", SqlDbType.NVarChar,50) ,
- new SqlParameter("@TelNum", SqlDbType.VarChar,20) ,
- new SqlParameter("@F_FaxCode", SqlDbType.VarChar,20) ,
- new SqlParameter("@WebFilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileName", SqlDbType.VarChar,50) ,
- new SqlParameter("@FilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@TifFilePath", SqlDbType.VarChar,200) ,
- new SqlParameter("@FileSize", SqlDbType.Int,4) ,
- new SqlParameter("@FileType", SqlDbType.VarChar,20) ,
- new SqlParameter("@Remark", SqlDbType.VarChar,200) ,
- new SqlParameter("@CommitTime", SqlDbType.DateTime)
-
- };
- parameters[0].Value = model.FaxID;
- parameters[1].Value = model.SendTime;
- parameters[2].Value = model.LastSentTime;
- parameters[3].Value = model.CurSentCount;
- parameters[4].Value = model.MaxSendCount;
- parameters[5].Value = model.Info;
- parameters[6].Value = model.FileState;
- parameters[7].Value = model.State;
- parameters[8].Value = model.F_UserID;
- parameters[9].Value = model.F_CustomerID;
- parameters[10].Value = model.F_Name;
- parameters[11].Value = model.TelNum;
- parameters[12].Value = model.F_FaxCode;
- parameters[13].Value = model.WebFilePath;
- parameters[14].Value = model.FileName;
- parameters[15].Value = model.FilePath;
- parameters[16].Value = model.TifFilePath;
- parameters[17].Value = model.FileSize;
- parameters[18].Value = model.FileType;
- parameters[19].Value = model.Remark;
- parameters[20].Value = model.CommitTime;
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public int UpdateWebFilePath(Model.T_Fax_SentFax model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("update T_Fax_SentFax set ");
- strSql.Append("WebFilePath=@WebFilePath");
- strSql.Append(" where FaxID=@FaxID ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4),
- new SqlParameter("@WebFilePath", SqlDbType.VarChar,200)};
- parameters[0].Value = model.FaxID;
- parameters[1].Value = model.WebFilePath;
- return DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- public bool Delete(int FaxID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("delete from T_Fax_SentFax ");
- strSql.Append(" where FaxID=@FaxID ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4) };
- parameters[0].Value = FaxID;
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 批量删除一批数据
- /// </summary>
- public bool DeleteList(string FaxIDlist)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("delete from T_Fax_SentFax ");
- strSql.Append(" where FaxID in (" + FaxIDlist + ") ");
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
- if (rows > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public Model.T_Fax_SentFax GetModel(int FaxID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select FaxID, SendTime, LastSentTime, CurSentCount, MaxSendCount, Info, FileState, State, F_UserID, F_CustomerID, F_Name, TelNum, F_FaxCode, WebFilePath, FileName, FilePath, TifFilePath, FileSize, FileType, Remark, CommitTime ");
- strSql.Append(" from T_Fax_SentFax ");
- strSql.Append(" where FaxID=@FaxID ");
- SqlParameter[] parameters = {
- new SqlParameter("@FaxID", SqlDbType.Int,4) };
- parameters[0].Value = FaxID;
- Model.T_Fax_SentFax model = new Model.T_Fax_SentFax();
- DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
- if (ds.Tables[0].Rows.Count > 0)
- {
- if (ds.Tables[0].Rows[0]["FaxID"].ToString() != "")
- {
- model.FaxID = int.Parse(ds.Tables[0].Rows[0]["FaxID"].ToString());
- }
- if (ds.Tables[0].Rows[0]["SendTime"].ToString() != "")
- {
- model.SendTime = DateTime.Parse(ds.Tables[0].Rows[0]["SendTime"].ToString());
- }
- if (ds.Tables[0].Rows[0]["LastSentTime"].ToString() != "")
- {
- model.LastSentTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastSentTime"].ToString());
- }
- if (ds.Tables[0].Rows[0]["CurSentCount"].ToString() != "")
- {
- model.CurSentCount = int.Parse(ds.Tables[0].Rows[0]["CurSentCount"].ToString());
- }
- if (ds.Tables[0].Rows[0]["MaxSendCount"].ToString() != "")
- {
- model.MaxSendCount = int.Parse(ds.Tables[0].Rows[0]["MaxSendCount"].ToString());
- }
- model.Info = ds.Tables[0].Rows[0]["Info"].ToString();
- if (ds.Tables[0].Rows[0]["FileState"].ToString() != "")
- {
- model.FileState = int.Parse(ds.Tables[0].Rows[0]["FileState"].ToString());
- }
- if (ds.Tables[0].Rows[0]["State"].ToString() != "")
- {
- model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
- }
- if (ds.Tables[0].Rows[0]["F_UserID"].ToString() != "")
- {
- model.F_UserID = int.Parse(ds.Tables[0].Rows[0]["F_UserID"].ToString());
- }
- if (ds.Tables[0].Rows[0]["F_CustomerID"].ToString() != "")
- {
- model.F_CustomerID = int.Parse(ds.Tables[0].Rows[0]["F_CustomerID"].ToString());
- }
- model.F_Name = ds.Tables[0].Rows[0]["F_Name"].ToString();
- model.TelNum = ds.Tables[0].Rows[0]["TelNum"].ToString();
- model.F_FaxCode = ds.Tables[0].Rows[0]["F_FaxCode"].ToString();
- model.WebFilePath = ds.Tables[0].Rows[0]["WebFilePath"].ToString();
- model.FileName = ds.Tables[0].Rows[0]["FileName"].ToString();
- model.FilePath = ds.Tables[0].Rows[0]["FilePath"].ToString();
- model.TifFilePath = ds.Tables[0].Rows[0]["TifFilePath"].ToString();
- if (ds.Tables[0].Rows[0]["FileSize"].ToString() != "")
- {
- model.FileSize = int.Parse(ds.Tables[0].Rows[0]["FileSize"].ToString());
- }
- model.FileType = ds.Tables[0].Rows[0]["FileType"].ToString();
- model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
- if (ds.Tables[0].Rows[0]["CommitTime"].ToString() != "")
- {
- model.CommitTime = DateTime.Parse(ds.Tables[0].Rows[0]["CommitTime"].ToString());
- }
- return model;
- }
- else
- {
- return null;
- }
- }
- /// <summary>
- /// 获得数据列表
- /// </summary>
- public DataSet GetList(string strWhere)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select * ");
- strSql.Append(" FROM T_Fax_SentFax ");
- if (strWhere.Trim() != "")
- {
- strSql.Append(" where " + strWhere);
- }
- 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(" * ");
- strSql.Append(" FROM T_Fax_SentFax ");
- if (strWhere.Trim() != "")
- {
- strSql.Append(" where " + strWhere);
- }
- strSql.Append(" order by " + filedOrder);
- return DbHelperSQL.Query(strSql.ToString());
- }
- }
- }
|