public static DOCUMENT GetDocument(decimal doc_id) { DOCUMENT ret = null; try { using (PSsqmEntities entities = new PSsqmEntities()) { decimal company_id; if (SessionManager.EffLocation != null) { company_id = SessionManager.EffLocation.Company.COMPANY_ID; } else { company_id = SQMModelMgr.LookupPrimaryCompany(entities).COMPANY_ID; } ret = (from d in entities.DOCUMENT.Include("DOCUMENT_FILE") where ( (d.COMPANY_ID == company_id) //filter by company id as well, for security && (d.DOCUMENT_ID == doc_id) ) select d).Single(); } } catch (Exception e) { //SQMLogger.LogException(e); ret = null; } return(ret); }
public static DOCUMENT Add(String filename, String description, decimal?display_type, string docScope, decimal recordID, Stream file) { DOCUMENT ret = null; try { using (PSsqmEntities entities = new PSsqmEntities()) { DOCUMENT d = new DOCUMENT(); d.FILE_NAME = filename; d.FILE_DESC = description; //To-do: what do we do when company_id is not set, like when they choose this // from the Business Org master screen? d.COMPANY_ID = SessionManager.EffLocation.Company.COMPANY_ID; d.OWNER_ID = SessionManager.UserContext.Person.PERSON_ID; d.RECORD_ID = recordID; d.UPLOADED_BY = SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME; d.UPLOADED_DT = WebSiteCommon.CurrentUTCTime(); d.LANGUAGE_ID = (int)SessionManager.UserContext.Person.PREFERRED_LANG_ID; d.DOCUMENT_SCOPE = docScope; if (display_type.HasValue) { d.DISPLAY_TYPE = display_type.Value; } if (d.DOCUMENT_FILE == null) { d.DOCUMENT_FILE = new DOCUMENT_FILE(); } //read in the file contents file.Seek(0, SeekOrigin.Begin); byte[] bytearray = new byte[file.Length]; int count = 0; while (count < file.Length) { bytearray[count++] = Convert.ToByte(file.ReadByte()); } d.DOCUMENT_FILE.DOCUMENT_DATA = bytearray; d.FILE_SIZE = file.Length; // d.DISPLAY_TYPE = Path.GetExtension(filename); entities.AddToDOCUMENT(d); entities.SaveChanges(); ret = d; } } catch (Exception e) { //SQMLogger.LogException(e); ret = null; } return(ret); }
public static string GetImageSourceString(DOCUMENT doc) { string src = ""; if (doc != null) { src = "data:image/"; //jpg;base64,"; switch (Path.GetExtension(doc.FILE_NAME)) { case ".bmp": src += "bmp"; break; case ".jpg": src += "jpg"; break; case ".jpeg": src += "jpeg"; break; case ".gif": src += "gif"; break; default: src += "png"; break; } src += ";base64," + Convert.ToBase64String(doc.DOCUMENT_FILE.DOCUMENT_DATA); } return(src); }
public async Task <string> SendMessage(string content, string title, string note, int receiverid) { User currentuser = Session["UserLogin"] as User; DOCUMENT doc = new DOCUMENT { CONTENT = content, CREATORID = currentuser.WorkerID }; DOCUMENT newdoc = null; Task addnewdoc = Task.Run(() => { newdoc = db.DOCUMENTS.Add(doc); db.SaveChanges(); }); await addnewdoc; db.DOCMESSAGEs.Add(new DOCMESSAGE { SENDERID = currentuser.WorkerID, RECIVED = receiverid, TITLE = title, Note = note, DOCID = newdoc.OBJECTID, OPRTYPE = 3, CREATEDATE = DateTime.Now }); db.SaveChanges(); return("OK"); }
public async Task <ActionResult> UpdateDoc(HttpPostedFileBase file, string DocID) { DocumentDAO docDao = new DocumentDAO(); DOCUMENT doc = new DOCUMENT(); doc.TOPIC_ID = docDao.GetTopicIDByDoc(DocID); doc.ID = DocID; // docDao.DeleteDocument(DocID); string title = docDao.GetTitle(DocID); FileStream stream; if (file != null) { // string a = file.FileName; //string b = file.ContentType; string path = Path.Combine(Server.MapPath("~/Content/tempFile"), file.FileName); file.SaveAs(path); stream = new FileStream(Path.Combine(path), FileMode.Open); await Task.Run(() => Delete(title)); await Task.Run(() => Upload(stream, file.FileName, path)); doc.TITLE = file.FileName; doc.LINK = CommonConstants.linkFile; if (docDao.UpdateDocument(doc)) { return(Json(new { status = true, file = new { filename = file.FileName, link = CommonConstants.linkFile } })); } } return(Json(new { status = false })); }
public static string DocumentPath(DOCUMENT type, DateTime? time) { var directory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); directory = Path.Combine(directory, "log"); directory = Path.Combine(directory, Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().ManifestModule.Name)); switch (type) { case DOCUMENT.JSON: directory = Path.Combine(directory, "JSON"); break; case DOCUMENT.XML: directory = Path.Combine(directory, "XML"); break; case DOCUMENT.REQUEST: directory = Path.Combine(directory, "REQUEST"); break; } if (time != null) { directory = Path.Combine(directory, "HISTORY"); directory = Path.Combine(directory, DateTime.Now.ToString("yyyy-MM")); directory = Path.Combine(directory, DateTime.Now.ToString("yyyy-MM-dd")); } else { directory = Path.Combine(directory, "TRANSACTION"); } if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } return directory; }
protected void lbUpload_Click(object sender, EventArgs e) { string name = ""; if (flFileUpload.HasFile) { name = flFileUpload.FileName; decimal?display_type = null; if (SessionManager.DocumentContext.Scope == "USR") { display_type = 15; } else { display_type = Convert.ToDecimal(ddlDisplayType.SelectedValue); } Stream stream = flFileUpload.FileContent; DOCUMENT d = SQMDocumentMgr.Add(flFileUpload.FileName, tbFileDescription.Text, display_type, SessionManager.DocumentContext.Scope, SessionManager.DocumentContext.RecordID, stream); if (d != null) { Bind_gvUploadedFiles(); // mt - put the new document and upload status in session so that we can retrieve it (if necessary) from the calling page SessionManager.ReturnObject = d; SessionManager.ReturnStatus = true; } else { SessionManager.ClearReturns(); } } }
public IHttpActionResult PostDOCUMENT(DOCUMENT dOCUMENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DOCUMENTs.Add(dOCUMENT); try { db.SaveChanges(); } catch (DbUpdateException) { if (DOCUMENTExists(dOCUMENT.STU_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = dOCUMENT.STU_ID }, dOCUMENT)); }
public void InsertFile(int thesisId, int typeId, int ownerId, string fileExtension, byte[] file, string description, byte isPublic, int size) { var doc = new DOCUMENT { THESIS_ID = thesisId, TYPE_ID = typeId, FILE_EXTENSION = fileExtension, BINCONTENT = file, SIZE = size, PUBLIC_ACCESS = isPublic }; if (ownerId != 0) { doc.AUTHOR_ID = ownerId; } if (!String.IsNullOrEmpty(description)) { doc.DESCRIPTION = description; } db.DOCUMENTS.Add(doc); db.SaveChanges(); }
public IHttpActionResult PutDOCUMENT(string id, DOCUMENT dOCUMENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dOCUMENT.STU_ID) { return(BadRequest()); } db.Entry(dOCUMENT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DOCUMENTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult getContentDocumant(int DocumentCode) { using (iysContext db = new iysContext()) { string user = User.Identity.Name; int DocumentCodeBefore = DocumentCode - 1; USER_QUIZ_STATUS quiz = db.USER_QUIZ_STATUSS.Where(x => x.USER_CODE == user).Where(x => x.DOCUMENT_CODE == DocumentCodeBefore).FirstOrDefault(); docDetail d = new docDetail(); if (quiz != null || DocumentCode == 1 || User.IsInRole("Admin")) { DOCUMENT doc = db.DOCUMENTS.Find(DocumentCode); d.sure = Convert.ToInt32(doc.DURATION.Substring(0, 2)) * 60 + Convert.ToInt32(doc.DURATION.Substring(3, 2)); if (doc.DOCUMENT_TYPE == 5)//video { d.path = doc.PATH; } else if (doc.DOCUMENT_TYPE == 6) { d.path = String.Format("<embed src=\"../dersler/{0}\" width=\"600\" height=\"480\">", doc.PATH); } d.hata = 0; } else { d.path = "Bu Dersi Almaya hakkınız yok!.."; d.sure = 0; d.hata = 1; } return(Json(d, JsonRequestBehavior.AllowGet)); } // return "<embed src=\"/Content/pdfd.pdf\" width=\"500\" height=\"375\">"; }
public override int GetHashCode() { unchecked { int hashCode = (ASSOCIATED != null ? ASSOCIATED.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CAR_PLATE != null ? CAR_PLATE.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CONTINENT != null ? CONTINENT.GetHashCode() : 0); hashCode = (hashCode * 397) ^ DATE_OF_FORMATION.GetHashCode(); hashCode = (hashCode * 397) ^ DATE_OF_RESOLUTION.GetHashCode(); hashCode = (hashCode * 397) ^ (DOCUMENT != null ? DOCUMENT.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (EU_MEMBER != null ? EU_MEMBER.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (EXIST_ADD != null ? EXIST_ADD.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ISO_2 != null ? ISO_2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ISO_3 != null ? ISO_3.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ISO_NUM; hashCode = (hashCode * 397) ^ (NAME_ENG != null ? NAME_ENG.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NAME_ENG_OFF != null ? NAME_ENG_OFF.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NAME_GER != null ? NAME_GER.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (NAME_GER_OFF != null ? NAME_GER_OFF.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PART_OF_EU.GetHashCode(); hashCode = (hashCode * 397) ^ (PREFIX != null ? PREFIX.GetHashCode() : 0); hashCode = (hashCode * 397) ^ STATUS; hashCode = (hashCode * 397) ^ (TLD != null ? TLD.GetHashCode() : 0); return(hashCode); } }
public static DOCUMENT FindCurrentDocument(string docScope, int displayType) { DOCUMENT ret = null; try { using (PSsqmEntities entities = new PSsqmEntities()) { decimal company_id; if (SessionManager.EffLocation != null) { company_id = SessionManager.EffLocation.Company.COMPANY_ID; } else { company_id = SQMModelMgr.LookupPrimaryCompany(entities).COMPANY_ID; } ret = (from d in entities.DOCUMENT.Include("DOCUMENT_FILE") select d).OrderByDescending(d => d.UPLOADED_DT).Where(l => l.COMPANY_ID == company_id && l.DISPLAY_TYPE == displayType).First(); } } catch (Exception e) { //SQMLogger.LogException(e); ret = null; } return(ret); }
public static void Delete(decimal Document_ID) { try { using (PSsqmEntities entities = new PSsqmEntities()) { DOCUMENT_FILE this_docfile = (from d in entities.DOCUMENT_FILE where (d.DOCUMENT_ID == Document_ID) select d).Single(); if (this_docfile != null) { entities.DeleteObject(this_docfile); entities.SaveChanges(); } DOCUMENT this_doc = (from d in entities.DOCUMENT where (d.DOCUMENT_ID == Document_ID) select d).Single(); if (this_doc != null) { entities.DeleteObject(this_doc); entities.SaveChanges(); } } } catch (Exception e) { //SQMLogger.LogException(e); } return; }
public ActionResult FileUploadBlacklist(HttpPostedFileBase file) { var firstName = Convert.ToString(Request["FIRST_NAME_GUEST"]); var lastName = Convert.ToString(Request["LAST_NAME_GUEST"]); var doc = new DOCUMENT(); if (file != null && file.ContentLength > 0) { string pic = System.IO.Path.GetFileName(file.FileName); byte[] uploadedFile = new byte[file.InputStream.Length]; file.InputStream.Read(uploadedFile, 0, uploadedFile.Length); doc.DT_INSERT = DateTime.UtcNow; doc.FILE_CONTENT = uploadedFile; doc.FILE_NAME = lastName; doc.FILE_TYPE = file.FileName.Split('.')[1]; var msgDoc = Fachada.Negocio.ManterDOCUMENT.Save(doc); if (msgDoc.Result != Message.ResultType.Success) { return(Content(msgDoc.Description)); } } var msgL = new LIST(); if (!string.IsNullOrEmpty(Request["CHECK_IN"])) { msgL.CHECK_IN = Convert.ToDateTime(Request["CHECK_IN"]); } if (!string.IsNullOrEmpty(Request["CHECK_OUT"])) { msgL.CHECK_OUT = Convert.ToDateTime(Request["CHECK_OUT"]); } if (!string.IsNullOrEmpty(Request["NOTES"])) { msgL.NOTES = Convert.ToString(Request["NOTES"]); } msgL.ID_LIST_TYPE = (int)TabList_Type.BLACKLIST; msgL.FIRST_NAME_GUEST = firstName; msgL.LAST_NAME_GUEST = lastName; msgL.LOGLOGIN = User.Identity.Name; if (doc.ID > 0) { msgL.ID_DOCUMENT = doc.ID; } var msgSaveList = Fachada.Negocio.ManterLIST.Save(msgL); if (msgSaveList.Result != Message.ResultType.Success) { return(Content(msgSaveList.Description)); } return(RedirectToAction("IndexBlacklist")); }
public void ProcessRequest(HttpContext context) { try { context.Response.Clear(); if (!String.IsNullOrEmpty(context.Request.QueryString["DOC_ID"])) { String document_id = context.Request.QueryString["DOC_ID"]; Decimal doc_id = decimal.Parse(document_id); string fileType = ""; String mime_type = ""; if (!string.IsNullOrEmpty(context.Request.QueryString["DOC"])) { switch (context.Request.QueryString["DOC"]) { case "a": // attachment ATTACHMENT a = SQMDocumentMgr.GetAttachment(doc_id); fileType = Path.GetExtension(a.FILE_NAME); // set this to whatever your format is of the image context.Response.ContentType = fileType; mime_type = SQM.Website.Classes.FileExtensionConverter.ToMIMEType(fileType); context.Response.ContentType = mime_type; //context.Response.AddHeader("content-length", d.DOCUMENT_DATA.Length.ToString()); //context.Response.OutputStream.Write(d.DOCUMENT_DATA, 0, d.DOCUMENT_DATA.Length); context.Response.AddHeader("content-length", a.ATTACHMENT_FILE.ATTACHMENT_DATA.Length.ToString()); context.Response.OutputStream.Write(a.ATTACHMENT_FILE.ATTACHMENT_DATA, 0, a.ATTACHMENT_FILE.ATTACHMENT_DATA.Length); context.Response.Flush(); break; default: // document DOCUMENT d = SQMDocumentMgr.GetDocument(doc_id); fileType = Path.GetExtension(d.FILE_NAME); // set this to whatever your format is of the image context.Response.ContentType = fileType; mime_type = SQM.Website.Classes.FileExtensionConverter.ToMIMEType(fileType); context.Response.ContentType = mime_type; //context.Response.AddHeader("content-length", d.DOCUMENT_DATA.Length.ToString()); //context.Response.OutputStream.Write(d.DOCUMENT_DATA, 0, d.DOCUMENT_DATA.Length); context.Response.AddHeader("content-length", d.DOCUMENT_FILE.DOCUMENT_DATA.Length.ToString()); context.Response.OutputStream.Write(d.DOCUMENT_FILE.DOCUMENT_DATA, 0, d.DOCUMENT_FILE.DOCUMENT_DATA.Length); context.Response.Flush(); break; } } } else { context.Response.ContentType = "text/html"; context.Response.Write("<p>Document not found</p>"); } } catch (Exception e) { //SQMLogger.LogException(e); } }
public IHttpActionResult GetDOCUMENT(string id) { DOCUMENT dOCUMENT = db.DOCUMENTs.Find(id); if (dOCUMENT == null) { return(NotFound()); } return(Ok(dOCUMENT)); }
public static string GetImageSourceString(decimal docID) { DOCUMENT doc = GetDocument(docID); if (doc != null && doc.DOCUMENT_FILE != null) { return(GetImageSourceString(doc)); } else { return(""); } }
public static void SetMsiVersion() { string aipPath = GetAdvancedInstallerProjectFilePath(); DOCUMENT aip = aipPath.FromXmlFile <DOCUMENT>(); List <DOCUMENTCOMPONENTROW> rows = new List <DOCUMENTCOMPONENTROW>(aip.COMPONENT[0].ROW); int versionRow = rows.FindIndex(r => r.Property.Equals("ProductVersion")); DOCUMENTCOMPONENTROW row = rows[versionRow]; row.Value = GetVersion(); rows[versionRow] = row; aip.COMPONENT[0].ROW = rows.ToArray(); aip.XmlSerialize(aipPath); }
public bool InsertDocument(DOCUMENT doc) { try { db.DOCUMENTs.Add(doc); db.SaveChanges(); return(true); } catch { return(false); } }
public RespuestaAccion INGRESO_LOTE(string descripcion, DateTime fecha_compra, string cod_proveedor, string documento, decimal total_compra, int vida_util, bool derecho_credito, DateTime fecha_contab, int origen_id, GENERIC_VALUE CtiPo) { var respuesta = new RespuestaAccion(); try { //check document var find_doc = documentos.ByNumProv(documento, cod_proveedor); var lote_rel_doc = new DOCS_BATCH(); if (find_doc == null) { //no existe documento asociado, lo creamos var nuevo_documento = new DOCUMENT(); nuevo_documento.docnumber = documento; nuevo_documento.comment = string.Empty; nuevo_documento.proveedor_id = cod_proveedor; nuevo_documento.proveedor_name = Proveedor.getNameByCode(cod_proveedor); lote_rel_doc.DOCUMENT = nuevo_documento; } else { //ya existe, asi que usamos ese mismo lote_rel_doc.document_id = find_doc.id; } BATCH_ARTICLE nuevo_lote = new BATCH_ARTICLE(); nuevo_lote.aproval_state_id = EstadoAprobacion.OPEN.id; nuevo_lote.descrip = descripcion; nuevo_lote.purchase_date = fecha_compra; nuevo_lote.initial_price = total_compra; nuevo_lote.initial_life_time = vida_util; nuevo_lote.account_date = fecha_contab; nuevo_lote.origin_id = origen_id; nuevo_lote.type_asset_id = CtiPo.id; lote_rel_doc.BATCHS_ARTICLES = nuevo_lote; _context.DOCS_BATCH.AddObject(lote_rel_doc); _context.BATCHS_ARTICLES.AddObject(nuevo_lote); _context.SaveChanges(); respuesta.set_ok(); respuesta.result_objs.Add((SV_BATCH_ARTICLE)nuevo_lote); } catch (Exception e) { respuesta.set(-1, e.StackTrace); } return(respuesta); }
public IHttpActionResult DeleteDOCUMENT(string id) { DOCUMENT dOCUMENT = db.DOCUMENTs.Find(id); if (dOCUMENT == null) { return(NotFound()); } db.DOCUMENTs.Remove(dOCUMENT); db.SaveChanges(); return(Ok(dOCUMENT)); }
public bool DeleteDocument(string id) { try { DOCUMENT doc = db.DOCUMENTs.First(x => x.ID == id); db.DOCUMENTs.Remove(doc); db.SaveChanges(); return(true); } catch { return(false); } }
public bool UpdateDocument(DOCUMENT doc) { try { db.DOCUMENTs.AddOrUpdate(doc); db.SaveChanges(); return(true); } catch (Exception ex) { throw (ex); //return false; } }
private DOCUMENT DOCUMENT_NEW_PREV(AFN_LOTE_ARTICULOS lote_old) { var new_doc = new DOCUMENT(); new_doc.docnumber = lote_old.num_doc; new_doc.comment = string.Empty; new_doc.proveedor_id = lote_old.proveedor; new_doc.proveedor_name = proveedor_master .Where(pm => pm.COD == lote_old.proveedor) .Select(pm => pm.VENDNAME) .DefaultIfEmpty(string.Empty) .First(); return(new_doc); }
public IActionResult GetDocuments([FromBody] REQ_DOCUMENT request) { RES_DOCUMENT oResult = new RES_DOCUMENT(); List <DOCUMENT> oDocuments = new List <DOCUMENT>(); List <MESSAGER> oMessages = new List <MESSAGER>(); try { int ilength = new Random().Next(10, 100); for (int i = 0; i < ilength; i++) { if (request.FILTER.REQUEST_TYPES.Length > 0) { for (int ii = 0; ii < request.FILTER.REQUEST_TYPES.Length; ii++) { DOCUMENT oItem = request.ToDocumentMockup($"{i}", DOCUMENT_TYPE.REQUEST, request.FILTER.REQUEST_TYPES[ii]); oDocuments.Add(oItem); } } if (request.FILTER.CLAIM_TYPES.Length > 0) { for (int ii = 0; ii < request.FILTER.CLAIM_TYPES.Length; ii++) { DOCUMENT oItem = request.ToDocumentMockup($"{i}", DOCUMENT_TYPE.CLAIM, request.FILTER.CLAIM_TYPES[ii]); oDocuments.Add(oItem); } } } oMessages.Add(new MESSAGER() { CODE = MESSAGE_TYPE.SUCCESS }); } catch (Exception ex) { oMessages.Add(new MESSAGER() { CODE = MESSAGE_TYPE.ERROR, MESSAGE = ex.Message }); } finally { oResult.DOCUMENTS = oDocuments; oResult.MESSAGES = oMessages; } return(Ok(oResult)); }
public IHttpActionResult AddFile() { string result = ""; try { INF370Entities objEntity = new INF370Entities(); DOCUMENT objFile = new DOCUMENT(); string fileName = null; var httpRequest = HttpContext.Current.Request; var postedFile = httpRequest.Files["FileUpload"]; if (postedFile != null) { fileName = new String(Path.GetFileNameWithoutExtension(postedFile.FileName).Take(10).ToArray()).Replace(" ", "-"); fileName = fileName + DateTime.Now.ToString("yymmssfff") + Path.GetExtension(postedFile.FileName); var filePath = HttpContext.Current.Server.MapPath("~/Files/" + fileName); postedFile.SaveAs(filePath); } //objFile.DOCUMENTTYPEID = 1; objFile.RENTALAPPLICATIONID = 9; objFile.IDENTITYDOCUMENT = fileName; objEntity.DOCUMENTs.Add(objFile); int i = objEntity.SaveChanges(); if (i > 0) { result = "File uploaded sucessfully"; } else { result = "File uploaded failed"; } } catch (Exception) { dynamic User = new ExpandoObject(); User.Message = "Something went wrong !"; return(User); } return(Ok(result)); }
//Upload image public ActionResult FileUpload(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { string pic = System.IO.Path.GetFileName(file.FileName); byte[] uploadedFile = new byte[file.InputStream.Length]; file.InputStream.Read(uploadedFile, 0, uploadedFile.Length); int id = Convert.ToInt32(Request["ID"]); var list = db.LISTs.Where(w => w.ID == id).FirstOrDefault(); var msgL = new LIST(); var doc = new DOCUMENT(); doc.DT_INSERT = DateTime.UtcNow; doc.FILE_CONTENT = uploadedFile; doc.FILE_NAME = list.LAST_NAME_GUEST; doc.FILE_TYPE = file.FileName.Split('.')[1]; var msgDoc = Fachada.Negocio.ManterDOCUMENT.Save(doc); if (msgDoc.Result != Message.ResultType.Success) { return(Content(msgDoc.Description)); } msgL.ID = list.ID; msgL.ID_LIST_TYPE = list.ID_LIST_TYPE; msgL.DT_START_BLOCK = list.DT_START_BLOCK; msgL.DT_START_BOOK = list.DT_START_BOOK; msgL.FIRST_NAME_GUEST = list.FIRST_NAME_GUEST; msgL.LAST_NAME_GUEST = list.LAST_NAME_GUEST; msgL.LOGLOGIN = list.LOGLOGIN; msgL.NOTES = Convert.ToString(Request["txtNotes"]); msgL.ID_DOCUMENT = doc.ID; var msgSaveList = Fachada.Negocio.ManterLIST.Save(msgL); if (msgSaveList.Result != Message.ResultType.Success) { return(Content(msgSaveList.Description)); } return(RedirectToAction("IndexVerifyBooking")); } return(RedirectToAction("EditVerifyBooking", "LISTS", new { id = Convert.ToInt32(Request["ID"]), uploadImage = true })); }
public ActionResult addQuestion(QUESTION Item2) { DOCUMENT doc = db.DOCUMENTS.Find(Item2.DOCUMENT_CODE); if (Item2.QUESTION_CODE == -1) { QUESTION question = new QUESTION(); if (doc != null) { question.COURSE_CODE = doc.COURSE_CODE; question.CHAPTER_CODE = doc.CHAPTER_CODE; question.LESSON_CODE = doc.LESSON_CODE; question.DOCUMENT_CODE = doc.DOCUMENT_CODE; question.questionText = Item2.questionText; question.rightChoose = Item2.rightChoose.ToString(); question.chooseAText = Item2.chooseAText; question.chooseBText = Item2.chooseBText; question.chooseCText = Item2.chooseCText; question.chooseDText = Item2.chooseDText; // question.chooseEText = Item2.chooseEText; db.QUESTIONS.Add(question); db.SaveChanges(); return(Content("Eklendi")); } else { return(Content("Döküman Bulunamadı")); } } else { QUESTION original = db.QUESTIONS.Find(Item2.QUESTION_CODE); if (original != null) { db.Entry(original).CurrentValues.SetValues(Item2); db.SaveChanges(); } return(Content("Soru Güncellendi")); } }
public void rptDocList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { try { DOCUMENT doc = (DOCUMENT)e.Item.DataItem; Label lbl = (Label)e.Item.FindControl("lblPosted"); lbl.Text = doc.UPLOADED_BY; lbl.Text = lbl.Text + " " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID), "d", true); //WebSiteCommon.LocalTime((DateTime)doc.UPLOADED_DT, SessionManager.UserContext.TimeZoneID).ToShortDateString(); lbl = (Label)e.Item.FindControl("lblDisplayArea"); lbl.Text = WebSiteCommon.GetXlatValue("docDisplayType", doc.DISPLAY_TYPE.ToString()); if (doc.RECORD_ID > 0) { lbl = (Label)e.Item.FindControl("lblDocReference"); if (doc.DOCUMENT_SCOPE == "BLI") { PLANT plant = SQMModelMgr.LookupPlant((decimal)doc.RECORD_ID); if (plant != null) { lbl.Text = plant.PLANT_NAME; } } } string ext = doc.FILE_NAME.Substring(doc.FILE_NAME.LastIndexOf('.') + 1).ToLower(); if (!string.IsNullOrEmpty(ext)) { Image img = (Image)e.Item.FindControl("imgFileType"); img.ImageUrl = "~/images/filetype/icon_" + ext + ".gif"; } } catch { } } }
private int populateDb() { Log.UCTechReception.Debug("populateDb()"); int idLoan = 0; // creating a loan associated with product, accessories, doc try { // using elementAt(0) because the list is empty after creating another one VisualisationPret loan = detail.ElementAt(0); LOAN newLoan = new LOAN { LOA_USER_ID_FK = UserManager.currentUser.Id, LOA_PROVIDER = radDropDownListProvider.Text, LOA_COMM_G = tBoxObservation.Text, LOA_DATE = dateTimePicker1.Value, LOA_STATE = 0 }; VpretContext.Instance.vPretContext.LOAN.InsertOnSubmit(newLoan); VpretContext.Instance.vPretContext.SubmitChanges(); idLoan = newLoan.LOA_ID; foreach (string item in loan.l_Photo) { DOCUMENT photo = new DOCUMENT { DOC_LOA_ID_FK = idLoan, DOC_NAME = item.ToString(), }; VpretContext.Instance.vPretContext.DOCUMENT.InsertOnSubmit(photo); VpretContext.Instance.vPretContext.SubmitChanges(); } foreach (VisualisationProduct product in loan.listProducts) { PRODUCT newProduct = new PRODUCT { PRO_LOA_ID_FK = idLoan, PRO_SN = product.Sn, PRO_NAME = product.Name, PRO_COM = product.Com, PRO_STATE = 0 }; VpretContext.Instance.vPretContext.PRODUCT.InsertOnSubmit(newProduct); VpretContext.Instance.vPretContext.SubmitChanges(); foreach (VisualitationAccesories accessorie in product.listAccessories) { ACCESSORIES naccessorie = new ACCESSORIES { ACC_LOA_ID_FK = idLoan, ACC_PRO_ID_FK = newProduct.PRO_ID, ACC_NAME = accessorie.Name, ACC_PN = accessorie.Pn, ACC_COM = accessorie.Com, ACC_STATE = 0 }; VpretContext.Instance.vPretContext.ACCESSORIES.InsertOnSubmit(naccessorie); VpretContext.Instance.vPretContext.SubmitChanges(); } } } catch (Exception e) { Log.UCTechReception.Error("Population failed with exception: " + e.ToString()); } finally { Log.UCTechReception.Debug("Population completed."); } return(idLoan); }
public void AddToDOCUMENT(DOCUMENT dOCUMENT) { base.AddObject("DOCUMENT", dOCUMENT); }
public static DOCUMENT CreateDOCUMENT(int ID, int lESSON_ID, string tITLE) { DOCUMENT dOCUMENT = new DOCUMENT(); dOCUMENT.ID = ID; dOCUMENT.LESSON_ID = lESSON_ID; dOCUMENT.TITLE = tITLE; return dOCUMENT; }