private void ChangeSelection(object sender, SelectionChangedEventArgs e) { try { if (lstStocks.SelectedIndex == -1) { return; } else { greenArrow.Visibility = Visibility.Hidden; redArrow.Visibility = Visibility.Hidden; if (comboBoxExchange.SelectedItem.Equals("Nasdaq")) { string getURL = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/NASDAQ/details"; WebClient newWebClient = new WebClient(); newWebClient.Proxy = null; lblStockName.Content = lstStocks.SelectedItem; var newSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string receivedString = newWebClient.DownloadString(getURL + "/" + lstStocks.SelectedItem.ToString()); Nasdaq newNasdaq = newSerializer.Deserialize <Nasdaq>(receivedString); lblStockName.Content = newNasdaq.ticker; lblOpeningPrice.Content = newNasdaq.openingPrice; lblClosingPrice.Content = newNasdaq.closingPrice; lblHigh.Content = newNasdaq.high; lblLow.Content = newNasdaq.low; lblVolume.Content = newNasdaq.volume; lblTickerValue.Content = Math.Abs(newNasdaq.upArrow);; if (Decimal.Compare(newNasdaq.upArrow, 0) >= 0) { greenArrow.Visibility = Visibility.Visible; } else { redArrow.Visibility = Visibility.Visible; } string getURLChart = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/NASDAQ/variation"; string receivedStringChart = newWebClient.DownloadString(getURLChart + "/" + lstStocks.SelectedItem.ToString()); List <Nasdaq> newNasdaqList = newSerializer.Deserialize <List <Nasdaq> >(receivedStringChart); List <KeyValuePair <int, decimal> > newKeyValuePairChart = new List <KeyValuePair <int, decimal> >(); for (int i = 0; i < newNasdaqList.Count; i++) { newKeyValuePairChart.Add(new KeyValuePair <int, decimal>(newNasdaqList[i].exchangeDate, newNasdaqList[i].closingPrice)); } LineSeries newLineSeries = new LineSeries(); newLineSeries.Title = newNasdaq.ticker.ToString(); newLineSeries.ItemsSource = newKeyValuePairChart; newLineSeries.DependentValuePath = "Value"; newLineSeries.IndependentValuePath = "Key"; lineChart.Series.Clear(); lineChart.Series.Add(newLineSeries); lineChart.Title = "Price Trend"; } else if (comboBoxExchange.SelectedItem.Equals("Nyse")) //changed { string getURL = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/FOREX/details"; WebClient newWebClient = new WebClient(); newWebClient.Proxy = null; lblStockName.Content = lstStocks.SelectedItem; var newSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string receivedString = newWebClient.DownloadString(getURL + "/" + lstStocks.SelectedItem.ToString()); Forex newNasdaq = newSerializer.Deserialize <Forex>(receivedString); lblStockName.Content = newNasdaq.ticker; lblOpeningPrice.Content = newNasdaq.openingPrice; lblClosingPrice.Content = newNasdaq.closingPrice; lblHigh.Content = newNasdaq.high; lblLow.Content = newNasdaq.low; lblVolume.Content = newNasdaq.volume; lblTickerValue.Content = Math.Abs(newNasdaq.upArrow);; if (Decimal.Compare(newNasdaq.upArrow, 0) >= 0) { greenArrow.Visibility = Visibility.Visible; } else { redArrow.Visibility = Visibility.Visible; } string getURLChart = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/FOREX/variation"; string receivedStringChart = newWebClient.DownloadString(getURLChart + "/" + lstStocks.SelectedItem.ToString()); List <Forex> newNasdaqList = newSerializer.Deserialize <List <Forex> >(receivedStringChart); List <KeyValuePair <int, decimal> > newKeyValuePairChart = new List <KeyValuePair <int, decimal> >(); for (int i = 0; i < newNasdaqList.Count; i++) { newKeyValuePairChart.Add(new KeyValuePair <int, decimal>(newNasdaqList[i].exchangeDate, newNasdaqList[i].closingPrice)); } LineSeries newLineSeries = new LineSeries(); newLineSeries.Title = newNasdaq.ticker.ToString(); newLineSeries.ItemsSource = newKeyValuePairChart; newLineSeries.DependentValuePath = "Value"; newLineSeries.IndependentValuePath = "Key"; lineChart.Series.Clear(); lineChart.Series.Add(newLineSeries); lineChart.Title = "Price Trend"; } else { string getURL = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/LIFFE/details"; WebClient newWebClient = new WebClient(); newWebClient.Proxy = null; lblStockName.Content = lstStocks.SelectedItem; var newSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string receivedString = newWebClient.DownloadString(getURL + "/" + lstStocks.SelectedItem.ToString()); Liffe newNasdaq = newSerializer.Deserialize <Liffe>(receivedString); lblStockName.Content = newNasdaq.ticker; lblOpeningPrice.Content = newNasdaq.openingPrice; lblClosingPrice.Content = newNasdaq.closingPrice; lblHigh.Content = newNasdaq.high; lblLow.Content = newNasdaq.low; lblVolume.Content = newNasdaq.volume; lblTickerValue.Content = Math.Abs(newNasdaq.upArrow);; if (Decimal.Compare(newNasdaq.upArrow, 0) >= 0) { greenArrow.Visibility = Visibility.Visible; } else { redArrow.Visibility = Visibility.Visible; } string getURLChart = "http://10.87.198.158:8080/MarketDataAnalyserWeb/rest/stocks/LIFFE/variation"; string receivedStringChart = newWebClient.DownloadString(getURLChart + "/" + lstStocks.SelectedItem.ToString()); List <Liffe> newNasdaqList = newSerializer.Deserialize <List <Liffe> >(receivedStringChart); List <KeyValuePair <int, decimal> > newKeyValuePairChart = new List <KeyValuePair <int, decimal> >(); for (int i = 0; i < newNasdaqList.Count; i++) { newKeyValuePairChart.Add(new KeyValuePair <int, decimal>(newNasdaqList[i].exchangeDate, newNasdaqList[i].closingPrice)); } LineSeries newLineSeries = new LineSeries(); newLineSeries.Title = newNasdaq.ticker.ToString(); newLineSeries.ItemsSource = newKeyValuePairChart; newLineSeries.DependentValuePath = "Value"; newLineSeries.IndependentValuePath = "Key"; lineChart.Series.Clear(); lineChart.Series.Add(newLineSeries); lineChart.Title = "Price Trend"; } } } catch { MessageBox.Show("Server unavailable. Please check the connection."); } }
/*public void TraverseGraph() { * Vertex root = Vfirst; * int i=0,j=0; * Vertex next = root.Adjacent[i]; * * while(j<Nodes) { * * TestLibrary.Logging.WriteLine("root: " + root.Name); * while(next != null) { * TestLibrary.Logging.WriteLine(next.Name); * if(next.Name == j) {break;} * next = next.Adjacent[0]; * } * i++; * if((next = root.Adjacent[i]) == null) { * i=0; * j++; * if(root == Vlast) break; * else root = root.Next; * next = root.Adjacent[i]; * * } * } * * }*/ public void DeleteVertex() { Vertex temp1 = null; Vertex temp2 = _vfirst; DateTime time = DateTime.Now; Int32 seed = (Int32)time.Ticks; Random rand = new Random(seed); int j = rand.Next(0, Nodes); //TestLibrary.Logging.WriteLine("Deleting vertex: " + j); while (temp2 != null) { int i = Decimal.Compare(j, temp2.Name); if (i == 0) { if (temp2 == _vfirst) { temp2 = null; _vfirst = _vfirst.Next; break; } temp1.Next = temp2.Next; temp2 = null; break; } else { temp1 = temp2; temp2 = temp2.Next; } } // Restructuring the Graph TestLibrary.Logging.WriteLine("Restructuring the Graph..."); temp2 = _vfirst; while (temp2 != null) { temp2.DeleteAdjacentEntry(j); temp2 = temp2.Next; } Edge e1 = null; Edge e2 = _efirst; Edge temp = null; while (e2 != null) { int v1 = Decimal.Compare(j, e2.v1.Name); int v2 = Decimal.Compare(j, e2.v2.Name); if ((v1 == 0) || (v2 == 0)) { if (e2 == _efirst) { temp = e2; e2 = e2.Next; _efirst = _efirst.Next; temp = null; } else { temp = e1; e1.Next = e2.Next; e2 = e2.Next; } } else { e1 = e2; e2 = e2.Next; } } }
public async Task <IActionResult> Post([FromQuery] Int32 hid, Int32 loanAccountID, Int32?tmpdocid, [FromBody] FinanceDocumentUIViewModel repaydoc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // The post here is: // 1. Post a repayment document with the content from this template doc // 2. Update the template doc with REFDOCID // 3. If the account balance is zero, close the account; // Basic check if (hid <= 0 || (tmpdocid.HasValue && tmpdocid.Value <= 0) || loanAccountID <= 0 || repaydoc == null || repaydoc.HID != hid || repaydoc.DocType != FinanceDocTypeViewModel.DocType_Repay) { return(BadRequest("No data inputted!")); } SqlConnection conn = null; SqlCommand cmd = null; SqlDataReader reader = null; SqlTransaction tran = null; String queryString = String.Empty; String strErrMsg = String.Empty; HttpStatusCode errorCode = HttpStatusCode.OK; Decimal acntBalance = 0M; String usrName = String.Empty; if (Startup.UnitTestMode) { usrName = UnitTestUtility.UnitTestUser; } else { var usrObj = HIHAPIUtility.GetUserClaim(this); usrName = usrObj.Value; } if (String.IsNullOrEmpty(usrName)) { return(BadRequest("User cannot recognize")); } // Update the database FinanceTmpDocLoanViewModel vmTmpDoc = new FinanceTmpDocLoanViewModel(); HomeDefViewModel vmHome = new HomeDefViewModel(); FinanceAccountUIViewModel vmAccount = new FinanceAccountUIViewModel(); try { using (conn = new SqlConnection(Startup.DBConnectionString)) { await conn.OpenAsync(); // Check: HID, it requires more info than just check, so it implemented it try { HIHAPIUtility.CheckHIDAssignment(conn, hid, usrName); } catch (Exception) { errorCode = HttpStatusCode.BadRequest; throw; } // Check: DocID String checkString = ""; if (tmpdocid.HasValue) { checkString = HIHDBUtility.GetFinanceDocLoanListQueryString() + " WHERE [DOCID] = " + tmpdocid.Value.ToString() + " AND [HID] = " + hid.ToString(); cmd = new SqlCommand(checkString, conn); reader = cmd.ExecuteReader(); if (!reader.HasRows) { errorCode = HttpStatusCode.BadRequest; throw new Exception("Invalid Doc ID inputted: " + tmpdocid.Value.ToString()); } else { while (reader.Read()) { HIHDBUtility.FinTmpDocLoan_DB2VM(reader, vmTmpDoc); // It shall be only one entry if found! break; } } reader.Dispose(); reader = null; cmd.Dispose(); cmd = null; } // Check: Tmp doc has posted or not? if (vmTmpDoc == null || (vmTmpDoc.RefDocID.HasValue && vmTmpDoc.RefDocID.Value > 0) || vmTmpDoc.AccountID != loanAccountID) { errorCode = HttpStatusCode.BadRequest; throw new Exception("Tmp Doc not existed yet or has been posted"); } // Check: Loan account checkString = HIHDBUtility.GetFinanceLoanAccountQueryString(hid, loanAccountID); cmd = new SqlCommand(checkString, conn); reader = cmd.ExecuteReader(); if (!reader.HasRows) { errorCode = HttpStatusCode.BadRequest; throw new Exception("Loan account read failed based on Doc ID inputted: " + tmpdocid.ToString()); } else { if (reader.HasRows) { while (reader.Read()) { HIHDBUtility.FinAccountHeader_DB2VM(reader, vmAccount, 0); break; } } reader.NextResult(); vmAccount.ExtraInfo_Loan = new FinanceAccountExtLoanViewModel(); if (reader.HasRows) { while (reader.Read()) { HIHDBUtility.FinAccountLoan_DB2VM(reader, vmAccount.ExtraInfo_Loan, 0); break; } } reader.NextResult(); if (reader.HasRows) { while (reader.Read()) { if (!reader.IsDBNull(0)) { acntBalance = reader.GetDecimal(0); } break; } } } reader.Dispose(); reader = null; cmd.Dispose(); cmd = null; // Data validation - basic try { await FinanceDocumentController.FinanceDocumentBasicValidationAsync(repaydoc, conn); } catch (Exception) { errorCode = HttpStatusCode.BadRequest; throw; } // Data validation - loan specific try { int ninvaliditems = 0; // Only four tran. types are allowed if (vmAccount.CtgyID == FinanceAccountCtgyViewModel.AccountCategory_BorrowFrom) { ninvaliditems = repaydoc.Items.Where(item => item.TranType != FinanceTranTypeViewModel.TranType_InterestOut && item.TranType != FinanceTranTypeViewModel.TranType_RepaymentOut && item.TranType != FinanceTranTypeViewModel.TranType_RepaymentIn) .Count(); } else if (vmAccount.CtgyID == FinanceAccountCtgyViewModel.AccountCategory_LendTo) { ninvaliditems = repaydoc.Items.Where(item => item.TranType != FinanceTranTypeViewModel.TranType_InterestIn && item.TranType != FinanceTranTypeViewModel.TranType_RepaymentOut && item.TranType != FinanceTranTypeViewModel.TranType_RepaymentIn) .Count(); } if (ninvaliditems > 0) { throw new Exception("Items with invalid tran type"); } // Check the amount decimal totalOut = repaydoc.Items.Where(item => item.TranType == FinanceTranTypeViewModel.TranType_RepaymentOut).Sum(item2 => item2.TranAmount); decimal totalIn = repaydoc.Items.Where(item => item.TranType == FinanceTranTypeViewModel.TranType_RepaymentIn).Sum(item2 => item2.TranAmount); //decimal totalintOut = repaydoc.Items.Where(item => (item.TranType == FinanceTranTypeViewModel.TranType_InterestOut)).Sum(item2 => item2.TranAmount); // New account balance if (vmAccount.CtgyID == FinanceAccountCtgyViewModel.AccountCategory_BorrowFrom) { acntBalance += totalOut; } else if (vmAccount.CtgyID == FinanceAccountCtgyViewModel.AccountCategory_LendTo) { acntBalance -= totalIn; } if (totalOut != totalIn) { throw new Exception("Amount is not equal!"); } } catch (Exception) { errorCode = HttpStatusCode.BadRequest; throw; } // Now go ahead for the creating tran = conn.BeginTransaction(); Int32 nNewDocID = 0; // Now go ahead for creating queryString = HIHDBUtility.GetFinDocHeaderInsertString(); // Header cmd = new SqlCommand(queryString, conn) { Transaction = tran }; HIHDBUtility.BindFinDocHeaderInsertParameter(cmd, repaydoc, usrName); SqlParameter idparam = cmd.Parameters.AddWithValue("@Identity", SqlDbType.Int); idparam.Direction = ParameterDirection.Output; Int32 nRst = await cmd.ExecuteNonQueryAsync(); nNewDocID = (Int32)idparam.Value; repaydoc.ID = nNewDocID; cmd.Dispose(); cmd = null; // Then, creating the items foreach (FinanceDocumentItemUIViewModel ivm in repaydoc.Items) { queryString = HIHDBUtility.GetFinDocItemInsertString(); SqlCommand cmd2 = new SqlCommand(queryString, conn) { Transaction = tran }; HIHDBUtility.BindFinDocItemInsertParameter(cmd2, ivm, nNewDocID); await cmd2.ExecuteNonQueryAsync(); cmd2.Dispose(); cmd2 = null; } // Then, update the template doc queryString = @"UPDATE [dbo].[t_fin_tmpdoc_loan] SET [REFDOCID] = @REFDOCID ,[UPDATEDBY] = @UPDATEDBY ,[UPDATEDAT] = @UPDATEDAT WHERE [HID] = @HID AND [DOCID] = @DOCID"; SqlCommand cmdTmpDoc = new SqlCommand(queryString, conn) { Transaction = tran }; cmdTmpDoc.Parameters.AddWithValue("@REFDOCID", nNewDocID); cmdTmpDoc.Parameters.AddWithValue("@UPDATEDBY", usrName); cmdTmpDoc.Parameters.AddWithValue("@UPDATEDAT", DateTime.Now); cmdTmpDoc.Parameters.AddWithValue("@HID", hid); cmdTmpDoc.Parameters.AddWithValue("@DOCID", tmpdocid); await cmdTmpDoc.ExecuteNonQueryAsync(); cmdTmpDoc.Dispose(); cmdTmpDoc = null; // Incase balance is zero, update the account status if (Decimal.Compare(acntBalance, 0) == 0) { queryString = HIHDBUtility.GetFinanceAccountStatusUpdateString(); SqlCommand cmdAccount = new SqlCommand(queryString, conn, tran); HIHDBUtility.BindFinAccountStatusUpdateParameter(cmdAccount, FinanceAccountStatus.Closed, loanAccountID, hid, usrName); await cmdAccount.ExecuteNonQueryAsync(); cmdAccount.Dispose(); cmdAccount = null; } tran.Commit(); // Update the buffer of the relevant Account! // Account List try { var cacheKey = String.Format(CacheKeys.FinAccountList, hid, null); this._cache.Remove(cacheKey); cacheKey = String.Format(CacheKeys.FinAccount, hid, loanAccountID); this._cache.Remove(cacheKey); } catch (Exception) { // Do nothing here. } } } catch (Exception exp) { #if DEBUG System.Diagnostics.Debug.WriteLine(exp.Message); #endif if (tran != null) { tran.Rollback(); } strErrMsg = exp.Message; if (errorCode == HttpStatusCode.OK) { errorCode = HttpStatusCode.InternalServerError; } } finally { if (tran != null) { tran.Dispose(); tran = null; } if (reader != null) { reader.Dispose(); reader = null; } if (cmd != null) { cmd.Dispose(); cmd = null; } if (conn != null) { conn.Dispose(); conn = null; } } if (errorCode != HttpStatusCode.OK) { switch (errorCode) { case HttpStatusCode.Unauthorized: return(Unauthorized()); case HttpStatusCode.NotFound: return(NotFound()); case HttpStatusCode.BadRequest: return(BadRequest(strErrMsg)); default: return(StatusCode(500, strErrMsg)); } } var setting = new Newtonsoft.Json.JsonSerializerSettings { DateFormatString = HIHAPIConstants.DateFormatPattern, ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() }; return(new JsonResult(repaydoc, setting)); }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3PY_CPfB_1506 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); /* * 0. Get current fiscal year * 1. Get current's account business participant * 2. Get booking accounts for bill's revenue participant and debtor participant * 3. Find unpayed amount for bill * 4. Create accounting transaction with booking lines * 5. Create new bill header assigned payment entry and assign accunting transaction to installments * 6. Update dunning process if needed */ #region 0. Load current fiscal year Guid currentFiscalYearID = CL2_FiscalYear.Complex.Retrieval.cls_Get_Current_FiscalYear.Invoke(Connection, Transaction, securityTicket).Result.ACC_FiscalYearID; #endregion #region 1. Get current's account business participant Guid accountBPID = CL1_USR.ORM_USR_Account.Query.Search(Connection, Transaction, new CL1_USR.ORM_USR_Account.Query { USR_AccountID = securityTicket.AccountID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).Single().BusinessParticipant_RefID; #endregion #region 2. Get booking accounts for bill's revenue participant and debtor participant var param = new CL3_Payments.Complex.Retrieval.P_L3PY_GBAfBP_1521 { FiscalYearID = currentFiscalYearID, BillHeaderID = Parameter.BillHeaderID }; var billDataWithBookingAccounts = CL3_Payments.Complex.Retrieval.cls_Get_Booking_Accounts_for_Bill_Participants.Invoke(Connection, Transaction, param, securityTicket).Result; #endregion #region 3. Find unpayed amount for bill var payedParam = new CL3_Payments.Atomic.Retrieval.P_L3PY_GPAfB_1312 { BillHeaderID_List = new Guid[] { Parameter.BillHeaderID } }; var payed = CL3_Payments.Atomic.Retrieval.cls_Get_Payed_Amount_for_Bills.Invoke(Connection, Transaction, payedParam, securityTicket).Result; decimal amountLeftToBePayed = billDataWithBookingAccounts.Bill.TotalValuee_with_DunningFees_IncludingTax - payed.Single(x => x.BillHeaderID == Parameter.BillHeaderID).TotalPayedValue; // check if amount left to be payed is zero or if the amount for the current payment is larger than amount that is left to pay and send error status if (Decimal.Compare(amountLeftToBePayed, Decimal.Zero) == 0) { throw new Exception("Amount left to be payed is zero."); } else if (Decimal.Compare((amountLeftToBePayed - Parameter.Amount), Decimal.Zero) < 0) { throw new Exception("Amount for the current payment is larger than amount that is left to pay for this bill"); } #endregion #region 4. Create accounting transaction with booking lines var transactionParam = new CL3_BookingAccounts.Complex.Manipulation.P_L3BA_CATwBL_1315 { AccountingTransactionTypeID = Guid.Empty, CurrencyID = billDataWithBookingAccounts.Bill.CurrencyID, DateOfTransaction = Parameter.PaymentDate }; var bookingLines = new List <CL3_BookingAccounts.Complex.Manipulation.P_L3BA_CATwBL_1315a>(); CL3_BookingAccounts.Complex.Manipulation.P_L3BA_CATwBL_1315a bookingLine = null; #region Customer Account booking line bookingLine = new CL3_BookingAccounts.Complex.Manipulation.P_L3BA_CATwBL_1315a(); bookingLine.BookingAccountID = billDataWithBookingAccounts.CustomerAccount.BookingAccountID; // Debtor account: Arrived amount is booked with positive sign bookingLine.TransactionValue = Parameter.Amount; bookingLines.Add(bookingLine); #endregion Guid tenantBPID = CL1_CMN_BPT.ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new CL1_CMN_BPT.ORM_CMN_BPT_BusinessParticipant.Query { IfTenant_Tenant_RefID = securityTicket.TenantID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).Single().CMN_BPT_BusinessParticipantID; var bankAccountParam = new CL3_BookingAccounts.Atomic.Retrieval.P_L3BA_GBAPBPAfBP_1717 { BusinessParticipantID_List = new Guid[] { tenantBPID }, FiscalYearID = currentFiscalYearID, IsBankAccount = true }; var bankAccount = CL3_BookingAccounts.Atomic.Retrieval.cls_Get_BookingAccount_Purpose_BPAssignment_for_BPID_List.Invoke( Connection, Transaction, bankAccountParam, securityTicket).Result.SingleOrDefault(); if (bankAccount != null) { #region Tenant's Bank Account booking line bookingLine = new CL3_BookingAccounts.Complex.Manipulation.P_L3BA_CATwBL_1315a(); bookingLine.BookingAccountID = bankAccount.BookingAccount_RefID; // On the tenants bank account the arrived amount is booked with negative sign bookingLine.TransactionValue = -1 * Parameter.Amount; bookingLines.Add(bookingLine); #endregion transactionParam.BookingLines = bookingLines.ToArray(); Guid accountTransactionID = CL3_BookingAccounts.Complex.Manipulation.cls_Create_Accounting_Transaction_with_BookingLines.Invoke( Connection, Transaction, transactionParam, securityTicket).Result; #endregion #region 5. Create new bill header assigned payment entry and assign accunting transaction to installments bool isFullyPaid = Decimal.Compare((amountLeftToBePayed - Parameter.Amount), Decimal.Zero) == 0; // if the whole bill is payed before -- stop if (Decimal.Compare(amountLeftToBePayed, Decimal.Zero) == 0) { return(returnValue); } // if this transaction will pay the rest of the bill set flag on the bill else if (isFullyPaid) { var billHeader = new CL1_BIL.ORM_BIL_BillHeader(); billHeader.Load(Connection, Transaction, Parameter.BillHeaderID); billHeader.IsFullyPaid = true; billHeader.Save(Connection, Transaction); } var assignParam = new P_L3PY_AATtB_1107 { AccountTransactionID = accountTransactionID, AssignedAmount = Parameter.Amount, BillHeaderID = Parameter.BillHeaderID, PaymentDate = Parameter.PaymentDate }; cls_Assign_AccountingTransaction_to_Bill.Invoke(Connection, Transaction, assignParam, securityTicket); #region Load taxes and bill positions for taxes per position var billPositions = CL1_BIL.ORM_BIL_BillPosition.Query.Search(Connection, Transaction, new CL1_BIL.ORM_BIL_BillPosition.Query { BIL_BilHeader_RefID = Parameter.BillHeaderID }); Guid[] applicableTaxes = billPositions.Select(x => x.ApplicableSalesTax_RefID).Distinct().ToArray(); var revenueAccountsParam = new CL3_BookingAccounts.Atomic.Retrieval.P_L3BA_GAfTaFY_1647 { FiscalYearID = currentFiscalYearID, TaxID = applicableTaxes, IsTaxAccount = false, IsRevenueAccount = true }; var revenueAccountAssignments = CL3_BookingAccounts.Atomic.Retrieval.cls_Get_Assignment_for_TaxID_List_and_FiscalYearID.Invoke( Connection, Transaction, revenueAccountsParam, securityTicket).Result; #endregion var balanceParam = new P_L3PY_CBCfAT_1329 { AccountingTransactionID = accountTransactionID, BookingAccountID = bankAccount.BookingAccount_RefID, Amount = Parameter.Amount }; cls_Create_BalanceChange_for_AccountingTransaction.Invoke(Connection, Transaction, balanceParam, securityTicket); #endregion #region 6. Update dunning process if needed var dunningProcessMemberBill = CL1_ACC_DUN.ORM_ACC_DUN_DunningProcess_MemberBill.Query.Search(Connection, Transaction, new CL1_ACC_DUN.ORM_ACC_DUN_DunningProcess_MemberBill.Query { BIL_BillHeader_RefID = Parameter.BillHeaderID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).SingleOrDefault(); if (dunningProcessMemberBill != null) { dunningProcessMemberBill.CurrentUnpaidBillFraction = amountLeftToBePayed; dunningProcessMemberBill.Save(Connection, Transaction); var dunningProcess = CL1_ACC_DUN.ORM_ACC_DUN_DunningProcess.Query.Search(Connection, Transaction, new CL1_ACC_DUN.ORM_ACC_DUN_DunningProcess.Query { ACC_DUN_DunningProcessID = dunningProcessMemberBill.ACC_DUN_DunningProcess_RefID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).Single(); if (isFullyPaid) { dunningProcess.IsDunningProcessClosed = true; dunningProcess.DunningProcessClosedAt_Date = DateTime.Now; dunningProcess.DunningProcessClosedBy_BusinessParticipnant_RefID = accountBPID; dunningProcess.Save(Connection, Transaction); } } } #endregion return(returnValue); #endregion UserCode }
void DisplayData() { Text = "Edit Class (" + MyAT.ClassName + " - " + MyAT.DisplayName + ")"; txtName.Text = MyAT.DisplayName; txtClassName.Text = MyAT.ClassName; cbClassType.BeginUpdate(); cbClassType.Items.Clear(); cbClassType.Items.AddRange(Enum.GetNames(MyAT.ClassType.GetType())); if (MyAT.ClassType > ~Enums.eClassType.None & MyAT.ClassType < (Enums.eClassType)cbClassType.Items.Count) { cbClassType.SelectedIndex = (int)MyAT.ClassType; } else { cbClassType.SelectedIndex = 0; } cbClassType.EndUpdate(); udColumn.Value = !(Decimal.Compare(new Decimal(MyAT.Column + 2), udColumn.Maximum) <= 0 & Decimal.Compare(new Decimal(MyAT.Column), udColumn.Minimum) >= 0) ? udColumn.Minimum : new Decimal(MyAT.Column); udThreat.Value = !(MyAT.BaseThreat > (double)Convert.ToSingle(udThreat.Maximum) | MyAT.BaseThreat < (double)Convert.ToSingle(udThreat.Minimum)) ? new Decimal(MyAT.BaseThreat) : new Decimal(0); chkPlayable.Checked = MyAT.Playable; txtHP.Text = Convert.ToString(MyAT.Hitpoints); txtHPCap.Text = Convert.ToString(MyAT.HPCap); txtResCap.Text = Convert.ToString(MyAT.ResCap * 100f); txtDamCap.Text = Convert.ToString(MyAT.DamageCap * 100f); txtRechargeCap.Text = Convert.ToString(MyAT.RechargeCap * 100f); txtRecCap.Text = Convert.ToString(MyAT.RecoveryCap * 100f); txtRegCap.Text = Convert.ToString(MyAT.RegenCap * 100f); txtBaseRec.Text = Strings.Format(MyAT.BaseRecovery, "##0" + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator + "00##"); txtBaseRegen.Text = Strings.Format(MyAT.BaseRegen, "##0" + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator + "00##"); txtPerceptionCap.Text = Convert.ToString(MyAT.PerceptionCap); cbPriGroup.BeginUpdate(); cbSecGroup.BeginUpdate(); cbPriGroup.Items.Clear(); cbSecGroup.Items.Clear(); foreach (string key in DatabaseAPI.Database.PowersetGroups.Keys) { cbPriGroup.Items.Add(key); cbSecGroup.Items.Add(key); } cbPriGroup.SelectedValue = MyAT.PrimaryGroup; cbSecGroup.SelectedValue = MyAT.SecondaryGroup; cbPriGroup.EndUpdate(); cbSecGroup.EndUpdate(); udColumn.Value = new Decimal(MyAT.Column); clbOrigin.BeginUpdate(); clbOrigin.Items.Clear(); foreach (Origin origin in DatabaseAPI.Database.Origins) { bool isChecked = false; int num = MyAT.Origin.Length - 1; for (int index = 0; index <= num; ++index) { if (origin.Name.ToLower() == MyAT.Origin[index].ToLower()) { isChecked = true; } } clbOrigin.Items.Add(origin.Name, isChecked); } clbOrigin.EndUpdate(); txtDescShort.Text = MyAT.DescShort; txtDescLong.Text = MyAT.DescLong; }
/// <summary> /// Compares this instance to another <typeparamref name="T"/> instance. /// </summary> /// <param name="obj"></param> /// <returns></returns> public int CompareTo(T that) { return(Decimal.Compare(Convert.ToDecimal(this), Convert.ToDecimal(that))); }
public int Compare(object x, object y) { ListViewItem lviX = x as ListViewItem; ListViewItem lviY = y as ListViewItem; int result; if (lviX == null && lviY == null) { result = 0; } else if (lviX == null) { result = -1; } else if (lviY == null) { result = 1; } switch (ColumnType) { case ColumnDataType.DateTime: DateTime xDt = DataParseUtility.ParseDate(lviX.SubItems[ColumnIndex].Text); DateTime yDt = DataParseUtility.ParseDate(lviY.SubItems[ColumnIndex].Text); result = DateTime.Compare(xDt, yDt); break; case ColumnDataType.Decimal: Decimal xD = DataParseUtility.ParseDecimal(lviX.SubItems[ColumnIndex].Text.Replace("$", string.Empty).Replace(",", string.Empty)); Decimal yD = DataParseUtility.ParseDecimal(lviY.SubItems[ColumnIndex].Text.Replace("$", string.Empty).Replace(",", string.Empty)); result = Decimal.Compare(xD, yD); break; case ColumnDataType.Short: short xShort = DataParseUtility.ParseShort(lviX.SubItems[ColumnIndex].Text); short yShort = DataParseUtility.ParseShort(lviY.SubItems[ColumnIndex].Text); result = xShort.CompareTo(yShort); break; case ColumnDataType.Int: int xInt = DataParseUtility.ParseInt(lviX.SubItems[ColumnIndex].Text); int yInt = DataParseUtility.ParseInt(lviY.SubItems[ColumnIndex].Text); return(xInt.CompareTo(yInt)); break; case ColumnDataType.Long: long xLong = DataParseUtility.ParseLong(lviX.SubItems[ColumnIndex].Text); long yLong = DataParseUtility.ParseLong(lviY.SubItems[ColumnIndex].Text); return(xLong.CompareTo(yLong)); break; default: result = string.Compare( lviX.SubItems[ColumnIndex].Text, lviY.SubItems[ColumnIndex].Text, false); break; } if (SortDirection == SortOrder.Descending) { return(-result); } else { return(result); } }
public async System.Threading.Tasks.Task TestRemainingBudget() { await HomePageViewModel.CalcMonth(); Assert.IsTrue(Decimal.Compare(HomePageViewModel.currentMonth, Convert.ToDecimal(925.00)) < 0); }
static IEnumerable <PriceLevel> Diff(SortedDictionary <decimal, Level> prev, SortedDictionary <decimal, Level> cur) { using (var enumPrev = prev.GetEnumerator()) using (var enumCur = cur.GetEnumerator()) { bool validPrev = enumPrev.MoveNext(); bool validCur = enumCur.MoveNext(); while (validPrev && validCur) { int cmp = Decimal.Compare(enumPrev.Current.Key, enumCur.Current.Key); if (cmp < 0) { // A price level has disappeared from the order book. var kv = enumPrev.Current; if (kv.Value.TotalSize > 0) { yield return new PriceLevel() { Price = kv.Key, SizeDelta = -kv.Value.TotalSize } } ; validPrev = enumPrev.MoveNext(); } else if (cmp > 0) { // A new price level has appeared in the order book. var kv = enumCur.Current; if (kv.Value.TotalSize > 0) { yield return new PriceLevel() { Price = kv.Key, SizeDelta = kv.Value.TotalSize } } ; validCur = enumCur.MoveNext(); } else { // A potential change in size within a price level. decimal sizePrev = enumPrev.Current.Value.TotalSize; decimal sizeCur = enumCur.Current.Value.TotalSize; if (sizeCur != sizePrev) { yield return(new PriceLevel() { Price = enumCur.Current.Key, SizeDelta = sizeCur - sizePrev }); } validPrev = enumPrev.MoveNext(); validCur = enumCur.MoveNext(); } } while (validPrev) { // A price level has disappeared from the order book. var kv = enumPrev.Current; if (kv.Value.TotalSize > 0) { yield return new PriceLevel() { Price = kv.Key, SizeDelta = -kv.Value.TotalSize } } ; validPrev = enumPrev.MoveNext(); } while (validCur) { // A new price level has appeared in the order book. var kv = enumCur.Current; if (kv.Value.TotalSize > 0) { yield return new PriceLevel() { Price = kv.Key, SizeDelta = kv.Value.TotalSize } } ; validCur = enumCur.MoveNext(); } } }
/// <summary> /// Проверка наличия необходимых средств на счете для совершения проводки /// </summary> /// <param name="balanceIn">Входящий баланс счета</param> /// <param name="ammountIn">Сумма изменения</param> /// <returns>Исходящий баланс</returns> public bool ValidateAmmount(decimal balanceIn, decimal ammountIn) => Decimal.Compare(ammountIn, balanceIn) > 0;
public async System.Threading.Tasks.Task TestDailyTotalAsync() { await HomePageViewModel.CalcMonth(); Assert.IsTrue(Decimal.Compare(HomePageViewModel.dailyTot, Convert.ToDecimal(75.00)) == 0); }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3PY_AFVfATtB_0934 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); /* * 0. Find current fiscal year if none is given by the parameter * 1. Load bill to find recepient's BPID * 2. Find all values from accounting transactions that are not fully assigned to other bills * 3. Assign maximum free amount that needs to be assigned to bill */ #region 0. Find current fiscal year if none is given by the parameter Guid currentFiscalYearID = Parameter.FiscalYearID; if (currentFiscalYearID == Guid.Empty) { currentFiscalYearID = CL2_FiscalYear.Complex.Retrieval.cls_Get_Current_FiscalYear.Invoke( Connection, Transaction, securityTicket).Result.ACC_FiscalYearID; } #endregion #region 1. Load bill to find recepient's BPID var billHeader = new CL1_BIL.ORM_BIL_BillHeader(); billHeader.Load(Connection, Transaction, Parameter.BillHeaderID); #endregion #region 2. Find all values from accounting transactions that are not fully assigned to other bills var unassignedParam = new CL3_Payments.Atomic.Retrieval.P_L3PY_GAATNFAtP_0846 { FiscalYearID = currentFiscalYearID, BusinessParticipantID = billHeader.BillRecipient_BuisnessParticipant_RefID }; var transactions = CL3_Payments.Atomic.Retrieval.cls_Get_All_AccountingTransactions_Not_Fully_Assigned_to_Payments.Invoke( Connection, Transaction, unassignedParam, securityTicket).Result.Where(x => x.UnassignedTransactionValue > 0); #endregion #region 3. Assign maximum free amount that needs to be assigned to bill var payedParam = new CL3_Payments.Atomic.Retrieval.P_L3PY_GPAfB_1312 { BillHeaderID_List = new Guid[] { Parameter.BillHeaderID } }; var payed = CL3_Payments.Atomic.Retrieval.cls_Get_Payed_Amount_for_Bills.Invoke(Connection, Transaction, payedParam, securityTicket).Result; decimal amountLeftToBill = billHeader.TotalValue_IncludingTax - payed.Single(x => x.BillHeaderID == Parameter.BillHeaderID).TotalPayedValue; foreach (var item in transactions) { // if the whole bill is payed with transaction - stop the iteration if (Decimal.Compare(amountLeftToBill, Decimal.Zero) == 0) { break; } decimal assignedAmount = item.UnassignedTransactionValue; if (amountLeftToBill > item.UnassignedTransactionValue) { assignedAmount = amountLeftToBill; } var assignParam = new P_L3PY_AATtB_1107 { AccountTransactionID = item.AccountingTransactionID, AssignedAmount = assignedAmount, BillHeaderID = Parameter.BillHeaderID }; cls_Assign_AccountingTransaction_to_Bill.Invoke(Connection, Transaction, assignParam, securityTicket); } #endregion return(returnValue); #endregion UserCode }
private void btnGatherData_Click(object sender, EventArgs e) { strFilter = ""; dvGongDan.RowFilter = ""; this.dgvGongDanData.DataSource = DBNull.Value; SqlConnection gdConn = new SqlConnection(SqlLib.StrSqlConnection); if (gdConn.State == ConnectionState.Closed) { gdConn.Open(); } SqlCommand gdComm = new SqlCommand(); gdComm.Connection = gdConn; gdComm.CommandText = @"SELECT COUNT(*) FROM M_DailyGongDanList WHERE [GD Pending] = 0"; int iCount = Convert.ToInt32(gdComm.ExecuteScalar()); if (iCount == 0) { MessageBox.Show("There is no data in GongDan list.", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Stop); gdComm.Dispose(); gdConn.Dispose(); return; } SqlDataAdapter gdAdapter = new SqlDataAdapter("SELECT * FROM V_QueryGongDan", gdConn); dtGongDan.Reset(); gdAdapter.Fill(dtGongDan); gdAdapter = new SqlDataAdapter("SELECT DISTINCT [GongDan No] FROM M_DailyGongDan", gdConn); DataTable dtGDL = new DataTable(); gdAdapter.Fill(dtGDL); // if gongdan is in both table M_DailyGongDan (dtGDL) and M_DailyGongDanList (dtGongDan), delete gongDan record in table M_DailyGongDan (dtGDL) if (dtGDL.Rows.Count > 0) { string strGongDanList = null; foreach (DataRow row in dtGDL.Rows) { string strGongDanNo = row[0].ToString().Trim(); DataRow[] dr = dtGongDan.Select("[GongDan No] = '" + strGongDanNo + "'"); if (dr.Length > 0) { strGongDanList += "'" + strGongDanNo + "',"; } } if (!String.IsNullOrEmpty(strGongDanList)) { strGongDanList = strGongDanList.Remove(strGongDanList.Length - 1); gdComm.CommandText = "DELETE FROM M_DailyGongDan WHERE [GongDan No] IN (" + strGongDanList + ")"; gdComm.ExecuteNonQuery(); } } dtGDL.Dispose(); dtGongDan.Columns.Add("Total RM Cost(USD)", typeof(decimal)); dtGongDan.Columns["Total RM Cost(USD)"].DefaultValue = 0.0M; dtGongDan.Columns["Total RM Cost(USD)"].SetOrdinal(20); dtGongDan.Columns.Add("RM Used Qty", typeof(decimal)); dtGongDan.Columns["RM Used Qty"].DefaultValue = 0.0M; dtGongDan.Columns["RM Used Qty"].SetOrdinal(21); dtGongDan.Columns.Add("Drools Quota", typeof(decimal)); dtGongDan.Columns["Drools Quota"].DefaultValue = 0.0M; dtGongDan.Columns["Drools Quota"].SetOrdinal(26); foreach (DataRow dr in dtGongDan.Rows) { string strGongDanNo = dr["GongDan No"].ToString().Trim(); int iGongDanQty = Convert.ToInt32(dr["GongDan Qty"].ToString().Trim()); decimal dDroolsRate = Convert.ToDecimal(dr["Qty Loss Rate"].ToString().Trim()) / 100.0M; decimal dConsumption = Convert.ToDecimal(dr["Consumption"].ToString().Trim()); decimal dRmUsedQty = 0.0M; if (Decimal.Compare(dDroolsRate, 1.0M) == 0) { dRmUsedQty = 0.0M; } else { dRmUsedQty = iGongDanQty * dConsumption / (1.0M - dDroolsRate); } dr["RM Used Qty"] = Math.Round(dRmUsedQty, 6); decimal dRMPrice = 0.0M; if (String.Compare(dr["RM Currency"].ToString().Trim(), "USD") != 0) { dRMPrice = Convert.ToDecimal(dr["RM Price"].ToString().Trim()) * this.GetExchangeRate(dr["RM Currency"].ToString().Trim()); } else { dRMPrice = Convert.ToDecimal(dr["RM Price"].ToString().Trim()); } decimal dTotalRMCost = Math.Round(dRMPrice * dRmUsedQty, 2); dr["Total RM Cost(USD)"] = dTotalRMCost; //if order price is 0 (say for scrap sales), use total RM cost as selling price decimal dOrderPrice = Convert.ToDecimal(dr["Order Price"].ToString().Trim()); //if (dOrderPrice == 0.0M) //{ // //decimal totalRMcost = dtGongDan.Select("SE") // //dOrderPrice = Math.Round(dTotalRMCost / Convert.ToDecimal(dr["GongDan Qty"].ToString().Trim()), 4); //} decimal dDroolsQuota = Math.Round(dRmUsedQty * dDroolsRate, 6); dr["Drools Quota"] = dDroolsQuota; gdComm.Parameters.Add("@ActualStartDate", SqlDbType.NVarChar).Value = dr["Actual Start Date"].ToString().Trim(); gdComm.Parameters.Add("@ActualEndDate", SqlDbType.NVarChar).Value = dr["Actual End Date"].ToString().Trim(); gdComm.Parameters.Add("@BatchPath", SqlDbType.NVarChar).Value = dr["Batch Path"].ToString().Trim(); gdComm.Parameters.Add("@BatchNo", SqlDbType.NVarChar).Value = dr["Batch No"].ToString().Trim(); gdComm.Parameters.Add("@BomInCustoms", SqlDbType.NVarChar).Value = dr["BOM In Customs"].ToString().Trim(); gdComm.Parameters.Add("@GongDanNo", SqlDbType.NVarChar).Value = dr["GongDan No"].ToString().Trim(); gdComm.Parameters.Add("@FgNo", SqlDbType.NVarChar).Value = dr["FG No"].ToString().Trim(); gdComm.Parameters.Add("@FgDescription", SqlDbType.NVarChar).Value = dr["FG Description"].ToString().Trim(); gdComm.Parameters.Add("@LineNo", SqlDbType.Int).Value = Convert.ToInt32(dr["Line No"].ToString().Trim()); gdComm.Parameters.Add("@ItemNo", SqlDbType.NVarChar).Value = dr["Item No"].ToString().Trim(); gdComm.Parameters.Add("@ItemDescription", SqlDbType.NVarChar).Value = dr["Item Description"].ToString().Trim(); gdComm.Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = dr["Lot No"].ToString().Trim(); gdComm.Parameters.Add("@InventoryType", SqlDbType.NVarChar).Value = dr["Inventory Type"].ToString().Trim(); gdComm.Parameters.Add("@RMCategory", SqlDbType.NVarChar).Value = dr["RM Category"].ToString().Trim(); gdComm.Parameters.Add("@RMEHB", SqlDbType.NVarChar).Value = dr["RM EHB"].ToString().Trim(); gdComm.Parameters.Add("@BgdNo", SqlDbType.NVarChar).Value = dr["BGD No"].ToString().Trim(); gdComm.Parameters.Add("@IeType", SqlDbType.NVarChar).Value = dr["IE Type"].ToString().Trim(); gdComm.Parameters.Add("@OrderNo", SqlDbType.NVarChar).Value = dr["Order No"].ToString().Trim(); gdComm.Parameters.Add("@GongDanQty", SqlDbType.Int).Value = iGongDanQty; gdComm.Parameters.Add("@OrderPrice", SqlDbType.Decimal).Value = dOrderPrice; gdComm.Parameters.Add("@OrderCurr", SqlDbType.NVarChar).Value = dr["Order Currency"].ToString().Trim(); gdComm.Parameters.Add("@TotalRmCost", SqlDbType.Decimal).Value = Convert.ToDecimal(dr["Total RM Cost(USD)"].ToString().Trim()); gdComm.Parameters.Add("@RmUsedQty", SqlDbType.Decimal).Value = Math.Round(dRmUsedQty, 6); gdComm.Parameters.Add("@RMCurr", SqlDbType.NVarChar).Value = dr["RM Currency"].ToString().Trim(); gdComm.Parameters.Add("@RMPrice", SqlDbType.Decimal).Value = Convert.ToDecimal(dr["RM Price"].ToString().Trim()); gdComm.Parameters.Add("@Consumption", SqlDbType.Decimal).Value = dConsumption; gdComm.Parameters.Add("@DroolsQuota", SqlDbType.Decimal).Value = dDroolsQuota; gdComm.Parameters.Add("@DroolsRate", SqlDbType.Decimal).Value = dDroolsRate * 100.0M; gdComm.Parameters.Add("@ChnName", SqlDbType.NVarChar).Value = dr["CHN Name"].ToString().Trim(); gdComm.Parameters.Add("@DroolsEHB", SqlDbType.NVarChar).Value = dr["Drools EHB"].ToString().Trim(); gdComm.Parameters.Add("@Destination", SqlDbType.NVarChar).Value = dr["Destination"].ToString().Trim(); gdComm.Parameters.Add("@Creater", SqlDbType.NVarChar).Value = funcLib.getCurrentUserName(); gdComm.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = Convert.ToDateTime(dr["Created Date"].ToString().Trim()); gdComm.CommandText = "INSERT INTO M_DailyGongDan([Actual Start Date], [Actual End Date], [Batch Path], [Batch No], [BOM In Customs], [GongDan No], " + "[FG No], [FG Description], [Line No], [Item No], [Item Description], [Lot No], [Inventory Type], [RM Category], [RM EHB], " + "[BGD No], [IE Type], [Order No], [GongDan Qty], [Order Price], [Order Currency], [Total RM Cost(USD)], [RM Used Qty], " + "[RM Currency], [RM Price], [Consumption], [Drools Quota], [Drools Rate], [CHN Name], [Drools EHB], [Destination], [Creater], " + "[Created Date]) VALUES(@ActualStartDate, @ActualEndDate, @BatchPath, @BatchNo, @BomInCustoms, @GongDanNo, @FgNo, @FgDescription, " + "@LineNo, @ItemNo, @ItemDescription, @LotNo, @InventoryType, @RMCategory, @RMEHB, @BgdNo, @IeType, @OrderNo, @GongDanQty, " + "@OrderPrice, @OrderCurr, @TotalRmCost, @RmUsedQty, @RMCurr, @RMPrice, @Consumption, @DroolsQuota, @DroolsRate, @ChnName, " + "@DroolsEHB, @Destination, @Creater, @CreatedDate)"; gdComm.ExecuteNonQuery(); gdComm.Parameters.Clear(); } string strSQL = @"SELECT SUM([RM Used Qty]) AS TotalRmQty, SUM([Total RM Cost(USD)]) AS TotalRmCost, [GongDan No] FROM M_DailyGongDan GROUP BY [GongDan No]"; gdAdapter = new SqlDataAdapter(strSQL, gdConn); DataTable dtGDC = new DataTable(); gdAdapter.Fill(dtGDC); foreach (DataRow dr in dtGDC.Rows) { gdComm.Parameters.Add("@TotalRmQty", SqlDbType.Decimal).Value = Convert.ToDecimal(dr[0].ToString().Trim()); gdComm.Parameters.Add("@TotalRmCost", SqlDbType.Decimal).Value = Convert.ToDecimal(dr[1].ToString().Trim()); gdComm.Parameters.Add("@GongDanNo", SqlDbType.NVarChar).Value = dr[2].ToString().Trim().ToUpper(); gdComm.CommandText = "UPDATE M_DailyGongDan SET [Total RM Qty] = @TotalRmQty, [Total RM Cost(USD)] = @TotalRmCost WHERE [GongDan No] = @GongDanNo"; gdComm.ExecuteNonQuery(); gdComm.Parameters.Clear(); } dtGDC.Dispose(); gdComm.CommandText = "DELETE FROM M_DailyGongDanList WHERE [GongDan No] IN (SELECT DISTINCT [GongDan No] FROM M_DailyGongDan)"; gdComm.ExecuteNonQuery(); //If RM cost per finished goods total quantity is higher than selling price, use total RM cost as selling price gdComm.CommandText = "Update [M_DailyGongDan] Set [Order Price] = CONVERT(decimal(18,2),[Total RM Cost(USD)]/[GongDan Qty]/[ObjectValue]) FROM [M_DailyGongDan] LEFT JOIN [B_SysInfo] on substring([B_SysInfo].[ObjectName], CHARINDEX(':',[B_SysInfo].[ObjectName],0)+1,3) = [M_DailyGongDan].[Order Currency] WHERE [GongDan Qty] > 0 AND ([Order Price] <0.1) AND ([ObjectValue] IS NOT NULL)"; //Update [M_DailyGongDan] Set [Order Price] = CONVERT(decimal(18,2),[Total RM Cost(USD)]/[GongDan Qty]/[ObjectValue]) FROM [M_DailyGongDan] LEFT JOIN [B_SysInfo] on substring([B_SysInfo].[ObjectName], CHARINDEX(':',[B_SysInfo].[ObjectName],0)+1,3) = [M_DailyGongDan].[Order Currency] WHERE [GongDan Qty] > 0 AND ([Order Price] <0.1) AND ([ObjectValue] IS NOT NULL) gdComm.ExecuteNonQuery(); gdComm.Dispose(); gdAdapter = new SqlDataAdapter("SELECT * FROM M_DailyGongDan", gdConn); dtGongDan.Reset(); gdAdapter.Fill(dtGongDan); gdAdapter.Dispose(); dtGongDan.Columns.Remove("Created Date"); dtGongDan.Columns.Remove("Creater"); dvGongDan = dtGongDan.DefaultView; this.dgvGongDanData.DataSource = dvGongDan; this.dgvGongDanData.Columns[0].HeaderText = "Select"; this.dgvGongDanData.Columns["Actual Start Date"].Visible = false; this.dgvGongDanData.Columns["Actual End Date"].Visible = false; this.dgvGongDanData.Columns["Batch Path"].Visible = false; this.dgvGongDanData.Columns["BOM In Customs"].Visible = false; this.dgvGongDanData.Columns["GongDan No"].Frozen = true; if (gdConn.State == ConnectionState.Open) { gdConn.Close(); gdConn.Dispose(); } }
public async Task Unit(Connection connection, string databaseName) { await connection.CreateDatabase(databaseName, CancellationToken.None); var newTable = DataSets.CreateTable(); var table = await connection.InitializeTable(newTable, 1000); //create the table await connection.CreateTable(table, true, CancellationToken.None); //insert a single row InsertQuery insertQuery = new InsertQuery("test_table", new List <QueryColumn>() { new QueryColumn(new TableColumn("IntColumn", ETypeCode.Int32), 1), new QueryColumn(new TableColumn("StringColumn", ETypeCode.String), "value1"), new QueryColumn(new TableColumn("DateColumn", ETypeCode.DateTime), new DateTime(2001, 01, 21, 0, 0, 0, DateTimeKind.Utc)), new QueryColumn(new TableColumn("BooleanColumn", ETypeCode.Boolean), true), new QueryColumn(new TableColumn("DoubleColumn", ETypeCode.Double), 1.1), new QueryColumn(new TableColumn("DecimalColumn", ETypeCode.Decimal), 1.1m), new QueryColumn(new TableColumn("GuidColumn", ETypeCode.Guid), Guid.NewGuid()) }); await connection.ExecuteInsert(table, new List <InsertQuery>() { insertQuery }, CancellationToken.None); //insert a second row insertQuery = new InsertQuery("test_table", new List <QueryColumn>() { new QueryColumn(new TableColumn("IntColumn", ETypeCode.Int32), 2), new QueryColumn(new TableColumn("StringColumn", ETypeCode.String), "value2"), new QueryColumn(new TableColumn("BooleanColumn", ETypeCode.Boolean), false), new QueryColumn(new TableColumn("DateColumn", ETypeCode.DateTime), new DateTime(2001, 01, 21, 0, 0, 0, DateTimeKind.Utc)), new QueryColumn(new TableColumn("DoubleColumn", ETypeCode.Double), 1.1), new QueryColumn(new TableColumn("DecimalColumn", ETypeCode.Decimal), 1.2m), new QueryColumn(new TableColumn("GuidColumn", ETypeCode.Guid), Guid.NewGuid()) }); await connection.ExecuteInsert(table, new List <InsertQuery>() { insertQuery }, CancellationToken.None); ////if the write was a file. move it back to the incoming directory to read it. if (connection.DatabaseConnectionCategory == Connection.EConnectionCategory.File) { var fileConnection = (ConnectionFlatFile)connection; var filename = fileConnection.LastWrittenFile; var filemoveResult = await fileConnection.MoveFile((FlatFile)table, filename, EFlatFilePath.Outgoing, EFlatFilePath.Incoming); Assert.True(filemoveResult); } SelectQuery selectQuery; //run a select query with one row, sorted descending. if (connection.CanFilter) { selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn(new TableColumn("StringColumn")) }, Sorts = new List <Sort>() { new Sort { Column = new TableColumn("IntColumn"), Direction = Sort.EDirection.Descending } }, Rows = 1, Table = "test_table" }; //should return value2 from second row var returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.NotNull(returnScalar); //if the connection doesn't support sorting, don't bother with this test. if (connection.CanSort == true) { Assert.Equal("value2", (string)returnScalar); } } if (connection.CanUpdate) { //run an update query which will change the second date value to 2001-01-21 var updateQuery = new UpdateQuery() { UpdateColumns = new List <QueryColumn>() { new QueryColumn(new TableColumn("DateColumn", ETypeCode.DateTime), new DateTime(2001, 01, 21, 0, 0, 0, DateTimeKind.Utc)) }, Filters = new List <Filter>() { new Filter() { Column1 = new TableColumn("IntColumn"), Operator = Filter.ECompare.IsEqual, Value2 = 2, CompareDataType = ETypeCode.Int32 } } }; await connection.ExecuteUpdate(table, new List <UpdateQuery>() { updateQuery }, CancellationToken.None); //run a select query to validate the updated row. selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn(new TableColumn("DateColumn", ETypeCode.DateTime)) }, Filters = new List <Filter>() { new Filter(new TableColumn("IntColumn"), Filter.ECompare.IsEqual, 2) }, Rows = 1, Table = "test_table" }; //should return updated date var returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.True((DateTime)returnScalar == new DateTime(2001, 01, 21), "DateTime didn't match"); } //run a simple aggregate query to get max value from decimaColumn if (connection.CanAggregate) { selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn("DecimalColumn", SelectColumn.EAggregate.Max) }, Sorts = new List <Sort>() { new Sort("DateColumn") }, Groups = new List <TableColumn>() { new TableColumn("DateColumn") }, Rows = 1, Table = "test_table" }; //should return value2 from second row var returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.True(Decimal.Compare(Convert.ToDecimal(returnScalar), (Decimal)1.2) == 0, "SelectQuery2 - returned value: " + returnScalar.ToString()); } if (connection.CanDelete) { //run a delete query. var deleteQuery = new DeleteQuery() { Filters = new List <Filter>() { new Filter("IntColumn", Filter.ECompare.IsEqual, 1) }, Table = "test_table" }; //should return value2 from second row await connection.ExecuteDelete(table, new List <DeleteQuery>() { deleteQuery }, CancellationToken.None); //run a select query to check row is deleted selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn("DateColumn") }, Filters = new List <Filter>() { new Filter("IntColumn", Filter.ECompare.IsEqual, 1) }, Rows = 1, Table = "test_table" }; //should return null var returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.True(returnScalar == null); //run an aggregate query to check rows left if (connection.CanAggregate) { selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn("IntColumn", SelectColumn.EAggregate.Count) }, Rows = 1000, Table = "test_table" }; returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.True(Convert.ToInt64(returnScalar) == 1, "Select count"); } //run a truncate await connection.TruncateTable(table, CancellationToken.None); //check the table is empty following truncate selectQuery = new SelectQuery() { Columns = new List <SelectColumn>() { new SelectColumn("StringColumn") }, Rows = 1, Table = "test_table" }; //should return null returnScalar = await connection.ExecuteScalar(table, selectQuery, CancellationToken.None); Assert.True(returnScalar == null); // } } if (connection.CanBulkLoad) { await connection.TruncateTable(table, CancellationToken.None); //start a datawriter and insert the test data await connection.DataWriterStart(table); var testData = DataSets.CreateTestData(); await connection.ExecuteInsertBulk(table, testData, CancellationToken.None); await connection.DataWriterFinish(table); ////if the write was a file. move it back to the incoming directory to read it. if (connection.DatabaseConnectionCategory == Connection.EConnectionCategory.File) { var fileConnection = (ConnectionFlatFile)connection; var filename = fileConnection.LastWrittenFile; var filemoveResult = await fileConnection.MoveFile((FlatFile)table, filename, EFlatFilePath.Outgoing, EFlatFilePath.Incoming); Assert.True(filemoveResult); } //check the table loaded 10 rows successully Transform reader = connection.GetTransformReader(table, true); int count = 0; var openResult = await reader.Open(0, null, CancellationToken.None); Assert.True(openResult, "Open Reader"); while (await reader.ReadAsync()) { count++; } Assert.True(count == 10, "Select count - value :" + count); } if (connection.CanFilter == true) { //run a lookup query. var filters = new List <Filter> { new Filter("IntColumn", Filter.ECompare.IsEqual, 5) }; var query = new SelectQuery() { Filters = filters }; //should return value5 var reader = connection.GetTransformReader(table, true); // if (reader.CanLookupRowDirect) // { // var openResult = await reader.Open(0, null, CancellationToken.None); // Assert.True(openResult, "Open Reader"); var returnLookup = await reader.Lookup(query, Transform.EDuplicateStrategy.Abend, CancellationToken.None); Assert.True(Convert.ToString(returnLookup.First()[0]) == "value5", "LookupValue :" + returnLookup.First()[0]); //run lookup again with caching set. reader = connection.GetTransformReader(table); // var openResult = await reader.Open(0, null, CancellationToken.None); // Assert.True(openResult, "Open Reader"); reader.SetCacheMethod(Transform.ECacheMethod.PreLoadCache); returnLookup = await reader.Lookup(query, Transform.EDuplicateStrategy.Abend, CancellationToken.None); Assert.True(Convert.ToString(returnLookup.First()[0]) == "value5", "Select count - value :" + returnLookup.First()[0]); // } reader.Close(); } }
void SetControls() { ConfigData config = MidsContext.Config; optSO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.SingleO; optDO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.DualO; optTO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.TrainingO; cbEnhLevel.SelectedIndex = (int)config.CalcEnhLevel; udExHigh.Value = new Decimal(config.ExempHigh); udExLow.Value = new Decimal(config.ExempLow); udForceLevel.Value = new Decimal(config.ForceLevel); chkHighVis.Checked = config.EnhanceVisibility; rbGraphTwoLine.Checked = config.DataGraphType == Enums.eDDGraph.Both; rbGraphStacked.Checked = config.DataGraphType == Enums.eDDGraph.Stacked; rbGraphSimple.Checked = config.DataGraphType == Enums.eDDGraph.Simple; rbPvE.Checked = !config.Inc.DisablePvE; rbPvP.Checked = config.Inc.DisablePvE; rbChanceAverage.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Average; rbChanceMax.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Max; rbChanceIgnore.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Minimum; udBaseToHit.Value = new Decimal(config.BaseAcc * 100f); chkVillainColour.Checked = !config.DisableVillainColours; chkUpdates.Checked = config.CheckForUpdates; udIOLevel.Value = Decimal.Compare(new Decimal(config.I9.DefaultIOLevel + 1), udIOLevel.Maximum) <= 0 ? new Decimal(config.I9.DefaultIOLevel + 1) : udIOLevel.Maximum; chkIOLevel.Checked = !config.I9.HideIOLevels; chkIOEffects.Checked = !config.I9.IgnoreEnhFX; chkSetBonus.Checked = !config.I9.IgnoreSetBonusFX; chkRelSignOnly.Checked = config.ShowRelSymbols; chkIOPrintLevels.Checked = !config.I9.DisablePrintIOLevels; chkColourPrint.Checked = config.PrintInColour; udRTFSize.Value = new decimal(config.RtFont.RTFBase / 2.0); udStatSize.Value = new decimal(config.RtFont.PairedBase); chkTextBold.Checked = config.RtFont.RTFBold; chkStatBold.Checked = config.RtFont.PairedBold; chkLoadLastFile.Checked = !config.DisableLoadLastFileOnStart; dcNickName.Text = config.DNickName; dcChannel.Text = config.DChannel; foreach (var item in config.DServers.Append(config.DSelServer).Where(item => !string.IsNullOrWhiteSpace(item) && !dcExList.Items.Contains(config.DSelServer)).Distinct()) { dcExList.Items.Add(item); } if (!string.IsNullOrWhiteSpace(config.DSelServer)) { dcExList.SelectedItem = config.DSelServer; } lblSaveFolder.Text = config.GetSaveFolder(); foreach (var item in config.CheckedStatBoxes) { SetStatCheck(item, true); } //this.txtUpdatePath.Text = config.UpdatePath; chkColorInherent.Checked = !config.DisableDesaturateInherent; chkMiddle.Checked = !config.DisableRepeatOnMiddleClick; chkNoTips.Checked = config.NoToolTips; chkShowAlphaPopup.Checked = !config.DisableAlphaPopup; chkUseArcanaTime.Checked = config.UseArcanaTime; cbUpdateURL.Text = MidsContext.Config.UpdatePath; TeamSize.Value = new decimal(config.TeamSize); int index = 0; do { defActs[index] = config.DragDropScenarioAction[index]; ++index; }while (index <= 19); }
/// <summary> /// Compares this LSDecimal value with another. /// </summary> /// <param name="value">The value to compare</param> /// <returns>A signed number indicating the relative values of this /// instance and value</returns> public int CompareTo(LSDecimal value) { return(Decimal.Compare((Decimal)this, (Decimal)value)); }
public int Compare(Produto x, Produto y) { return(Decimal.Compare(x.Preco, y.Preco)); }
/// <summary> /// Determines whether this value is equal to another /// </summary> /// <param name="other">The value to compare</param> /// <returns>True if the values are equal; false otherwise</returns> public bool Equals(LSDecimal other) { return(Decimal.Compare((Decimal)this, (Decimal)other) == 0); }
public int Compare(object a, object b) { int result; ListViewItem itemA = a as ListViewItem; ListViewItem itemB = b as ListViewItem; if (itemA == null && itemB == null) { result = 0; } else if (itemA == null) { result = -1; } else if (itemB == null) { result = 1; } if (itemA == itemB) { result = 0; } /* * // datetime comparison * DateTime x1, y1; * // Parse the two objects passed as a parameter as a DateTime. * if (!DateTime.TryParse(itemA.SubItems[Column].Text, out x1)) * x1 = DateTime.MinValue; * if (!DateTime.TryParse(itemB.SubItems[Column].Text, out y1)) * y1 = DateTime.MinValue; * result = DateTime.Compare(x1, y1); * if (x1 != DateTime.MinValue && y1 != DateTime.MinValue) * goto done; */ // Numeric comparison decimal x2, y2; if (!Decimal.TryParse(itemA.SubItems[Column].Text, out x2)) { x2 = Decimal.MinValue; } if (!Decimal.TryParse(itemB.SubItems[Column].Text, out y2)) { y2 = Decimal.MinValue; } result = Decimal.Compare(x2, y2); if (x2 != Decimal.MinValue && y2 != Decimal.MinValue) { goto done; } //alphabetic comparison result = String.Compare(itemA.SubItems[Column].Text, itemB.SubItems[Column].Text); done: // If sort order is descending. if (Order == SortOrder.Descending) { // Invert the value returned by Compare. result *= -1; } return(result); }
/// <summary> /// Operator overload /// </summary> /// <param name="d1"></param> /// <param name="d2"></param> /// <returns></returns> public static bool operator >=(LSDecimal d1, LSDecimal d2) { return(Decimal.Compare((Decimal)d1, (Decimal)d2) >= 0); }
void SetControls() { ConfigData config = MidsContext.Config; this.optSO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.SingleO; this.optDO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.DualO; this.optTO.Checked = config.CalcEnhOrigin == Enums.eEnhGrade.TrainingO; this.cbEnhLevel.SelectedIndex = (int)config.CalcEnhLevel; this.udExHigh.Value = new Decimal(config.ExempHigh); this.udExLow.Value = new Decimal(config.ExempLow); this.udForceLevel.Value = new Decimal(config.ForceLevel); this.chkHighVis.Checked = config.EnhanceVisibility; this.rbGraphTwoLine.Checked = config.DataGraphType == Enums.eDDGraph.Both; this.rbGraphStacked.Checked = config.DataGraphType == Enums.eDDGraph.Stacked; this.rbGraphSimple.Checked = config.DataGraphType == Enums.eDDGraph.Simple; this.rbPvE.Checked = !config.Inc.DisablePvE; this.rbPvP.Checked = config.Inc.DisablePvE; this.rbChanceAverage.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Average; this.rbChanceMax.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Max; this.rbChanceIgnore.Checked = config.DamageMath.Calculate == ConfigData.EDamageMath.Minimum; this.udBaseToHit.Value = new Decimal(config.BaseAcc * 100f); this.chkVillainColour.Checked = !config.DisableVillainColours; this.chkUpdates.Checked = config.CheckForUpdates; this.udIOLevel.Value = Decimal.Compare(new Decimal(config.I9.DefaultIOLevel + 1), this.udIOLevel.Maximum) <= 0 ? new Decimal(config.I9.DefaultIOLevel + 1) : this.udIOLevel.Maximum; this.chkIOLevel.Checked = !config.I9.HideIOLevels; this.chkIOEffects.Checked = !config.I9.IgnoreEnhFX; this.chkSetBonus.Checked = !config.I9.IgnoreSetBonusFX; this.chkRelSignOnly.Checked = config.ShowRelSymbols; this.chkIOPrintLevels.Checked = !config.I9.DisablePrintIOLevels; this.chkColourPrint.Checked = config.PrintInColour; this.udRTFSize.Value = new decimal(config.RtFont.RTFBase / 2.0); this.udStatSize.Value = new decimal(config.RtFont.PairedBase); this.chkTextBold.Checked = config.RtFont.RTFBold; this.chkStatBold.Checked = config.RtFont.PairedBold; this.chkLoadLastFile.Checked = !config.DisableLoadLastFileOnStart; this.dcNickName.Text = config.DNickName; this.dcChannel.Text = config.DChannel; foreach (var item in config.DServers.Append(config.DSelServer).Where(item => !string.IsNullOrWhiteSpace(item) && !this.dcExList.Items.Contains(config.DSelServer)).Distinct()) { this.dcExList.Items.Add(item); } if (!string.IsNullOrWhiteSpace(config.DSelServer)) { this.dcExList.SelectedItem = config.DSelServer; } this.richTextBox3.AppendText("You can invite the bot by clicking -> " + Clshook.ShrinkTheDatalink("https://discordapp.com/api/oauth2/authorize?client_id=593333282234695701&permissions=18432&redirect_uri=https%3A%2F%2Fmidsreborn.com&scope=bot")); this.lblSaveFolder.Text = config.GetSaveFolder(); //this.txtUpdatePath.Text = config.UpdatePath; this.chkColorInherent.Checked = !config.DisableDesaturateInherent; this.chkMiddle.Checked = !config.DisableRepeatOnMiddleClick; this.chkNoTips.Checked = config.NoToolTips; this.chkShowAlphaPopup.Checked = !config.DisableAlphaPopup; this.chkUseArcanaTime.Checked = config.UseArcanaTime; this.TeamSize.Value = new decimal(config.TeamSize); int index = 0; do { this.defActs[index] = config.DragDropScenarioAction[index]; ++index; }while (index <= 19); }
protected void Page_Load(object sender, EventArgs e) { String strConnString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; ItemDAL itemdal = new ItemDAL(strConnString); int ItemID = Int32.Parse(Request.Form["ItemID"].ToString()); String SupplierItemCode = Request.Form["SupplierItemCode"].Trim().ToString(); String Description = Request.Form["Description"].Trim().ToString(); float COG = float.Parse(Request.Form["COG"].ToString()); float ManagedPrice = float.Parse(Request.Form["ManagedUnitPrice"].ToString()); int SupplierID = Int32.Parse(Request.Form["SupplierID"].ToString()); string ActInact = Request.Form["ActInact"].ToString(); String BestPrice = Request.Form["BestPrice"].ToString(); String Faulty = Request.Form["Faulty"].ToString(); string finalActInact = ""; String finalBestPrice = String.Empty; String finalFaulty = String.Empty; int quantity = 0; string qty = Request.Form["Quantity"].ToString(); if (!string.IsNullOrEmpty(qty)) { quantity = Convert.ToInt32(qty); } double?dsb = null; var dsbVal = Request.Form["DSBPrice"].ToString(); if (!string.IsNullOrEmpty(dsbVal)) { dsb = Convert.ToDouble(dsbVal); } if (ActInact == "false") { finalActInact = "N"; } else { finalActInact = "Y"; } if (BestPrice == "true") { finalBestPrice = "Y"; } else { finalBestPrice = "N"; } if (Faulty == "true") { finalFaulty = "Y"; } else { finalFaulty = "N"; } var Orderid = 0; var strCompanyID = -1; // For product we do not use companyid refer -1 to identify the type for items var newvalues = ""; var oldvalues = ""; // newvalues = " PRODUCT CODE : " + SupplierItemCode; var connString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var itemObj = PopulateForObject(ItemID.ToString(), connString); if (itemObj.description != Description) { newvalues = newvalues + " Description: " + Description; oldvalues = oldvalues + " Description: " + itemObj.description; } if (Decimal.Compare(Convert.ToDecimal(itemObj.cogPrice), Convert.ToDecimal(COG)) != 0) { newvalues = newvalues + " COST: " + COG; oldvalues = oldvalues + " COST: " + itemObj.cogPrice; } if (Decimal.Compare(Convert.ToDecimal(itemObj.resellPrice), Convert.ToDecimal(ManagedPrice)) != 0) { newvalues = newvalues + " RESELL PRICE: " + ManagedPrice; oldvalues = oldvalues + " RESELL PRICE: " + itemObj.resellPrice; } if (itemObj.active.Trim() != finalActInact) { newvalues = newvalues + " Active: " + finalActInact; oldvalues = oldvalues + " Active: " + itemObj.active; } if (itemObj.bestPrice.Trim() != finalBestPrice) { newvalues = newvalues + " BEST PRICE:" + finalBestPrice; oldvalues = oldvalues + " BEST PRICE: " + itemObj.bestPrice; } // newvalues = newvalues + " Supplier Id: " + SupplierID; if (itemObj.quantity != quantity.ToString()) { newvalues = newvalues + " Quantity: " + quantity; oldvalues = oldvalues + " Quantity: " + itemObj.quantity; } if (dsb != null) { if (Decimal.Compare(Convert.ToDecimal(itemObj.DSBPrice), Convert.ToDecimal(dsb)) != 0) { newvalues = newvalues + " DSB: " + dsb; oldvalues = oldvalues + " DSB: " + itemObj.DSBPrice; } } //var oldString = Populate(ItemID.ToString(), connString); var result = itemdal.UpdateItem(ItemID, Description, COG, ManagedPrice, SupplierID, SupplierItemCode, finalActInact, finalBestPrice, finalFaulty, quantity, dsb); Orderid = ItemID; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connString; var loggedInUserId = Convert.ToInt32(Session["LoggedUserID"].ToString()); var columnName = "Product Items"; var talbeName = "Product Items"; var ActionType = "Updated Product Items"; int primaryKey = Orderid; var lastString = newvalues; if (newvalues != "") { new DeltoneCRM_DAL.CompanyDAL(connString).CreateActionONAuditLog(oldvalues, lastString, loggedInUserId, conn, 0, columnName, talbeName, ActionType, primaryKey, strCompanyID); } Response.Write(result); }
void btnOK_Click(object sender, EventArgs e) { if (!CheckClassName()) { return; } if (clbOrigin.CheckedItems.Count < 1) { int num1 = (int)Interaction.MsgBox("An archetype class must have at least one valid origin!", MsgBoxStyle.Information, "Oops."); } else if (cbPriGroup.Text == "" | cbSecGroup.Text == "") { int num2 = (int)Interaction.MsgBox("You must set a Primary and Secondary Powerset Group!", MsgBoxStyle.Information, "Oops."); } else { float num3 = (float)Conversion.Val(txtHP.Text); if (num3 < 1.0) { num3 = 1f; int num4 = (int)Interaction.MsgBox("Hit Point value of < 1 is invalid. Hit Points set to 1", MsgBoxStyle.Information); } MyAT.Hitpoints = (int)Math.Round(num3); float num5 = (float)Conversion.Val(txtHPCap.Text); if (num5 < 1.0) { num5 = 1f; } if (num5 < (double)MyAT.Hitpoints) { num5 = MyAT.Hitpoints; } MyAT.HPCap = num5; float num6 = (float)Conversion.Val(txtResCap.Text); if (num6 < 1.0) { num6 = 1f; } MyAT.ResCap = num6 / 100f; float num7 = (float)Conversion.Val(txtDamCap.Text); if (num7 < 1.0) { num7 = 1f; } MyAT.DamageCap = num7 / 100f; float num8 = (float)Conversion.Val(txtRechargeCap.Text); if (num8 < 1.0) { num8 = 1f; } MyAT.RechargeCap = num8 / 100f; float num9 = (float)Conversion.Val(txtRecCap.Text); if (num9 < 1.0) { num9 = 1f; } MyAT.RecoveryCap = num9 / 100f; float num10 = (float)Conversion.Val(txtRegCap.Text); if (num10 < 1.0) { num10 = 1f; } MyAT.RegenCap = num10 / 100f; float num11 = (float)Conversion.Val(txtBaseRec.Text); if (num11 < 0.0) { num11 = 0.0f; } if (num11 > 100.0) { num11 = 1.67f; } MyAT.BaseRecovery = num11; float num12 = (float)Conversion.Val(txtBaseRegen.Text); if (num12 < 0.0) { num12 = 0.0f; } if (num12 > 100.0) { num12 = 100f; } MyAT.BaseRegen = num12; float num13 = (float)Conversion.Val(txtPerceptionCap.Text); if (num13 < 0.0) { num13 = 0.0f; } if (num13 > 10000.0) { num13 = 1153f; } MyAT.PerceptionCap = num13; MyAT.PrimaryGroup = cbPriGroup.Text; MyAT.SecondaryGroup = cbSecGroup.Text; MyAT.Origin = new string[clbOrigin.CheckedItems.Count - 1 + 1]; int num14 = clbOrigin.CheckedItems.Count - 1; for (int index = 0; index <= num14; ++index) { MyAT.Origin[index] = Convert.ToString(clbOrigin.CheckedItems[index]); } MyAT.Column = Decimal.Compare(udColumn.Value, new Decimal(0)) >= 0 ? Convert.ToInt32(udColumn.Value) : 0; MyAT.BaseThreat = Decimal.Compare(udThreat.Value, new Decimal(0)) >= 0 ? Convert.ToSingle(udThreat.Value) : 0.0f; DialogResult = DialogResult.OK; Hide(); } }
public int Compare(object a, object b) { int result; ListViewItem itemA = a as ListViewItem; ListViewItem itemB = b as ListViewItem; if (itemA == null && itemB == null) { result = 0; } else if (itemA == null) { result = -1; } else if (itemB == null) { result = 1; } if (itemA == itemB) { result = 0; } // Compara as datas DateTime x1, y1; // Tenta fazer parse das dos objectos para data if (!DateTime.TryParse(itemA.SubItems[Column].Text, out x1)) { x1 = DateTime.MinValue; } if (!DateTime.TryParse(itemB.SubItems[Column].Text, out y1)) { y1 = DateTime.MinValue; } result = DateTime.Compare(x1, y1); if (x1 != DateTime.MinValue && y1 != DateTime.MinValue) { goto done; } //Comparação de numeros decimal x2, y2; if (!Decimal.TryParse(itemA.SubItems[Column].Text, out x2)) { x2 = Decimal.MinValue; } if (!Decimal.TryParse(itemB.SubItems[Column].Text, out y2)) { y2 = Decimal.MinValue; } result = Decimal.Compare(x2, y2); if (x2 != Decimal.MinValue && y2 != Decimal.MinValue) { goto done; } //Comparação de duas strings result = String.Compare(itemA.SubItems[Column].Text, itemB.SubItems[Column].Text); done: // Se a ordem for descendente if (Order == SortOrder.Descending) { // Vai inverter o valor devolvido na comparaçao result *= -1; } return(result); }
/// <summary> /// 比较两个值,o1>o2返回1, o1=o2返回0, o1<o2返回-1 /// </summary> /// <param name="o1"></param> /// <param name="o2"></param> /// <param name="type"></param> /// <returns></returns> public static int CompareValue(object o1, object o2, Type type) { if (o1 == DBNull.Value && o2 == DBNull.Value) { return(0); } if (o1 == DBNull.Value) { return(-1); } if (o2 == DBNull.Value) { return(1); } if (o1 == null && o2 == null) { return(0); } if (o1 == null) { return(-1); } if (o2 == null) { return(1); } int result = 0; if (type == null) { double d1, d2; if (Double.TryParse(o1.ToString(), out d1) && Double.TryParse(o2.ToString(), out d2)) { return(Math.Sign(d1 - d2)); } else { return(String.Compare(ToStr(o1).PadLeft(20), ToStr(o2).PadLeft(20))); } } switch (type.Name) { case "Int": case "Int32": case "Int64": case "Decimal": case "Short": case "Byte": result = Decimal.Compare((decimal)o1, (decimal)o2); break; case "Float": case "Double": if ((Double)o1 > (Double)o2) { result = 1; break; } if ((Double)o1 == (Double)o2) { result = 0; break; } result = -1; break; case "DateTime": DateTime d1 = DateTime.MinValue; DateTime d2 = DateTime.MinValue; DateTime.TryParse(o1.ToString(), out d1); DateTime.TryParse(o2.ToString(), out d2); result = DateTime.Compare(d1, d2); break; case "Boolean": String i1 = "a", i2 = "a"; if ((Boolean)o1) { i1 = "b"; } if ((Boolean)o1) { i2 = "b"; } result = String.Compare(i1, i2); break; default: result = System.String.Compare(o1.ToString(), o2.ToString()); break; } return(result); }
public static object GetNull(object objField, object objDBNull) { object objectValue = RuntimeHelpers.GetObjectValue(objField); if (objField == null) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } else if (objField is byte) { if ((int)Convert.ToByte(RuntimeHelpers.GetObjectValue(objField)) == (int)Null.NullByte) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is short) { if ((int)Convert.ToInt16(RuntimeHelpers.GetObjectValue(objField)) == (int)Null.NullShort) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is int) { if (Convert.ToInt32(RuntimeHelpers.GetObjectValue(objField)) == Null.NullInteger) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is float) { if ((double)Convert.ToSingle(RuntimeHelpers.GetObjectValue(objField)) == (double)Null.NullSingle) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is double) { if (Convert.ToDouble(RuntimeHelpers.GetObjectValue(objField)) == Null.NullDouble) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is Decimal) { if (Decimal.Compare(Convert.ToDecimal(RuntimeHelpers.GetObjectValue(objField)), Null.NullDecimal) == 0) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is DateTime) { if (DateTime.Compare(Convert.ToDateTime(RuntimeHelpers.GetObjectValue(objField)).Date, Null.NullDate.Date) == 0) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is string) { if (objField == null) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } else if (Operators.CompareString(objField.ToString(), Null.NullString, false) == 0) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is bool) { if (Convert.ToBoolean(RuntimeHelpers.GetObjectValue(objField)) == Null.NullBoolean) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } else if (objField is Guid) { object obj = objField; Guid guid = NullGuid; if ((obj != null ? (Guid)obj : guid).Equals(Null.NullGuid)) { objectValue = RuntimeHelpers.GetObjectValue(objDBNull); } } return(objectValue); }
public void BuildEdge(int v1, int v2) { Vertex n1 = null, n2 = null; Vertex temp = _vfirst; while (temp != null) { int i = Decimal.Compare(v1, temp.Name); if (i == 0) { //found 1st node.. n1 = temp; break; } else { temp = temp.Next; } } //check if edge already exists for (int i = 0; i < n1.Num_Edges; i++) { int j = Decimal.Compare(v2, n1.Adjacent[i].Name); if (j == 0) { return; } } temp = _vfirst; while (temp != null) { int i = Decimal.Compare(v2, temp.Name); if (i == 0) { //found 2nd node.. n2 = temp; break; } else { temp = temp.Next; } } n1.Adjacent[n1.Num_Edges++] = n2; Edge temp2 = new Edge(n1, n2); if (_efirst == null) { _efirst = temp2; _elast = temp2; } else { temp2.AddEdge(_elast, temp2); _elast = temp2; } }
/// <summary> /// Create SAP Invoice /// </summary> /// <param name="cardCode">The CardCode for the BP.</param> /// <param name="o">The Amazon order object</param> /// <returns>Dictionary with DocEntry and DocNum of the invoice.</returns> public Dictionary <string, string> CreateInvoice(string cardCode, MWSOrder o) { double totalItemPrice = 0, totalItemTax = 0, totalShipCost = 0, totalShipTax = 0; string DocEntry = null, q; int DocNum = 0; Dictionary <string, string> InvoiceNums = new Dictionary <string, string>(); Recordset rs; try { // If invoice exists with AmzOrderId, log and return q = "usp_MarketplaceGetDocNumByAmazonOrderID '" + o.Order.AmazonOrderId + "'"; rs = (Recordset)DIAPI_Objects_FBA.Company.GetBusinessObject(BoObjectTypes.BoRecordset); rs.DoQuery(q); if (!(rs.EoF)) // Invoice exists { _orderLogRepository.LogEvent( o.Order.AmazonOrderId, "Invoice #" + rs.Fields.Item(0).Value.ToString() + " already exists in SAP.", nameof(LogEventLevel.Warning), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); InvoiceNums.Add("DocNum", rs.Fields.Item(0).Value.ToString()); InvoiceNums.Add("DocEntry", rs.Fields.Item(1).Value.ToString()); // Check if invoice total matches Amazon order total var validInvTotal = Decimal.TryParse(rs.Fields.Item(2).Value.ToString(), out decimal invTotal); var validAmzTotal = Decimal.TryParse(o.Order.OrderTotal.Amount, out decimal amzTotal); if (validInvTotal && validAmzTotal) { if (Decimal.Compare(invTotal, amzTotal) != 0) { bool shipToWA = false; if (o.Order.ShippingAddress.StateOrRegion == "WA" || o.Order.ShippingAddress.StateOrRegion == "Washington") { shipToWA = true; } _orderLogRepository.LogEvent( o.Order.AmazonOrderId, (shipToWA ? "Shipped to WA: " : "") + "Invoice total $" + invTotal.ToString() + " doesn't equal Amazon-order total of $" + amzTotal.ToString() + ". Please verify that this isn't an error.", nameof(LogEventLevel.Warning), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } } _unitOfWork.Commit(); return(InvoiceNums); } rs = null; DIAPI_Objects_FBA.Invoice = (Documents)DIAPI_Objects_FBA.Company.GetBusinessObject(BoObjectTypes.oInvoices); DIAPI_Objects_FBA.Invoice.CardCode = cardCode; DIAPI_Objects_FBA.Invoice.NumAtCard = o.Order.AmazonOrderId.Trim(); DIAPI_Objects_FBA.Invoice.HandWritten = BoYesNoEnum.tNO; DIAPI_Objects_FBA.Invoice.DocDate = DateTime.Now; DIAPI_Objects_FBA.Invoice.DocDueDate = DateTime.Now; DIAPI_Objects_FBA.Invoice.DocCurrency = "$"; DIAPI_Objects_FBA.Invoice.SalesPersonCode = 68; // Amazon slpcode DIAPI_Objects_FBA.Invoice.TransportationCode = 13; // Ground // Calculate shipping foreach (var l in o.OrderItems) { var s = l.ShippingPrice == null ? "0" : l.ShippingPrice?.Amount; //var t = l.ShippingTax == null ? "0" : l.ShippingTax?.Amount; if (Double.TryParse(s, out double shipCost)) { totalShipCost += shipCost; //if (Double.TryParse(t, out double shipTax)) //{ // totalShipTax += shipTax; //} } else { throw new InvalidOperationException("Invalid shipping cost for " + l.SellerSKU + " - " + l.Title); } } DIAPI_Objects_FBA.Invoice.Expenses.ExpenseCode = 1; DIAPI_Objects_FBA.Invoice.Expenses.LineTotal = totalShipCost; DIAPI_Objects_FBA.Invoice.Expenses.Add(); bool partFound = false; foreach (var line in o.OrderItems) { //if quantity shipped is zero, continue if (line.QuantityShipped == 0) { continue; } // Amazon: get mfr SKU by substring to left of underscore. int index = line.SellerSKU.IndexOf("_"); string sku = (index > 0 ? line.SellerSKU.Substring(0, index) : line.SellerSKU); q = "usp_findPartBySKU '" + sku + "'"; rs = (Recordset)DIAPI_Objects_FBA.Company.GetBusinessObject(BoObjectTypes.BoRecordset); rs.DoQuery(q); if (!(rs.EoF)) { DIAPI_Objects_FBA.Invoice.Lines.ItemCode = rs.Fields.Item(0).Value.ToString(); DIAPI_Objects_FBA.Invoice.Lines.Quantity = Convert.ToDouble(line.QuantityShipped); DIAPI_Objects_FBA.Invoice.Lines.WarehouseCode = "AM1"; // FBA orders ship from Amazon's warehouse. // Add serial numbers var sn = _sapDataService.GetSerialNumbers(sku, Convert.ToInt32(line.QuantityShipped)); // ensure that available serial numbers/license keys exist for SKU, in the required quantity if (sn != null && sn.Count >= line.QuantityShipped) { for (int k = 0; k < Convert.ToInt32(line.QuantityShipped); k++) { DIAPI_Objects_FBA.Invoice.Lines.SerialNumbers.SetCurrentLine(k); DIAPI_Objects_FBA.Invoice.Lines.SerialNumbers.ManufacturerSerialNumber = sn[k].SuppSerial; DIAPI_Objects_FBA.Invoice.Lines.SerialNumbers.Quantity = 1; DIAPI_Objects_FBA.Invoice.Lines.SerialNumbers.Add(); } } else // throw exception. { throw new SerialNumberNotFoundException(sku + ": Available serial#/license key was either not found or not enough to match quantity."); } // Set tax if (Double.TryParse(line.ItemTax?.Amount, out double itemTax)) { DIAPI_Objects_FBA.Invoice.Lines.TaxTotal = itemTax; if ((string.Equals(o.Order.ShippingAddress.StateOrRegion, "ca", StringComparison.OrdinalIgnoreCase) || string.Equals(o.Order.ShippingAddress.StateOrRegion, "california", StringComparison.OrdinalIgnoreCase)) && itemTax == 0) { DIAPI_Objects_FBA.Invoice.Lines.TaxCode = "Exempt"; _orderLogRepository.LogEvent( o.Order.AmazonOrderId, "Adding " + sku + " - Shipping address is CA, but no sales tax was charged.", nameof(LogEventLevel.Warning), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } else if (!string.Equals(o.Order.ShippingAddress.StateOrRegion, "ca", StringComparison.OrdinalIgnoreCase) && !string.Equals(o.Order.ShippingAddress.StateOrRegion, "california", StringComparison.OrdinalIgnoreCase)) { // no tax outside of california DIAPI_Objects_FBA.Invoice.Lines.TaxCode = "Exempt"; DIAPI_Objects_FBA.Invoice.Lines.TaxTotal = 0; } else // California { // Set tax DIAPI_Objects_FBA.Invoice.Lines.TaxCode = "CA"; DIAPI_Objects_FBA.Invoice.Lines.TaxTotal = itemTax; //totalItemTax += itemTax; } } else // invalid number, set tax to zero { DIAPI_Objects_FBA.Invoice.Lines.TaxTotal = 0; _orderLogRepository.LogEvent( o.Order.AmazonOrderId, "Adding " + sku + ": Tax format invalid. Unable to set sales tax. Please validate tax manually.", nameof(LogEventLevel.Error), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } if (!Double.TryParse(line.ItemPrice.Amount, out double itemPrice)) { throw new InvalidOperationException("Invalid ItemPrice value for " + line.SellerSKU + " - " + line.Title); } else { totalItemPrice += itemPrice; } // Amazon ItemPrice = Quantity * ItemPrice DIAPI_Objects_FBA.Invoice.Lines.LineTotal = itemPrice; DIAPI_Objects_FBA.Invoice.Lines.Add(); partFound = true; _orderLogRepository.LogEvent( o.Order.AmazonOrderId, String.Format("{0} was added to Invoice", sku), nameof(LogEventLevel.Information), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } else // SKU not found { // update return Dictionary with missingSKU flag if (!InvoiceNums.ContainsKey("ActionRequired")) { InvoiceNums.Add("ActionRequired", "true"); } else { InvoiceNums["ActionRequired"] = "true"; } _orderLogRepository.LogEvent( o.Order.AmazonOrderId, String.Format("{0} was not found. Please add manually", sku), nameof(LogEventLevel.Error), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } } rs = null; if (!partFound) { DIAPI_Objects_FBA.Invoice.Lines.ItemCode = "PLCHLDR"; DIAPI_Objects_FBA.Invoice.Lines.ItemDescription = "Placeholder"; DIAPI_Objects_FBA.Invoice.Lines.Quantity = 1; DIAPI_Objects_FBA.Invoice.Lines.UnitPrice = 0; DIAPI_Objects_FBA.Invoice.Lines.Add(); _orderLogRepository.LogEvent( o.Order.AmazonOrderId, "Unable to find SKUs for invoice, so a placeholder was added.", nameof(LogEventLevel.Error), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); } if (!Double.TryParse(o.Order.OrderTotal.Amount, out double total)) { throw new InvalidOrderTotalException("The OrderTotal for Amazon order " + o.Order.AmazonOrderId + " is invalid."); } // Override OrderTotal // if shipping state is not CA, ignore tax and generate order total from the sum of all totalItemPrice + totalShipCost if (string.Equals(o.Order.ShippingAddress.StateOrRegion, "ca", StringComparison.OrdinalIgnoreCase) || string.Equals(o.Order.ShippingAddress.StateOrRegion, "california", StringComparison.OrdinalIgnoreCase)) { DIAPI_Objects_FBA.Invoice.DocTotal = total; } else { DIAPI_Objects_FBA.Invoice.DocTotal = totalItemPrice + totalShipCost; } RetCode = DIAPI_Objects_FBA.Invoice.Add(); if (RetCode != 0) { DIAPI_Objects_FBA.Company.GetLastError(out errCode, out errMsg); _orderLogRepository.LogEvent( o.Order.AmazonOrderId, errCode + " - " + errMsg + " - Invoice was not created.", nameof(LogEventLevel.Critical), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); if (!InvoiceNums.ContainsKey("ActionRequired")) { InvoiceNums.Add("ActionRequired", "true"); } else { InvoiceNums["ActionRequired"] = "true"; } DocEntry = RetCode.ToString(); // return err num } else { // return DocEntry of new Invoice DIAPI_Objects_FBA.Company.GetNewObjectCode(out DocEntry); // NOTE: pass DocEntry to proc to get invoice DocNum for log, but return DocEntry q = "usp_MarketplaceGetDocNum " + DocEntry + ", 'Inv'"; rs = (Recordset)DIAPI_Objects_FBA.Company.GetBusinessObject(BoObjectTypes.BoRecordset); rs.DoQuery(q); if (!(rs.EoF)) { DocNum = Convert.ToInt32(rs.Fields.Item(0).Value); } InvoiceNums.Add("DocEntry", DocEntry); InvoiceNums.Add("DocNum", DocNum.ToString()); _orderLogRepository.LogEvent( o.Order.AmazonOrderId, String.Format("Invoice {0} was created. Please verify addresses, pricing, warehouses and shipping.", DocNum), nameof(LogEventLevel.Information), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); rs = null; } _unitOfWork.Commit(); // return Dictionary with DocNum and DocEntry return(InvoiceNums); } catch (Exception ex) { _orderLogRepository.LogEvent( o.Order.AmazonOrderId, String.Format("{0} - Invoice was not created.", ex.GetType().Name + " - " + ex.Message), nameof(LogEventLevel.Critical), "DIAPI_Services", StackExtensions.GetCurrentMethod(), "Bast", "HAL 9000"); if (!InvoiceNums.ContainsKey("ActionRequired")) { InvoiceNums.Add("ActionRequired", "true"); } else { InvoiceNums["ActionRequired"] = "true"; } rs = null; return(InvoiceNums); } }
public int Compare(RankedAlias x, RankedAlias y) { return(Decimal.Compare(y.YesValue, x.YesValue)); }
public int CompareTo(object obj) { Bank b = (Bank)obj; return(Decimal.Compare(this.USD_out, b.USD_out)); }