private void btnOK_Click(object sender, EventArgs e) { //船只航道费用资料 String BoatName = textBoatName.Text.Trim(); String Fare = textFare.Text; String Date = textDate.Text; String DeadLine = textDeadLine.Text; String TotalFare = textTotalFare.Text; //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "航道费用添加"; //通知时间 DateTime dt = new DateTime(); try { dt = DateTime.ParseExact(DeadLine, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); dt = dt.AddDays(-3); //通知时间为期限的前3天 } catch (Exception et) { MessageBox.Show(et.Message + ",输入的日期格式不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //连接数据库 SqlConnection conn = DataBase.Connect(); String str = "INSERT INTO 航道费纪录表 VALUES('" + BoatName + "', '" + Fare + "', '" + Date + "', '" + DeadLine + "', '" + TotalFare + "')"; String str1 = "select * from 船只基本资料 where 船只名称 = '" + BoatName + "'"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; try { if (!DataBase.Inquire(str1, conn)) { MessageBox.Show("船只不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DataBase.Insert(str, conn)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DataBase.Insert(str3, conn); //记录该操作 } catch (Exception ex) { MessageBox.Show(ex.Message, "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
/// <summary> /// Загрузка истории /// </summary> internal static void LoadHistory() { try { string sql = "SELECT * FROM OperationHistory"; lock (o) { ConnectionClient.ConOpen(); using (SqlCommand commmand = new SqlCommand(sql, ConnectionClient.connection)) { SqlDataReader reader = commmand.ExecuteReader(); while (reader.Read()) { OperationHistory oper = new OperationHistory((int)reader["Id"], (int)reader["OperationId"], (decimal)reader["Money"], (DateTime)reader["OperationDate"], (long)reader["AccountNumber"]); HIstoryRepository.OperationHistories.Add(oper); } } ConnectionClient.ConClose(); } } catch (SqlException e) { errorMes.ErrorSQL(e.Message); ConnectionClient.ConClose(); } catch (Exception e) { errorMes.ErrorSQL(e.Message); ConnectionClient.ConClose(); } finally { ConnectionClient.ConClose(); } }
private void btnDel_Click(object sender, EventArgs e) { String s = DateTime.Now.ToString(); String d; String n = null; //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "水运费删除"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; //连接数据库 SqlConnection conn = DataBase.Connect(); SqlDataReader dr = null; String str = "select * from 水运费表"; try { if (!DataBase.Inquire(str, conn)) { MessageBox.Show("记录不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataBase.Inquire(str, conn, ref dr); if (dr.Read()) { d = dr["水运费有效期"].ToString(); int i = d.CompareTo(s); if (i < 0) { n = dr["水运费有效期"].ToString(); String str1 = "DELETE FROM 水运费表 WHERE 水运费有效期 = '" + n + "' "; dr.Close(); if (DataBase.Delete(str1, conn)) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { MessageBox.Show("没有缴费过期记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } dr.Close(); DataBase.Insert(str3, conn); //记录该操作 } catch (Exception ex) { MessageBox.Show(ex.Message, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
/// <summary> /// Добавление истории /// </summary> /// <param name="item"></param> internal static void AddHistory(this OperationHistory item) { try { string sql = "INSERT INTO OperationHistory ( OperationId, Money, OperationDate, AccountNumber)" + " VALUES ( @OperationId, @Money, @OperationDate, @AccountNumber)"; ConnectionClient.ConOpen(); using (SqlCommand cmd = new SqlCommand(sql, ConnectionClient.connection)) { cmd.Parameters.AddWithValue("@OperationId", item.OperationId); cmd.Parameters.AddWithValue("@Money", item.Money); cmd.Parameters.AddWithValue("@OperationDate", item.OperationDate); cmd.Parameters.AddWithValue("@AccountNumber", item.AccountNumber); cmd.ExecuteNonQuery(); ConnectionClient.ConClose(); } } catch (SqlException e) { errorMes.ErrorSQL(e.Message); ConnectionClient.ConClose(); } catch (Exception e) { errorMes.ErrorSQL(e.Message); ConnectionClient.ConClose(); } }
/// <summary> /// Добавление истории /// </summary> /// <param name="history"></param> public void AddHistory(OperationHistory history) { if (history != null) { history.OperationDate = DateTime.Now; OperationHistories.Add(history); AddData.AddHistory(history); } }
public OperationHistory CreatePlaceMarketOrder(string figi, OperationType operationType, int lots, StopLossData stopLoss = null, TakeProfitData takeProfit = null) { OperationHistory operation = null; Task.Run(async() => operation = await CreatePlaceMarketOrderAsync(figi, operationType, lots, stopLoss, takeProfit)) .Wait(); return(operation); }
public AdderSpec() { Describe <Adder>(() => { It("can add a positive number to a negative number", () => { var adder = new Adder(); Expect(adder.Add(-1, 1)).ToEqual(0M); }); }); Describe <Adder>(() => { List <decimal[]> specs = new List <decimal[]> { // n1, n2, expected new[] { -7M, 3M, -4M }, new[] { 0M, 0M, 0M }, new[] { 999999999M, 1M, 1000000000M } }; foreach (var spec in specs) { It($"can add 2 numbers ({spec[0]}, {spec[1]})", () => { var adder = new Adder(); Expect(adder.Add(spec[0], spec[1])).ToEqual(spec[2]); }); } }); Describe <Adder>(() => { It("appends to history", () => { OperationHistory history = new OperationHistory(); Spy historySpy = Jaz.SpyOn(history, nameof(history.Append)); var adder = new Adder(history); adder.Add(-1, 1); Expect(historySpy).ToHaveBeenCalled(); }); }); Describe <Adder>(() => { Describe(nameof(Adder.Add), () => { It("can add a positive number to a negative number", () => { var adder = new Adder(); Expect(adder.Add(-1, 1)).ToEqual(0M); }); }); }); }
public async Task <int> UpsertAvgPriceAsync(IEnumerable <OperationHistoryEntity> entities) { var result = await OperationHistory.UpsertRange(entities) .On(e => new { e.OperationId, e.WalletId, e.AssetId }) .WhenMatched((oldEntity, newEntity) => new OperationHistoryEntity { OperationId = oldEntity.OperationId, OperationType = oldEntity.OperationType, AssetId = oldEntity.AssetId, WalletId = oldEntity.WalletId, Status = oldEntity.Status, TimeStamp = oldEntity.TimeStamp, Amount = oldEntity.Amount, Balance = oldEntity.Balance, TxId = oldEntity.TxId, FromAddress = oldEntity.FromAddress, DepositAmount = oldEntity.DepositAmount, ToAddress = oldEntity.ToAddress, WithdrawalAssetId = oldEntity.WithdrawalAssetId, WithdrawalAmount = oldEntity.WithdrawalAmount, SellAssetId = oldEntity.SellAssetId, SellAmount = oldEntity.SellAmount, BuyAssetId = oldEntity.BuyAssetId, BuyAmount = oldEntity.BuyAmount, FeeAssetId = oldEntity.FeeAssetId, FeeAmount = oldEntity.FeeAmount, FeePercent = oldEntity.FeePercent, Comment = oldEntity.Comment, FromPhoneNumber = oldEntity.FromPhoneNumber, ToPhoneNumber = oldEntity.ToPhoneNumber, IsInternal = oldEntity.IsInternal, Integration = oldEntity.Integration, SenderName = oldEntity.SenderName, CardLast4 = oldEntity.CardLast4, Network = oldEntity.Network, ScheduleType = oldEntity.ScheduleType, RecurringBuyId = oldEntity.RecurringBuyId, AvgOpenPrice = newEntity.AvgOpenPrice, AssetPriceInUsd = newEntity.AssetPriceInUsd, AssetPriceInEur = newEntity.AssetPriceInEur, }).RunAsync(); return(result); }
public static bool AddOrUpdate(OperationHistory operation) { var elem = operations.Where(x => x.id == operation.id).FirstOrDefault(); if (elem != null) { elem = operation; return(false); } operations.Add(operation); return(true); }
public void SaveHistory(OperationHistory operationType, Guid operationId, int brIsoId, int brId, int vId, int v2Id, int count, string details, Tuple <string, string> keys) { IScanService client = null; try { client = ScanServiceClient.CreateProxy(Program.SCAN_URL); client.SaveHistory(Program.currentUser.CountryID, Program.currentUser.UserID, operationType, operationId, brIsoId, brId, vId, v2Id, count, details, keys.Item1, keys.Item2); } finally { ((IDisposable)client).DisposeSf(); } }
public HistoryByCountryInfo[] ReadHistory(OperationHistory data, DateTime fromTime, DateTime toTime) { IScanService client = null; try { client = ScanServiceClient.CreateProxy(Program.SCAN_URL); var keys = Security.CreateInstance().GenerateSecurityKeys(); var list = client.ReadHistory(Program.currentUser.CountryID, Program.currentUser.UserID, data, fromTime, toTime, keys.Item1, keys.Item2); return(list); } finally { ((IDisposable)client).DisposeSf(); } }
public RepaymentViewModel(Accounts accounts) { repository = new CreditRepository(); this.GetAccounts = accounts; this.AccountId = accounts.Id; this.getrepayments = new List <Repayment>(); this.history = new OperationHistory(); CreditsItem = (Credits)Repository.GetAccountsId(accounts.Id); GetRepayments = repository.LoadRepayment(CreditsItem); DateClose = CreditsItem.OpenDate.AddMonths(CreditsItem.MonthsPeriod); history.AccountNumber = GetAccounts.AccountNumber; history.OperationDate = DateTime.Now; ViewHandler(); Money = AccountMoney; }
public void SaveHistory(int operatorCountryId, int operatorUserId, OperationHistory operationType, Guid operationId, int brIsoId, int brId, int vId, int v2Id, int count, string details, string s1, string s2) { try { if (!SecurityCheck(s1, s2)) { throw new Exception("Wrong caller id"); } RecordCallHistory("SaveHistory"); VoucherDataAccess.Instance.SaveHistory(operatorCountryId, operatorUserId, (int)operationType, operationId, brIsoId, brId, vId, v2Id, count, details); } catch (Exception ex) { throw new FaultException <MyApplicationFault>(new MyApplicationFault(), ex.Message); } }
private void btnDel_Click(object sender, EventArgs e) { String name = textBoatName.Text.Trim(); String No = textNo.Text.Trim(); //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "删除营运证"; //连接数据库 SqlConnection conn = DataBase.Connect(); String str = "delete from 船舶营运证 where 船名 = '" + name + "' and 营运证书编号 = '" + No + "'"; String str1 = "select * from 船舶营运证 where 营运证书编号 = '" + No + "'"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; String str2 = "delete from 各证书有效期 where 船名 = '" + name + "' and 证书编号 = '" + No + "'"; try { if (!DataBase.Inquire(str1, conn)) { MessageBox.Show("证书不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DataBase.Delete(str, conn)) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DataBase.Insert(str3, conn); //记录该操作 DataBase.Delete(str2, conn); //在有效期表删除该证书 } catch (Exception ex) { MessageBox.Show(ex.Message, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
public void LogOperation(OperationHistory operation, Guid session, int countryId, int branchId, int voucherId, int voucher2Id = 0, int count = 0, string message = null) { #if SCANNING IScanService client = null; try { client = ScanServiceClient.CreateProxy(Program.SCAN_IP); var keys = Security.CreateInstance().GenerateSecurityKeys(); client.SaveHistory(Program.currentUser.CountryID, Program.currentUser.UserID, operation, session, countryId, branchId, voucherId, voucher2Id, count, message, keys.Item1, keys.Item2); } finally { ((IDisposable)client).DisposeSf(); } #endif }
public void GetOperationsHistoryTest() { OperationHistoryRequest request = new OperationHistoryRequest(); //request.BalanceCurrencies.Add("BTC"); try { history = bbClient.History.GetOperationHistory(request); } catch (FailResponseException e) { Tools.HandlingErrors(e); return; } Assert.IsNotNull(history); if (history.Items.Count > 0) { Assert.AreEqual("BTC", history.Items[0].Balance.Currency); } }
private void btnUp_Click(object sender, EventArgs e) { //水运费用资料 String BoatName = textBoatName.Text.Trim(); String Date = textDate.Text; String DeadLine = textDeadLine.Text; String TotalFare = textTotalFare.Text; //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "水运费用更改"; //连接数据库 SqlConnection conn = DataBase.Connect(); String str = "UPDATE 水运费表 SET 交付日期 = '" + Date + "', 水运费合计 = '" + TotalFare + "', 水运费有效期 = '" + DeadLine + "'"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; try { if (DataBase.Update(str, conn)) { MessageBox.Show("更改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DataBase.Insert(str3, conn); //记录该操作 } catch (Exception ex) { MessageBox.Show(ex.Message, "更改失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
public async Task <OperationHistory> PlaceMarketOrderAsync(string figi, int lots, OperationType operationType, StopLossData stopLoss, TakeProfitData takeProfit) { var result = await _contextApi.PlaceMarketOrderAsync(figi, lots, operationType); if (stopLoss == null) { stopLoss = new StopLossData(); } if (takeProfit == null) { takeProfit = new TakeProfitData(); } var operationHistory = new OperationHistory { orderType = (operationType == OperationType.Buy) ? TinkoffApi.Data.Enums.OrderType.Buy : TinkoffApi.Data.Enums.OrderType.Sell, lots = lots, figi = figi, orderMode = _contextApi.GetMode(), time = ServerTime.GetDate(), orderId = result.OrderId, operationStatus = TinkoffApi.Data.Enums.OperationStatus.Progress, Commission = new TinkoffApi.Data.Models.MoneyAmount(), Price = 0.0, StopLoss = stopLoss, TakeProfit = takeProfit }; _context.OperationsHistory.Add(operationHistory); await SaveCurrentPortfolioBDAsync(); await _context.SaveChangesAsync(); _backgroundService.TaskFindOperation(_contextApi, figi, result.OrderId); return(operationHistory); }
/// <summary> /// Добавление нового счета /// </summary> /// <typeparam name="T">Personal</typeparam> /// <param name="model">Модель данных</param> private void AddPersonelAccount <T>(T model) { try { Personal personal = model as Personal; personal.Id = IdGenerator(); personal.AccountNumber = NumberGenerator(); personal.TypeId = 2; personal.AddPersonal(); OperationHistory operation = new OperationHistory { AccountNumber = personal.AccountNumber, Money = personal.Cash, OperationId = 1 }; operation.Create(operation); AddAccount(model); } catch (Exception e) { MessageBox.Show($"Добавление счета {e}"); } }
/// <summary> /// Добавление нового кредита /// </summary> /// <typeparam name="T">Credits</typeparam> /// <param name="model">Модель данных</param> private void AddCreditAccount <T>(T model) { try { Credits credits = model as Credits; credits.Id = IdGenerator(); credits.AccountNumber = NumberGenerator(); credits.TypeId = 4; // GetCredits.Add(credits); credits.AddCredits(); OperationHistory operation = new OperationHistory { AccountNumber = credits.AccountNumber, Money = credits.AmountIssue, OperationId = 7 }; operation.Create(operation); AddAccount(model); } catch (Exception e) { MessageBox.Show($"Добавление кредита {e}"); } }
/// <summary> /// Добавление нового вклада /// </summary> /// <typeparam name="T">Deposit</typeparam> /// <param name="model">Модель данных</param> private void AddDepositAccount <T>(T model) { try { Deposit deposit = model as Deposit; deposit.Id = IdGenerator(); deposit.AccountNumber = NumberGenerator(); deposit.TypeId = 3; // GetDeposits.Add(deposit); deposit.AddDeposit(); OperationHistory operation = new OperationHistory { AccountNumber = deposit.AccountNumber, Money = deposit.DepositAmount, OperationId = 5 }; operation.Create(operation); AddAccount(model); } catch (Exception e) { MessageBox.Show($"Добавление вклада {e}"); } }
public async Task PushElement(Operation operation, [FromServices] DaprClient daprClient) { logger.LogInformation($"Arrive event: {JsonSerializer.Serialize(operation)}"); var state = await daprClient.GetStateEntryAsync <OperationHistory>(StoreName, operation.OperationData.Id); logger.LogInformation($"Current state: {JsonSerializer.Serialize(state)}"); if (state.Value == null || state.Value.Operations.Count == 0) { var newHistory = new OperationHistory(new Collection <Operation> { operation }); await daprClient.SaveStateAsync(StoreName, operation.OperationData.Id, newHistory); logger.LogInformation($"Save new event"); } else { state.Value.AddOperation(operation); await state.SaveAsync(); logger.LogInformation($"Update event"); } }
public void ApplyOperation(OperationList operationEnum, dynamic[] args) { IsNotSaved = true; switch (operationEnum) { case OperationList.None: return; case OperationList.Resize: args = new dynamic[] { ResizeWidth, ResizeHeight }; break; case OperationList.Scale: args = new dynamic[] { ResizeScale }; break; case OperationList.Crop: if (selectionRect.Width > 0 && selectionRect.Height > 0) { args = new dynamic[] { Canvas.GetLeft(selectionRect), Canvas.GetTop(selectionRect), selectionRect.Width, selectionRect.Height }; IsSelectToolEnabled = false; break; } else { return; } case OperationList.Undo: if (HistoryIndex > 0) { HistoryIndex = HistoryIndex - 1; } return; case OperationList.Redo: if (HistoryIndex + 1 < OperationHistory.Count) { HistoryIndex = HistoryIndex + 1; } return; case OperationList.Reset: HistoryIndex = 0; OperationHistory.Clear(); History.Clear(); operationEnum = OperationList.Original; break; } DisableAllTools(); Dissolve(); Operation operation = Operations.ImageOperations[operationEnum]; DisplayImage(operation.Operate(image, args)); OperationHistory.Add(image); History.Add(operation.OperationName); HistoryIndex = History.Count - 1; }
public void SaveHistory(OperationHistory operationType, string details) { var keys = Security.CreateInstance().GenerateSecurityKeys(); SaveHistory(operationType, Guid.NewGuid(), 0, 0, 0, 0, 0, details, keys); }
private void btnOK_Click(object sender, EventArgs e) { //国籍资料 String BoatName = textBoatName.Text; String CerNo = textCerNo.Text.Trim(); String CerDeadLine = textCerDeadLine.Text; String BoatMan = textBoatMan.Text; String CerOutDate = textCerOutDate.Text; String CerOut = textCerOut.Text; //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "船舶国籍更改"; //证书有效期 CertificateValidityPeriod validDate = new CertificateValidityPeriod(); validDate.shipName = textBoatName.Text.Trim(); validDate.certificateName = "船舶国籍"; validDate.certificateLimit = textCerDeadLine.Text; validDate.certificateNo = textCerNo.Text.Trim(); //通知时间 DateTime dt = new DateTime(); try { dt = DateTime.ParseExact(validDate.certificateLimit, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); dt = dt.AddDays(-3); //通知时间为期限的前3天 } catch (Exception et) { MessageBox.Show(et.Message + ",输入的日期格式不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //连接数据库 SqlConnection conn = DataBase.Connect(); String str = "UPDATE 船舶国籍证书 SET 船名 = '" + BoatName + "', 证书编号 = '" + CerNo + "', 证书有效期 = '" + CerDeadLine + "', 船舶所有人 = '" + BoatMan + "', 发证日期 = '" + CerOutDate + "', 发证机关及其编号 = '" + CerOut + "'"; String str1 = "select * from 船只基本资料 where 船只名称 = '" + BoatName + "'"; String str2 = "UPDATE 各证书有效期 SET 证书名 = '" + validDate.certificateName + "', 证书有效期至 = '" + validDate.certificateLimit + "', 通知时间 = '" + dt.ToString("yyyy-MM-dd") + "'"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; try { if (!DataBase.Inquire(str1, conn)) { MessageBox.Show("船只不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DataBase.Insert(str, conn)) { MessageBox.Show("更改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DataBase.Update(str2, conn); //更新证书有效期表 DataBase.Insert(str3, conn); //记录该操作 } catch (Exception ex) { MessageBox.Show(ex.Message, "更改失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
private void btnOK_Click(object sender, EventArgs e) { //营运证资料 OperatingCertificates operatingCertificates = new OperatingCertificates(); operatingCertificates.BoatName = textBoatName.Text.Trim(); operatingCertificates.CerNo = lblYY.Text.Trim() + textCerNo.Text.Trim(); operatingCertificates.CerType = textCerType.Text.Trim(); operatingCertificates.CerOut = textCerOut.Text; operatingCertificates.CerOutDate = textCerOutDate.Text; operatingCertificates.CerOutNo = textCerOutNo.Text.Trim(); operatingCertificates.DeadLine = textDeadLine.Text; operatingCertificates.BoatRunnerName = textBoatRunnerName.Text.Trim(); operatingCertificates.RunnerNo = textRunnerNo.Text.Trim(); //历史操作 OperationHistory OH = new OperationHistory(); OH.userID = DataBase.userID; OH.operationDate = DateTime.Now.ToString(); OH.operationNanme = "营运证添加"; //证书有效期 CertificateValidityPeriod validDate = new CertificateValidityPeriod(); validDate.shipName = textBoatName.Text.Trim(); validDate.certificateName = "船舶营运证"; validDate.certificateLimit = textDeadLine.Text; validDate.certificateNo = lblYY.Text.Trim() + textCerNo.Text.Trim(); //通知时间 DateTime dt = new DateTime(); try { dt = DateTime.ParseExact(validDate.certificateLimit, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); dt = dt.AddDays(-3); //通知时间为期限的前3天 } catch (Exception et) { MessageBox.Show(et.Message + ",输入的日期格式不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //连接数据库 SqlConnection conn = DataBase.Connect(); String str = "INSERT INTO 船舶营运证 VALUES ('" + operatingCertificates.BoatName + "', '" + operatingCertificates.CerNo + "', '" + operatingCertificates.CerType + "', '" + operatingCertificates.BoatRunnerName + "', '" + operatingCertificates.RunnerNo + "', '" + operatingCertificates.CerOut + "', '" + operatingCertificates.CerOutNo + "', '" + operatingCertificates.CerOutDate + "', '" + operatingCertificates.DeadLine + "')"; String str1 = "select * from 船只基本资料 where 船只名称 = '" + operatingCertificates.BoatName + "'"; String str2 = "INSERT INTO 各证书有效期 VALUES ('" + validDate.shipName + "', '" + validDate.certificateNo + "', '" + validDate.certificateName + "','" + validDate.certificateLimit + "','" + dt.ToString("yyyy-MM-dd") + "')"; String str3 = "INSERT INTO 用户重要操作历史表 VALUES ('" + OH.userID + "', '" + OH.operationDate + "', '" + OH.operationNanme + "')"; try { if (!DataBase.Inquire(str1, conn)) { MessageBox.Show("船只不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DataBase.Insert(str, conn)) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } DataBase.Insert(str2, conn); //插入证书有效期表 DataBase.Insert(str3, conn); //记录该操作 } catch (Exception ex) { MessageBox.Show(ex.Message, "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DataBase.Close(conn); } }
public void SaveHistory(OperationHistory operationType, int brIsoId, int brId, int vId, int v2Id, int count, string details = "") { var keys = Security.CreateInstance().GenerateSecurityKeys(); SaveHistory(operationType, Guid.NewGuid(), brIsoId, brId, vId, v2Id, count, details, keys); }
public List <HistoryByCountryInfo> ReadHistory(int operatorCountryId, int?operatorUserId, OperationHistory operationType, DateTime from, DateTime to, string s1, string s2) { try { SecurityCheckThrow(s1, s2); RecordCallHistory("ReadHistory"); var list = VoucherDataAccess.Instance.SelectHistoryByCountryAndOperator(operatorCountryId, operatorUserId, (int)operationType, from, to); var resultList = new List <HistoryByCountryInfo>(); foreach (var data in list) { resultList.Add(new HistoryByCountryInfo(data)); } return(resultList); } catch (Exception ex) { throw new FaultException <MyApplicationFault>(new MyApplicationFault(), ex.Message); } }
public IList <OperationHistoryData> GetAllHistory(Guid id) { return(OperationHistory.ToJavaScriptCustomerHistory(_eventStoreRepository.All(id))); }
public async Task <OperationHistory> GetOperations(DateTime?startDate = null, DateTime?endDate = null) { await Login(); var result = new OperationHistory(); var operationsPageGetResult = await _httpClient.GetAsync(URL_OPERATIONS); var documentOperationsPageGet = new HtmlDocument(); documentOperationsPageGet.LoadHtml(await operationsPageGetResult.Content.ReadAsStringAsync()); var startDateFromPage = documentOperationsPageGet.DocumentNode.SelectSingleNode("//*[@id=\"ctl00_ContentPlaceHolder1_txtDataDeBolsa\"]").GetAttributeValue("value", ""); if (string.IsNullOrEmpty(startDateFromPage)) { throw new ApplicationException("Initial date not found."); } if (startDate.HasValue && startDate.Value < DateTime.ParseExact(startDateFromPage, "dd/MM/yyyy", null)) { throw new InvalidDateRangeException($"Start date needs be grater than { startDateFromPage }"); } var endDateFrompage = documentOperationsPageGet.DocumentNode.SelectSingleNode("//*[@id=\"ctl00_ContentPlaceHolder1_txtDataAteBolsa\"]").GetAttributeValue("value", ""); if (string.IsNullOrEmpty(endDateFrompage)) { throw new ApplicationException("End date not found."); } if (endDate.HasValue && endDate.Value > DateTime.ParseExact(endDateFrompage, "dd/MM/yyyy", null)) { throw new InvalidDateRangeException($"Start date needs be grater than { endDateFrompage }"); } var brokers = documentOperationsPageGet.DocumentNode.SelectSingleNode("//*[@id=\"ctl00_ContentPlaceHolder1_ddlAgentes\"]"); var brokersCodes = brokers.ChildNodes.Where(x => x.Name == "option" && x.GetAttributeValue("value", -1) != -1).Select(x => x.GetAttributeValue("value", -1)); foreach (var broker in brokersCodes) { var operationsPageForm = new List <KeyValuePair <string, string> >(); operationsPageForm.AddRange(GetHiddenFields(documentOperationsPageGet.DocumentNode)); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$hdnPDF_EXCEL", "")); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$ddlAgentes", broker.ToString())); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$ddlContas", "0")); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$txtDataDeBolsa", startDate.HasValue ? startDate.Value.ToString("dd/MM/yyyy") : startDateFromPage)); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$txtDataAteBolsa", endDate.HasValue ? endDate.Value.ToString("dd/MM/yyyy") : endDateFrompage)); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$ToolkitScriptManager1", "ctl00$ContentPlaceHolder1$updFiltro|ctl00$ContentPlaceHolder1$btnConsultar")); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00_ContentPlaceHolder1_ToolkitScriptManager1_HiddenField", "")); operationsPageForm.Add(new KeyValuePair <string, string>("ctl00$ContentPlaceHolder1$btnConsultar", "Consultar")); var operationsPagePostResult = await _httpClient.PostAsync(URL_OPERATIONS, new FormUrlEncodedContent(operationsPageForm)); var documentOperationsPagePost = new HtmlDocument(); documentOperationsPagePost.LoadHtml(await operationsPagePostResult.Content.ReadAsStringAsync()); var tables = documentOperationsPagePost.DocumentNode.SelectNodes("//table"); var tableOperations = tables.First(); var tbody = tableOperations.ChildNodes.SingleOrDefault(x => x.Name == "tbody"); if (tbody == null) { continue; } foreach (var rows in tbody.ChildNodes) { var columns = rows.ChildNodes.Where(x => x.Name == "td").ToList(); if (!columns.Any()) { continue; } var operation = new Operation { Date = DateTime.ParseExact(columns[0].InnerText.Trim(), "dd/MM/yyyy", null), OperationType = columns[1].InnerText.Trim(), Market = columns[2].InnerText.Trim(), Expiration = string.IsNullOrEmpty(columns[3].InnerText.Trim()) ? null : (DateTime?)DateTime.ParseExact(columns[3].InnerText.Trim(), "dd/MM/yyyy", null), Code = columns[4].InnerText.Trim(), Name = columns[5].InnerText.Trim(), Quantity = int.Parse(columns[6].InnerText.Trim()), Price = decimal.Parse(columns[7].InnerText.Trim().Replace(".", "").Replace(",", "."), NumberStyles.Currency), TotalValue = decimal.Parse(columns[8].InnerText.Trim().Replace(".", "").Replace(",", "."), NumberStyles.Currency), QuotationFactor = int.Parse(columns[9].InnerText.Trim()) }; result.Operations.Add(operation); } } return(result); }