public async Task UploadAsync_Stream() { await using DisposingContainer test = await GetTestContainerAsync(); var name = GetNewBlobName(); BlobClient blob = InstrumentClient(test.Container.GetBlobClient(name)); var data = GetRandomBuffer(Constants.KB); using (var stream = new MemoryStream(data)) { await blob.UploadAsync(stream); } System.Collections.Generic.IList <BlobItem> blobs = await test.Container.GetBlobsAsync().ToListAsync(); Assert.AreEqual(1, blobs.Count); Assert.AreEqual(name, blobs.First().Name); Response <BlobDownloadInfo> download = await blob.DownloadAsync(); using var actual = new MemoryStream(); await download.Value.Content.CopyToAsync(actual); TestHelper.AssertSequenceEqual(data, actual.ToArray()); }
public async Task UploadAsync_File() { await using DisposingContainer test = await GetTestContainerAsync(); var name = GetNewBlobName(); BlobClient blob = InstrumentClient(test.Container.GetBlobClient(name)); var data = GetRandomBuffer(Constants.KB); using (var stream = new MemoryStream(data)) { var path = Path.GetTempFileName(); try { File.WriteAllBytes(path, data); // Test that we can upload a read-only file. File.SetAttributes(path, FileAttributes.ReadOnly); await blob.UploadAsync(path); } finally { if (File.Exists(path)) { File.SetAttributes(path, FileAttributes.Normal); File.Delete(path); } } } System.Collections.Generic.IList <BlobItem> blobs = await test.Container.GetBlobsAsync().ToListAsync(); Assert.AreEqual(1, blobs.Count); Assert.AreEqual(name, blobs.First().Name); Response <BlobDownloadInfo> download = await blob.DownloadAsync(); using var actual = new MemoryStream(); await download.Value.Content.CopyToAsync(actual); TestHelper.AssertSequenceEqual(data, actual.ToArray()); }
private void BindEquInfo() { new ResResourceService(); EquEquipmentTypeService equEquipmentTypeService = new EquEquipmentTypeService(); EquEquipment byId = this.equSer.GetById(this.id); this.lblEquCode.Text = byId.EquCode; this.lblEquName.Text = byId.EquName; EquEquipmentType byId2 = equEquipmentTypeService.GetById(byId.TypeId); if (byId2 != null) { this.lblEquTypeName.Text = byId2.Name; } if (byId.SupplierId.HasValue) { XPMBasicContactCorpService xPMBasicContactCorpService = new XPMBasicContactCorpService(); XPMBasicContactCorp byId3 = xPMBasicContactCorpService.GetById(byId.SupplierId.Value); if (byId3 != null) { this.lblCorpName.Text = byId3.CorpName; } } this.lblFactoryNumber.Text = byId.FactoryNumber; this.lblFactoryDate.Text = this.ConvertToString(byId.FactoryDate); this.lblPurchaseDate.Text = this.ConvertToString(byId.PurchaseDate); this.lblDepreciationRate.Text = byId.DepreciationRate.ToString("0.000"); this.lblPeriodicVertification.Text = byId.PeriodicVertification; this.lblDurableYear.Text = byId.DurableYear; this.lblPurchasePrice.Text = byId.PurchasePrice.ToString("0.000"); this.lblState.Text = this.GetStateOrProperty("EquState", byId.State); this.lblEquProperty.Text = this.GetStateOrProperty("EquProperty", byId.EquProperty); this.lblReceiptNo.Text = byId.ReceiptNo; if (equEquipmentTypeService.IsShip(byId.TypeId)) { this.trShip.Style["Display"] = "Block"; this.lblShipLength.Text = byId.ShipLength; this.lblShipWidth.Text = byId.ShipWidth; this.lblShipCapacity.Text = byId.ShipCapaticy; EquShipTechnicalParasService equShipTechnicalParasService = new EquShipTechnicalParasService(); System.Collections.Generic.IList <EquShipTechnicalParas> equShipTechParasByEquId = equShipTechnicalParasService.GetEquShipTechParasByEquId(this.id); if (equShipTechParasByEquId == null || equShipTechParasByEquId.Count <= 0) { goto IL_352; } if (equShipTechParasByEquId.Count == 1) { this.lblOtherShipInfo.Text = equShipTechParasByEquId.First <EquShipTechnicalParas>().OtherShipInfo; } int num = 0; Label label = null; using (System.Collections.Generic.IEnumerator <EquShipTechnicalParas> enumerator = equShipTechParasByEquId.GetEnumerator()) { while (enumerator.MoveNext()) { EquShipTechnicalParas current = enumerator.Current; if (num == 0) { this.lblOtherShipInfo.Text = string.Format("参数{0}: {1}", (num + 1).ToString(), current.OtherShipInfo); label = (this.plOtherShips.FindControl("lblOtherShipInfo") as Label); } else { Literal literal = new Literal(); literal.Text = "<br />"; this.plOtherShips.Controls.Add(literal); Label label2 = new Label(); label2.ID = label.ID + num.ToString(); label2.Text = string.Format("参数{0}: {1}", num + 1, current.OtherShipInfo); this.plOtherShips.Controls.Add(label2); } num++; } goto IL_352; } } this.trShip.Style["Display"] = "None"; IL_352: this.lblMiddleInspectDate.Text = this.ConvertToString(byId.MiddleInspectDate); this.lblYearInspectDate.Text = this.ConvertToString(byId.YearInspectDate); this.lblOtherCredentials.Text = byId.OtherCredentials; this.lblAnnex.Text = FileView.FilesBind(1901, byId.Id); this.lblNotes.Text = byId.Note; }
public DataFilterExt(string YHID, string FAID, string DYID, string KZID, string SUFFIX = null) { this.dbserver_type = DB.GetDbtype(); if (this.dbserver_type == DBSERVER_TYPE.ORACLE) { this.dual_sql = " from dual "; } else { this.dual_sql = " "; } this.FAID = FAID; this.DYID = DYID; this.YHID = YHID; this.KZID = KZID; this.SUFFIX = SUFFIX; string format = "SELECT XXMXID {0} FROM ({1}) A GROUP BY XXMXID"; System.Collections.Generic.IList <XT_SJQX_DX> list = DB.List <XT_SJQX_DX>(new { FAID = FAID, ORDER_BY_CLAUSE = " PXXH ASC" }.toStrObjDict()); string text = ""; foreach (XT_SJQX_DX current in list) { string text2 = current.GXSQL; if (string.IsNullOrEmpty(text2)) { text2 = string.Concat(new object[] { "SELECT '$DXID$' AS DXID, '$YHID$' AS DXMXID,'$YHID$' AS YHID,", current.PXXH, " AS PXXH ", this.dual_sql }); } else { text2 = string.Concat(new object[] { "SELECT A.DXID,A.DXMXID,A.YHID,", current.PXXH, " AS PXXH FROM (", text2, ") A WHERE YHID = '$YHID$'" }); } text = (string.IsNullOrEmpty(text) ? "" : " UNION ") + DataFiltersAction.ChuliSql(text2, YHID, FAID, current.DXID); } System.Collections.Generic.IList <StrObjectDict> list2 = DB.ListSod("LIST_XT_SJQX_QX_BY_DY", new { FAID = FAID, DYID = DYID, KZID = KZID, DXSQL = text }.toStrObjDict()); if (list2.Count > 0) { string PXXH = Utils.GetString(list2.First <StrObjectDict>()["PXXH"]); string text3 = string.Format("SELECT DISTINCT A.XXMXID, A.XXID, A.KCID FROM XT_SJQX_QXMX A ,({0}) B,XT_SJQX_DY_XX C WHERE A.DXID=B.DXID AND A.DXMXID=B.DXMXID AND A.FAID=C.FAID AND C.DYID=A.DYID AND C.XXID=A.XXID AND A.FAID='{1}'AND A.DYID='{2}' AND A.KCID='{3}' AND B.PXXH='{4}' AND C.XXLX=2", new object[] { text, FAID, DYID, KZID, PXXH }); System.Collections.Generic.List <StrObjectDict> source = ( from item in list2 where Utils.GetString(item["PXXH"]) == PXXH select item).ToList <StrObjectDict>(); string text4 = ""; if (( from item in source where Utils.GetString(item["XXLX"]) == "0" select item).Count <StrObjectDict>() == 0) { string text5 = text4; text4 = string.Concat(new string[] { text5, ",(case when sum(case when kcid = '", KZID, "' then 1 else 0 end )>0 then 1 else 0 end) AS ", string.IsNullOrEmpty(SUFFIX) ? (FAID + "_" + DYID) : SUFFIX, "_KZ_", KZID }); foreach (StrObjectDict current2 in from item in source where Utils.GetString(item["XXLX"]) == "1" select item) { text3 += string.Format(" UNION SELECT A.ID AS XXMXID,'{0}' AS XXID,'{1}' AS KCID FROM ({2}) A ", Utils.GetString(current2["XXID"]), KZID, DataFiltersAction.ChuliSql(Utils.GetString(current2["ZSQL"]), YHID, FAID)); } foreach (StrObjectDict current2 in from item in source where Utils.GetString(item["XXLX"]) == "3" select item) { string arg = DataFiltersAction.ChuliSql(Utils.GetString(current2["GLSQL"]), YHID, FAID); string arg2 = string.Format("SELECT DISTINCT A.XXMXID, A.XXID, A.KCID FROM XT_SJQX_QXMX A ,({0}) B,XT_SJQX_DY_XX C WHERE A.DXID=B.DXID AND A.DXMXID=B.DXMXID AND A.FAID=C.FAID AND C.DYID=A.DYID AND C.XXID=A.XXID AND A.FAID='{1}'AND A.DYID='{2}' AND A.KCID='{3}' AND A.XXID='{4}'", new object[] { text, FAID, DYID, KZID, Utils.GetString(current2["XXID"]) }); text3 += string.Format(" UNION SELECT A.XXMXID,B.XXID,B.KCID FROM ({0}) A INNER JOIN ({1}) B ON A.FLID = B.XXMXID", arg, arg2); } } else { StrObjectDict strObjDict = ( from item in source where Utils.GetString(item["XXLX"]) == "0" select item).ToList <StrObjectDict>()[0]; string text5 = text4; text4 = string.Concat(new string[] { text5, ",1 as ", string.IsNullOrEmpty(SUFFIX) ? (FAID + "_" + DYID) : SUFFIX, "_KZ_", KZID }); text3 += string.Format(" UNION SELECT A.ID AS XXMXID,'{0}' AS XXID,'{1}' AS KCID FROM ({2}) A ", Utils.GetString(strObjDict["XXID"]), KZID, DataFiltersAction.ChuliSql(Utils.GetString(strObjDict["ZSQL"]), YHID, FAID)); } this.KZ_ZSQL = string.Format(format, text4, text3); } else { XT_SJQX_DY xT_SJQX_DY = DB.Load <XT_SJQX_DY, PK_XT_SJQX_DY>(new PK_XT_SJQX_DY { FAID = FAID, DYID = DYID }); if (!string.IsNullOrEmpty(xT_SJQX_DY.MRZ)) { XT_SJQX_DY_XX xT_SJQX_DY_XX = DB.Load <XT_SJQX_DY_XX, PK_XT_SJQX_DY_XX>(new PK_XT_SJQX_DY_XX { FAID = FAID, DYID = DYID, XXID = xT_SJQX_DY.MRZ }); if (xT_SJQX_DY_XX.XXLX == 0 || xT_SJQX_DY_XX.XXLX == 1) { this.KZ_ZSQL = string.Format(" SELECT A.ID AS XXMXID,1 AS " + (string.IsNullOrEmpty(SUFFIX) ? (FAID + "_" + DYID) : SUFFIX) + "_KZ_{0} FROM ({1}) A ", KZID, DataFiltersAction.ChuliSql(Utils.GetString(xT_SJQX_DY_XX.ZSQL), YHID, FAID)); return; } } if (string.IsNullOrEmpty(this.KZ_ZSQL)) { this.KZ_ZSQL = string.Format(" SELECT NULL AS XXMXID, 0 AS " + (string.IsNullOrEmpty(SUFFIX) ? (FAID + "_" + DYID) : SUFFIX) + "_KZ_{0} " + this.dual_sql, KZID); } } }