123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Dapper;
- using System.Data;
- using StarTech_Model;
- using Startech.IDAL;
- namespace StarTech_DAL
- {
- public class SendProvider : BaseProvider<SMSHasSend>, ISMSHasSend
- {
- public IEnumerable<SMSHasSend> FindAll()
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <returns></returns>
- public IEnumerable<SMSHasSend> FindAll(string tablename,string strWhere, string orderby, int index, int size)
- {
- IEnumerable<SMSHasSend> result = null;
- StringBuilder strSql = new StringBuilder();
- strSql.Append("T.*,c.Describe,b.DisplayName from SMSHasSend_" + tablename + " T ");
- strSql.Append(" LEFT join SMSApplication as c on c.ApplicationID=T.ApplicationID");
- strSql.Append(" LEFT JOIN Users as b ON T.Sender=b.ID ");
- if (!string.IsNullOrEmpty(strWhere.Trim()))
- {
- strSql.Append(" WHERE b.DisplayName='" + strWhere + "'");
- }
- string str = BuildPageSQL(strSql.ToString(), orderby, index, size);
- //string str = c.GetListByPage(sql, strWhere, orderby, startIndex, endIndex);
- this.Q<IEnumerable<SMSHasSend>>(e => result = e.Query<SMSHasSend>(str, null));
- return result;
- }
- /// <summary>
- /// 获取数据总条数
- /// </summar
- /// <returns></returns>
- public int GetCount(string TableName, string UserName)
- {
- object result="";
- StringBuilder strSql = new StringBuilder();
- strSql.Append("FROM SMSHasSend_" + TableName + " as a left join Users as b on a.Sender=b.ID");
- if (!string.IsNullOrEmpty(UserName.Trim()))
- {
- strSql.Append(" WHERE b.DisplayName='" + UserName + "'");
- }
- string query = BuildTotalSQL(strSql.ToString());
- this.E(e =>result= e.ExecuteScalar(query, null));
- return Convert.ToInt32(result);
- }
- #region 注释的代码
- //public SMSHasReceived FindOne(int id)
- //{
- // throw new NotImplementedException();
- //}
- //public IEnumerable<SMSHasReceived> FindAll()
- //{
- // throw new NotImplementedException();
- //}
- //public IEnumerable<SMSHasReceived> Search(string serverID, string key)
- //{
- // throw new NotImplementedException();
- //}
- //public void Insert(SMSHasReceived value)
- //{
- // throw new NotImplementedException();
- //}
- //public void Delete(SMSHasReceived value)
- //{
- // throw new NotImplementedException();
- //}
- //public void Update(SMSHasReceived value)
- //{
- // if (value == null)
- // return;
- // this.E(e => e.Execute(SqlTexts.UPDATE_USER, value));
- //}
-
- //public SMSHasReceived FindOne(string serverID, string loginName)
- //{
- // SMSHasReceived result = null;
- // this.Q<SMSHasReceived>(e => result = e.Query<SMSHasReceived>(SqlTexts.SELECT_USER, new { ServerID = serverID, LoginName = loginName }).FirstOrDefault());
- // return result;
- //}
- //public SMSHasReceived FindOne(string serverID, string account, string password)
- //{
- // SMSHasReceived result = null;
- // this.Q<SMSHasReceived>(e => result = e.Query<SMSHasReceived>(SqlTexts.SELECT_LOGIN, new { ServerID = serverID, Account = account, Password = password }).FirstOrDefault());
- // return result;
- //}
- //public void Update(string serverID, string loginName, string displayName, string watchWord)
- //{
- // //if (value == null)
- // // return;
- // //this.E(e => e.Execute(SqlTexts.UPDATE_USER, value));
- // throw new NotImplementedException();
- //}
- //public void Update(string serverID, string loginName, string password, string oldPassword, string userIP = "")
- //{
- // const string execSQL = "ChangePassword";
- // DynamicParameters args = new DynamicParameters();
- // args.AddDynamicParams(new { LoginName = loginName, OldPassword = oldPassword, NewPassword = password, UserIP = userIP });
- // args.Add(name: "PasswordChanged", value: 0, direction: ParameterDirection.Output);
- // args.Add(name: "Cause", value: String.Empty, direction: ParameterDirection.Output);
- // E(e => e.Execute(sql: execSQL, param: args, commandType: CommandType.StoredProcedure));
- //}
- //public void Update(string serverID, string loginName, string headImageHashValue, int headImageType)
- //{
- // E(e => e.Execute(sql: SqlTexts.UPDATE_HEADIMAGE,
- // param: new
- // {
- // ServerID = serverID,
- // LoginName = loginName,
- // HeadImageHashValue = headImageHashValue,
- // HeadImageType = headImageType
- // },
- // commandType: CommandType.StoredProcedure));
- //}
- #endregion
- public string GetUserServer(string access_token, int expires_in, string redirect_uri, string clientkey)
- {
- throw new NotImplementedException();
- }
- public SMSHasSend FindOne(string id)
- {
- throw new NotImplementedException();
- }
- public void Delete(string id)
- {
- throw new NotImplementedException();
- }
- }
- }
|