public static long PostTransaction(string catalog, long transactionMasterId, DateTime valueDate, int officeId, int userId, long loginId, int storeId, string partyCode, int priceTypeId, string referenceNumber, string statementReference, Collection <StockDetail> details, Collection <Attachment> attachments) { string detail = StockMasterDetailHelper.CreateStockMasterDetailParameter(details); string attachment = AttachmentHelper.CreateAttachmentModelParameter(attachments); string sql = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM transactions.post_sales_return(@TransactionMasterId::bigint, @OfficeId::integer, @UserId::integer, @LoginId::bigint, @ValueDate::date, @StoreId::integer, @PartyCode::national character varying(12), @PriceTypeId::integer, @ReferenceNumber::national character varying(24), @StatementReference::text, ARRAY[{0}], ARRAY[{1}]);", detail, attachment); using (NpgsqlCommand command = new NpgsqlCommand(sql)) { command.Parameters.AddWithValue("@TransactionMasterId", transactionMasterId); command.Parameters.AddWithValue("@OfficeId", officeId); command.Parameters.AddWithValue("@UserId", userId); command.Parameters.AddWithValue("@LoginId", loginId); command.Parameters.AddWithValue("@ValueDate", valueDate); command.Parameters.AddWithValue("@StoreId", storeId); command.Parameters.AddWithValue("@PartyCode", partyCode); command.Parameters.AddWithValue("@PriceTypeId", priceTypeId); command.Parameters.AddWithValue("@ReferenceNumber", referenceNumber); command.Parameters.AddWithValue("@StatementReference", statementReference); command.Parameters.AddRange(StockMasterDetailHelper.AddStockMasterDetailParameter(details).ToArray()); command.Parameters.AddRange(AttachmentHelper.AddAttachmentParameter(attachments).ToArray()); long tranId = Conversion.TryCastLong(DbOperation.GetScalarValue(catalog, command)); return(tranId); } }
public override void Run(RunCustomActionParams args) { try { var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log); if (att == null) { throw new Exception("No attachment to signature"); } var signUrl = CallAdobeApi(att, args.Context.CurrentDocument); _log.AppendLine($"Document URL: {signUrl}"); args.TransitionInfo.RedirectUrl(signUrl); } catch (Exception e) { _log.AppendLine(e.ToString()); args.HasErrors = true; args.Message = e.Message; } finally { args.LogMessage = _log.ToString(); args.Context.PluginLogger.AppendInfo(_log.ToString()); } }
private async Task <List <Media> > GetMediaFromAttachments(IReadOnlyCollection <IAttachment> attachments) { if (attachments == null || attachments.Count == 0) { return(null); } List <Media> mediaContent = new List <Media>(); var attachmentFiles = AttachmentHelper.DownloadAttachments(attachments); try { foreach (var file in attachmentFiles) { string mediaType = $"image/{Path.GetExtension(file).Replace(".", string.Empty)}"; byte[] fileData = File.ReadAllBytes(file); var media = await _twitterContext.UploadMediaAsync(fileData, mediaType, "tweet_image"); mediaContent.Add(media); File.Delete(file); } return(mediaContent); } finally { AttachmentHelper.DeleteFiles(attachmentFiles); } }
protected void DeleteAttachmentButton_Click(object sender, EventArgs e) { string aid = AttachmentIDTextBox.Text; AttachmentHelper.DeleteAttachment(aid); BindAttachmentList(); }
public static IEnumerable <AttachmentModel> FilterAttachments( IEnumerable <AttachmentModel> attachments, AgentJobProcessorState <ExchangeSharedMailboxCrawlJobData> state) { var skippedFirstContactPhoto = false; foreach (var model in attachments) { var attachment = model.Attachment; if (attachment is FileAttachment fileAttachment && fileAttachment.IsContactPhoto && !skippedFirstContactPhoto) { skippedFirstContactPhoto = true; continue; } if (AttachmentHelper.IsFiltered(state, attachment)) { continue; } if (!(attachment is FileAttachment)) { continue; } yield return(model); } }
public async Task HankImagesAsync([Remainder][Summary("Text to project onto the canvas. If a number is supplied, number of times to repeat the projection instead.")] string text = null) { IReadOnlyCollection <Attachment> attachments = await AttachmentHelper.GetMostRecentAttachmentsAsync(Context, AttachmentFilter.Images); if (attachments == null && text == null) { await ServiceReplyAsync(NO_ATTACHMENTS_FOUND_MESSAGE); return; } ParamType paramType = ParseParamType(text); List <string> images = new List <string>(); switch (paramType) { case ParamType.Numeric: images = _imageService.HankImages(attachments, uint.Parse(text)); await SendImages(images); break; case ParamType.Text: string textImg = _imageService.HankText(text); await SendImage(textImg); break; case ParamType.None: images = _imageService.HankImages(attachments); await SendImages(images); break; } }
public ContentBytesForm(byte[] byteArray) { InitializeComponent(); Cursor = Cursors.WaitCursor; tbContent.Text = AttachmentHelper.GetHexStringFromByteArray(byteArray); Cursor = Cursors.Default; }
public ActionResult EditProfile(UserProfileViewModel model, HttpPostedFileBase image) { var userId = User.Identity.GetUserId(); var user = db.Users.Find(userId); if (model.FirstName != null) { user.FirstName = model.FirstName; } if (model.LastName != null) { user.LastName = model.LastName; } if (model.DisplayName != null) { user.DisplayName = model.DisplayName; } if (AttachmentHelper.IsWebFriendlyAttachment(image)) { var fileName = Path.GetFileName(image.FileName); image.SaveAs(Path.Combine(Server.MapPath("~/Uploads/"), fileName)); user.Avatar = "/Uploads/" + fileName; } db.SaveChanges(); return(RedirectToAction("EditProfile")); }
public List <string> MirrorImages(IReadOnlyCollection <Attachment> attachments, string flipModeStr) { var returnImgs = new List <string>(); var imagesFirstHalf = AttachmentHelper.DownloadAttachments(attachments); returnImgs.AddRange(imagesFirstHalf); FlipMode flipMode = FlipMode.Horizontal; if (flipModeStr == "vertical" || flipModeStr == "vert") { flipMode = FlipMode.Vertical; } //mirror the images one way foreach (var image in imagesFirstHalf) { MirrorImage(image, flipMode); } var imagesSecondHalf = AttachmentHelper.DownloadAttachments(attachments); returnImgs.AddRange(imagesSecondHalf); //and mirror the images the other way foreach (var image in imagesSecondHalf) { MirrorImage(image, flipMode, false); } return(returnImgs); }
public ActionResult Create([Bind(Include = "Id,UserId,TicketID,FilePath,AttachmentDescription")] TicketAttachment ticketAttachment, HttpPostedFileBase attachment) { if (ModelState.IsValid) { if (attachment != null) { //start processing my image if (AttachmentHelper.IsWebFriendlyAttachment(attachment)) { var fileName = Path.GetFileName(attachment.FileName).Replace(' ', '_'); attachment.SaveAs(Path.Combine(Server.MapPath("~/Attachments/"), fileName)); ticketAttachment.FilePath = "/Attachments/" + fileName; } } ticketAttachment.Created = DateTimeOffset.UtcNow.ToLocalTime(); ticketAttachment.UserId = User.Identity.GetUserId(); db.TicketAttachments.Add(ticketAttachment); db.SaveChanges(); return(RedirectToAction("Details", "Tickets", new { id = ticketAttachment.TicketID })); } ViewBag.TicketID = new SelectList(db.Tickets, "Id", "OwnerUserId", ticketAttachment.TicketID); ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", ticketAttachment.UserId); return(View(ticketAttachment)); }
public async Task CleanTempDir([Summary("The type of temp files to delete. Possible values: `images, media, text, all (default value)`")] string filter = "all") { AttachmentFilter filterType; switch (filter) { case "all": default: filterType = AttachmentFilter.All; break; case "images": filterType = AttachmentFilter.Images; break; case "media": filterType = AttachmentFilter.Media; break; case "text": filterType = AttachmentFilter.Plaintext; break; } List <string> files = AttachmentHelper.GetTempAssets(filterType); if (files.Count == 0) { await ReplyAsync("No temp files to delete."); } else { AttachmentHelper.DeleteFiles(files); await ReplyAsync($"Deleted {files.Count} temp files."); } }
public ActionResult Create([Bind(Include = "Id,TicketId,FilePath,AttachmentDescription,UserId")] TicketAttachment ticketAttachment, HttpPostedFileBase attachment) { if (ModelState.IsValid) { //need to add in image upload code like profile pic here if (attachment != null) { if (AttachmentHelper.IsWebFriendlyAttachment(attachment)) { var fileName = Path.GetFileName(attachment.FileName).Replace(' ', '_'); attachment.SaveAs(Path.Combine(Server.MapPath("~/Attachments/"), fileName)); ticketAttachment.FilePath = "/Attachments/" + fileName; } } ticketAttachment.Created = DateTimeOffset.UtcNow.ToOffset(new TimeSpan(-4, 0, 0)); ticketAttachment.UserId = User.Identity.GetUserId(); db.TicketAttachments.Add(ticketAttachment); db.SaveChanges(); return(RedirectToAction("Details", "Tickets", new { id = ticketAttachment.TicketId })); } //ViewBag.TicketId = new SelectList(db.Tickets, "Id", "OwnerUserId", ticketAttachment.TicketId); //ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", ticketAttachment.UserId); return(View(ticketAttachment)); }
void BindAttachmentList() { List <Attachment> atms = AttachmentHelper.GetAttachments(ArticleID); DataGridView.DataSource = atms; DataGridView.DataBind(); }
public override void Run(RunCustomActionParams args) { try { var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log); var attContent = Convert.ToBase64String(att.Content); var response = new SkribbleHelper(_log, Configuration.ApiConfig).SendEnvelope(attContent, GenerateRequestModel(), PrepareUser()); args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id); args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id); args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID); args.TransitionInfo.RedirectUrl($"{response.signing_url}?exitURL={Configuration.RedirectUrl}"); } catch (Exception e) { _log.AppendLine(e.ToString()); args.HasErrors = true; args.Message = e.Message; } finally { args.LogMessage = _log.ToString(); args.Context.PluginLogger.AppendInfo(_log.ToString()); } }
/// <summary> /// Create Attachment data object using the give parameters. /// </summary> /// <param name="name">Attachment name.</param> /// <param name="content">Attachment content url.</param> /// <param name="contentType">Attachment content type.</param> /// <returns>A valid AttachmentData instance.</returns> private async Task <AttachmentData> CreateAttachmentDataAsync(string name, string content, string contentType) { if (string.IsNullOrEmpty(contentType)) { throw new ArgumentNullException(nameof(contentType), "Content type can not be null."); } if (string.IsNullOrEmpty(content)) { throw new ArgumentNullException(nameof(content), "Content url can not be null."); } // ContentUrl can contain a url or dataUrl of the form "data:image/jpeg;base64,XXXXXXXXX..." byte[] bytesData; if (AttachmentHelper.IsUrl(content)) { bytesData = await _wechatClient.SendHttpRequestAsync(HttpMethod.Get, content, timeout : 60000).ConfigureAwait(false); } else { bytesData = AttachmentHelper.DecodeBase64String(content, out contentType); } name = name ?? Guid.NewGuid().ToString(); // should be lower by WeChat. #pragma warning disable CA1308 contentType = contentType.ToLowerInvariant(); #pragma warning restore CA1308 return(new AttachmentData(contentType, name, bytesData, bytesData)); }
public override void Run(RunCustomActionParams args) { var log = new StringBuilder(); try { var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, log); if (att == null) { throw new Exception("No attachment to signature"); } var api = new AdobeSignHelper(log); var docId = api.SendDocument(att.Content, Configuration.ApiConfig.TokenValue, $"{att.FileName}.{att.FileExtension}"); var operationId = api.SendToSig(docId, Configuration.ApiConfig.TokenValue, Configuration.MessageContent.MailSubject, Configuration.MessageContent.MailBody, GetMembersInfo(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId))); args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AgreementsIdFild, operationId); args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID); } catch (Exception e) { log.AppendLine(e.ToString()); args.HasErrors = true; args.Message = e.Message; } finally { args.LogMessage = log.ToString(); args.Context.PluginLogger.AppendInfo(log.ToString()); } }
/// <summary> /// Process all types of general attachment. /// </summary> /// <param name="activity">The message activity.</param> /// <param name="attachment">The attachment object need to be processed.</param> /// <returns>List of WeChat response message.</returns> private async Task <IList <IResponseMessageBase> > ProcessAttachmentAsync(IMessageActivity activity, Attachment attachment) { var responseList = new List <IResponseMessageBase>(); // Create media response directly if mediaId provide by user. attachment.Properties.TryGetValue("MediaId", StringComparison.InvariantCultureIgnoreCase, out var mediaId); if (mediaId != null) { responseList.Add(CreateMediaResponse(activity, mediaId.ToString(), attachment.ContentType)); return(responseList); } if (!string.IsNullOrEmpty(attachment.ThumbnailUrl)) { responseList.Add(await MediaContentToWeChatResponse(activity, attachment.Name, attachment.ThumbnailUrl, attachment.ContentType).ConfigureAwait(false)); } if (!string.IsNullOrEmpty(attachment.ContentUrl)) { responseList.Add(await MediaContentToWeChatResponse(activity, attachment.Name, attachment.ContentUrl, attachment.ContentType).ConfigureAwait(false)); } if (AttachmentHelper.IsUrl(attachment.Content)) { responseList.Add(await MediaContentToWeChatResponse(activity, attachment.Name, attachment.Content.ToString(), attachment.ContentType).ConfigureAwait(false)); } else if (attachment.Content != null) { responseList.AddRange(GetFixedMessages(activity, attachment.Content.ToString())); } return(responseList); }
public async Task ExecutePythonString([Remainder] string pythonStr = null) { List <string> pythonOut = new List <string>(); //check for python files in the current message if (pythonStr == null && Context.Message.Attachments != null && Context.Message.Attachments.Count > 0 && AttachmentHelper.AttachmentsAreValid(Context.Message.Attachments, AttachmentFilter.Plaintext)) { pythonOut = _pythonService.ExecutePythonFiles(Context.Message.Attachments); } //otherwise, use the given text else { pythonOut = _pythonService.ExecutePythonString(pythonStr); } //sent output as monospaced text foreach (string outPage in pythonOut) { await ReplyAsync($"```\n{outPage}\n```"); } }
public ActionResult Details(QuestionViewModel questionView, IEnumerable <HttpPostedFileBase> files) { if (ModelState.IsValid) { var answer = new Answer() { QuestionId = questionView.Id, Text = questionView.NewAnswerText, Author = User.Identity.Name, CreationDate = DateTime.Now }; answer = db.Answers.Add(answer); var attachments = AttachmentHelper.TransformToAnswerAttachment(answer.Id, files); db.AnswerAttachments.AddRange(attachments); db.SaveChanges(); var emailManager = new EmailManager(Request.Url.GetLeftPart(UriPartial.Authority)); emailManager.NewAnswerCreated(questionView.Id, questionView.Title, questionView.Author); return(RedirectToAction("Details", "Questions", new { id = questionView.Id })); } return(View(questionView)); }
public override void Run(RunCustomActionParams args) { try { var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log); var attContent = Convert.ToBase64String(att.Content); var userList = args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId); var skribble = new SkribbleHelper(_log, Configuration.ApiConfig); var response = skribble.SendEnvelope(attContent, GenerateRequestModel(), PrepareUsers(userList)); args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id); args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id); args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID); SaveUrlForUsers(userList, response); } catch (Exception e) { _log.AppendLine(e.ToString()); args.HasErrors = true; args.Message = e.Message; } finally { args.LogMessage = _log.ToString(); args.Context.PluginLogger.AppendInfo(_log.ToString()); } }
/// <summary> /// 取得当前的文章 /// </summary> /// <returns>文章实体</returns> protected virtual Article GetThisArticle() { Article article = null; Attachments = new List <Attachment>(); if (DesignHelper.IsDesigning) { DesignHelper.FillItems <Article>(out article, PageSize); Attachments.Add(new Attachment() { ArticleID = article.ID, FilePath = DesignHelper.GetAttachment() }); Attachments.Add(new Attachment() { ArticleID = article.ID, FilePath = DesignHelper.GetAttachment() }); Attachments.Add(new Attachment() { ArticleID = article.ID, FilePath = DesignHelper.GetAttachment() }); Attachments.Add(new Attachment() { ArticleID = article.ID, FilePath = DesignHelper.GetAttachment() }); } else { if (We7Helper.IsEmptyID(BindColumnID) && !We7Helper.IsEmptyID(ArticleID)) { article = ArticleHelper.GetArticle(ArticleID, null); } else { List <Article> articles = GetArticleListFromDB(); if (articles.Count > 0) { article = articles[0]; } } } if (article != null) { List <Article> list = new List <Article>(); list.Add(article); FormatArticlesData(list); article = list[0]; if (AttachmentNum > 0) { Attachments = AttachmentHelper.GetAttachments(article.ID); } } else { article = new Article(); } return(article); }
public static long Add(string bookName, DateTime valueDate, int officeId, int userId, long loginId, int costCenterId, string referenceNumber, string statementReference, StockMaster stockMaster, Collection <StockDetail> details, Collection <Attachment> attachments, bool nonTaxable) { if (stockMaster == null) { return(0); } if (details == null) { return(0); } if (details.Count.Equals(0)) { return(0); } string detail = StockMasterDetailHelper.CreateStockMasterDetailParameter(details); string attachment = AttachmentHelper.CreateAttachmentModelParameter(attachments); string sql = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM transactions.post_sales(@BookName, @OfficeId, @UserId, @LoginId, @ValueDate, @CostCenterId, @ReferenceNumber, @StatementReference, @IsCredit, @PaymentTermId, @PartyCode, @PriceTypeId, @SalespersonId, @ShipperId, @ShippingAddressCode, @StoreId, @NonTaxable, ARRAY[{0}], ARRAY[{1}])", detail, attachment); using (NpgsqlCommand command = new NpgsqlCommand(sql)) { command.Parameters.AddWithValue("@BookName", bookName); command.Parameters.AddWithValue("@OfficeId", officeId); command.Parameters.AddWithValue("@UserId", userId); command.Parameters.AddWithValue("@LoginId", loginId); command.Parameters.AddWithValue("@ValueDate", valueDate); command.Parameters.AddWithValue("@CostCenterId", costCenterId); command.Parameters.AddWithValue("@ReferenceNumber", referenceNumber); command.Parameters.AddWithValue("@StatementReference", statementReference); command.Parameters.AddWithValue("@IsCredit", stockMaster.IsCredit); if (stockMaster.PaymentTermId.Equals(0)) { command.Parameters.AddWithValue("@PaymentTermId", DBNull.Value); } else { command.Parameters.AddWithValue("@PaymentTermId", stockMaster.PaymentTermId); } command.Parameters.AddWithValue("@PartyCode", stockMaster.PartyCode); command.Parameters.AddWithValue("@PriceTypeId", stockMaster.PriceTypeId); command.Parameters.AddWithValue("@SalespersonId", stockMaster.SalespersonId); command.Parameters.AddWithValue("@ShipperId", stockMaster.ShipperId); command.Parameters.AddWithValue("@ShippingAddressCode", stockMaster.ShippingAddressCode); command.Parameters.AddWithValue("@StoreId", stockMaster.StoreId); command.Parameters.AddWithValue("@NonTaxable", nonTaxable); command.Parameters.AddRange(StockMasterDetailHelper.AddStockMasterDetailParameter(details).ToArray()); command.Parameters.AddRange(AttachmentHelper.AddAttachmentParameter(attachments).ToArray()); long tranId = Conversion.TryCastLong(DbOperation.GetScalarValue(command)); return(tranId); } }
public void SetAttachmentResult() { AttachmentHelper.SetAttachmentResult(flag, byteArray); Assert.IsTrue(AttachmentHelper.AttachmentResults.Count > 0); AttachmentHelper.SetAttachmentResult(flag, null); Assert.IsTrue(AttachmentHelper.AttachmentResults.Count == 0); }
public virtual int ClearUserTemp(AttachmentInputDto attachmentDto) { var fileDirectory = Path.Combine(_hostingEnvironment.ContentRootPath, @"FileRoot\Attach\UserTemp\", attachmentDto.BussinessTypeElementCode, _currentUser.LoginName); AttachmentHelper.ClearUserTemp(fileDirectory); return(1); }
public JsonResult GetAttachDepto(String tagClabe) { AttachmentHelper at = new AttachmentHelper(); var serializer = new JavaScriptSerializer(); var serializedResult = serializer.Serialize(at.GetAttachDepto(tagClabe)); return(Json(serializedResult, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAttachArea(int idParent) { AttachmentHelper at = new AttachmentHelper(); var serializer = new JavaScriptSerializer(); var serializedResult = serializer.Serialize(at.GetAttachArea(idParent)); return(Json(serializedResult, JsonRequestBehavior.AllowGet)); }
private void Activating(IActivatingEventArgs <object> e) { var matchingAttachments = conventionManager.FindMatchingAttachments(e.Instance).Select(e.Context.Resolve); foreach (var attachment in matchingAttachments) { AttachmentHelper.Attach(attachment, e.Instance); } }
/// <summary> /// Create an attachment from drive path. /// <para> /// For more information look at https://msdn.microsoft.com/en-us/library/gg328344(v=crm.7).aspx /// </para> /// </summary> /// <param name="emailId"><c>Email Activity</c> Id</param> /// <param name="path">File path</param> /// <returns> /// Created record Id (<see cref="System.Guid"/>) /// </returns> public Guid Attach(Guid emailId, string path) { ExceptionThrow.IfGuidEmpty(emailId, "emailId"); ExceptionThrow.IfNullOrEmpty(path, "path"); var attachment = AttachmentHelper.CreateFromPath(path, string.Empty); return(Attach(emailId, attachment.Data.ByteArray, attachment.Meta.Name)); }
internal static long Add(string catalog, string book, DateTime valueDate, int officeId, int userId, long loginId, string referenceNumber, string statementReference, StockMaster stockMaster, Collection <StockDetail> details, Collection <long> transactionIdCollection, Collection <Attachment> attachments, bool nonTaxable) { if (stockMaster == null) { return(0); } if (details == null) { return(0); } if (details.Count.Equals(0)) { return(0); } string tranIds = ParameterHelper.CreateBigintArrayParameter(transactionIdCollection, "bigint", "@TranId"); string detail = StockMasterDetailHelper.CreateStockMasterDetailParameter(details); string attachment = AttachmentHelper.CreateAttachmentModelParameter(attachments); string sql = string.Format(CultureInfo.InvariantCulture, "SELECT * FROM transactions.post_non_gl_transaction(@Book::national character varying(48), @OfficeId::integer, @UserId::integer, @LoginId::bigint, @ValueDate::date, @ReferenceNumber::national character varying(24), @StatementReference::text, @PartyCode::national character varying(12), @PriceTypeId::integer, @NonTaxable::boolean,@SalesPersonId::integer, @ShipperId::integer, @ShippingAddressCode::national character varying(12), @StoreId::integer, ARRAY[{0}]::bigint[], ARRAY[{1}], ARRAY[{2}]);", tranIds, detail, attachment); using (NpgsqlCommand command = new NpgsqlCommand(sql)) { command.Parameters.AddWithValue("@Book", book); command.Parameters.AddWithValue("@OfficeId", officeId); command.Parameters.AddWithValue("@UserId", userId); command.Parameters.AddWithValue("@LoginId", loginId); command.Parameters.AddWithValue("@ValueDate", valueDate); command.Parameters.AddWithValue("@ReferenceNumber", referenceNumber); command.Parameters.AddWithValue("@StatementReference", statementReference); command.Parameters.AddWithValue("@PartyCode", stockMaster.PartyCode); if (stockMaster.PriceTypeId.Equals(0)) { command.Parameters.AddWithValue("@PriceTypeId", DBNull.Value); } else { command.Parameters.AddWithValue("@PriceTypeId", stockMaster.PriceTypeId); } command.Parameters.AddWithValue("@NonTaxable", nonTaxable); command.Parameters.AddWithValue("@SalesPersonId", stockMaster.SalespersonId); command.Parameters.AddWithValue("@ShipperId", stockMaster.ShipperId); command.Parameters.AddWithValue("@ShippingAddressCode", stockMaster.ShippingAddressCode); command.Parameters.AddWithValue("@StoreId", stockMaster.StoreId); command.Parameters.AddRange(ParameterHelper.AddBigintArrayParameter(transactionIdCollection, "@TranId").ToArray()); command.Parameters.AddRange(StockMasterDetailHelper.AddStockMasterDetailParameter(details).ToArray()); command.Parameters.AddRange(AttachmentHelper.AddAttachmentParameter(attachments).ToArray()); long tranId = Conversion.TryCastLong(DbOperation.GetScalarValue(catalog, command)); return(tranId); } }
public async Task AddSong([Summary("alias to use when playing this song in the future")] string alias) { IReadOnlyCollection <Attachment> atts = await AttachmentHelper.GetMostRecentAttachmentsAsync(Context, AttachmentFilter.Media); if (atts == null) { throw new NullReferenceException("No media attachments were found in the current or previous 20 messages."); } _service.SaveSong(alias, atts); }