public ActionResult EventandTrainingTab(string id) { EandTModel eventsListData = new EandTModel(); eventsListData = GetDataHelper.GetEandT(); foreach (var item in eventsListData.EventsAndtraining) { if (item.ETID == id) { GetDataHelper.ETStatusUpdate(item.ETID); } } eventsListData = GetDataHelper.GetEandT(); EventsAndTraining[] EventGrid = new EventsAndTraining[eventsListData.EventsAndtraining.Length]; EventsAndTraining[] UpcomingEventGrid = new EventsAndTraining[eventsListData.EventsAndtraining.Length]; EventsAndTraining[] TrainingGrid = new EventsAndTraining[eventsListData.EventsAndtraining.Length]; EventsAndTraining[] UpcomingTrainingGrid = new EventsAndTraining[eventsListData.EventsAndtraining.Length]; TrainingGrid = eventsListData.EventsAndtraining.Where(i => i.UserAdded == true).ToArray(); UpcomingTrainingGrid = eventsListData.EventsAndtraining.Where(i => i.UserAdded == false).ToArray(); EventGrid = eventsListData.EventsAndtraining.Where(i => i.UserAdded == true).ToArray(); UpcomingEventGrid = eventsListData.EventsAndtraining.Where(i => i.UserAdded == false). Where(i => i.UserAdded == false).ToArray(); EventGrid = TrainingGrid; UpcomingEventGrid = UpcomingTrainingGrid; eventsListData.EventGrid = EventGrid; eventsListData.UpcomingEventGrid = UpcomingEventGrid; return(View(eventsListData)); }
public MainPage() { InitializeComponent(); _productViewModel = new ProductViewModel(); BindingContext = _productViewModel; _dataHelper = new GetDataHelper(); }
public ActionResult Preferences(string emailID) { //Preference pref = new Preference(); Preference userPref = GetDataHelper.UserPreference(emailID); Preference user = new Preference() { UserName = emailID }; if (userPref == null) { user = new Preference();// TODO: Add defaults } else { user = userPref; if (user == null) { user = new Preference() { UserName = emailID } } ; } return(View(user)); }
public ActionResult Release(int?id) { if (BLLSession.UserInfoSessioin == null) { Response.Redirect("/Account/Login?href=/ManageBlog/Release"); return(null); } Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("blogTag", GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.UserId).ToList()); dic.Add("blogType", DataCache.GetAllType().Where(t => t.UserId == BLLSession.UserInfoSessioin.UserId).ToList()); Blogs blog = null; if (null != id) { blog = new Blogs(); BlogsBLL blogbll = new BlogsBLL(); blog = blogbll.GetList(t => t.BlogId == id && (t.UserId == BLLSession.UserInfoSessioin.UserId || BLLSession.UserInfoSessioin.UserName == admin)).FirstOrDefault(); if (blog == null) { return(View("Error")); } } dic.Add("blog", blog); return(View(dic)); }
public ActionResult Edit(int?id) { var userinfo = BLLSession.UserInfoSessioin; Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("blogTag", GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.Id).ToList()); dic.Add("blogType", CacheData.GetAllType().Where(t => t.UsersId == BLLSession.UserInfoSessioin.Id).ToList()); List <BlogsDTO> blogs = new List <BlogsDTO>(); if (null != id) { int ttt; BLL.BlogsBLL blogbll = new BlogsBLL(); if (id == 0)//代表 未分类 { blogs = blogbll.GetList(1, 50, out ttt, t => t.BlogTypes.Count() == 0 && (t.UsersId == userinfo.Id), false, t => t.BlogCreateTime, false) .ToList().Select(t => new BlogsDTO() { Id = t.Id, BlogTitle = t.BlogTitle }).ToList(); } else { blogs = blogbll.GetList(1, 50, out ttt, t => t.BlogTypes.Where(v => v.Id == id).Count() > 0 && (t.UsersId == userinfo.Id), false, t => t.BlogCreateTime, false) .ToList().Select(t => new BlogsDTO() { Id = t.Id, BlogTitle = t.BlogTitle }).ToList(); } } dic.Add("blogs", blogs); return(View(dic)); }
public ActionResult PurchaseOrder(string poNumber, string vendorno) { // TempData["data"] = poNumber; // ViewBag.vendorNo = vendorno; SpfxPODetails poList = new SpfxPODetails(); poList = GetDataHelper.GetPODetails(); List <POValue> podetaillist = poList.value.Where(a => a.PONumber.Equals(poNumber)).ToList(); int poTotal = 0; for (int poCount = 0; poCount < podetaillist.Count; poCount++) { podetaillist[poCount].Total = (Convert.ToInt32(podetaillist[poCount].UnitPrice) * Convert.ToInt32(podetaillist[poCount].Quantity)); //poTotal += Convert.ToInt32(poList.value[poCount]); poTotal = poTotal + Convert.ToInt32(podetaillist[poCount].Total); } string TotalPOSum = poTotal.ToString(); // ViewData["Sum"] = TotalPOSum; var purchaseViewModel = new PurchaseViewModel() { PoNumber = poNumber, TotalSum = TotalPOSum, PoValues = podetaillist, VendorNumber = vendorno }; // ViewData["poDetails"] = podetaillist; return(View(purchaseViewModel)); }
/// <summary> /// (无效邮箱)重新绑定邮箱 邮箱发送成功 默认跳转到激活页面 /// </summary> /// <param name="id"></param> /// <returns></returns> public JSData EmailValidation(string UserMail) { JSData jsdata = new JSData(); jsdata.State = EnumState.失败; if (null == Session[tempUserinfo]) { jsdata.JSurl = "/UserManage/Login"; } else if (string.IsNullOrEmpty(UserMail) || string.IsNullOrEmpty(UserMail.Trim())) { jsdata.Messg = "邮箱不能为空~"; } else if (GetDataHelper.GetAllUser().Where(t => t.UserMail == UserMail.Trim()).Count() >= 1) { jsdata.Messg = "此邮箱已被占用~"; } else { var userobj = (BlogUser)Session[tempUserinfo]; userobj.UserMail = UserMail; GetActivate(ref jsdata); } return(jsdata); }
private void ButtonClicked_Valider(object sender, EventArgs e) { InsertProduct(); GetDataHelper helper = new GetDataHelper(); helper.InsertLog("Ajout nouveau produit"); ProductModel productAdded = ProductAddViewModelItems.ProductModelItems; }
/// <summary> /// 获取用户下的所有标签和文章分类 /// </summary> /// <returns></returns> public UserTagTypesOutput GetUserTagTypes() { UserTagTypesOutput userTagTypes = new UserTagTypesOutput(); userTagTypes.BlogTags = GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.Id).ToList(); userTagTypes.BlogTypeS = GetDataHelper.GetAllType(BLLSession.UserInfoSessioin.Id).ToList(); return(userTagTypes); }
public static SkillViewModel CreateSkill() { SkillViewModel skill = new SkillViewModel() { Name = GetDataHelper.GetNameFromUser(), }; return(skill); }
public static ComposeExtensionResponse HandleMessageExtensionQuery(ConnectorClient connector, Activity activity) { // GetDataHelper helper = new GetDataHelper(); var query = activity.GetComposeExtensionQueryData(); if (query == null) { // We only process the 'getRandomText' queries with this message extension return(null); } if (query.CommandId == "News") { NewsModel news = GetDataHelper.GetNews(); var title = ""; var titleParam = query.Parameters?.FirstOrDefault(p => p.Name == "newstitle"); var response = new ComposeExtensionResponse(new ComposeExtensionResult("list", "result")); ComposeExtensionAttachment[] attachments = null; if (titleParam != null) { title = titleParam.Value.ToString(); // List<string> searchtitle = news.Select(a => a.NewsTitle).Where(c => c.ToLower().Contains(title.ToLower())).Select(d => d).ToList(); // List<string> searchImages = news.Where(a => a.NewsTitle.ToLower().Contains(title.ToLower())).Select(c => c.NewsThumbnailUrl).ToList(); // List<string> searchDateTime = news.Where(a => a.NewsTitle.ToLower().Contains(title.ToLower())).Select(c => c.NewsDateTIme).ToList(); // List<string> searchviews = news.Where(a => a.NewsTitle.ToLower().Contains(title.ToLower())).Select(c => c.NoOfViews).ToList(); // List<string> searchby = news.Where(a => a.NewsTitle.ToLower().Contains(title.ToLower())).Select(c => c.NewsBy).ToList(); // int attacCount = searchtitle.Count(); // attachments = new ComposeExtensionAttachment[attacCount]; // for (int i = 0; i < attacCount; i++) // { // attachments[i] = GetAttachment(searchImages[i], searchtitle[i], searchDateTime[i], searchviews[i],searchby[i]); // } response.ComposeExtension.Attachments = attachments.ToList(); } else { // List<string> searchtitle = news.Select(c => c.NewsTitle).ToList(); // List<string> searchImages = news.Select(c => c.NewsThumbnailUrl).ToList(); // List<string> searchDateTime = news.Select(c => c.NewsDateTIme).ToList(); // List<string> searchviews = news.Select(c => c.NoOfViews).ToList(); // List<string> searchby=news.Select(c => c.NewsBy).ToList(); // attachments = new ComposeExtensionAttachment[searchtitle.Count()]; // for (int i = 0; i < searchtitle.Count(); i++) // { // attachments[i] = GetAttachment(searchImages[i], searchtitle[i], searchDateTime[i], searchviews[i],searchby[i]); // } response.ComposeExtension.Attachments = attachments.ToList(); } return(response); } else { return(null); } }
public static CourseViewModel CreateCourse() { CourseViewModel user = new CourseViewModel() { Name = GetDataHelper.GetNameFromUser(), Description = GetDataHelper.GetDescriptionForCourseFromUser(), }; return(user); }
/// <summary> /// 公共数据存储(从数据缓存中取 如何以后数据量大的话 再考虑是否实时查询) /// </summary> /// <param name="dic"></param> /// <param name="name"></param> private void SetDic(Dictionary <string, object> dic, string name) { var user = GetDataHelper.GetAllUser().FirstOrDefault(t => t.UserName == name); //dic.Add("blogName", name); dic.Add(Constant.blogUser, user); dic.Add(Constant.userBlogTag, GetDataHelper.GetAllTag(user.Id).ToList()); dic.Add(Constant.userBlogType, GetDataHelper.GetAllType().Where(t => t.BlogUser.Id == user.Id).ToList()); dic.Add(Constant.SessionUser, BLL.Common.BLLSession.UserInfoSessioin); }
public void PreferenceInDb(string[] newsPrefCat, string newsTime, bool newsNotificationFlag, string newsNotifyMe, string eandtTime, string eandtNotify, bool eandtflag, string taskNotifyMe, string taskTime, bool taskNotificationFlag, string UserName, bool isAdded) { //Preference pref = new Preference(); Preference userPref = GetDataHelper.UserPreference(UserName); Preference user = new Preference() { UserName = UserName }; if (userPref != null) { user = userPref; if (user == null) { user = new Preference() { UserName = UserName } } ; } user.News.NewsNotificationFlag = newsNotificationFlag; user.News.NewsNotificationTime = newsTime; var oldPrefList = user.News.SelectedCategories.ToList(); foreach (var cat in newsPrefCat) { if (isAdded && !oldPrefList.Contains(cat)) { oldPrefList.Add(cat); } else { oldPrefList.Remove(cat); } } user.News.SelectedCategories = oldPrefList.ToArray(); // user.News[0].SelectedCategories = newsPrefCat; user.News.NewsNotifyMe = newsNotifyMe; user.EandT.EandTNotificationFlag = eandtflag; user.EandT.EandTNotifyMe = eandtNotify; user.EandT.EandTNotificationTime = eandtTime; user.Task.TaskNotificationFlag = taskNotificationFlag; user.Task.TaskNotificationTime = taskTime; user.Task.TaskNotifyMe = taskNotifyMe; GetDataHelper.WritePreferences(user); }
public static ArticleViewModel CreateArticle() { ArticleViewModel article = new ArticleViewModel() { Name = GetDataHelper.GetNameFromUser(), PublicationDate = GetDataHelper.GetDateTimeFromUser(), Site = GetDataHelper.GetSiteAddressFromUser(), }; return(article); }
public async Task <ActionResult> ShowTask(string userName) { Preference uPref = GetDataHelper.UserPreference(userName); //Preference user = uPref.preferences.Where(c => c.UserName == userName).Select(d => d).FirstOrDefault(); UserInfo userInfo = uPref.UserInfo.FirstOrDefault(); var card = Helper.CardHelper.PendingTasks(); await NotificationHelper.SendNotification(userInfo.UniqueID, userInfo.ServiceURl, userInfo.TenantID, card); return(View()); }
public static BookViewModel CreateBook() { BookViewModel book = new BookViewModel() { Name = GetDataHelper.GetNameFromUser(), Author = GetDataHelper.GetAuthorNameFromUser(), CountOfPages = GetDataHelper.GetCountOfBookPages(), }; return(book); }
public static UserViewModel CreateUser() { UserViewModel user = new UserViewModel() { Name = GetDataHelper.GetNameFromUser(), Email = GetDataHelper.GetEmailFromUser(), Password = GetDataHelper.GetPasswordWithConfirmFromUser(), PhoneNumber = GetDataHelper.GetPhoneNumberFromUser(), }; return(user); }
public ActionResult News() { NewsModel news = new NewsModel(); int day = DateTime.Now.Day; if (day == 15 || day == 30) { MockDataHelper.UpdateNewsMockData(); } news = GetDataHelper.GetNews(); return(View(news)); }
public static VideoViewModel CreateVideo() { VideoViewModel video = new VideoViewModel() { Name = GetDataHelper.GetNameFromUser(), Link = GetDataHelper.GetSiteAddressFromUser(), Duration = GetDataHelper.GetVideoDuration(), Quality = GetDataHelper.GetVideoQuality(), }; return(video); }
public ActionResult HiBlogEdit(string url, string isshowhome, string isshowmyhome, string userName, string blogTag) { try { var userinfo = GetDataHelper.GetAllUser().Where(t => t.UserName == userName).FirstOrDefault(); PlugInUnitController.ForwardRealization(userinfo, blogTag, "", url, Request.Url.Host, isshowhome == "on", isshowmyhome == "on", true); } catch (Exception ex) { LogSave.ErrLogSave("", ex); } return(null); }
/// <summary> /// 根据token获取登录用户 /// 如果不存在 或过期 返回null /// [主要用在特性验证] /// </summary> /// <param name="key"></param> /// <returns></returns> public static BlogUser GetLoginUser(string key) { if (!ToKens.Keys.Contains(key)) { return(null); } if (ToKens[key].Time.AddHours(time) < DateTime.Now) { ToKens.Remove(key); return(null); } ToKens[key].Time = DateTime.Now; return(GetDataHelper.GetAllUser() .Where(t => t.UserName == ToKens[key].Name || t.UserMail == ToKens[key].Name).FirstOrDefault()); }
public async Task <string> Get(string str) { GetDataHelper sqlHelper = new GetDataHelper(); switch (str) { //AsyncHelper.RunSync( case "异步处理": // return(await sqlHelper.GetDataAsync()); case "同步处理": // return(sqlHelper.GetData()); } return("参数不正确"); }
/// <summary> /// Ajouter produit dans base de données local /// </summary> /// <param name="productCode"></param> private async void AddProductToLocalBase(string productCode) { var isProductExist = await ProductViewModel.Database.GetItemAsync(productCode); if (!string.IsNullOrEmpty(isProductExist.ProductCode)) { GetDataHelper helper = new GetDataHelper(); ProductModel product = await helper.GetProductInfoByCodeAsync(productCode); List <ProductModel> listProduct = new List <ProductModel>() { product }; await ProductViewModel.Database.SaveItemAsync(ProductMapping.MappingProductModelToProductEntityModel(listProduct).First(), false); } }
public ActionResult Index(int?id) { // int total; Response.Cache.SetOmitVaryStar(true); id = id ?? 1; int idex = int.Parse(id.ToString()); BLL.BaseBLL <BlogInfo> blog = new BLL.BaseBLL <BlogInfo>(); var bloglist = blog.GetList <DateTime?>(idex, sizePage, out total, t => t.IsShowHome == true, false, t => t.BlogCreateTime, false) .Select(t => new { Id = t.Id, BlogTitle = t.Title, BlogContent = t.Content, UserName = t.User.UserName, UserNickname = t.User.UserNickname, BlogCreateTime = t.BlogCreateTime, BlogReadNum = t.ReadNum, BlogCommentNum = t.CommentNum }) .ToList() .Select(t => new BlogInfo() { Id = t.Id, Title = t.BlogTitle, Content = MyHtmlHelper.GetHtmlText(t.BlogContent), BlogCreateTime = t.BlogCreateTime, User = new BlogUser() { UserName = t.UserName, UserNickname = t.UserNickname }, ReadNum = t.BlogReadNum, CommentNum = t.BlogCommentNum }).ToList(); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("blog", bloglist); dic.Add("users", GetDataHelper.GetAllUser().Where(t => t.IsLock == false).ToList()); dic.Add("SessionUser", BLL.Common.BLLSession.UserInfoSessioin); dic.Add("total", total); return(View(dic)); }
/// <summary> /// 登录 返回token /// </summary> /// <param name="userName">用户名</param> /// <param name="userPas">密码</param> /// <returns></returns> public object GetLoginToken(string userName, string userPas) { RemoveToKen(); userPas = userPas.MD5(); //if ( GetDataHelper.GetAllUser().Count() <= 0) // BLL.Common.CacheData.GetAllUserInfo(true); var userTemp = GetDataHelper.GetAllUser() .Where(t => (t.UserName == userName || t.UserMail == userName) && t.UserPass == userPas && t.IsLock == false).FirstOrDefault(); if (userTemp != null) { string toKenKey = Guid.NewGuid().ToString("N"); if (ToKens.Keys.Contains(toKenKey)) { ToKens[toKenKey].Time = DateTime.Now; } else { ToKens.Add(toKenKey, new ToKenModel() { Name = userName, Time = DateTime.Now }); } return(new { state = 1, msg = toKenKey, userInfo = new BlogUser() { Id = userTemp.Id, UserName = userTemp.UserName, UserMail = userTemp.UserMail, UserNickname = userTemp.UserNickname } }); } else { return new { state = 0, msg = "用户名或密码错误", userInfo = string.Empty } }; } #endregion }
public string SendRequestIndb(string hostName, string hostLocation, string org, string contact, string purpose, string date, string time) { JObject data = new JObject( new JProperty("hostName", hostName), new JProperty("hostLocation", hostLocation), new JProperty("contactNo", contact), new JProperty("org", org), new JProperty("purpose", purpose), new JProperty("Date", date), new JProperty("Time", time)); var objectData = data.ToString(); GetDataHelper.SaveVisitorInfo(data); JavaScriptSerializer js = new JavaScriptSerializer(); var parsedData = js.Serialize(objectData); return(parsedData); }
/// <summary> /// 加载 Lucene.net 的搜索结果 /// </summary> /// <returns></returns> public ActionResult ShowLuceneResult() { if (!Request.QueryString.AllKeys.Contains("key")) { return(null); } string key = Request.QueryString["key"]; var zhankey = key.Split(' ');//分割关键字 var blogName = string.Empty; if (zhankey.Length >= 2) { var str = zhankey[0].Trim(); if (str.Length > 6 && str.Substring(0, 5) == "blog:") { blogName = str.Substring(5);//取得用户名 } } string userid = Request.QueryString.AllKeys.Contains("userid") ? Request.QueryString["userid"] : ""; //这里判断是否 用户名不为空 然后取得用户对应的 用户ID (因为 我在做Lucene 是用用户id 来标记的) if (!string.IsNullOrEmpty(blogName)) { key = key.Substring(key.IndexOf(' ')); var userinfo = GetDataHelper.GetAllUser().Where(t => t.UserName == blogName).FirstOrDefault(); if (null != userinfo) { userid = userinfo.Id.ToString(); } } string pIndex = Request.QueryString.AllKeys.Contains("p") ? Request.QueryString["p"] : ""; int PageIndex = 1; int.TryParse(pIndex, out PageIndex); int PageSize = 10; var searchlist = PanGuLuceneHelper.instance.Search(userid, key, PageIndex, PageSize); return(PartialView(searchlist)); }
public JsonResult ResetPass(BlogUsersSet blog) { JsonResult jsonRe = new JsonResult(); var pass = blog.UserPass; var email = blog.UserMail; var objJson = new Common.CustomModel.JSData(); #region 1.数据验证 if (string.IsNullOrEmpty(pass.Trim())) { objJson.Messg = "新密码不能为空~"; } if (string.IsNullOrEmpty(email.Trim())) { objJson.Messg = "邮箱不能为空~"; } if (!string.IsNullOrEmpty(objJson.Messg)) { objJson.State = EnumState.失败; jsonRe.Data = objJson; return(jsonRe); } #endregion var obj = GetDataHelper.GetAllUser().Where(t => t.UserMail == email); if (null == obj || obj.Count() <= 0) { objJson.State = EnumState.失败; objJson.Messg = "您输入的邮箱不是注册时候的邮箱~"; jsonRe.Data = objJson; } else { Session[tempUserinfo] = obj.FirstOrDefault(); var userobj = (ModelDB.BlogUsersSet)Session[tempUserinfo]; userobj.UserPass = pass;//z GetActivate(out objJson); jsonRe.Data = objJson; } return(jsonRe); }
public void VerifyLoginAndPassword() { // get data from user string name = GetDataHelper.GetNameFromUser(); string password = GetDataHelper.GetPasswordFromUser(); // verify user bool validUser = this.userService.VerifyUser(name, password); if (validUser) { ProgramBranch.SelectFirstStepForAuthorizedUser(); } else { Console.WriteLine("User with such data does not exist"); Thread.Sleep(4000); ProgramBranch.StartApplication(); } }