public void SetReceiptState(ResponseReceiptStates state, AccountSession accountSession, double?value = null) { // push a new receipt onto the list this.Receipts.Add(new ResponseReceipt() { State = state, On = DateTimeHelper.Now, By = accountSession.MemberId, Value = QuoteHelper.NormalizeValue(value) }); // set the current state this.State = state; if (state == ResponseReceiptStates.Pending) { // initialize the quote details based on the value submitted by the provider this.Quote = QuoteHelper.NormalizeValue(value); this.DepositDue = QuoteHelper.ComputeDepositeDue(value); this.DepositPaid = 0; this.BalanceDue = QuoteHelper.ComputeBalanceDue(value); this.BalancePaid = 0; } if (state == ResponseReceiptStates.Accepted) { // update the deposit paid based on the value paid by the consumer this.DepositDue = 0; this.DepositPaid = QuoteHelper.NormalizeValue(value); this.BalanceDue = QuoteHelper.ComputeBalanceDue(this.Quote, value); this.BalancePaid = 0; } }
private void LoadQuotesByFounder(int founderId) { bool addedMeta = false; CoreDataObjects.QuotesViewDataTable quotesDt = quotesAdpt.GetByFounderID(founderId); int numOfRecords = quotesDt.Rows.Count; int numOfPages = (int)Math.Ceiling((decimal)numOfRecords / (decimal)RECORDS_PER_PAGE); //loop for generating the page links for these results for (int p = 1; p <= numOfPages; p++) { string linkUrl = string.Format("~/search.aspx?searchType=Founders&founderId={0}&p={1}", _founderId, p); HyperLink pageLink = new HyperLink(); pageLink.NavigateUrl = linkUrl; pageLink.Text = p.ToString(); //set visual difference for active page if (p == _page) { pageLink.CssClass = "ActivePage"; } PanelPagingBottom.Controls.Add(pageLink); } //loop that displays the quotes int startRecord = ((_page * RECORDS_PER_PAGE) - RECORDS_PER_PAGE) + 1; int lastRecOnPage = _page * RECORDS_PER_PAGE; int recRatio = lastRecOnPage / numOfRecords; int totalRecsLeft = numOfRecords - ((_page - 1) * RECORDS_PER_PAGE); int endRecord = lastRecOnPage + (recRatio * totalRecsLeft) - (recRatio * RECORDS_PER_PAGE); if (numOfRecords < RECORDS_PER_PAGE) { startRecord = 1; endRecord = numOfRecords; PanelPagingBottom.Visible = false; } for (int i = startRecord; i <= endRecord; i++) { //add the quote to the page CoreDataObjects.QuotesViewRow r = (CoreDataObjects.QuotesViewRow)quotesDt.Rows[i - 1]; QuoteHelper.LoadQuote(PanelQuotes, "", r.QuoteText, r.QuoteID, r.ReferenceInfo, r.Keywords, false); //add the page meta data only once if (!addedMeta) { SummaryText.Text = string.Format("Showing {3} Quotes <b>{0}</b> - <b>{1}</b> of <b>{2}</b>", startRecord, endRecord, quotesDt.Rows.Count, r.FullName); LoadFounderData(_founderId); Page.Title = string.Format("Quotes By {0}", r.FullName); Page.AddMetaInfo(MetaTags.Title, string.Format("What Would The Founders Do : {0}", r.FullName)); Page.AddMetaInfo(MetaTags.Description, string.Format("WWFD found {0} quotes by {1}: \"{2}\" More quotes available at http://whatwouldthefoundersdo.org.", quotesDt.Rows.Count, r.FullName, r.QuoteText)); addedMeta = true; } } }
protected void btnSave_ServerClick(object sender, EventArgs e) { lblError.Visible = false; int status = Convert.ToInt32(slctType.Items[slctType.SelectedIndex].Value); if (status == 0) { lblError.Visible = true; lblError.InnerHtml = "İşlem Tipi seçiniz..."; return; } QuoteStatus quoteStatus = (QuoteStatus)status; string quoteNo = txtSalesNo.Value; Dictionary <Guid, QuoteStatus> quoteInfo = GetQuoteId(quoteNo); if (quoteInfo == null) { lblError.Visible = true; lblError.InnerHtml = "Satış bulunamadı..."; return; } else { if (quoteStatus == QuoteStatus.MuhasebeyeAktarıldı) { MsCrmResult result = QuoteHelper.Muhasebelestir(quoteInfo.Keys.FirstOrDefault().ToString()); lblError.Visible = true; lblError.InnerHtml = result.Result; return; } else //if(quoteStatus==QuoteStatus.İptalEdildi) { //if(quoteInfo.Values.FirstOrDefault()==QuoteStatus.İptalEdildi || quoteInfo.Values.FirstOrDefault()==QuoteStatus.İptalAktarıldı) //{ MsCrmResult resultIptal = IptalEt(quoteInfo.Keys.FirstOrDefault().ToString()); lblError.Visible = true; lblError.InnerHtml = resultIptal.Result; return; //} } } }
public void QuotedMore() { var delimiter = '\t'; var quotedChar = '"'; var line = "asdf\t\t\t\tasd\t"; Assert.AreEqual(5, QuoteHelper.CountNumberOfDelimiters(line, delimiter, quotedChar)); line = "\t\t\t\tasd\t"; Assert.AreEqual(5, QuoteHelper.CountNumberOfDelimiters(line, delimiter, quotedChar)); line = "\t\t\t\tasd\tasd"; Assert.AreEqual(5, QuoteHelper.CountNumberOfDelimiters(line, delimiter, quotedChar)); line = "asd\t\t\t\tasd\tasd"; Assert.AreEqual(5, QuoteHelper.CountNumberOfDelimiters(line, delimiter, quotedChar)); }
public Payment CreatePaymentTransaction(Braintree.Transaction transaction) { var payment = new Payment() { CardholderName = transaction.CreditCard.CardholderName, CardLastFour = transaction.CreditCard.LastFour, CardType = Convert.ToString(transaction.CreditCard.CardType), ExpirationMonth = transaction.CreditCard.ExpirationMonth, ExpirationYear = transaction.CreditCard.ExpirationYear, PostalCode = transaction.CreditCard.BillingAddress.PostalCode, Amount = Convert.ToDouble(QuoteHelper.NormalizeValue(transaction.Amount)), TransactionId = transaction.Id, MerchantAccountId = transaction.MerchantAccountId, ProcessorAuthorizationCode = transaction.ProcessorAuthorizationCode }; return(payment); }
public void Execute(IServiceProvider serviceProvider) { #region | Service | if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService adminService = serviceFactory.CreateOrganizationService(Globals.AdministratorId); OrganizationServiceContext orgContext = new OrganizationServiceContext(adminService); #endregion Entity entity = (Entity)context.InputParameters["Target"]; #region | Satış Düzelt Denildiğinde ilgili Ödeme kayıtlarınıda kopyalar | if (context.ParentContext.InputParameters.Contains("QuoteId")) { Guid quoteId = (Guid)context.ParentContext.InputParameters["QuoteId"]; QuoteHelper.SetPaymentForNewQuote(entity, quoteId, adminService); DiscountProtocolHelper.SetDiscountProtocolsForNewQuote(entity, quoteId, adminService); //QuoteHelper.SetAmountForNewQuote(entity, quoteId, adminService); } #endregion | Satış Düzelt Denildiğinde ilgili Ödeme kayıtlarınıda kopyalar | #region | Satış Üzerine Fırsatı Set Eder FIRSAT KAPATILIRKEN HATA VERİYOR. İLGİLİ TEKLİF HALA AÇIK OLDUĞU İÇİN. **KAPALI** | // QuoteHelper.SetOpportunity(entity, adminService); #endregion | Satış Üzerine Fırsatı Set Eder FIRSAT KAPATILIRKEN HATA VERİYOR. İLGİLİ TEKLİF HALA AÇIK OLDUĞU İÇİN. **KAPALI** | #region | Birim metrekare | QuoteHelper.CalculatePerSquareMeter(entity, adminService); #endregion | Birim metrekare | #region | Birim metrekare | if (entity.Contains("new_salesprocessdate") && entity.Contains("transactioncurrencyid") && !context.ParentContext.InputParameters.Contains("QuoteId")) { QuoteHelper.SetExchangeRateOnQuotePostCreate(entity, adminService); } #endregion }
private void ShowResults(DataTable results, string[] searchWords) { lnkSort.NavigateUrl = string.Format("~/Search.aspx?searchType=Quotes&searchText={0}&sort={1}", Server.UrlEncode(searchBox.Text), "true"); bool addedMeta = false; foreach (CoreDataObjects.QuotesViewRow r in results.Rows) { QuoteHelper.LoadQuote(PanelQuotes, r.FullName, r.QuoteText, r.QuoteID, r.ReferenceInfo, r.Keywords, searchWords, true); if (!addedMeta) { int founderCount = results.SelectDistinct("FounderID").Rows.Count; Page.Title = string.Format("{0} - WWFD Search", searchBox.Text); Page.AddMetaInfo(MetaTags.Title, string.Format("WWFD Search for '{0}' Returned {1} Quote(s) From {2} Founder(s).", searchBox.Text, results.Rows.Count, founderCount)); Page.AddMetaInfo(MetaTags.Description, string.Format("{0}", r.QuoteText, r.FullName)); addedMeta = true; } } }
private static async Task <Quote.Quote> getQuoteOfDay() { return(await QuoteHelper.GetQuoteOfDay()); }
private void LoadSingleQuote(int quoteId) { CoreDataObjects.QuotesViewRow r; if (quoteId == 0) { //load the quote of the day r = (CoreDataObjects.QuotesViewRow)quotesAdpt.GetQuoteOfTheDay().Rows[0]; } else { //get quote that is requested r = (CoreDataObjects.QuotesViewRow)quotesAdpt.GetByQuoteID(quoteId).Rows[0]; } //setup page meta data title Page.Title = string.Format("{0} Quote #{1}", r.FullName, r.QuoteID); //change meta title on the quote of the day request if (_qotd) { Page.AddMetaInfo(OpenGraphMetaTags.Title, string.Format("Quote of the Day: {0} Quote #{1}", r.FullName, r.QuoteID)); } else { Page.AddMetaInfo(OpenGraphMetaTags.Title, string.Format("{0} Quote #{1}", r.FullName, r.QuoteID)); } Page.AddMetaInfo(OpenGraphMetaTags.Type, "article"); Page.AddMetaInfo(OpenGraphMetaTags.Site_Name, "WhatWouldTheFoundersDo.org"); Page.AddMetaInfo(OpenGraphMetaTags.URL, string.Format("http://www.whatwouldthefoundersdo.org/showquote.aspx?q={0}", r.QuoteID)); Page.AddMetaInfo(OpenGraphMetaTags.Description, string.Format("{0}", r.QuoteText)); LoadFounderData(r.FounderID); try { if (Request.QueryString["Edit"] != null) { if (Authenticator.GetUser().Role == ContributorRoles.Admin) { if (!IsPostBack) { FoundersTableAdapter foundersAdpt = new FoundersTableAdapter(); this.ddFounders.DataSource = foundersAdpt.GetData().OrderBy(n => n.FirstName); this.ddFounders.DataTextField = "FullName"; this.ddFounders.DataValueField = "FounderID"; this.ddFounders.DataBind(); } //show the quote in a text box QuoteText.Text = r.QuoteText; QuoteText.Width = 580; QuoteText.Rows = (r.QuoteText.Length / 118) + 1; QuoteText.CssClass = "transparent"; QuoteText.ToolTip = "Click to modify."; QuoteText.Attributes.Add("onclick", "this.className = 'selected';"); QuoteText.Attributes.Add("onblur", "this.className = 'transparent';"); ddFounders.ClearSelection(); //ddFounders.SelectedValue = r.FounderID.ToString(); ddFounders.Items.FindByValue(r.FounderID.ToString()).Attributes.Add("selected", "true"); PanelAdmin.Visible = true; QuoteId.Value = r.QuoteID.ToString(); } } else { QuoteHelper.LoadQuote(PanelQuote, "", r.QuoteText, 0, r.ReferenceInfo, r.Keywords, false); } } catch { QuoteHelper.LoadQuote(PanelQuote, "", r.QuoteText, 0, r.ReferenceInfo, r.Keywords, false); } }
public async Task <ActionResult <string> > Get(string user, string stockSymbol, string transactionId) { var quote = await QuoteHelper.GetQuote(user, stockSymbol, transactionId); return(Json(quote)); }
public static MsCrmResult Process() { MsCrmResult returnValue = new MsCrmResult(); int totalCount = 0; int errorCount = 0; int successCount = 0; IOrganizationService service = MSCRM.GetOrgService(true); SqlDataAccess sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); DataTable lstImports = QuoteHelper.GetNotProcessedYellowExcelQuotes(sda); Console.SetCursorPosition(0, 1); Console.WriteLine("Listeler çekildi. Adet:" + lstImports.Rows.Count.ToString()); if (lstImports.Rows.Count > 0) { for (int i = 0; i < lstImports.Rows.Count; i++) { Guid quoteId = new Guid(Convert.ToString(lstImports.Rows[i]["QuoteId"])); try { Console.SetCursorPosition(0, 2); Console.WriteLine((i + 1).ToString() + ". Liste İşleniyor."); //HATALI KAYITLARI SİLER PaymentHelper.DeletePaymentsIfExist(quoteId, service, sda); totalCount = 0; errorCount = 0; successCount = 0; int customerIdType = Convert.ToInt32(lstImports.Rows[i]["CustomerIdType"]); Guid customerId = new Guid(Convert.ToString(lstImports.Rows[i]["CustomerId"])); Guid financialAccount = new Guid(Convert.ToString(lstImports.Rows[i]["new_financialaccountid"])); Decimal totalAmountQuote = Convert.ToDecimal(lstImports.Rows[i]["totalamountlessfreight"]); Decimal totalLineItemAmount = Convert.ToDecimal(lstImports.Rows[i]["TotalLineItemAmount"]); MsCrmResult resultProcessing = QuoteHelper.UpdateYellowExcelState(quoteId, 2, service); //İşleniyor if (resultProcessing.Success) { DataTable dt = QuoteHelper.GetNotProcessedYellowExcelData(quoteId, "Sheet1", sda); Console.SetCursorPosition(0, 3); Console.WriteLine((i + 1).ToString() + ". Liste Kayıt sayısı: " + dt.Rows.Count.ToString()); if (dt.Rows.Count > 0) { totalCount = dt.Rows.Count; decimal totalAmountExcel = 0; foreach (DataRow currentPayment in dt.Rows) { if (DBNull.Value != currentPayment["Tutar"]) { totalAmountExcel += Convert.ToDecimal(currentPayment["Tutar"]); } } if (totalAmountExcel != totalAmountQuote) { string message = "İndirimli Konut Fiyatı, Sarı Excel tutar toplamı ile aynı değil. Lütfen kontrol edin."; message += Environment.NewLine; message += "Excel Tutar Toplamı : " + totalAmountExcel.ToString("#.##"); message += Environment.NewLine; message += "İndirimli Konut Fiyatı : " + totalAmountQuote.ToString("#.##"); QuoteHelper.LogYellowExcelError(quoteId, message, service); SendInformationMail(quoteId, 0, service); break; } for (int j = 0; j < totalCount; j++) { Console.SetCursorPosition(0, 4); Console.WriteLine("Sayaç:" + (j + 1).ToString()); //Satıs tutarı kontrolü geçici bir süre kapatıldı. //if (j == 0) //{ // if (totalLineItemAmount == Convert.ToDecimal(dt.Rows[j]["Satıs Tutarı"])) // { // } //} if ((DBNull.Value == dt.Rows[j]["Tutar"] || Convert.ToDecimal(dt.Rows[j]["Tutar"]) == 0) || DBNull.Value == dt.Rows[j]["Vade Gün"] || dt.Rows[j]["Vade Gün"].ToString().Contains("1900")) { continue; } if (DBNull.Value == dt.Rows[j]["Ödeme Tipi"] || Convert.ToString(dt.Rows[j]["Ödeme Tipi"]).Trim().ToUpper().Equals("KAPARO")) { continue; } #region | PROCESS ROW | try { SetPayment(dt.Rows[j], quoteId, customerIdType, customerId, financialAccount, service); } catch (Exception ex) { //Console.WriteLine("hata 1" + ex.Message); //Console.ReadLine(); QuoteHelper.UpdateYellowExcelState(quoteId, 4, service, ex.Message); //Hata alındı SendInformationMail(quoteId, 0, service); } #endregion Console.SetCursorPosition(0, 5); Console.WriteLine("Hata:" + errorCount.ToString()); Console.SetCursorPosition(0, 6); Console.WriteLine("Başarılı:" + successCount.ToString()); } } } QuoteHelper.UpdateYellowExcelState(quoteId, 3, service, "Excel başarılı bir şekilde işlendi."); //İşlendi SendInformationMail(quoteId, 1, service); } catch (Exception ex) { QuoteHelper.LogYellowExcelError(quoteId, ex.Message, service); returnValue.Result = ex.Message; //Console.WriteLine("hata 1" + ex.Message); //Console.ReadLine(); } } returnValue.Success = true; returnValue.Result = "Listeler işlendi..."; } return(returnValue); }
static async Task Main(string[] args) { var username = "******"; var password = "******"; var loginURL = "https://sandbox-api-applet.shipprimus.com/api/v1/login"; var quoteURL = "https://sandbox-api-applet.shipprimus.com/applet/v1/rate/multiple"; var quoteSaveURL = "https://sandbox-api-applet.shipprimus.com/applet/v1/rate/save"; var createShipmentUrl = "https://sandbox-api-applet.shipprimus.com/applet/v1/book"; Console.WriteLine("Get Token"); var token = await QuoteHelper.GetBearerTokenPostAsync(username, password, loginURL); Console.WriteLine("Get Quotes"); var quoteRequest = new QuoteRequest() { originCity = "Miami", originState = "FL", originZipcode = "33142", originCountry = "US", destinationCity = "Laredo", destinationState = "TX", destinationZipcode = "78045", destinationCountry = "US", uOM = "US", pickupDate = "06/30/2020", equipment = "Van", Accessorials = new List <string>() { "LFO", "INO", "LFD", "IND" }, freightInfo = JArray.Parse("[{'qty':3,'weight':500,'weightType':'each','length':40,'width':48,'height':48,'class':50,'hazmat':0,'commodity':'','dimType':'PLT','stack':false}]") }; var quote = await QuoteHelper.GetQuotes(quoteRequest, token, quoteURL); foreach (var item in quote.data.results.rates) { Console.WriteLine("id: " + item.id); Console.WriteLine("name: " + item.name); Console.WriteLine("SCAC: " + item.SCAC); Console.WriteLine("serviceLevel: " + item.serviceLevel); Console.WriteLine("serviceLevelCode: " + item.serviceLevelCode); Console.WriteLine("transitDays: " + item.transitDays); Console.WriteLine("total: " + item.total); Console.WriteLine("rateType: " + item.rateType); Console.WriteLine("iconUrl: " + item.iconUrl); Console.WriteLine("responseTime: " + item.responseTime); Console.WriteLine("vendorId: " + item.vendorId); foreach (var item1 in item.rateBreakdown) { Console.WriteLine("Breakdown =>>> " + item1.name + ":" + item1.total); } Console.WriteLine("--------------------------------------------------------------------------------"); } Console.WriteLine("Save Quotes"); var quoteSaveRequest = new SaveQuoteRequest() { rateId = quote.data.results.rates[0].id, originShippingLocationId = 0, destinationShippingLocationId = 0, laneDistance = 0, }; JObject jrequestsavequote = JObject.FromObject(quoteSaveRequest); var quoteSave = QuoteHelper.SaveQuote(quoteSaveURL, token, jrequestsavequote); Console.WriteLine("Create Shipment"); var createShipmentRequest = new CreateShipmentRequest() { thirdPartyReferenceNumber = "", PRONmbr = "", BOLNmbr = "testmehmet12345", BOLPrefix = "", shipper = new Location() { id = 0, name = "string", referenceNumber = "1515154", address1 = "string", address2 = "string", city = "Miami", state = "FL", zipCode = "33142", country = "US", phone = "string", fax = "string", email = "string", contact = "string", contactPhone = "string" }, consignee = new Location() { id = 0, name = "string", referenceNumber = "25551", address1 = "string", address2 = "string", city = "Laredo", state = "TX", zipCode = "78045", country = "US", phone = "string", fax = "string", email = "string", contact = "string", contactPhone = "string" }, quoteNumber = quoteSave.data != null ? quoteSave.data.results.quoteNumber:"", lineItems = JArray.Parse("[{'qty':3,'weight':500,'weightType':'each','length':40,'width':48,'height':48,'volume': 200,'dimType':'PLT','class':'50','hazmat':0,'stack':false,'stackAmount': 1,'commodity':''}]"), UOM = "US", accessorialsList = new List <string>() { "LFO", "LFO" }, insuranceAmount = 0, insuranceFreight = true, insuranceAddOn = true, brokerInformation = new BrokerInformation() { name = "", contact = "", phone = "", notes = "" }, pickupInformation = new LocationInformation() { date = "2020-07-07", type = "PO", fromTime = "08:30", toTime = "10:30" }, deliveryInformation = new LocationInformation() { date = "2020-07-09", type = "DO", fromTime = "08:30", toTime = "12:30" }, BOLInstructions = "", shipmentNotes = "" }; JObject jrequestcreateshipment = JObject.FromObject(createShipmentRequest); var quoteCreateShipment = QuoteHelper.CreateShipment(createShipmentUrl, token, jrequestcreateshipment); }