/// <summary> /// Сохранить данные постинга. /// </summary> /// <param name="data">Данные.</param> /// <returns>Таск.</returns> public async Task SavePostData(PostingData data) { var fileName = string.Format("{0}.cache", Services.GetServiceOrThrow<ILinkHashService>().GetLinkHash(data.Link)); var file = await GetCacheFile(fileName); var folder = await GetCacheFolder(); await WriteCacheXmlObject(file, folder, data, true); }
/// <summary> /// Lists the post types. /// </summary> /// <returns>the posting data</returns> public static PostingData ListPostTypes() { PostingData postingData = new PostingData(); Hashtable ht = new Hashtable(); Utility.LoadDataSet(postingData.ListPostTypes, "f1200_pclst_PostingQueue", ht); return(postingData); }
/// <summary> /// Lists the preview posting. /// </summary> /// <param name="postDate">The post date.</param> /// <returns>the posting data</returns> public static PostingData ListPreviewPosting(DateTime postDate) { PostingData postingData = new PostingData(); Hashtable ht = new Hashtable(); ht.Add("@PostDate", postDate); Utility.LoadDataSet(postingData.ListPostingPreview, "f1200_pclst_PostingPreview", ht); return(postingData); }
/// <summary> /// Performs the posting. /// </summary> /// <param name="postDate">The post date.</param> /// <param name="selectedPostTypes">The selected post types.</param> /// <param name="userId">The user id.</param> /// <returns>the posting data</returns> public static PostingData PerformPosting(DateTime postDate, string selectedPostTypes, int userId) { PostingData postingData = new PostingData(); Hashtable ht = new Hashtable(); ht.Add("@PostTypes", selectedPostTypes); ht.Add("@PostDate", postDate); ht.Add("@UserID", userId); Utility.LoadDataSet(postingData.PostLockCount, "f1200_pcexe_PerformPost", ht); return(postingData); }
/// <summary> /// Compiles the posting record set. /// </summary> /// <param name="postDate">The post date.</param> /// <param name="selectedPostTypes">The selected post types.</param> /// <param name="userId">The user id.</param> /// <returns>the posting data</returns> public static PostingData CompilePostingRecordSet(DateTime postDate, string selectedPostTypes, int userId) { PostingData postingData = new PostingData(); Hashtable ht = new Hashtable(); ht.Add("@PostDate", postDate); ht.Add("@PostTypes", selectedPostTypes); ht.Add("@UserID", userId); ////Utility.FillDataSet(postingData.PostingErrorCount, "f1200_pcins_CompileRecordset_WA", ht); Utility.LoadDataSet(postingData.PostingErrorCount, "f1200_pcins_CompileRecordset", ht); return(postingData); }
// GET: posting/Edit/5 public ActionResult Edit(int id) { TempDataFilling(); var message = string.Empty; PostingRepository repository = new PostingRepository(this.UserId); PostingProfile postProfile; //Perform the conversion and fetch the destination view model var profileDetails = repository.GetPostingDetailByPostId(id, out postProfile, out message); PostingData data = new PostingData() { profile = postProfile, details = profileDetails.Response }; return(View(data)); }
public ActionResult Create(PostingData data) { try { if (ModelState.IsValid) { var message = string.Empty; data.profile.userid = this.UserId; PostingRepository repository = new PostingRepository(this.UserId); //Perform the conversion and fetch the destination view model var profileresult = repository.PostingPorfileCreation(data.profile, out message); if (profileresult.Response != null) { data.details.postingid = profileresult.Response.postingid; var details = repository.PostingDetailCreation(data.details, out message); if (details.Response != null) { ViewBag.Message = string.IsNullOrEmpty(message) ? "Post saved successfully" : message;; return(RedirectToAction("Details/" + profileresult.Response.postingid)); } else { ViewBag.Message = string.IsNullOrEmpty(message) ? "Operation fail due to some reason." : message; } } else { ViewBag.Message = string.IsNullOrEmpty(message) ? "Operation fail due to some reason." : message; } } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); ViewBag.Message = errors; } } catch (Exception exp) { ////TODO: log the error ViewBag.Message = "Unexpected error occured"; } TempDataFilling(); return(View(data)); }
/// <summary> /// Отправить пост. /// </summary> /// <param name="data">Данные поста.</param> /// <param name="captcha">Данные капчи.</param> /// <param name="mode">Режим постинга.</param> /// <returns>Ссылка-результат (null, если нет такой ссылки).</returns> public IEngineOperationsWithProgress<BoardLinkBase, EngineProgress> Post(PostingData data, CaptchaPostingData captcha, PostingMode mode = PostingMode.Default) { if ((data.Link.LinkKind & BoardLinkKind.Thread) == 0 && (data.Link.LinkKind & BoardLinkKind.BoardPage) == 0) { throw new ArgumentException("Неправильный тип ссылки"); } return new PostOperation(Services, new PostOperationParameter() {Captcha = captcha, Data = data, Mode = mode}); }
/// <summary> /// Запуск. /// </summary> /// <returns>Задача.</returns> public async Task Start() { try { var storage = ServiceLocator.Current.GetServiceOrThrow<IStorageService>(); data = await storage.PostData.LoadPostData(PostingLink); dataGot = true; if (data == null) { SaveTime = ""; } else { SaveTime = data.SaveTime.ToString("g"); } UpdateData(); } catch (Exception ex) { await AppHelpers.ShowError(ex); } }
private IEngineOperationsWithProgress<Logic.IPostingResult, EngineProgress> OperationFactory(object o) { var data = new PostingData() { FieldData = new Dictionary<PostingFieldSemanticRole, object>(), Link = PostingLink, SaveTime = DateTime.Now }; Fields.Save(data.FieldData); return new PostingOperation(ServiceLocator.Current, new PostingArgument() { Captcha = captcha, Data = data }); }
/// <summary> /// 清空PostingData, ResponseHeaders, 并把Verb设置为Get. /// 在发出一个包含上述信息的请求后,必须调用此方法或手工设置相应属性以使下一次请求不会受到影响. /// </summary> public void Reset() { Verb = HttpVerb.GET; PostingData.Clear(); m_ResponseHeaders = null; }