Beispiel #1
0
        public void InsertDetail()
        {
            FileStream fs = File.OpenRead(@"C:\Users\Jacobeo\Pictures\amarillo.png");
            Byte[] bytes = null;

            BinaryReader br = new BinaryReader(fs);
            bytes = br.ReadBytes((Int32)fs.Length);

            IssueDetailRepository issueDetailRepository = new IssueDetailRepository();
            IssueDetail issueDetail = new IssueDetail()
                                          {
                                              ContentType = "myContent",
                                              Data = bytes,
                                              Date = DateTime.Now,
                                              Description = "Description",
                                              FileName = "fileName",
                                              InternalId = "InternalId"
                                          };

            issueDetail = issueDetailRepository.SaveEntity(issueDetail);

            Int16 a = 11;
        }
        protected void AddItem(object sender, EventArgs e)
        {
            string pattern = @"dd/MM/yyyy H:m";
            IssueDetail twitterIssueDetail = new IssueDetail();

            twitterIssueDetail.Date =System.DateTime.ParseExact(DateTime.Text,pattern,null);;
            twitterIssueDetail.Description =this.Description.Text;
            twitterIssueDetail.InternalId = HistoryTwitterIssues[0].IntenalId;

            if (FileUpload.HasFile)
            {
                twitterIssueDetail.FileName = FileUpload.PostedFile.FileName;
                twitterIssueDetail.ContentType = FileUpload.PostedFile.ContentType;

                Stream fs = FileUpload.PostedFile.InputStream;
                BinaryReader br = new BinaryReader(fs);
                twitterIssueDetail.Data = br.ReadBytes((Int32)fs.Length);
            }

            IssueDetailRepository.SaveEntity(twitterIssueDetail);
            _issueDetails = null;
            IssuesDetailsRepeater.DataSource = IssueDetails;
            IssuesDetailsRepeater.DataBind();
        }