public int Update(ProfilesInfo model) { StringBuilder sb = new StringBuilder(250); sb.Append(@"update Profiles set Username = @Username,AppName = @AppName,IsAnonymous = @IsAnonymous,LastActivityDate = @LastActivityDate,LastUpdatedDate = @LastUpdatedDate where Id = @Id " ); SqlParameter[] parms = { new SqlParameter("@Id", SqlDbType.UniqueIdentifier), new SqlParameter("@Username", SqlDbType.NVarChar, 50), new SqlParameter("@AppName", SqlDbType.NVarChar, 50), new SqlParameter("@IsAnonymous", SqlDbType.Bit), new SqlParameter("@LastActivityDate", SqlDbType.DateTime), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.Id; parms[1].Value = model.Username; parms[2].Value = model.AppName; parms[3].Value = model.IsAnonymous; parms[4].Value = model.LastActivityDate; parms[5].Value = model.LastUpdatedDate; return(SqlHelper.ExecuteNonQuery(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), parms)); }
public ActionResult EamilSetting(int TimeStamp) { ProfilesInfo infoSenderName = ProfilesBLL.Get(ProfilesInfo.EmailItem.发件人显示名, true); ProfilesInfo infoSenderHostName = ProfilesBLL.Get(ProfilesInfo.EmailItem.发件邮件主机, true); ProfilesInfo infoSenderEmailAddress = ProfilesBLL.Get(ProfilesInfo.EmailItem.发件邮箱地址, true); ProfilesInfo infoSenderEmailPwd = ProfilesBLL.Get(ProfilesInfo.EmailItem.发件邮箱密码, true); ProfilesInfo infoSenderEmailPort = ProfilesBLL.Get(ProfilesInfo.EmailItem.发件邮箱端口, true); ProfilesInfo infoReplyAddress = ProfilesBLL.Get(ProfilesInfo.EmailItem.回复地址, true); ProfilesInfo infoReplyDisplayName = ProfilesBLL.Get(ProfilesInfo.EmailItem.回复时显示名, true); infoSenderName.Value = Function.GetRequestString("SenderName"); infoSenderHostName.Value = Function.GetRequestString("SenderHostName"); infoSenderEmailAddress.Value = Function.GetRequestString("SenderEmailAddress"); infoSenderEmailPwd.Value = Function.GetRequestString("SenderEmailPwd"); infoSenderEmailPort.Value = Function.GetRequestString("SenderEmailPort"); infoReplyAddress.Value = Function.GetRequestString("ReplyAddress"); infoReplyDisplayName.Value = Function.GetRequestString("ReplyDisplayName"); ProfilesBLL.Edit(infoSenderName); ProfilesBLL.Edit(infoSenderHostName); ProfilesBLL.Edit(infoSenderEmailAddress); ProfilesBLL.Edit(infoSenderEmailPwd); ProfilesBLL.Edit(infoSenderEmailPort); ProfilesBLL.Edit(infoReplyAddress); ProfilesBLL.Edit(infoReplyDisplayName); return(Content(MVCScriptHelper.AlertRefresh("更新成功", null))); }
public IList <ProfilesInfo> GetList() { StringBuilder sb = new StringBuilder(250); sb.Append(@"select Id,Username,AppName,IsAnonymous,LastActivityDate,LastUpdatedDate from Profiles order by LastUpdatedDate desc " ); IList <ProfilesInfo> list = new List <ProfilesInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString())) { if (reader != null && reader.HasRows) { while (reader.Read()) { ProfilesInfo model = new ProfilesInfo(); model.Id = reader.GetGuid(0); model.Username = reader.GetString(1); model.AppName = reader.GetString(2); model.IsAnonymous = reader.GetBoolean(3); model.LastActivityDate = reader.GetDateTime(4); model.LastUpdatedDate = reader.GetDateTime(5); list.Add(model); } } } return(list); }
public IList <ProfilesInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms) { StringBuilder sb = new StringBuilder(250); sb.Append(@"select Id,Username,AppName,IsAnonymous,LastActivityDate,LastUpdatedDate from Profiles "); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } IList <ProfilesInfo> list = new List <ProfilesInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), cmdParms)) { if (reader != null && reader.HasRows) { while (reader.Read()) { ProfilesInfo model = new ProfilesInfo(); model.Id = reader.GetGuid(0); model.Username = reader.GetString(1); model.AppName = reader.GetString(2); model.IsAnonymous = reader.GetBoolean(3); model.LastActivityDate = reader.GetDateTime(4); model.LastUpdatedDate = reader.GetDateTime(5); list.Add(model); } } } return(list); }
public int Insert(ProfilesInfo model) { StringBuilder sb = new StringBuilder(250); sb.Append(@"insert into Profiles (Username,AppName,IsAnonymous,LastActivityDate,LastUpdatedDate) values (@Username,@AppName,@IsAnonymous,@LastActivityDate,@LastUpdatedDate) " ); SqlParameter[] parms = { new SqlParameter("@Username", SqlDbType.NVarChar, 50), new SqlParameter("@AppName", SqlDbType.NVarChar, 50), new SqlParameter("@IsAnonymous", SqlDbType.Bit), new SqlParameter("@LastActivityDate", SqlDbType.DateTime), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.Username; parms[1].Value = model.AppName; parms[2].Value = model.IsAnonymous; parms[3].Value = model.LastActivityDate; parms[4].Value = model.LastUpdatedDate; return(SqlHelper.ExecuteNonQuery(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), parms)); }
public ProfilesInfo GetModel(object Id) { ProfilesInfo model = null; StringBuilder sb = new StringBuilder(300); sb.Append(@"select top 1 Id,Username,AppName,IsAnonymous,LastActivityDate,LastUpdatedDate from Profiles where Id = @Id " ); SqlParameter parm = new SqlParameter("@Id", SqlDbType.UniqueIdentifier); parm.Value = Guid.Parse(Id.ToString()); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), parm)) { if (reader != null) { if (reader.Read()) { model = new ProfilesInfo(); model.Id = reader.GetGuid(0); model.Username = reader.GetString(1); model.AppName = reader.GetString(2); model.IsAnonymous = reader.GetBoolean(3); model.LastActivityDate = reader.GetDateTime(4); model.LastUpdatedDate = reader.GetDateTime(5); } } } return(model); }
public ActionResult WechatSubscribeContent(ProfilesInfo info) { ProfilesInfo infoExist = ProfilesBLL.GetList(p => p.ID == info.ID).FirstOrDefault(); infoExist.Value = info.Value; ProfilesBLL.Edit(infoExist); return(Content(MVCScriptHelper.AlertRefresh("更新成功", null))); }
public ActionResult InportSetting(int TimeStamp) { ProfilesInfo DefaultRuleIDWhenInport = ProfilesBLL.Get(ProfilesInfo.InportSetting.DefaultRuleIDWhenInport, true); DefaultRuleIDWhenInport.Value = Function.GetRequestString("DefaultRuleIDWhenInport"); ProfilesBLL.Edit(DefaultRuleIDWhenInport); return(Content(MVCScriptHelper.AlertRefresh("更新成功", null))); }
public ActionResult Edit() { ProfilesInfo ifnoa = ProfilesBLL.Get("手机购买时间有效小时数", true); ProfilesInfo infoAiQiYiRate = ProfilesBLL.Get("AiQiYiRate", true); ProfilesInfo infoEnableAgenterName = ProfilesBLL.Get("EnableAgenterName", true); ViewBag.ifnoa = ifnoa; ViewBag.infoAiQiYiRate = infoAiQiYiRate; ViewBag.infoEnableAgenterName = infoEnableAgenterName; return(View()); }
public IList <ProfilesInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms) { StringBuilder sb = new StringBuilder(250); sb.Append(@"select count(*) from Profiles "); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), cmdParms); if (totalRecords == 0) { return(new List <ProfilesInfo>()); } sb.Clear(); int startIndex = (pageIndex - 1) * pageSize + 1; int endIndex = pageIndex * pageSize; sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber, Id,Username,AppName,IsAnonymous,LastActivityDate,LastUpdatedDate from Profiles " ); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex); IList <ProfilesInfo> list = new List <ProfilesInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), cmdParms)) { if (reader != null && reader.HasRows) { while (reader.Read()) { ProfilesInfo model = new ProfilesInfo(); model.Id = reader.GetGuid(1); model.Username = reader.GetString(2); model.AppName = reader.GetString(3); model.IsAnonymous = reader.GetBoolean(4); model.LastActivityDate = reader.GetDateTime(5); model.LastUpdatedDate = reader.GetDateTime(6); list.Add(model); } } } return(list); }
public ActionResult Edit(int TimeStamp) { ProfilesInfo ifnoa = ProfilesBLL.Get("手机购买时间有效小时数", true); ProfilesInfo infoAiQiYiRate = ProfilesBLL.Get("AiQiYiRate", true); ProfilesInfo infoEnableAgenterName = ProfilesBLL.Get("EnableAgenterName", true); ifnoa.Value = Function.GetRequestString("Txtinfoa"); infoAiQiYiRate.Value = Function.GetRequestString("TxtinfoAiQiYiRate"); infoEnableAgenterName.Value = Function.GetRequestString("TxtinfoEnableAgenterName"); ProfilesBLL.Edit(ifnoa); ProfilesBLL.Edit(infoAiQiYiRate); ProfilesBLL.Edit(infoEnableAgenterName); return(Content(MVCScriptHelper.AlertRefresh("更新成功", null))); }
public ActionResult MainSetting(int TimeStamp) { ProfilesInfo EnableUpdateTimeBegin = ProfilesBLL.Get("EnableUpdateTimeBegin", true); ProfilesInfo EnableUpdateTimeEnd = ProfilesBLL.Get("EnableUpdateTimeEnd", true); ProfilesInfo EnableUpdateTimeInterval = ProfilesBLL.Get("EnableUpdateTimeInterval", true); EnableUpdateTimeBegin.Value = Function.GetRequestString("EnableUpdateTimeBegin"); EnableUpdateTimeEnd.Value = Function.GetRequestString("EnableUpdateTimeEnd"); EnableUpdateTimeInterval.Value = Function.GetRequestString("EnableUpdateTimeInterval"); ProfilesBLL.Edit(EnableUpdateTimeBegin); ProfilesBLL.Edit(EnableUpdateTimeEnd); ProfilesBLL.Edit(EnableUpdateTimeInterval); return(Json(new APIJson(0, "更新成功"))); }
public ActionResult UserMenu(string menuJson) { ProfilesInfo info = ProfilesBLL.Get(ProfilesInfo.Wechat.MenuJson); info.Value = menuJson; ProfilesBLL.Edit(info); string URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="; string token = WeiXin.APIClient.WechatService.GetAccessTonken(); string msg = "Token={0};<br/>result={1}"; if (!string.IsNullOrEmpty(token)) { if (token.Length < 10) { return(Content("token有误")); } } var result = DataHelper.PostHttpData(URL + token, menuJson); return(Content(string.Format(msg, token, result))); }
public Task AddAndSaveProfilesInfo(ProfilesInfo var) { _context.Add(var); return(_context.SaveChangesAsync()); }
public IList <ProfilesInfo> GetProfileInfo(int authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, string appName, out int totalRecords) { StringBuilder sqlSelect1 = new StringBuilder("SELECT COUNT(*) FROM Profiles WHERE AppName = @AppName"); SqlParameter[] parms1 = { new SqlParameter("@AppName", SqlDbType.NVarChar, 50) }; parms1[0].Value = appName; StringBuilder sqlSelect2 = new StringBuilder("SELECT Username,IsAnonymous, LastActivityDate, LastUpdatedDate FROM Profiles WHERE AppName = @AppName"); SqlParameter[] parms2 = { new SqlParameter("@AppName", SqlDbType.NVarChar, 50) }; parms2[0].Value = appName; int arraySize; if (usernameToMatch != null) { arraySize = parms1.Length; sqlSelect1.Append(" AND Username LIKE @Username "); Array.Resize <SqlParameter>(ref parms1, arraySize + 1); parms1[arraySize] = new SqlParameter("@Username", SqlDbType.VarChar, 256); parms1[arraySize].Value = usernameToMatch; sqlSelect2.Append(" AND Username LIKE @Username "); Array.Resize <SqlParameter>(ref parms2, arraySize + 1); parms2[arraySize] = new SqlParameter("@Username", SqlDbType.VarChar, 256); parms2[arraySize].Value = usernameToMatch; } if (userInactiveSinceDate != null) { arraySize = parms1.Length; sqlSelect1.Append(" AND LastActivityDate >= @LastActivityDate "); Array.Resize <SqlParameter>(ref parms1, arraySize + 1); parms1[arraySize] = new SqlParameter("@LastActivityDate", SqlDbType.DateTime); parms1[arraySize].Value = (DateTime)userInactiveSinceDate; sqlSelect2.Append(" AND LastActivityDate >= @LastActivityDate "); Array.Resize <SqlParameter>(ref parms2, arraySize + 1); parms2[arraySize] = new SqlParameter("@LastActivityDate", SqlDbType.DateTime); parms2[arraySize].Value = (DateTime)userInactiveSinceDate; } if (authenticationOption != AUTH_ALL) { arraySize = parms1.Length; Array.Resize <SqlParameter>(ref parms1, arraySize + 1); sqlSelect1.Append(" AND IsAnonymous = @IsAnonymous"); parms1[arraySize] = new SqlParameter("@IsAnonymous", SqlDbType.Bit); Array.Resize <SqlParameter>(ref parms2, arraySize + 1); sqlSelect2.Append(" AND IsAnonymous = @IsAnonymous"); parms2[arraySize] = new SqlParameter("@IsAnonymous", SqlDbType.Bit); switch (authenticationOption) { case AUTH_ANONYMOUS: parms1[arraySize].Value = true; parms2[arraySize].Value = true; break; case AUTH_AUTHENTICATED: parms1[arraySize].Value = false; parms2[arraySize].Value = false; break; default: break; } } IList <ProfilesInfo> list = new List <ProfilesInfo>(); totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.HnztcShopDbConnString, CommandType.Text, sqlSelect1.ToString(), parms1); if (totalRecords <= 0) { return(list); } using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sqlSelect2.ToString(), parms2)) { while (reader.Read()) { ProfilesInfo model = new ProfilesInfo(); model.Username = reader.GetString(1); model.IsAnonymous = reader.GetBoolean(3); model.LastActivityDate = reader.GetDateTime(4); model.LastUpdatedDate = reader.GetDateTime(5); list.Add(model); } } return(list); }
public ActionResult WechatSubscribeContent() { ProfilesInfo info = ProfilesBLL.Get(ProfilesInfo.Wechat.SubcribeContent, true); return(View(info)); }
/// <summary> /// 添加数据到数据库 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(ProfilesInfo model) { return(dal.Insert(model)); }
/// <summary> /// 修改数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Update(ProfilesInfo model) { return(dal.Update(model)); }
public Task SetProfilesInfo(ProfilesInfo var) { _context.Update(var); return(_context.SaveChangesAsync()); }