public async Task <ApiResponseObject <List <TenderDetailsDto> > > GetTenderDetailsByReferenceNumberAndCr(string referenceNumber, string cr) { var result = await _dbContext.Tenders.Where(tender => tender.IsActive == true && tender.ReferenceNumber == referenceNumber) .Where(tender => tender.ConditionsBooklets.Any(booklet => booklet.IsActive == true && booklet.CommericalRegisterNo == cr && booklet.BillInfo.BillStatusId == (int)Enums.BillStatus.Paid) || tender.Invitations.Any(invitation => invitation.IsActive == true && invitation.CommericalRegisterNo == cr && invitation.StatusId == (int)Enums.InvitationStatus.Approved)) .Select(tender => new TenderDetailsDto { TenderName = tender.TenderName, ReferenceNumber = tender.ReferenceNumber, AgencyCode = tender.AgencyCode, AgencyName = tender.Agency.NameArabic, TenderStatsId = tender.TenderStatusId, TenderStatusName = tender.Status.NameAr, OffersOpeningDate = tender.OffersOpeningDate.Value, AwardedSuppliers = tender.TenderStatusId == (int)Enums.TenderStatus.OffersAwardedConfirmed ? tender.Offers.Where(offer => offer.IsActive == true && (offer.TotalOfferAwardingValue.HasValue || offer.PartialOfferAwardingValue.HasValue)).Select(x => new AwardedSuppliers() { SupplierCr = x.CommericalRegisterNo, SupplierName = x.Supplier.SelectedCrName }).ToList() : new List <AwardedSuppliers>() }) .ToListAsync(); var resultResponse = new ApiResponseObject <List <TenderDetailsDto> >(result); if (!result.Any()) { resultResponse.message = "غير مصرح"; resultResponse.success = false; } return(resultResponse); }
public async Task <ApiResponseObject <List <PurchasedSupplierTendersDto> > > GetPurchasedTendersForSupplierByCrAndBankGuaranteeType(string cr, int bankGauranteeTypeId) { var result = await _dbContext.Tenders.Where(tender => tender.IsActive == true) .Where(tender => tender.ConditionsBooklets.Any(booklet => booklet.IsActive == true && booklet.CommericalRegisterNo == cr && booklet.BillInfo.BillStatusId == (int)Enums.BillStatus.Paid) || tender.Invitations.Any(invitation => invitation.IsActive == true && invitation.CommericalRegisterNo == cr && invitation.StatusId == (int)Enums.InvitationStatus.Approved)) .WhereIf(bankGauranteeTypeId == (int)Enums.BankGuaranteeType.Primary, tender => !string.IsNullOrEmpty(tender.InitialGuaranteeAddress) && tender.TenderStatusId != (int)Enums.TenderStatus.Canceled && tender.TenderStatusId != (int)Enums.TenderStatus.OffersAwardedConfirmed) .WhereIf(bankGauranteeTypeId == (int)Enums.BankGuaranteeType.Final, tender => tender.TenderStatusId == (int)Enums.TenderStatus.OffersAwardedConfirmed && tender.Offers.Any(offer => offer.IsActive == true && offer.CommericalRegisterNo == cr && (offer.TotalOfferAwardingValue.HasValue || offer.PartialOfferAwardingValue.HasValue))) .Select(tender => new PurchasedSupplierTendersDto { TenderName = tender.TenderName, ReferenceNumber = tender.ReferenceNumber, AgencyCode = tender.AgencyCode, AgencyName = tender.Agency.NameArabic, TenderStatsId = tender.TenderStatusId, TenderStatusName = tender.Status.NameAr, OffersOpeningDate = tender.OffersOpeningDate.Value, }) .ToListAsync(); var resultResponse = new ApiResponseObject <List <PurchasedSupplierTendersDto> >(result); if (!result.Any() || (bankGauranteeTypeId != (int)Enums.BankGuaranteeType.Primary && bankGauranteeTypeId != (int)Enums.BankGuaranteeType.Final)) { resultResponse.message = "لا يوجد بيانات"; resultResponse.success = false; resultResponse.data = new List <PurchasedSupplierTendersDto>(); } return(resultResponse); }
public async Task <ApiResponseObject <string> > UpdateBankGuaranteeFile(BankGuaranteeFileDto bankGuarantee) { var checkData = CheckValidData(bankGuarantee); if (!checkData.success) { return(checkData); } var offer = await _bankGuaranteeQueries.GetOfferDetailsByTenderNumberAndCr(bankGuarantee.Tender_number, bankGuarantee.CR_number); if (offer == null) { return new ApiResponseObject <string>("") { success = false, data = "", message = "خطا في البيانات" } } ; List <SupplierBankGuaranteeDetail> guaranteesLst = new List <SupplierBankGuaranteeDetail>(); var offerBankGuarantee = new SupplierBankGuaranteeDetail(0, offer.OfferId, true, bankGuarantee.Guarantee_number, bankGuarantee.Bank_identity, bankGuarantee.Guarantee_value, bankGuarantee.Guarantee_start_date, bankGuarantee.Guarantee_end_date, int.Parse(bankGuarantee.GuaranteeDays.ToString())); guaranteesLst.Add(offerBankGuarantee); offer.UpdateBankGurnteesDetails(guaranteesLst); var updatedOffer = await _offerCommands.UpdateAsync(offer); var response = new ApiResponseObject <string>(""); if (updatedOffer == null) { response = new ApiResponseObject <string>("") { success = false, data = "", message = "خطا في البيانات" } } ; else { response = new ApiResponseObject <string>("") { success = true, data = "", message = "تم استلام ملف الضمان البنكي بنجاح" } }; return(response); }
/// <summary>Update a table category by replacing items in its definition.</summary> public Object Update(string webId, PITableCategory tableCategory) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, tableCategory); return(localVarResponse.Data); }
/// <summary>Delete a configuration item.</summary> public Object Delete(string key) { ApiResponseObject localVarResponse = DeleteWithHttpInfo(key); return(localVarResponse.Data); }
/// <summary>Get the current system configuration.</summary> public Object List() { ApiResponseObject localVarResponse = ListWithHttpInfo(); return(localVarResponse.Data); }
/// <summary>Update a unit.</summary> public Object Update(string webId, PIUnit unitDTO) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, unitDTO); return(localVarResponse.Data); }
/// <summary>Delete an enumeration value from an enumeration set.</summary> public Object DeleteEnumerationValue(string webId) { ApiResponseObject localVarResponse = DeleteEnumerationValueWithHttpInfo(webId); return(localVarResponse.Data); }
/// <summary>Create a unit in the specified Unit Class.</summary> public Object CreateUnit(string webId, PIUnit unitDTO, string webIdType = null) { ApiResponseObject localVarResponse = CreateUnitWithHttpInfo(webId, unitDTO, webIdType); return(localVarResponse.Data); }
/// <summary>Create a security entry owned by the attribute category.</summary> public Object CreateSecurityEntry(string webId, PISecurityEntry securityEntry, bool applyToChildren, string webIdType = null) { ApiResponseObject localVarResponse = CreateSecurityEntryWithHttpInfo(webId, securityEntry, applyToChildren, webIdType); return(localVarResponse.Data); }
/// <summary>Update an element category by replacing items in its definition.</summary> public Object Update(string webId, PIElementCategory elementCategory) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, elementCategory); return localVarResponse.Data; }
/// <summary>Update a security identity by replacing items in its definition.</summary> public Object Update(string webId, PISecurityIdentity securityIdentity) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, securityIdentity); return(localVarResponse.Data); }
/// <summary>Create a new Analysis Rule as a child of an existing Analysis Rule.</summary> public Object CreateAnalysisRule(string webId, PIAnalysisRule analysisRule, string webIdType = null) { ApiResponseObject localVarResponse = CreateAnalysisRuleWithHttpInfo(webId, analysisRule, webIdType); return(localVarResponse.Data); }
/// <summary>Create a point in the specified Data Server.</summary> public Object CreatePoint(string webId, PIPoint pointDTO, string webIdType = null) { ApiResponseObject localVarResponse = CreatePointWithHttpInfo(webId, pointDTO, webIdType); return(localVarResponse.Data); }
/// <summary>Create an enumeration set on the Data Server.</summary> public Object CreateEnumerationSet(string webId, PIEnumerationSet enumerationSet, string webIdType = null) { ApiResponseObject localVarResponse = CreateEnumerationSetWithHttpInfo(webId, enumerationSet, webIdType); return(localVarResponse.Data); }
/// <summary>Create an attribute template as a child of another attribute template.</summary> public Object CreateAttributeTemplate(string webId, PIAttributeTemplate template) { ApiResponseObject localVarResponse = CreateAttributeTemplateWithHttpInfo(webId, template); return(localVarResponse.Data); }
/// <summary>Update an attribute category by replacing items in its definition.</summary> public Object Update(string webId, PIAttributeCategory category) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, category); return(localVarResponse.Data); }
/// <summary>Delete an element category.</summary> public Object Delete(string webId) { ApiResponseObject localVarResponse = DeleteWithHttpInfo(webId); return localVarResponse.Data; }
/// <summary>Delete a security entry owned by the attribute category.</summary> public Object DeleteSecurityEntry(string name, string webId, bool applyToChildren) { ApiResponseObject localVarResponse = DeleteSecurityEntryWithHttpInfo(name, webId, applyToChildren); return(localVarResponse.Data); }
/// <summary>Update a security entry owned by the element category.</summary> public Object UpdateSecurityEntry(string name, string webId, PISecurityEntry securityEntry, bool applyToChildren) { ApiResponseObject localVarResponse = UpdateSecurityEntryWithHttpInfo(name, webId, securityEntry, applyToChildren); return localVarResponse.Data; }
/// <summary>Update an enumeration value by replacing items in its definition.</summary> public Object UpdateEnumerationValue(string webId, PIEnumerationValue enumerationValue) { ApiResponseObject localVarResponse = UpdateEnumerationValueWithHttpInfo(webId, enumerationValue); return(localVarResponse.Data); }
/// <summary>Update an Analysis.</summary> public Object Update(string webId, PIAnalysis analysis) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, analysis); return(localVarResponse.Data); }
static void Main(string[] args) { PIWebApiClient client = new PIWebApiClient(); bool connectionTest = client.Connect("https://marc-web-sql.marc.net/piwebapi", true); if (connectionTest == false) { return; } PIDataServer dataServer = client.DataServer.GetByPath("\\\\MARC-PI2016"); PIPoint createdPoint = client.Point.GetByPath("\\\\MARC-PI2016\\SINUSOIDR1259", null); string webId = createdPoint.WebId; createdPoint.DigitalSetName = null; createdPoint.EngineeringUnits = null; createdPoint.Descriptor = "14 Hour Sine Waveeeeee"; createdPoint.Future = false; createdPoint.Id = 0; createdPoint.Links = null; createdPoint.Name = null; createdPoint.Path = null; createdPoint.PointClass = null; createdPoint.PointType = null; createdPoint.WebId = null; createdPoint.Span = 0; createdPoint.Zero = 0; ApiResponseObject response = client.Point.UpdateWithHttpInfo(webId, createdPoint); Console.WriteLine(response.StatusCode); PIPoint point1 = client.Point.GetByPath("\\\\marc-pi2016\\sinusoid"); PIPoint point2 = client.Point.GetByPath("\\\\marc-pi2016\\sinusoidu"); PIPoint point3 = client.Point.GetByPath("\\\\marc-pi2016\\cdt158"); string webIds = point1.WebId + "," + point2.WebId + "," + point3.WebId; PIItemsStreamValues piItemsStreamValues = client.StreamSet.GetRecordedAdHoc(webIds, true, 10000); for (int i = 0; i < piItemsStreamValues.GetItemsLength(); i++) { Console.WriteLine(piItemsStreamValues.GetItem(i).Path); for (int j = 0; j < piItemsStreamValues.GetItem(i).GetItemsLength(); j++) { Console.WriteLine(piItemsStreamValues.GetItem(i).GetItem(j).Value); } } PIItemsStreamValues streamValuesItems = new PIItemsStreamValues(); streamValuesItems.CreateItemsArray(3); PITimedValue value1 = new PITimedValue(); value1.Value = 2; value1.Timestamp = "*-1d"; PITimedValue value2 = new PITimedValue(); value2.Value = 3; value2.Timestamp = "*-2d"; PITimedValue value3 = new PITimedValue(); value3.Value = 4; value3.Timestamp = "*-1d"; PITimedValue value4 = new PITimedValue(); value4.Value = 5; value4.Timestamp = "*-2d"; PITimedValue value5 = new PITimedValue(); value5.Value = 6; value5.Timestamp = "*-1d"; PITimedValue value6 = new PITimedValue(); value6.Value = 7; value6.Timestamp = "*-2d"; PIStreamValues streamValue1 = new PIStreamValues(); streamValue1.WebId = point1.WebId; streamValue1.CreateItemsArray(2); streamValue1.SetItem(0, value1); streamValue1.SetItem(1, value2); streamValuesItems.SetItem(0, streamValue1); PIStreamValues streamValue2 = new PIStreamValues(); streamValue2.WebId = point2.WebId; streamValue2.CreateItemsArray(2); streamValue2.SetItem(0, value3); streamValue2.SetItem(1, value4); streamValuesItems.SetItem(1, streamValue2); PIStreamValues streamValue3 = new PIStreamValues(); streamValue3.WebId = point2.WebId; streamValue3.CreateItemsArray(2); streamValue3.SetItem(0, value5); streamValue3.SetItem(1, value6); streamValuesItems.SetItem(2, streamValue3); ApiResponsePIItemsItemsSubstatus responsee = client.StreamSet.UpdateValuesAdHocWithHttpInfo(streamValuesItems); PIElement myElement = client.Element.GetByPath("\\\\MARC-PI2016\\CrossPlatformLab\\marc.adm"); Console.WriteLine(myElement.Description); PIItemsAttribute attributes = client.Element.GetAttributes(myElement.WebId, 1000, false, false, false, 0); Console.WriteLine(attributes); PIAttribute attribute = client.Attribute.GetByPath(string.Format("{0}|{1}", "\\\\MARC-PI2016\\CrossPlatformLab\\marc.adm", attributes.Items[0].Name)); PITimedValue value = client.Stream.GetEnd(attribute.WebId); Console.WriteLine(value); string expression = "'sinusoid'*2 + 'cdt158'"; PITimedValues values1 = client.Calculation.GetAtTimes(webId: dataServer.WebId, expression: expression, times: "*-1d, *-2d"); string expression2 = "'cdt158'+tagval('sinusoid','*-1d')"; PITimedValues values2 = client.Calculation.GetAtTimes(webId: dataServer.WebId, expression: expression2, times: "*-1d, *-2d"); PIItemsSummaryValue itemsSummaryValue = client.Calculation.GetSummary(expression: expression2, startTime: "*-1d", endTime: "*", webId: dataServer.WebId, summaryTypes: "Average, Maximum"); //Get the attribute's end of the stream value PITimedValue newValue = client.Stream.GetEnd(attribute.WebId); //Stream Updates PIItemsStreamUpdatesRegister piItemsStreamUpdatesRegister = client.StreamSet.RegisterStreamSetUpdates(webIds); List <string> markersList = piItemsStreamUpdatesRegister.Items.Select(i => i.LatestMarker).ToList(); string markers = String.Join(",", markersList.ToArray()); int k = 3; while (k > 0) { PIItemsStreamUpdatesRetrieve piItemsStreamUpdatesRetrieve = client.StreamSet.RetrieveStreamSetUpdates(markers); markersList = piItemsStreamUpdatesRetrieve.Items.Select(i => i.LatestMarker).ToList(); markers = String.Join(",", markersList.ToArray()); foreach (PIStreamUpdatesRetrieve item in piItemsStreamUpdatesRetrieve.Items) { foreach (PIDataPipeEvent piEvent in item.Events) { Console.WriteLine("Action={0}, Value={1}, SourcePath={2}", piEvent.Action, piEvent.Value, item.SourcePath); } } System.Threading.Thread.Sleep(30000); k--; } }
/// <summary>Update a point attribute value.</summary> public Object UpdateAttributeValue(string webId, string name, string value) { ApiResponseObject localVarResponse = UpdateAttributeValueWithHttpInfo(webId, name, value); return(localVarResponse.Data); }
/// <summary>Get the current versions of the PI Web API instance and all external plugins.</summary> public Object Versions() { ApiResponseObject localVarResponse = VersionsWithHttpInfo(); return(localVarResponse.Data); }
/// <summary>Create or update an attribute's DataReference configuration (Create/Update PI point for PI Point DataReference).</summary> public Object CreateConfig(string webId) { ApiResponseObject localVarResponse = CreateConfigWithHttpInfo(webId); return(localVarResponse.Data); }
/// <summary>Get the value of a configuration item.</summary> public Object Get(string key) { ApiResponseObject localVarResponse = GetWithHttpInfo(key); return(localVarResponse.Data); }
/// <summary>Set the value of a configuration item attribute. For attributes with a data reference or non-configuration item attributes, consult the documentation for streams.</summary> public Object SetValue(string webId, PITimedValue value) { ApiResponseObject localVarResponse = SetValueWithHttpInfo(webId, value); return(localVarResponse.Data); }
/// <summary>Create or update a configuration item.</summary> public Object Put(string key, string value) { ApiResponseObject localVarResponse = PutWithHttpInfo(key, value); return(localVarResponse.Data); }
/// <summary>Update a Time Rule by replacing items in its definition.</summary> public Object Update(string webId, PITimeRule timeRule) { ApiResponseObject localVarResponse = UpdateWithHttpInfo(webId, timeRule); return(localVarResponse.Data); }