/// <summary> /// 获取邮箱地址 /// </summary> /// <param name="emailAddressInfo">邮箱地址实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList <EmailAddressInfo> GetEmailAddress(EmailAddressInfo emailAddressInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable <EmailAddressInfo> emailAddressInfos = ( from item in DB.GetTable <EmailAddressInfo>() orderby item.ID descending select item ); if (emailAddressInfo != null && emailAddressInfo.ID != 0) { emailAddressInfos = emailAddressInfos.Where <EmailAddressInfo>(m => m.ID == emailAddressInfo.ID); } if (emailAddressInfo != null && emailAddressInfo.UserID != 0) { emailAddressInfos = emailAddressInfos.Where <EmailAddressInfo>(m => m.UserID == emailAddressInfo.UserID); } if (pageInfo != null) { pageInfo.TotalRecord = emailAddressInfos.Count(); return(emailAddressInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList <EmailAddressInfo>()); } else { return(emailAddressInfos.ToList <EmailAddressInfo>()); } } }
/// <summary> /// 获取帮助 /// </summary> /// <param name="ID">帮助编号</param> public HelpInfo GetHelpByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return(DB.GetTable <HelpInfo>().FirstOrDefault <HelpInfo>(u => u.ID == ID)); } }
/// <summary> /// 获取用户 /// </summary> /// <param name="userInfo">用户实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList<UsersInfo> GetUser(UsersInfo userInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable<UsersInfo> userInfos = ( from item in DB.GetTable<UsersInfo>() orderby item.ID descending select item ); if (userInfo != null && userInfo.ID != 0) userInfos = userInfos.Where<UsersInfo>(m => m.ID == userInfo.ID); if (userInfo != null && !string.IsNullOrEmpty(userInfo.Name)) userInfos = userInfos.Where<UsersInfo>(m => m.Name.Contains(userInfo.Name)); if (userInfo != null && userInfo.UserGroup != 0) userInfos = userInfos.Where<UsersInfo>(m => m.UserGroup == userInfo.UserGroup); if (pageInfo != null) { pageInfo.TotalRecord = userInfos.Count(); return userInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<UsersInfo>(); } else return userInfos.ToList<UsersInfo>(); } }
/// <summary> /// 获取用户 /// </summary> /// <param name="name">用户名</param> /// <param name="password">密码</param> /// <returns></returns> public UsersInfo GetUserByNameAndPassword(string name, string password) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<UsersInfo>().FirstOrDefault<UsersInfo>(u => u.Name == name && u.Password == password); } }
/// <summary> /// 获取用户 /// </summary> /// <param name="ID">用户编号</param> public UsersInfo GetUserByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<UsersInfo>().FirstOrDefault<UsersInfo>(u => u.ID == ID); } }
/// <summary> /// 获取用户 /// </summary> /// <param name="userInfo">用户实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList <UsersInfo> GetUser(UsersInfo userInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable <UsersInfo> userInfos = ( from item in DB.GetTable <UsersInfo>() orderby item.ID descending select item ); if (userInfo != null && userInfo.ID != 0) { userInfos = userInfos.Where <UsersInfo>(m => m.ID == userInfo.ID); } if (userInfo != null && !string.IsNullOrEmpty(userInfo.Name)) { userInfos = userInfos.Where <UsersInfo>(m => m.Name.Contains(userInfo.Name)); } if (userInfo != null && userInfo.UserGroup != 0) { userInfos = userInfos.Where <UsersInfo>(m => m.UserGroup == userInfo.UserGroup); } if (pageInfo != null) { pageInfo.TotalRecord = userInfos.Count(); return(userInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList <UsersInfo>()); } else { return(userInfos.ToList <UsersInfo>()); } } }
/// <summary> /// 获取用户 /// </summary> /// <param name="ID">用户编号</param> public UsersInfo GetUserByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return(DB.GetTable <UsersInfo>().FirstOrDefault <UsersInfo>(u => u.ID == ID)); } }
/// <summary> /// 获取用户 /// </summary> /// <param name="name">用户名</param> /// <param name="password">密码</param> /// <returns></returns> public UsersInfo GetUserByNameAndPassword(string name, string password) { using (DataContextDB DB = new DataContextDB()) { return(DB.GetTable <UsersInfo>().FirstOrDefault <UsersInfo>(u => u.Name == name && u.Password == password)); } }
/// <summary> /// 获取邮件发送 /// </summary> /// <param name="ID">邮件发送编号</param> public EmailSendInfo GetEmailSendByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<EmailSendInfo>().FirstOrDefault<EmailSendInfo>(u => u.ID == ID); } }
/// <summary> /// 获取短信配置 /// </summary> /// <param name="ID">短信配置编号</param> public MessageProfileInfo GetMessageProfileByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<MessageProfileInfo>().FirstOrDefault<MessageProfileInfo>(u => u.ID == ID); } }
/// <summary> /// 获取短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList <MessageProfileInfo> GetMessageProfile(MessageProfileInfo messageProfileInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable <MessageProfileInfo> messageProfileInfos = ( from item in DB.GetTable <MessageProfileInfo>() orderby item.ID descending select item ); if (messageProfileInfo != null && messageProfileInfo.ID != 0) { messageProfileInfos = messageProfileInfos.Where <MessageProfileInfo>(m => m.ID == messageProfileInfo.ID); } if (messageProfileInfo != null && messageProfileInfo.UserID != 0) { messageProfileInfos = messageProfileInfos.Where <MessageProfileInfo>(m => m.UserID == messageProfileInfo.UserID); } if (pageInfo != null) { pageInfo.TotalRecord = messageProfileInfos.Count(); return(messageProfileInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList <MessageProfileInfo>()); } else { return(messageProfileInfos.ToList <MessageProfileInfo>()); } } }
/// <summary> /// 获取短信配置 /// </summary> /// <param name="ID">短信配置编号</param> public MessageProfileInfo GetMessageProfileByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return(DB.GetTable <MessageProfileInfo>().FirstOrDefault <MessageProfileInfo>(u => u.ID == ID)); } }
/// <summary> /// 获取手机联系人 /// </summary> /// <param name="ID">手机联系人编号</param> public PhoneAddressInfo GetPhoneAddressByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<PhoneAddressInfo>().FirstOrDefault<PhoneAddressInfo>(u => u.ID == ID); } }
/// <summary> /// 获取邮箱地址 /// </summary> /// <param name="ID">邮箱地址编号</param> public EmailAddressInfo GetEmailAddressByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return(DB.GetTable <EmailAddressInfo>().FirstOrDefault <EmailAddressInfo>(u => u.ID == ID)); } }
/// <summary> /// 获取帮助 /// </summary> /// <param name="helpInfo">帮助实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList <HelpInfo> GetHelp(HelpInfo helpInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable <HelpInfo> helpInfos = ( from item in DB.GetTable <HelpInfo>() orderby item.ID descending select item ); if (helpInfo != null && helpInfo.ID != 0) { helpInfos = helpInfos.Where <HelpInfo>(m => m.ID == helpInfo.ID); } if (pageInfo != null) { pageInfo.TotalRecord = helpInfos.Count(); return(helpInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList <HelpInfo>()); } else { return(helpInfos.ToList <HelpInfo>()); } } }
/// <summary> /// 获取帮助 /// </summary> /// <param name="ID">帮助编号</param> public HelpInfo GetHelpByID(int ID) { using (DataContextDB DB = new DataContextDB()) { return DB.GetTable<HelpInfo>().FirstOrDefault<HelpInfo>(u => u.ID == ID); } }
/// <summary> /// 添加短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> public int InsertMessageProfile(MessageProfileInfo messageProfileInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <MessageProfileInfo>().InsertOnSubmit(messageProfileInfo); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 添加用户 /// </summary> /// <param name="userInfo">用户实体</param> public int InsertUser(UsersInfo userInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <UsersInfo>().InsertOnSubmit(userInfo); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 添加邮箱地址 /// </summary> /// <param name="emailAddressInfo">邮箱地址实体</param> public int InsertEmailAddress(EmailAddressInfo emailAddressInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <EmailAddressInfo>().InsertOnSubmit(emailAddressInfo); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 修改短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> public int UpdateMessageProfile(MessageProfileInfo messageProfileInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<MessageProfileInfo>().Attach(messageProfileInfo, true); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 修改短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> public int UpdateMessageProfile(MessageProfileInfo messageProfileInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <MessageProfileInfo>().Attach(messageProfileInfo, true); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 添加短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> public int InsertMessageProfile(MessageProfileInfo messageProfileInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<MessageProfileInfo>().InsertOnSubmit(messageProfileInfo); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 添加帮助 /// </summary> /// <param name="helpInfo">帮助实体</param> public int InsertHelp(HelpInfo helpInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<HelpInfo>().InsertOnSubmit(helpInfo); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 修改邮箱地址 /// </summary> /// <param name="emailAddressInfo">邮箱地址实体</param> public int UpdateEmailAddress(EmailAddressInfo emailAddressInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <EmailAddressInfo>().Attach(emailAddressInfo, true); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 修改邮件发送 /// </summary> /// <param name="emailSendInfo">邮件发送实体</param> public int UpdateEmailSend(EmailSendInfo emailSendInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<EmailSendInfo>().Attach(emailSendInfo, true); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 添加邮件发送 /// </summary> /// <param name="emailSendInfo">邮件发送实体</param> public int InsertEmailSend(EmailSendInfo emailSendInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<EmailSendInfo>().InsertOnSubmit(emailSendInfo); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 修改用户 /// </summary> /// <param name="userInfo">用户实体</param> public int UpdateUser(UsersInfo userInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable <UsersInfo>().Attach(userInfo, true); DB.SubmitChanges(); return(1); } catch (Exception e) { string error = e.Message; return(-1); } } }
/// <summary> /// 修改手机联系人 /// </summary> /// <param name="phoneAddressInfo">手机联系人实体</param> public int UpdatePhoneAddress(PhoneAddressInfo phoneAddressInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<PhoneAddressInfo>().Attach(phoneAddressInfo, true); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 添加手机联系人 /// </summary> /// <param name="phoneAddressInfo">手机联系人实体</param> public int InsertPhoneAddress(PhoneAddressInfo phoneAddressInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<PhoneAddressInfo>().InsertOnSubmit(phoneAddressInfo); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }
/// <summary> /// 获取帮助 /// </summary> /// <param name="helpInfo">帮助实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList<HelpInfo> GetHelp(HelpInfo helpInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable<HelpInfo> helpInfos = ( from item in DB.GetTable<HelpInfo>() orderby item.ID descending select item ); if (helpInfo != null && helpInfo.ID != 0) helpInfos = helpInfos.Where<HelpInfo>(m => m.ID == helpInfo.ID); if (pageInfo != null) { pageInfo.TotalRecord = helpInfos.Count(); return helpInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<HelpInfo>(); } else return helpInfos.ToList<HelpInfo>(); } }
/// <summary> /// 获取邮件发送 /// </summary> /// <param name="emailSendInfo">邮件发送实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList<EmailSendInfo> GetEmailSend(EmailSendInfo emailSendInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable<EmailSendInfo> emailSendInfos = ( from item in DB.GetTable<EmailSendInfo>() orderby item.ID descending select item ); if (emailSendInfo != null && emailSendInfo.ID != 0) emailSendInfos = emailSendInfos.Where<EmailSendInfo>(m => m.ID == emailSendInfo.ID); if (emailSendInfo != null && emailSendInfo.UserID != 0) emailSendInfos = emailSendInfos.Where<EmailSendInfo>(m => m.UserID == emailSendInfo.UserID); if (pageInfo != null) { pageInfo.TotalRecord = emailSendInfos.Count(); return emailSendInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<EmailSendInfo>(); } else return emailSendInfos.ToList<EmailSendInfo>(); } }
/// <summary> /// 获取手机联系人 /// </summary> /// <param name="phoneAddressInfo">手机联系人实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList<PhoneAddressInfo> GetPhoneAddress(PhoneAddressInfo phoneAddressInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable<PhoneAddressInfo> phoneAddressInfos = ( from item in DB.GetTable<PhoneAddressInfo>() orderby item.ID descending select item ); if (phoneAddressInfo != null && phoneAddressInfo.ID != 0) phoneAddressInfos = phoneAddressInfos.Where<PhoneAddressInfo>(m => m.ID == phoneAddressInfo.ID); if (phoneAddressInfo != null && phoneAddressInfo.UserID != 0) phoneAddressInfos = phoneAddressInfos.Where<PhoneAddressInfo>(m => m.UserID == phoneAddressInfo.UserID); if (pageInfo != null) { pageInfo.TotalRecord = phoneAddressInfos.Count(); return phoneAddressInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<PhoneAddressInfo>(); } else return phoneAddressInfos.ToList<PhoneAddressInfo>(); } }
/// <summary> /// 获取短信配置 /// </summary> /// <param name="messageProfileInfo">短信配置实体</param> /// <param name="pageInfo">分页实体</param> /// <returns></returns> public IList<MessageProfileInfo> GetMessageProfile(MessageProfileInfo messageProfileInfo, PageInfo pageInfo) { using (DataContextDB DB = new DataContextDB()) { IQueryable<MessageProfileInfo> messageProfileInfos = ( from item in DB.GetTable<MessageProfileInfo>() orderby item.ID descending select item ); if (messageProfileInfo != null && messageProfileInfo.ID != 0) messageProfileInfos = messageProfileInfos.Where<MessageProfileInfo>(m => m.ID == messageProfileInfo.ID); if (messageProfileInfo != null && messageProfileInfo.UserID != 0) messageProfileInfos = messageProfileInfos.Where<MessageProfileInfo>(m => m.UserID == messageProfileInfo.UserID); if (pageInfo != null) { pageInfo.TotalRecord = messageProfileInfos.Count(); return messageProfileInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<MessageProfileInfo>(); } else return messageProfileInfos.ToList<MessageProfileInfo>(); } }
/// <summary> /// 修改用户 /// </summary> /// <param name="userInfo">用户实体</param> public int UpdateUser(UsersInfo userInfo) { using (DataContextDB DB = new DataContextDB()) { try { DB.GetTable<UsersInfo>().Attach(userInfo, true); DB.SubmitChanges(); return 1; } catch (Exception e) { string error = e.Message; return -1; } } }