public ActionResult DeleteConfirmed(int id) { AttachmentDetail attachmentDetail = db.AttachmentDetails.Find(id); db.AttachmentDetails.Remove(attachmentDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,OrderID,FileName,File")] AttachmentDetail attachmentDetail) { if (ModelState.IsValid) { db.Entry(attachmentDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID = new SelectList(db.Orders, "ID", "File", attachmentDetail.ID); return(View(attachmentDetail)); }
// GET: AttachmentDetails/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AttachmentDetail attachmentDetail = db.AttachmentDetails.Find(id); if (attachmentDetail == null) { return(HttpNotFound()); } return(View(attachmentDetail)); }
// GET: AttachmentDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AttachmentDetail attachmentDetail = db.AttachmentDetails.Find(id); if (attachmentDetail == null) { return(HttpNotFound()); } ViewBag.ID = new SelectList(db.Orders, "ID", "File", attachmentDetail.ID); return(View(attachmentDetail)); }
// save the attachment details to the db public void saveWitAttachment(AttachmentDetail witsAttachment) { try { var witAttachmentsQuery = Resource.ResourceManager.GetString("wit_attachments_insert"); sql_con = new SQLiteConnection(Common.localDatabasePath, true); sql_cmd = new SQLiteCommand(witAttachmentsQuery, sql_con); sql_cmd.Parameters.Add("@id", DbType.String); sql_cmd.Parameters["@id"].Value = Utilities.GUIDGenerator.getGUID(); sql_cmd.Parameters.Add("@file_id", DbType.String); sql_cmd.Parameters["@file_id"].Value = witsAttachment.fileId; sql_cmd.Parameters.Add("@wit_id", DbType.String); sql_cmd.Parameters["@wit_id"].Value = witsAttachment.witId; sql_cmd.Parameters.Add("@file_name", DbType.String); sql_cmd.Parameters["@file_name"].Value = witsAttachment.fileName; sql_cmd.Parameters.Add("@file_mime_type", DbType.String); sql_cmd.Parameters["@file_mime_type"].Value = witsAttachment.fileMimeType; sql_cmd.Parameters.Add("@file_association_id", DbType.String); sql_cmd.Parameters["@file_association_id"].Value = witsAttachment.fileAssociationId; sql_cmd.Parameters.Add("@seq_number", DbType.String); sql_cmd.Parameters["@seq_number"].Value = witsAttachment.seqNumber; sql_cmd.Parameters.Add("@is_inline", DbType.String); sql_cmd.Parameters["@is_inline"].Value = witsAttachment.inline; sql_cmd.Parameters.Add("@source", DbType.String); sql_cmd.Parameters["@source"].Value = witsAttachment.source; sql_cmd.Parameters.Add("@extention", DbType.String); sql_cmd.Parameters["@extention"].Value = witsAttachment.extention; sql_cmd.Parameters.Add("@fileSize", DbType.String); sql_cmd.Parameters["@fileSize"].Value = witsAttachment.fileSize; sql_cmd.Parameters.Add("@attachment_type", DbType.String); sql_cmd.Parameters["@attachment_type"].Value = witsAttachment.attachmentType; sql_con.Open(); sql_cmd.ExecuteNonQuery(); } catch (SQLiteException e) { throw e; } finally { sql_con.Close(); } }
protected override async void OnAppearing() { Url = "http://192.168.1.111:8081/etm_log/api/project/log/" + posts.LogId + "/remark"; String content = await _client.GetStringAsync(Url); //Sends a GET request to the specified Uri and returns the response body as a string in an asynchronous operation CommentPost commentPosts = JsonConvert.DeserializeObject <CommentPost>(content); //Deserializes or converts JSON String into a collection of Post Comment.Clear(); Attachment.Clear(); CommentDetail.Clear(); AttachmentDetail.Clear(); for (int i = 0; i < commentPosts.returnValue.Count; i++) { Comment.Add(new TextCell { Text = commentPosts.returnValue[i].title, Detail = commentPosts.returnValue[i].remark }); CommentDetail.Add(new TextCell { Text = commentPosts.returnValue[i].title, Detail = commentPosts.returnValue[i].remark }); } ; CommentSwitch = new SwitchCell(); CommentSwitch.OnChanged += addComment_Clicked; CommentSwitch.Text = "Add Comment"; Comment.Add(CommentSwitch); CommentSwitchDetail = new SwitchCell(); CommentSwitchDetail.OnChanged += addComment_Clicked; CommentSwitchDetail.Text = "Add Comment"; CommentDetail.Add(CommentSwitchDetail); AttachmentSwitch = new SwitchCell(); AttachmentSwitch.OnChanged += attachmentManagement_Clicked; AttachmentSwitch.Text = "Attachment Download"; Attachment.Add(AttachmentSwitch); AttachmentSwitchDetail = new SwitchCell(); AttachmentSwitchDetail.OnChanged += attachmentManagement_Clicked; AttachmentSwitchDetail.Text = "Attachment Download"; AttachmentDetail.Add(AttachmentSwitchDetail); _LogNo.Text = posts.LogId; LogNo.Text = posts.LogId; _LogTitle.Text = posts.Title; LogTitle.Text = posts.Title; _Priority.Text = posts.codePriority; Priority.Text = posts.codePriority; _AssignTo.Text = posts.codeUserAction; AssignTo.Text = posts.codeUserAction; _Status.Text = posts.Status; Status.Text = posts.Status; ParentLog.Text = posts.parentIdLog; Organization.Text = posts.codeOrg; Project.Text = posts.codeProject; Ver.Text = posts.versionNo; FunctionCode.Text = posts.codeFunc; IssuedBy.Text = posts.codeUserIssued; IssuedDate.Text = posts.issueDate; LogType.Text = posts.codeLogType; LogEnvironment.Text = posts.codeEnvironment; IncidentType.Text = posts.codeIncidentType; UserRef.Text = posts.userLogRef; base.OnAppearing(); }