public ActionResult EditOffer(TOffer oldOffer, string securityPercent, Lot4Offer[] lots, SecurityDoc[] securityDocs, String content1, String signature1, File[] files1, Contact[] contatcs, String content2, String signature2, File[] files2, DeletedFiles[] delFiles1, DeletedFiles[] delFiles2) { TOffer offer = new TOffer(); //fill offer info TOfferInfo offerInfo = new TOfferInfo(); offerInfo.OfferRegNumber = oldOffer.OfferInfo.OfferRegNumber; offerInfo.ExpiryOfferDate = oldOffer.OfferInfo.ExpiryOfferDate; offerInfo.SecurityPercent = oldOffer.OfferInfo.SecurityPercent; offerInfo.SubjectName = oldOffer.OfferInfo.SubjectName; offer.OfferInfo = offerInfo; offer.OfferID = oldOffer.OfferID; offer.AuctionHeader = oldOffer.AuctionHeader; offer.AuctionID = oldOffer.AuctionID; offer.AuctionStatusText = oldOffer.AuctionStatusText; offer.BudgetFunding = oldOffer.BudgetFunding; offer.BudgetFundingText = oldOffer.BudgetFundingText; offer.ServiceFeeFlag = oldOffer.ServiceFeeFlag; offer.ServiceFeeText = oldOffer.ServiceFeeText; offer.Participant = oldOffer.Participant; //fill lots data TOfferLotInfo[] offerLots = new TOfferLotInfo[lots == null ? 0 : lots.Length]; for (int i = 0; i < offerLots.Length; i++) { offerLots[i] = new TOfferLotInfo(); offerLots[i].AddInfo = lots[i].OtherInfo; //offerLots[i].AuctionLotStatusText = offerLots[i].AgreementConsent = 1; offerLots[i].Currency = lots[i].CurrencyCode; offerLots[i].CurrencyAbb = lots[i].Currency; offerLots[i].DeliveryDate = lots[i].Time; offerLots[i].DeliveryPlace = lots[i].Place; offerLots[i].Description = lots[i].Description; offerLots[i].EdIzm = lots[i].EdIzmCode; offerLots[i].EdIzmAbb = lots[i].EdIzm; offerLots[i].FundingSource = int.Parse(lots[i].FinanceSourceCode); offerLots[i].FundingSourceText = lots[i].FinanceSource; offerLots[i].LotID = lots[i].LotID; offerLots[i].LotVolume = string.IsNullOrEmpty(lots[i].Value) ? 0 : double.Parse(lots[i].Value.Trim().Replace(" ", ""), System.Globalization.CultureInfo.InvariantCulture); offerLots[i].NumLot = lots[i].NumLot; TOKRBRec[] okrb = new TOKRBRec[lots[i].OKRB.Length]; for (int j = 0; j < lots[i].OKRB.Length; j++) { TOKRBRec okrbRec = new TOKRBRec(); okrbRec.OKRBCode = lots[i].OKRB[j].OKRBCode; okrbRec.OKRBID = int.Parse(lots[i].OKRB[j].OKRBID); okrbRec.OKRBName = lots[i].OKRB[j].OKRBName; okrb[j] = okrbRec; } offerLots[i].OKRBList = okrb; offerLots[i].PrefPercent = string.IsNullOrEmpty(lots[i].Correction)? 0: double.Parse(lots[i].Correction.Trim().Replace(" ", ""), System.Globalization.CultureInfo.InvariantCulture); offerLots[i].PrefReason = lots[i].FoundingCorrection; offerLots[i].SecurityValue = string.IsNullOrEmpty(securityPercent) ? 0 : double.Parse(securityPercent.Trim().Replace(" ", ""), System.Globalization.CultureInfo.InvariantCulture); offerLots[i].StartPrice = string.IsNullOrEmpty(lots[i].Price) ? 0 : double.Parse(lots[i].Price.Trim().Replace(" ", ""), System.Globalization.CultureInfo.InvariantCulture); offerLots[i].VolumeMethod = lots[i].CalcMethod; } offer.Lots = offerLots; //fill contact data TContactPerson[] tContatcs = new TContactPerson[contatcs == null ? 0 : contatcs.Length]; for (int i = 0; i < contatcs.Length; i++) { tContatcs[i] = new TContactPerson(); tContatcs[i].FIO = contatcs[i].FIO; tContatcs[i].Phone = contatcs[i].Phones; tContatcs[i].Fax = contatcs[i].Fax; tContatcs[i].Email = contatcs[i].Email; tContatcs[i].AddInfo = contatcs[i].OtherInfo; } offer.ContactPersons = tContatcs; //fill security docs data TSecurityDoc[] tSecurityDocs = new TSecurityDoc[securityDocs == null ? 0 : securityDocs.Length]; for (int i = 0; i < tSecurityDocs.Length; i++) { tSecurityDocs[i] = new TSecurityDoc(); //tSecurityDocs[i].ConfirmDate = ...; tSecurityDocs[i].Currency = securityDocs[i].CurrencyCode; tSecurityDocs[i].CurrencyAbb = securityDocs[i].Currency; tSecurityDocs[i].DocDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(securityDocs[i].DocDate.Trim().Replace(" ", string.Empty))); tSecurityDocs[i].DocNum = securityDocs[i].DocNumber; tSecurityDocs[i].DocTypeText = securityDocs[i].SecurityView; tSecurityDocs[i].ExpiryDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(securityDocs[i].SecurityPeriod.Trim().Replace(" ", string.Empty))); tSecurityDocs[i].SecuritySum = string.IsNullOrEmpty(securityDocs[i].SecurityValue) ? 0 : double.Parse(securityDocs[i].SecurityValue, System.Globalization.CultureInfo.InvariantCulture); } offer.SecurityDocs = tSecurityDocs; GovernmentPurchases.WebReference.TEDContent eContent1 = new GovernmentPurchases.WebReference.TEDContent(); eContent1.Content = content1; eContent1.Signature = signature1; GovernmentPurchases.WebReference.TEDContent eContent2 = new GovernmentPurchases.WebReference.TEDContent(); eContent2.Content = content2; eContent2.Signature = signature2; int[] deletedFiles1 = null; if (delFiles1 != null) { deletedFiles1 = new int[delFiles1.Length]; for (int i = 0; i < delFiles1.Length; i++) { deletedFiles1[i] = delFiles1[i].DocID; } } else { deletedFiles1 = new int[0]; } int[] deletedFiles2 = null; if (delFiles2 != null) { deletedFiles2 = new int[delFiles2.Length]; for (int i = 0; i < delFiles2.Length; i++) { deletedFiles2[i] = delFiles2[i].DocID; } } else { deletedFiles2 = new int[0]; } //union int[] deletedFiles = new int[deletedFiles1.Length + deletedFiles2.Length]; Array.Copy(deletedFiles1, deletedFiles, deletedFiles1.Length); Array.Copy(deletedFiles2, 0, deletedFiles, deletedFiles1.Length, deletedFiles2.Length); TAuthHeader header = new TAuthHeader(); header.SessionID = (String)Session["sessionID"]; header.SessionKey = (String)Session["sessionKey"]; client.TAuthHeaderValue = header; client.EditOffer(offer, eContent1, eContent2, deletedFiles); int offerID = oldOffer.OfferID; //upload files GovernmentPurchases.IUploadFiles.IUploadFilesservice fileClient = new GovernmentPurchases.IUploadFiles.IUploadFilesservice(); //upload I section files if (files1 != null) { GovernmentPurchases.IUploadFiles.TEDocument document = new GovernmentPurchases.IUploadFiles.TEDocument(); GovernmentPurchases.IUploadFiles.TEDContent cont = new GovernmentPurchases.IUploadFiles.TEDContent(); for (int i = 0; i < files1.Length; i++) { document.IDParent = offerID; document.FileName = files1[i].FileName; document.NameDocument = files1[i].DocName; document.TypeDocument = files1[i].DocType; cont.Content = files1[i].Content; cont.Signature = files1[i].Signature; int DocID = new int(); fileClient.AddEDoc((String)Session["sessionID"], (String)Session["sessionKey"], C_LINK_OFFERS, document, cont, ref DocID); } } //upload II section files if (files2 != null) { GovernmentPurchases.IUploadFiles.TEDocument document = new GovernmentPurchases.IUploadFiles.TEDocument(); GovernmentPurchases.IUploadFiles.TEDContent cont = new GovernmentPurchases.IUploadFiles.TEDContent(); for (int i = 0; i < files2.Length; i++) { document.IDParent = offerID; document.FileName = files2[i].FileName; document.NameDocument = files2[i].DocName; document.TypeDocument = files2[i].DocType; cont.Content = files2[i].Content; cont.Signature = files2[i].Signature; int DocID = new int(); fileClient.AddEDoc((String)Session["sessionID"], (String)Session["sessionKey"], C_LINK_OFFERS, document, cont, ref DocID); } } AppLogger.Info(Session, "EditOffer: " + offerID); return Json(true); }
public ActionResult EditAuction(int auctionID, AuctionInitData auctionInitData, AuctionGeneralInfo generalInfo, Contact[] contacts, string auctionRole, Lot[] lots, String content, String signature, File[] files, DeletedFiles[] delFiles) { TAuction auction = new TAuction(); auction.AuctionID=auctionID; //заполняем шапку TAuctionHeader auctionHeader = new TAuctionHeader(); auctionHeader.AuctionRegNumber = auctionInitData.AuctionRegNumber; auctionHeader.PurchaseName = auctionInitData.PurchaseName; auctionHeader.PurchaseSite = auctionInitData.PurchaseSite; auction.AuctionHeader = auctionHeader; //заполняем информацию о заказчике TMemberInfo memeberInfo = new TMemberInfo(); memeberInfo.Address = auctionInitData.Address; memeberInfo.MemberRegNumber = auctionInitData.MemberRegNumber; memeberInfo.MemberType = int.Parse(auctionInitData.MemberType); memeberInfo.Name = auctionInitData.Name; memeberInfo.UNP = auctionInitData.UNP; auction.Customer = memeberInfo; //заполняем общую информацию об аукционе TAuctionInfo auctionInfo = new TAuctionInfo(); auctionInfo.AddInfo = generalInfo.AddInfo; auctionInfo.CodeTender = generalInfo.RegNum; //currency code auctionInfo.Currency = generalInfo.CurrencyCode; //currency label auctionInfo.CurrencyAbb = generalInfo.Currency; auctionInfo.EndOfferDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(generalInfo.EndOfferDate.Trim().Replace(" ", string.Empty))); auctionInfo.ExpiryOfferDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(generalInfo.TenderEndDate.Trim().Replace(" ", string.Empty))); auctionInfo.FinanceType = generalInfo.FinanceType; auctionInfo.MemberRequires = generalInfo.MemberRequires; auctionInfo.PublishDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(generalInfo.RegDate.Trim().Replace(" ", string.Empty))); auctionInfo.QualificationRequires = generalInfo.QualificationRequires; if (generalInfo.SecurityPercent != null) { auctionInfo.SecurityPercent = double.Parse(generalInfo.SecurityPercent, System.Globalization.CultureInfo.InvariantCulture); } else { auctionInfo.SecurityPercent = 0; } auctionInfo.ServiceFee = double.Parse(auctionInitData.ServiceFee, System.Globalization.CultureInfo.InvariantCulture); auctionInfo.TotalCost = double.Parse(auctionInitData.TotalCost, System.Globalization.CultureInfo.InvariantCulture); auctionInfo.SubjectName = generalInfo.Name; auctionInfo.TenderDate = DateTimeUtils.DateTimeToDouble(DateTime.Parse(generalInfo.TenderDate.Trim().Replace(" ", string.Empty) + " " + generalInfo.TenderTime.Trim().Replace(" ", string.Empty))); auction.AuctionInfo = auctionInfo; //заполняем роль заказчика auction.CustomerRoleText = auctionRole; //заполняем контактные лица TContactPerson[] contactsPerson = new TContactPerson[contacts.Length]; for (int i = 0; i < contacts.Length; i++) { TContactPerson contact = new TContactPerson(); contact.Email = contacts[i].Email; contact.FIO = contacts[i].FIO; contact.Phone = contacts[i].Phones; contact.Fax = contacts[i].Fax; contact.AddInfo = contacts[i].OtherInfo; contactsPerson[i] = contact; } auction.ContactPersons = contactsPerson; TLotInfo[] lotsInfo = new TLotInfo[lots.Length]; for (int i = 0; i < lots.Length; i++) { TLotInfo lotInfo = new TLotInfo(); lotInfo.AddInfo = lots[i].OtherInfo; //lotInfo.AgreementConsent= //lotInfo.AuctionLotStatusText= lotInfo.Currency = generalInfo.CurrencyCode; lotInfo.CurrencyAbb = generalInfo.Currency; lotInfo.DeliveryDate = lots[i].Time; lotInfo.DeliveryPlace = lots[i].Place; lotInfo.Description = lots[i].Description; lotInfo.EdIzm = lots[i].EdIzmCode; lotInfo.EdIzmAbb = lots[i].EdIzm; lotInfo.FundingSource = int.Parse(lots[i].FinanceSourceCode); lotInfo.FundingSourceText = lots[i].FinanceSource; //lotInfo.LotID= lotInfo.LotVolume = double.Parse(lots[i].Value, System.Globalization.CultureInfo.InvariantCulture); lotInfo.LotID = lots[i].LotID; lotInfo.NumLot = i + 1; //lotInfo.OfferLotStatusText= TOKRBRec[] okrb = new TOKRBRec[lots[i].OKRB.Length]; for (int j = 0; j < lots[i].OKRB.Length; j++) { TOKRBRec okrbRec = new TOKRBRec(); okrbRec.OKRBCode = lots[i].OKRB[j].OKRBCode; okrbRec.OKRBID = int.Parse(lots[i].OKRB[j].OKRBID); okrbRec.OKRBName = lots[i].OKRB[j].OKRBName; okrb[j] = okrbRec; } lotInfo.OKRBList = okrb; //lotInfo.PrefPercent = lots[i]. //lotInfo.PrefReason = lots[i]. //lotInfo.SecurityValue= lotInfo.StartPrice = double.Parse(lots[i].Price, System.Globalization.CultureInfo.InvariantCulture); lotInfo.VolumeMethod = lots[i].CalcMethod; lotsInfo[i] = lotInfo; } auction.Lots = lotsInfo; TEDContent eContent = new TEDContent(); eContent.Content = content; eContent.Signature = signature; int[] deletedFiles = null; if (delFiles != null) { deletedFiles = new int[delFiles.Length]; for (int i = 0; i < delFiles.Length; i++) { deletedFiles[i] = delFiles[i].DocID; } } else { deletedFiles = new int[0]; } TAuthHeader header = new TAuthHeader(); header.SessionID = (String)Session["sessionID"]; header.SessionKey = (String)Session["sessionKey"]; client.TAuthHeaderValue = header; client.EditAuction(auction, eContent, deletedFiles); if (files != null) { GovernmentPurchases.IUploadFiles.IUploadFilesservice fileClient = new GovernmentPurchases.IUploadFiles.IUploadFilesservice(); GovernmentPurchases.IUploadFiles.TEDocument document = new GovernmentPurchases.IUploadFiles.TEDocument(); GovernmentPurchases.IUploadFiles.TEDContent cont = new GovernmentPurchases.IUploadFiles.TEDContent(); for (int i = 0; i < files.Length; i++) { document.IDParent = auctionID; document.FileName = files[i].FileName; document.NameDocument = files[i].DocName; document.TypeDocument = files[i].DocType; cont.Content = files[i].Content; cont.Signature = files[i].Signature; int DocID = new int(); fileClient.AddEDoc((String)Session["sessionID"], (String)Session["sessionKey"], C_LINK_AUCTIONS, document, cont, ref DocID); } } client.LockAuctionForEdit(auctionID, 0); return Json(true); }