public ActionResult <DocumentId> UploadDocument(DocumentUpload documentUpload) { int length = 0; if (String.IsNullOrEmpty(documentUpload.Text)) { documentUpload.Text = PDFService.GetTextFromPDFBytes(documentUpload.Contents); length = documentUpload.Contents.Length; } else { length = documentUpload.Text.Length; } string id = DocumentService.SaveDocumentDataFromText(documentUpload.Email, length, documentUpload.Text); if (string.IsNullOrWhiteSpace(id)) { return(NotFound()); } else { return(Ok(new DocumentId { Id = id })); } }
public ActionResult DeleteConfirmed(int id) { DocumentUpload documentUpload = db.DocumentUploads.Find(id); db.DocumentUploads.Remove(documentUpload); db.SaveChanges(); return(RedirectToAction("Index")); }
public DocumentUpload createSampleDocumentUpload() { FileStream file = new FileStream(BT_LOGO_PATH, FileMode.Open, FileAccess.Read); DocumentUploadRequest request = new DocumentUploadRequest(); request.File = file; request.DocumentKind = DocumentUploadKind.EVIDENCE_DOCUMENT; DocumentUpload documentUpload = gateway.DocumentUpload.Create(request).Target; return documentUpload; }
public void PostDocumentsTest() { // TODO: add unit test for the method 'PostDocuments' DocumentUpload body = null; // TODO: replace null with proper value string copySource = null; // TODO: replace null with proper value string moveSource = null; // TODO: replace null with proper value bool? _override = null; // TODO: replace null with proper value var response = instance.PostDocuments(body, copySource, moveSource, _override); Assert.IsInstanceOf <Document> (response, "response is Document"); }
public async Task Create(DocumentUpload documentUpload) { var file = documentUpload.GetByteArrayData(); var document = new Document(documentUpload); //_fileCache.TryAdd(document); WriteFile(document.Location, file); _context.Documents.Add(document); await Save(); }
public ActionResult Edit([Bind(Include = "DocumentUploadId,VendorId,Document,Creator,CreatedDate")] DocumentUpload documentUpload) { if (ModelState.IsValid) { db.Entry(documentUpload).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.VendorId = new SelectList(db.Vendors, "VendorId", "VendorName", documentUpload.VendorId); return(View(documentUpload)); }
public void AddFileEvidence_addsEvidence() { DocumentUpload document = createSampleDocumentUpload(); Dispute dispute = createSampleDispute(); DisputeEvidence evidence = gateway.Dispute.AddFileEvidence(dispute.Id, document.Id).Target; Assert.NotNull(evidence); DisputeEvidence foundEvidence = gateway.Dispute.Find(dispute.Id).Target.Evidence[0]; Assert.NotNull(foundEvidence); }
public void DocumentUploadValidFileSz(String value) { DocumentUpload doc = new DocumentUpload(); doc.Base64Content = value; doc.Description = "abcdefg"; var validationContext = new ValidationContext(doc, null, null); var validationResults = new List <ValidationResult>(); var isValid = Validator.TryValidateObject(doc, validationContext, validationResults, true); Assert.True(isValid); }
public void Create_returnsSuccessfulWithValidRequest() { FileStream fs = new FileStream(BT_LOGO_PATH, FileMode.Open, FileAccess.Read); DocumentUploadRequest request = new DocumentUploadRequest(); request.File = fs; request.DocumentKind = DocumentUploadKind.EVIDENCE_DOCUMENT; DocumentUpload documentUpload = gateway.DocumentUpload.Create(request).Target; Assert.NotNull(documentUpload); Assert.AreEqual(DocumentUploadKind.EVIDENCE_DOCUMENT, documentUpload.Kind); Assert.AreEqual("bt_logo.png", documentUpload.Name); Assert.AreEqual("image/png", documentUpload.ContentType); Assert.AreEqual(2443m, documentUpload.Size); }
/*new methods*/ public long CreateOrUpdateDocumentUpload(DocumentUpload doc) { try { mbc.CreateOrUpdateDocumentUpload(doc); return(doc.Id); } catch (Exception ex) { throw ex; } finally { } }
// GET: DocumentUploads/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DocumentUpload documentUpload = db.DocumentUploads.Find(id); if (documentUpload == null) { return(HttpNotFound()); } return(View(documentUpload)); }
public void AddFileEvidence_whenDisputeNotOpenErrors() { DocumentUpload document = createSampleDocumentUpload(); Dispute dispute = createSampleDispute(); gateway.Dispute.Accept(dispute.Id); var result = gateway.Dispute.AddFileEvidence(dispute.Id, document.Id); Assert.IsFalse(result.IsSuccess()); Assert.AreEqual(ValidationErrorCode.DISPUTE_CAN_ONLY_ADD_EVIDENCE_TO_OPEN_DISPUTE, result.Errors.ForObject("Dispute").OnField("Status")[0].Code); Assert.AreEqual("Evidence can only be attached to disputes that are in an Open state", result.Errors.ForObject("Dispute").OnField("Status")[0].Message); }
// GET: DocumentUploads/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DocumentUpload documentUpload = db.DocumentUploads.Find(id); if (documentUpload == null) { return(HttpNotFound()); } ViewBag.VendorId = new SelectList(db.Vendors, "VendorId", "VendorName", documentUpload.VendorId); return(View(documentUpload)); }
public void AddFileEvidence_failsToAddEvidenceWithUnSupportedCategory() { DocumentUpload document = createSampleDocumentUpload(); Dispute dispute = createSampleDispute(); FileEvidenceRequest request = new FileEvidenceRequest { Category = "NOTAREALCATEGORY", DocumentId = document.Id, }; var result = gateway.Dispute.AddFileEvidence(dispute.Id, request); Assert.IsFalse(result.IsSuccess()); Assert.AreEqual(ValidationErrorCode.DISPUTE_CAN_ONLY_CREATE_EVIDENCE_WITH_VALID_CATEGORY, result.Errors.ForObject("Dispute").OnField("Evidence")[0].Code); }
protected void btnSave_Click(object sender, EventArgs e) { DocumentUpload dop = new DocumentUpload(); if (flup.HasFile) { flup.SaveAs(@"E:\Projects\Igrss\Final\Upload\" + flup.FileName); Label1.Text = "File Uploaded: " + flup.FileName; } else { Label1.Text = "No File Uploaded."; } dop.UploadDocument(txtName.Text, txtDescription.Text, @"E:\Projects\Igrss\Final\Upload\" + flup.FileName); }
public async Task AddFileEvidenceAsync_addsEvidence() { Dispute dispute = await createSampleDisputeAsync(); DocumentUpload document = await createSampleDocumentUploadAsync(); Result <DisputeEvidence> evidenceResult = await gateway.Dispute.AddFileEvidenceAsync(dispute.Id, document.Id); Assert.NotNull(evidenceResult.Target); Result <Dispute> foundResult = await gateway.Dispute.FindAsync(dispute.Id); DisputeEvidence foundEvidence = foundResult.Target.Evidence[0]; Assert.NotNull(foundEvidence); }
public async Task RenderAsync_ShouldSet_DocumentUploadUrl() { var url = "test"; var callBackValue = new DocumentUpload(); _mockElementHelper.Setup(_ => _.GenerateDocumentUploadUrl(It.IsAny <Element>(), It.IsAny <FormSchema>(), It.IsAny <FormAnswers>())) .Returns(url); _mockIViewRender.Setup(_ => _.RenderAsync(It.IsAny <string>(), It.IsAny <DocumentUpload>(), It.IsAny <Dictionary <string, dynamic> >())) .Callback <string, DocumentUpload, Dictionary <string, object> >((x, y, z) => callBackValue = y); //Arrange var element = new ElementBuilder() .WithType(EElementType.DocumentUpload) .Build(); var page = new PageBuilder() .WithElement(element) .Build(); var viewModel = new Dictionary <string, dynamic>(); var schema = new FormSchemaBuilder() .WithName("form-name") .Build(); var formAnswers = new FormAnswers(); //Act await element.RenderAsync( _mockIViewRender.Object, _mockElementHelper.Object, string.Empty, viewModel, page, schema, _mockHostingEnv.Object, formAnswers); //Assert _mockIViewRender.Verify(_ => _.RenderAsync(It.Is <string>(x => x.Equals("DocumentUpload")), It.IsAny <DocumentUpload>(), It.IsAny <Dictionary <string, object> >()), Times.Once); _mockElementHelper.Verify(_ => _.GenerateDocumentUploadUrl(It.IsAny <Element>(), It.IsAny <FormSchema>(), It.IsAny <FormAnswers>()), Times.Once); Assert.NotEmpty(callBackValue.Properties.DocumentUploadUrl); Assert.Equal(url, callBackValue.Properties.DocumentUploadUrl); }
public IHttpActionResult UploadMemberDocuments([FromBody] DocumentUpload upload) { var member = GetMemberDetails(upload.Email); if (member == null) { return(BadRequest("Member not found")); } try { var mandatoryDocsLink = SaveDocumentsToMedia(upload.MandatoryDocuments, member.Id); member.SetValue("mandatoryDocument", mandatoryDocsLink); member.SetValue("identityDocType", (int)upload.DocumentType); if (upload.SupportingDocuments != null) { var supportingDocsLink = SaveDocumentsToMedia(upload.SupportingDocuments, member.Id); member.SetValue("supportingDocument", supportingDocsLink); } if (upload.OtherDocuments != null) { var otherDocsLink = SaveDocumentsToMedia(upload.OtherDocuments, member.Id); member.SetValue("otherDocument", otherDocsLink); } _memberService.Save(member); var json = JsonConvert.SerializeObject(ConvertRawMember(member), new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); return(Ok(new { memberInfo = json })); } catch (Exception e) { Console.WriteLine(e); return(Ok(new { error = upload })); } }
static void Main(string[] args) { string url = "http://*****:*****@"C:\temp\photo1.jpg"); FileStream stream2 = File.OpenRead(filePath); DocumentUpload document = new DocumentUpload { Author = "Marcin", Name = "Photo", Content = new MemoryStream() }; stream2.CopyTo(document.Content); client.AddLargeDocument(document); }
public long CreateOrUpdateDocumentUpload(DocumentUpload doc) { try { if (doc != null) { PSF.SaveOrUpdate <DocumentUpload>(doc); } else { throw new Exception("Document is required and it cannot be null.."); } return(doc.Id); } catch (Exception) { throw; } }
public void AddFileEvidenceAsync_addsEvidence() { Task.Run(async () => #endif { Dispute dispute = await createSampleDisputeAsync(); DocumentUpload document = await createSampleDocumentUploadAsync(); Result<DisputeEvidence> evidenceResult = await gateway.Dispute.AddFileEvidenceAsync(dispute.Id, document.Id); Assert.NotNull(evidenceResult.Target); Result<Dispute> foundResult = await gateway.Dispute.FindAsync(dispute.Id); DisputeEvidence foundEvidence = foundResult.Target.Evidence[0]; Assert.NotNull(foundEvidence); } #if net452 ).GetAwaiter().GetResult(); }
public void CreateAsync_returnsSuccessfulWithValidRequest() { Task.Run(async () => #endif { FileStream fs = new FileStream(BT_LOGO_PATH, FileMode.Open, FileAccess.Read); DocumentUploadRequest request = new DocumentUploadRequest(); request.File = fs; request.DocumentKind = DocumentUploadKind.EVIDENCE_DOCUMENT; Result<DocumentUpload> documentUploadResult = await gateway.DocumentUpload.CreateAsync(request); DocumentUpload documentUpload = documentUploadResult.Target; Assert.NotNull(documentUpload); Assert.AreEqual(DocumentUploadKind.EVIDENCE_DOCUMENT, documentUpload.Kind); Assert.AreEqual("bt_logo.png", documentUpload.Name); Assert.AreEqual("image/png", documentUpload.ContentType); Assert.AreEqual(2443m, documentUpload.Size); } #if net452 ).GetAwaiter().GetResult(); }
public void AddFileEvidenceAsync_whenDisputeNotOpenErrors() { Task.Run(async () => #endif { DocumentUpload document = await createSampleDocumentUploadAsync(); Dispute dispute = await createSampleDisputeAsync(); await gateway.Dispute.AcceptAsync(dispute.Id); var result = await gateway.Dispute.AddFileEvidenceAsync(dispute.Id, document.Id); Assert.IsFalse(result.IsSuccess()); Assert.AreEqual(ValidationErrorCode.DISPUTE_CAN_ONLY_ADD_EVIDENCE_TO_OPEN_DISPUTE, result.Errors.ForObject("Dispute").OnField("Status")[0].Code); Assert.AreEqual("Evidence can only be attached to disputes that are in an Open state", result.Errors.ForObject("Dispute").OnField("Status")[0].Message); } #if net452 ).GetAwaiter().GetResult(); }
public void AddFileEvidenceAsync_failsToAddEvidenceWithUnsupportedCategory() { Task.Run(async () => #endif { DocumentUpload document = await createSampleDocumentUploadAsync(); Dispute dispute = await createSampleDisputeAsync(); FileEvidenceRequest request = new FileEvidenceRequest { Category = "NOTAREALCATEGORY", DocumentId = document.Id, }; var result = await gateway.Dispute.AddFileEvidenceAsync(dispute.Id, request); Assert.IsFalse(result.IsSuccess()); Assert.AreEqual(ValidationErrorCode.DISPUTE_CAN_ONLY_CREATE_EVIDENCE_WITH_VALID_CATEGORY, result.Errors.ForObject("Dispute").OnField("Evidence")[0].Code); } #if net452 ).GetAwaiter().GetResult(); }
public void AddFileEvidence_addsEvidenceWithCategory() { DocumentUpload document = createSampleDocumentUpload(); Dispute dispute = createSampleDispute(); var fileEvidenceRequest = new FileEvidenceRequest { DocumentId = document.Id, Category = "GENERAL", }; DisputeEvidence evidence = gateway.Dispute.AddFileEvidence(dispute.Id, fileEvidenceRequest).Target; Assert.NotNull(evidence); DisputeEvidence foundEvidence = gateway.Dispute.Find(dispute.Id).Target.Evidence[0]; Assert.NotNull(evidence.Category); Assert.AreEqual(evidence.Category, "GENERAL"); Assert.NotNull(foundEvidence); }
public bool AddDocumentUpload(DocumentUploadEL docUploads) { bool isInserted = false; using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted })) { try { if (docUploads != null) { using (uow = new UnitOfWork.UnitOfWork()) { #region Create Document Upload DocumentUpload docUpload = new DocumentUpload(); docUpload.UserId = docUploads.UserId; docUpload.doc_id = docUploads.doc_id; docUpload.doctypename = docUploads.doctypename; docUpload.filepath = docUploads.filepath; uow.DocumentUploadRepository.Insert(docUpload); uow.Save(); isInserted = true; #endregion transactionScope.Complete(); // EmailHelper emailHelper = new EmailHelper(); // emailHelper.SendHtmlFormattedEmail("New account created", newUser, RandomPassword); } } } catch (Exception ex) { transactionScope.Dispose(); } } return(isInserted); }
public void UpdateDocumentSrtatus(string connectionString, DocumentUpload objDocumentUpload) { string storedProcedureCommand = "exec [spUpdateDocumentSrtatus] " + objDocumentUpload.referenceNo + "," + objDocumentUpload.dstatus + ""; clsDataManipulation.StoredProcedureExecuteNonQuery(connectionString, storedProcedureCommand); }
public ComprehensiveAssessmentAPIController(IComprehensiveAssessmentService iComprehensiveAssessmentService) { _ComprehensiveAssessmentService = iComprehensiveAssessmentService; _documentUpload = new DocumentUpload(); }
public List <ComputerCommon> GetList(string user, string id) { var list = new List <ComputerCommon>(); try { var sql = "EXEC proc_tblComputer "; sql += " @FLAG = " + dao.FilterString((id != "0" ? "S" : "A")); sql += ",@User = "******",@RowId = " + dao.FilterString(id.ToString()); var ds = dao.ExecuteDataset(sql); if (null != ds.Tables[0]) { int sn = 1; foreach (System.Data.DataRow item in ds.Tables[0].Rows) { var common = new ComputerCommon() { UniqueId = Convert.ToInt32(item["RowId"]), ProductReferenceId = item["ProductReferenceId"].ToString(), ProductDestintId = item["ProductDestintId"].ToString(), Brand = item["Brand"].ToString(), ProductName = item["ProductName"].ToString(), CreatedDate = item["CreatedDate"].ToString(), ProductDescription = item["ProductDescription"].ToString(), ModelNo = item["ModelNo"].ToString(), PartNumbers = item["PartNumbers"].ToString(), InTheBox = item["InTheBox"].ToString(), Series = item["Series"].ToString(), Color = item["Color"].ToString(), SuitableFor = item["SuitableFor"].ToString(), TouchScreen = item["TouchScreen"].ToString(), Sensor = item["Sensor"].ToString(), SoundEnhancement = item["SoundEnhancement"].ToString(), ProcessorBrand = item["ProcessorBrand"].ToString(), ProcessorName = item["ProcessorName"].ToString(), ProcessorGeneration = item["ProcessorGeneration"].ToString(), ProcessorVariant = item["ProcessorVariant"].ToString(), ProcessorCore = item["ProcessorCore"].ToString(), ProcessorClockSpeed = item["ProcessorClockSpeed"].ToString(), HDDCapacity = item["HDDCapacity"].ToString(), SSD = item["SSD"].ToString(), SSDVersiom = item["SSDVersiom"].ToString(), SSDCapacity = item["SSDCapacity"].ToString(), RAM = item["RAM"].ToString(), RAMType = item["RAMType"].ToString(), RAMFrequency = item["RAMFrequency"].ToString(), Cache = item["Cache"].ToString(), RPM = item["RPM"].ToString(), GraphicProcessor = item["GraphicProcessor"].ToString(), GraphicProcessorBrand = item["GraphicProcessorBrand"].ToString(), GraphicProcessorCapacity = item["GraphicProcessorCapacity"].ToString(), GraphicProcessorGen = item["GraphicProcessorGen"].ToString(), OpeatingSystem = item["OpeatingSystem"].ToString(), MicIn = item["MicIn"].ToString(), RJ45 = item["RJ45"].ToString(), USBPort = item["USBPort"].ToString(), HDMIPort = item["HDMIPort"].ToString(), MultiCardSlot = item["MultiCardSlot"].ToString(), FirePort = item["FirePort"].ToString(), TypeCPort = item["TypeCPort"].ToString(), ScreenSize = item["ScreenSize"].ToString(), Resolution = item["Resolution"].ToString(), ScreenType = item["ScreenType"].ToString(), InternalMic = item["InternalMic"].ToString(), Speakers = item["Speakers"].ToString(), OtherDisplayFeature = item["OtherDisplayFeature"].ToString(), Ethernet = item["Ethernet"].ToString(), InternetConnectivity = item["InternetConnectivity"].ToString(), BluetoothSuppoert = item["BluetoothSuppoert"].ToString(), BluetoothVersion = item["BluetoothVersion"].ToString(), WIFI = item["WIFI"].ToString(), WIFIVersion = item["WIFIVersion"].ToString(), WifiHotspot = item["WifiHotspot"].ToString(), Width = item["Width"].ToString(), Height = item["Height"].ToString(), Depth = item["Depth"].ToString(), Weight = item["Weight"].ToString(), BatteryBackup = item["BatteryBackup"].ToString(), PowerSupply = item["PowerSupply"].ToString(), BatteryCell = item["BatteryCell"].ToString(), BatteryRemovable = item["BatteryRemovable"].ToString(), WebCam = item["WebCam"].ToString(), LockPort = item["LockPort"].ToString(), Keyboard = item["Keyboard"].ToString(), KeyboardLight = item["KeyboardLight"].ToString(), PointerDevice = item["PointerDevice"].ToString(), AdditionalFeatures = item["AdditionalFeatures"].ToString(), Quantity = item["Quantity"].ToString(), SupplierEmail = item["SupplierEmail"].ToString(), SupplierAddress = item["SupplierAddress"].ToString(), SupplierContactNo = item["SupplierContactNo"].ToString(), ProductPrice = item["ProductPrice"].ToString(), OfferedPrice = item["OfferedPrice"].ToString(), DiscountPercent = item["DiscountPercent"].ToString(), DiscountAmount = item["DiscountAmount"].ToString(), Warrenty = item["Warrenty"].ToString(), WarrentyCondition = item["WarrentyCondition"].ToString(), WarrentyPeriod = item["WarrentyPeriod"].ToString(), Highlights = item["Highlights"].ToString(), TermsAndConditions = item["TermsAndConditions"].ToString(), QuickLinksSEOTag = item["QuickLinksSEOTag"].ToString(), ProductReviewed = item["ProductReviewed"].ToString(), User = item["CreatedBy"].ToString(), }; var DocList = new List <DocumentUpload>(); if (ds.Tables.Count > 1) { if (null != ds.Tables[1]) { foreach (System.Data.DataRow item2 in ds.Tables[1].Rows) { var Doc = new DocumentUpload() { View = item2["Viewof"].ToString(), Color = item2["Color"].ToString(), DocName = item2["DocName"].ToString(), }; DocList.Add(Doc); } } } common.Doc = DocList; sn++; list.Add(common); } } } catch (Exception e) { return(list); } return(list); }
public virtual int Update(DocumentUpload dataSet) { return this.Adapter.Update(dataSet, "Document_Upload"); }
public virtual int Update(DocumentUpload.Document_UploadDataTable dataTable) { return this.Adapter.Update(dataTable); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { DocumentUpload ds = new DocumentUpload(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public List <GadgetCommon> GetList(string user, string id) { var list = new List <GadgetCommon>(); try { var sql = "EXEC proc_tblGadget "; sql += " @FLAG = " + dao.FilterString((id != "0" ? "S" : "A")); sql += ",@User = "******",@RowId = " + dao.FilterString(id.ToString()); var ds = dao.ExecuteDataset(sql); if (null != ds.Tables[0]) { int sn = 1; foreach (System.Data.DataRow item in ds.Tables[0].Rows) { var common = new GadgetCommon() { UniqueId = Convert.ToInt32(item["RowId"]), ProductReferenceId = item["ProductReferenceId"].ToString(), ProductDestintId = item["ProductDestintId"].ToString(), Brand = item["Brand"].ToString(), ProductName = item["ProductName"].ToString(), CreatedDate = item["CreatedDate"].ToString(), ProductDescription = item["ProductDescription"].ToString(), ModelNo = item["ModelNo"].ToString(), ModelName = item["ModelName"].ToString(), InTheBox = item["InTheBox"].ToString(), Color = item["Color"].ToString(), BrowseType = item["BrowseType"].ToString(), SimType = item["SimType"].ToString(), SimSize = item["SimSize"].ToString(), HybridSimSlot = item["HybridSimSlot"].ToString(), TouchScreen = item["TouchScreen"].ToString(), Sensor = item["Sensor"].ToString(), OTGCompatable = item["OTGCompatable"].ToString(), QuickCharging = item["QuickCharging"].ToString(), SoundEnhancement = item["SoundEnhancement"].ToString(), PrimaryCameraDetail = item["PrimaryCameraDetail"].ToString(), PrimaryCameraFeatures = item["PrimaryCameraFeatures"].ToString(), FrontCameraDetail = item["FrontCameraDetail"].ToString(), FrontCameraFeatures = item["FrontCameraFeatures"].ToString(), Flash = item["Flash"].ToString(), FrameRate = item["FrameRate"].ToString(), OpeatingSystem = item["OpeatingSystem"].ToString(), ProcessorType = item["ProcessorType"].ToString(), ProcessorCore = item["ProcessorCore"].ToString(), ProcessorClockSpeed = item["ProcessorClockSpeed"].ToString(), OSFrequency = item["OSFrequency"].ToString(), InternalStorage = item["InternalStorage"].ToString(), RAM = item["RAM"].ToString(), ExpandableStorage = item["ExpandableStorage"].ToString(), SupprtedMemoryCardType = item["SupprtedMemoryCardType"].ToString(), MemoryCardSlotTypes = item["MemoryCardSlotTypes"].ToString(), DisplaySize = item["DisplaySize"].ToString(), Resolution = item["Resolution"].ToString(), ResolutionType = item["ResolutionType"].ToString(), GPU = item["GPU"].ToString(), GraphicPPI = item["GraphicPPI"].ToString(), OtherDisplayFeature = item["OtherDisplayFeature"].ToString(), Width = item["Width"].ToString(), Height = item["Height"].ToString(), Depth = item["Depth"].ToString(), Weight = item["Weight"].ToString(), BatteryCapacity = item["BatteryCapacity"].ToString(), BatteryFeatures = item["BatteryFeatures"].ToString(), BatteryRemovable = item["BatteryRemovable"].ToString(), NetworkType = item["NetworkType"].ToString(), SupportedNetwork = item["SupportedNetwork"].ToString(), InternetConnectivity = item["InternetConnectivity"].ToString(), BluetoothSuppoert = item["BluetoothSuppoert"].ToString(), BluetoothVersion = item["BluetoothVersion"].ToString(), WIFI = item["WIFI"].ToString(), WIFIVersion = item["WIFIVersion"].ToString(), WifiHotspot = item["WifiHotspot"].ToString(), USBConnectivity = item["USBConnectivity"].ToString(), AudioJack = item["AudioJack"].ToString(), ChargerType = item["ChargerType"].ToString(), Quantity = item["Quantity"].ToString(), SupplierEmail = item["SupplierEmail"].ToString(), SupplierAddress = item["SupplierAddress"].ToString(), SupplierContactNo = item["SupplierContactNo"].ToString(), ProductPrice = item["ProductPrice"].ToString(), OfferedPrice = item["OfferedPrice"].ToString(), DiscountPercent = item["DiscountPercent"].ToString(), DiscountAmount = item["DiscountAmount"].ToString(), Warrenty = item["Warrenty"].ToString(), WarrentyCondition = item["WarrentyCondition"].ToString(), WarrentyPeriod = item["WarrentyPeriod"].ToString(), Highlights = item["Highlights"].ToString(), ReplacementPeriod = item["ReplacementPeriod"].ToString(), TermsAndConditions = item["TermsAndConditions"].ToString(), QuickLinksSEOTag = item["QuickLinksSEOTag"].ToString(), ProductReviewed = item["ProductReviewed"].ToString(), User = item["CreatedBy"].ToString(), }; var DocList = new List <DocumentUpload>(); if (ds.Tables.Count > 1) { if (null != ds.Tables[1]) { foreach (System.Data.DataRow item2 in ds.Tables[1].Rows) { var Doc = new DocumentUpload() { View = item2["Viewof"].ToString(), Color = item2["Color"].ToString(), DocName = item2["DocName"].ToString(), }; DocList.Add(Doc); } } } common.Doc = DocList; sn++; list.Add(common); } } } catch (Exception e) { return(list); } return(list); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); DocumentUpload ds = new DocumentUpload(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "Document_UploadDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }