public string this [int id] { get { return(list.FirstOrDefault(emp => emp.empId == id).name); } set { list.FirstOrDefault(emp => emp.empId == id).name = value; } }
protected void BindGv() { System.Collections.Generic.List <PTStopMsg> list = ( from stop in this.stopMsgServer where stop.PrjGuid == this.hfldPrjId.Value select stop into list0 orderby list0.InputDate descending select list0).ToList <PTStopMsg>(); this.gvStopMsg.DataSource = list; this.gvStopMsg.DataBind(); if (list.Count <= 0) { this.hfldIsAllowAdd.Value = "1"; return; } PTStopMsg stopMsg = list.FirstOrDefault <PTStopMsg>(); PTRetMsgService source = new PTRetMsgService(); System.Collections.Generic.List <PTRetMsg> list2 = ( from ret in source where ret.StopMsgId == stopMsg.StopMsgId && ret.FlowState.Value == 1 select ret).ToList <PTRetMsg>(); if (list2.Count > 0) { this.hfldIsAllowAdd.Value = "1"; return; } this.hfldIsAllowAdd.Value = "0"; }
public ActionResult PrintOrder(int?id) { PrintOrderContext context = new PrintOrderContext(); context.Form = new PrintOrderModel(); context.Form.Claim = (id.HasValue ? id.ToString() : ""); ActionResult result; if (WebSecurity.IsAuthenticated) { int guestId = WebSecurity.CurrentUserId; System.Collections.Generic.List <GuestClaim> claims = GuestProvider.GetLinkedClaims(UrlLanguage.CurrentLanguage, guestId); int?detailedId = null; if (id.HasValue) { if (claims.FirstOrDefault((GuestClaim m) => m.claim == id.Value) != null) { detailedId = new int?(id.Value); } } if (detailedId.HasValue) { result = this.BuildVoucher(detailedId.Value); return(result); } context.NotFound = true; } result = base.View(context); return(result); }
public IActionResult Upsert(Game game) { var foundGame = games.FirstOrDefault(g => g.GameID == game.GameID); if (foundGame != null) { if (!String.IsNullOrEmpty(game.SteamOriginalImageURL)) { if (game.SteamOriginalImageURL.Contains("http")) { foundGame.LogoURL = game.SteamOriginalImageURL; } } foundGame.Disabled = game.Disabled; } else { var cover = HttpContext.Request.Form.Files.GetFile("LogoURL"); if (cover != null) { MyCollections.Util.File.UploadFile(cover, cover.FileName); game.LogoURL = "games/covers/" + cover.FileName; } games.Add(game); } _db.SaveJson(games, @"docs/games/games.json"); return(RedirectToAction("Index", "Games")); }
protected internal void RemoveConnection(string id) { ClientObject client = clients.FirstOrDefault(c => c.Id == id); // получаем по id закрытое подключение if (client != null) // и удаляем его из списка подключений { clients.Remove(client); } }
public static StoredItem GetStoredItem(Profile p) { StoredItem item = _storedItems.FirstOrDefault((StoredItem i) => i.profile == p); if (item == null) { item = new StoredItem { profile = p }; _storedItems.Add(item); } return(item); }
public static void LinkGuestClaim(int userId, string name, int claim) { System.Collections.Generic.List <GuestClaim> claims = GuestProvider.FindGuestClaims("", userId, name, new int?(claim), null); if (claims != null && claims.FirstOrDefault((GuestClaim m) => m.claim == claim) != null) { DatabaseOperationProvider.ExecuteProcedure("up_guest_linkGuestClaim", new { userid = userId, claim = claim }); return; } throw new ExceptionWithCode(203, string.Format("claim {0} not found", claim)); }
void IService.Leave(Network.IStreamable stream) { User user = null; lock (_Users) { user = _Users.FirstOrDefault(u => u.Stream == stream); } if (user != null) { user.Shutdown(); lock (_Users) _Users.Remove(user); } }
public Connection GetConnectionInfo(int connectionID) { if (_connectioniInfos.Count == 1) { return(_connectioniInfos.ElementAt(0)); } else if (_connectioniInfos == null || _connectioniInfos.Count == 0) { return(null); } else { return(_connectioniInfos.FirstOrDefault(p => p.ConnectionID == connectionID)); } }
public ReservationState State(int?id, [FromUri] StatusParams param) { Func <GuestClaim, bool> func = null; if (!id.HasValue) { throw new ArgumentNullExceptionWithCode(110, "id"); } if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); ReservationState result = BookingProvider.GetReservationState(param.Language, id.Value); ReservationState result2; if (result != null && result.claimId.HasValue) { if (param.PartnerSessionID != null && result.partner != null && result.partner.id == partner.id) { result2 = result; return(result2); } if (WebSecurity.CurrentUserId > 0) { System.Collections.Generic.List <GuestClaim> claims = GuestProvider.GetLinkedClaims(param.Language, WebSecurity.CurrentUserId); bool arg_10E_0; if (claims != null) { arg_10E_0 = (claims.FirstOrDefault((GuestClaim m) => m.claim == result.claimId.Value) == null); } else { arg_10E_0 = true; } if (!arg_10E_0) { result2 = result; return(result2); } } } return(null); }
public static void startAnimation(int ventId) { JackInTheBox box = AllJackInTheBoxes.FirstOrDefault((x) => x?.vent != null && x.vent.Id == ventId); if (box == null) { return; } HudManager.Instance.StartCoroutine(Effects.Lerp(0.6f, new Action <float>((p) => { if (box.boxRenderer != null) { box.boxRenderer.sprite = getBoxAnimationSprite((int)(p * boxAnimationSprites.Length)); if (p == 1f) { box.boxRenderer.sprite = getBoxAnimationSprite(0); } } }))); }
public static System.Collections.Generic.List <CategoryGroupWithCategories> GetCategoriesByGroup(string lang, int?startPoint) { DataSet ds = DatabaseOperationProvider.QueryProcedure("up_guest_getExcursionCategories", "categories", new { language = lang, startpoint = startPoint }); System.Collections.Generic.List <CategoryGroupWithCategories> result = ( from DataRow row in ds.Tables["categories"].Rows select ExcursionProvider.factory.CategoryGroupWithCategories(row)).Distinct(new ExcursionProvider.CategoryGroupWithCategoriesComparer()).ToList <CategoryGroupWithCategories>(); CategoryGroupWithCategories emptyGroup = result.FirstOrDefault((CategoryGroupWithCategories m) => m.group == null); if (emptyGroup != null) { result.Remove(emptyGroup); result.Insert(0, emptyGroup); } foreach (CategoryGroupWithCategories group in result) { if (group.group == null) { group.categories = ( from DataRow row in ds.Tables["categories"].Rows where row.IsNull("categorygroup$inc") select ExcursionProvider.factory.Category(row)).ToList <Category>(); } else { group.categories = ( from row in ds.Tables["categories"].Rows.Cast <DataRow>().Where(delegate(DataRow row) { int?num = row.ReadNullableInt("categorygroup$inc"); return(num == ((@group.@group != null) ? new int?(@[email protected]) : null)); }) select ExcursionProvider.factory.Category(row)).ToList <Category>(); } } return(result); }
protected void BindGv() { System.Collections.Generic.List <PTRetMsg> list = ( from ret in this.retMsgServer where ret.PrjGuid == this.hfldPrjId.Value select ret into List orderby List.InputDate descending select List).ToList <PTRetMsg>(); this.gvRetMsg.DataSource = list; this.gvRetMsg.DataBind(); if (list.Count <= 0) { this.hfldIsAllowAdd.Value = "1"; return; } if (list.FirstOrDefault <PTRetMsg>().FlowState == 1) { this.hfldIsAllowAdd.Value = "1"; return; } this.hfldIsAllowAdd.Value = "0"; }
/// <summary> /// Constructor /// </summary> /// <param name="Reader">Reader to copy from</param> public CacheTables(IDataReader Reader) { CacheTables Temp = Reader as CacheTables; if (Temp!=null) { this.Tables = Temp.Tables; CurrentTable = Tables.FirstOrDefault(); CurrentRow = CurrentTable[0]; CurrentTablePosition = 0; RowPosition = -1; return; } Tables = new System.Collections.Generic.List<Table>(); Tables.Add(new Table(Reader)); while (Reader.NextResult()) { Tables.Add(new Table(Reader)); } CurrentTable = Tables.FirstOrDefault(); CurrentRow = CurrentTable[0]; CurrentTablePosition = 0; RowPosition = -1; }
public static void startAnimation(int ventId) { JackInTheBox box = AllJackInTheBoxes.FirstOrDefault((x) => x?.vent != null && x.vent.Id == ventId); if (box == null) { return; } Vent vent = box.vent; HudManager.Instance.StartCoroutine(Effects.Lerp(0.6f, new Action <float>((p) => { var sprites = getBoxAnimationSprites(); if (vent != null && vent.myRend != null && sprites != null && sprites.Count > 0) { int index = (int)(p * sprites.Count); vent.myRend.sprite = sprites[Mathf.Clamp(index, 0, sprites.Count - 1)]; if (p == 1f) { vent.myRend.sprite = getBoxSprite(); } } }))); }
/// <summary> /// Constructor /// </summary> /// <param name="Reader">Reader to copy from</param> public CacheTables(IDataReader Reader) { CacheTables Temp = Reader as CacheTables; if (Temp != null) { this.Tables = Temp.Tables; CurrentTable = Tables.FirstOrDefault(); CurrentRow = CurrentTable[0]; CurrentTablePosition = 0; RowPosition = -1; return; } Tables = new System.Collections.Generic.List <Table>(); Tables.Add(new Table(Reader)); while (Reader.NextResult()) { Tables.Add(new Table(Reader)); } CurrentTable = Tables.FirstOrDefault(); CurrentRow = CurrentTable[0]; CurrentTablePosition = 0; RowPosition = -1; }
public void Remove(int id) { var existing = _students.FirstOrDefault(student => student.Id == id); _students.Remove(existing); }
public BFURichTextEditor() { buttonCommand = new RelayCommand(async(p) => { var item = items.FirstOrDefault(x => x.Key == p.ToString()); if (item != null) { if (item.CanCheck) { if (!item.Checked) { await jsRuntime.InvokeVoidAsync("BlazorFluentUiRichTextEditor.setFormat", quillId, p.ToString().ToLowerInvariant()); } else { await jsRuntime.InvokeVoidAsync("BlazorFluentUiRichTextEditor.setFormat", quillId, p.ToString().ToLowerInvariant(), false); } item.Checked = !item.Checked; } else { switch (item.Key) { case "Image": isImageDialogOpen = true; //await jsRuntime.InvokeVoidAsync("window.BlazorFluentUiRichTextEditor.setFormat", quillId, "image", ""; break; } } } StateHasChanged(); }); _debounceTextTimer = new System.Timers.Timer(); _debounceTextTimer.Interval = 150; _debounceTextTimer.AutoReset = false; _debounceTextTimer.Elapsed += async(s, e) => { await InvokeAsync(async() => { await RichTextChanged.InvokeAsync(_waitingText); }); }; _debounceSelectionTimer = new System.Timers.Timer(); _debounceSelectionTimer.Interval = 150; _debounceSelectionTimer.AutoReset = false; _debounceSelectionTimer.Elapsed += async(s, e) => { await InvokeAsync(() => { if (_waitingFormattingState != null) { var stateNeedsChanging = false; var props = _waitingFormattingState.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var prop in props) { var commandButton = items.FirstOrDefault(x => x.Key == prop.Name); if (commandButton != null && commandButton.Checked != (bool)prop.GetValue(_waitingFormattingState)) { commandButton.Checked = !commandButton.Checked; stateNeedsChanging = true; } } if (stateNeedsChanging) { StateHasChanged(); } } }); }; items = new System.Collections.Generic.List <BFUCommandBarItem> { new BFUCommandBarItem() { Text = "Bold", CanCheck = true, IconOnly = true, IconName = "Bold", Key = "Bold", Command = buttonCommand, CommandParameter = "Bold" }, new BFUCommandBarItem() { Text = "Italic", CanCheck = true, IconOnly = true, IconName = "Italic", Key = "Italic", Command = buttonCommand, CommandParameter = "Italic" }, new BFUCommandBarItem() { Text = "Underline", CanCheck = true, IconOnly = true, IconName = "Underline", Key = "Underline", Command = buttonCommand, CommandParameter = "Underline" }, new BFUCommandBarItem() { Text = "Superscript", CanCheck = true, IconOnly = true, IconName = "Superscript", Key = "Superscript", Command = buttonCommand, CommandParameter = "Superscript" }, new BFUCommandBarItem() { Text = "Subscript", CanCheck = true, IconOnly = true, IconName = "Subscript", Key = "Subscript", Command = buttonCommand, CommandParameter = "Subscript" }, new BFUCommandBarItem() { Text = "Insert Image", CanCheck = false, IconOnly = true, IconName = "ImagePixel", Key = "Image", Command = buttonCommand, CommandParameter = "Image" } }; }
protected override async Task OnParametersSetAsync() { if (SubGroupSelector != null) { //if (ItemsSource != null && !ItemsSource.Equals(_itemsSource)) //if (RootGroup != null && !RootGroup.Equals(_rootGroup)) if (ItemsSource != null && !ItemsSource.Equals(_itemsSource)) { //dispose old subscriptions _transformedDisposable?.Dispose(); _itemsSource = ItemsSource; //_rootGroup = RootGroup; if (_itemsSource != null) //if (_rootGroup != null) { //var list = new System.Collections.Generic.List<TItem>(); //list.Add(_rootGroup); var changeSet = _itemsSource.AsObservableChangeSet(); System.Collections.Generic.List <HeaderItem <TItem> > headersList = new System.Collections.Generic.List <HeaderItem <TItem> >(); Dictionary <int, int> depthIndex = new Dictionary <int, int>(); var rootIndex = 0; var transformedChangeSet = changeSet.TransformMany <GroupedListItem <TItem>, TItem>((x) => { var header = new HeaderItem <TItem>(x, null, rootIndex++, 0, GroupTitleSelector); headersList.Add(header); var children = SubGroupSelector(x).RecursiveSelect <TItem, GroupedListItem <TItem> >( r => SubGroupSelector(r), (s, index, depth) => { if (!depthIndex.ContainsKey(depth)) { depthIndex[depth] = 0; } var parent = headersList.FirstOrDefault(header => header.Depth == depth - 1 && SubGroupSelector(header.Item).Contains(s)); if (SubGroupSelector(s) == null || SubGroupSelector(s).Count() == 0) { var item = new PlainItem <TItem>(s, parent, index, depth); parent?.Children.Add(item); return(item); } else { var header = new HeaderItem <TItem>(s, parent, index, depth, GroupTitleSelector); headersList.Add(header); parent?.Children.Add(header); return(header); } }, 1); return(Enumerable.Repeat(header, 1).Concat(children)); }); _transformedDisposable = transformedChangeSet .AutoRefreshOnObservable(x => x.IsVisibleObservable) .Filter(x => x.IsVisible) .Sort(new GroupedListItemComparer <TItem>()) .Bind(out dataItems) .Subscribe(); } } } //if (Selection != null) //{ // if (SelectionMode == SelectionMode.Single && Selection.SelectedItems.Count() > 1) // { // SelectionZone.ClearSelection(); // } // else if (SelectionMode == SelectionMode.None && Selection.SelectedItems.Count() > 0) // { // Selection.ClearSelection(); // } // else // { // bool hasChanged = false; // //make a copy of list // var selected = Selection.SelectedItems.ToList(); // //check to see if a header needs to be turned OFF because all of its children are *not* selected. // restart: // var headers = selected.Where(x => SubGroupSelector(x) != null && SubGroupSelector(x).Count() > 0).ToList(); // foreach (var header in headers) // { // if (SubGroupSelector(header).Except(selected).Count() > 0) // { // hasChanged = true; // selected.Remove(header); // //start loop over again, simplest way to start over is a goto statement. This is needed when a header turns off, but it's parent header needs to turn off, too. // goto restart; // } // } // //check to see if a header needs to be turned ON because all of its children *are* selected. // var potentialHeaders = dataItems.Where(x => selected.Contains(x.Item)).Select(x => x.Parent).Where(x => x != null).Distinct().ToList(); // foreach (var header in potentialHeaders) // { // if (header.Children.Select(x => x.Item).Except(selected).Count() == 0) // { // if (!selected.Contains(header.Item)) // { // selected.Add(header.Item); // hasChanged = true; // } // } // } // if (hasChanged) // { // SelectionZone.AddAndRemoveItems(selected.Except(Selection.SelectedItems).ToList(), Selection.SelectedItems.Except(selected).ToList()); // } // } //} await base.OnParametersSetAsync(); }
public static void ImportAnswerToDep(string directory, string pubsuburl) { if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl)) { throw new Exception("Arguments cannot be null"); } System.Collections.Generic.List <ThreePLAnswer> answers = new System.Collections.Generic.List <ThreePLAnswer>(); bool skipheaders = true; string[] entries = null; System.Collections.Generic.List <char> delim = new System.Collections.Generic.List <char>(); delim.Add('\r'); delim.Add('\n'); string[] files = System.IO.Directory.GetFiles(directory); foreach (var file in files) { if (!file.Contains("OUTB")) { continue; } skipheaders = true; foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>()) { if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false))) { entries = row?.Split(';'); if ((skipheaders)) { skipheaders = false; continue; } if ((entries.Length > 0 && (entries[0] == null || entries[0] == "") == false)) { ThreePLAnswer answer; answer = answers.FirstOrDefault(y => y.DeliveryNo == entries[11]); if ((answer == null)) { answer = new ThreePLAnswer(); answer.Products = new List <Product>(); answer.Document = file; try { answer.DeliveryDate = DateTime.ParseExact(entries[0], "yyyyMMd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception y) { Console.WriteLine(y.Message); } answer.OrderNo = entries[12].Trim(); answer.ShippingDocument = new ShippingDocument(); answer.ShippingDocument.DocumentNo = entries[14]; answer.MaterialNumber = entries[4].Trim(); Product prod = new Product(); prod.Code = entries[4].Trim(); if (((((entries[7]) == null || entries[7] == "")) == false)) { if ((entries[7]).Contains(".")) { string temp = entries[7].Split('.')[0]; prod.Quantity = int.Parse(temp); } else { prod.Quantity = int.Parse(entries[7]); } } answer.Products.Add(prod); answer.WareHouse = entries[5]; answer.CustomerCode = entries[9]; answer.DeliveryNo = entries[11]; answer.OrderNo = entries[12].Trim(); answer.PickingListNo = entries[13]; answer.VehiclePlateNo = entries[14]; answer.LineNo = entries[17]; answer.NoOfColli = entries[19]; answers?.Add(answer); } else { Product prod = new Product(); prod.Code = entries[4].Trim(); if (((((entries[7] == null || entries[7] == "")) == false))) { if ((entries[7].Contains("."))) { string temp = entries[7].Split('.')[0]; prod.Quantity = int.Parse(temp); } else { prod.Quantity = int.Parse(entries[7]); } } answer.Products.Add(prod); } } } } string message = ConvertToPubSubMessage(answers); PostMessage(message, ""); answers?.Clear(); } }
public static void ImportInvoices(string directory, string pubsuburl) { if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl)) { throw new Exception("Arguments cannot be null"); } bool skipheaders = true; string[] entries = null; int rowCount = 0; bool fileerror = false; System.Collections.Generic.List <Invoice> invoices = new System.Collections.Generic.List <Invoice>(); System.Collections.Generic.List <char> delim = new System.Collections.Generic.List <char>(); delim.Add('\r'); delim.Add('\n'); string[] files = System.IO.Directory.GetFiles(directory).Where(x => x.Contains("INV")).ToArray(); foreach (var file in files) { skipheaders = true; foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>()) { if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false))) { entries = row?.Split(';'); if ((skipheaders)) { skipheaders = false; continue; } if ((entries[8].Length != 8 || entries[4].Length != 8)) { Console.WriteLine(file); } Invoice invoice = invoices?.FirstOrDefault((y) => y.DeliveryNo == entries[5]); if ((invoice == null)) { invoice = new Invoice(); invoice.Products = new List <Product>(); Product prod = new Product(); invoice.DeliveryNo = entries[5]; invoice.DeliveryLegalDoc = entries[7]; invoice.BillingLegalDoc = entries[11]; if ((invoice?.DeliveryLegalDoc?.Contains("ΤΔΑ") ?? false)) { invoice.isTDA = true; } else { invoice.isTDA = false; } invoice.BillingNo = entries[9]; try { invoice.BillingDate = DateTime.ParseExact(entries[8], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { if ((((fileerror) == false))) { Console.WriteLine("Error in file" + file); fileerror = true; } } try { invoice.DeliveryDate = DateTime.ParseExact(entries[4], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { if ((((fileerror) == false))) { Console.WriteLine("Error in file" + file); fileerror = true; } } invoice.BillingLine_No = entries[10]; prod.Code = entries[15].Trim(); prod.SaleUnit = entries[20]; try { prod.BillingQuantity = Decimal.Parse(entries[19].Trim(), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(x.Message + "on file" + file); } if (((((entries[18] == null || entries[18] == "")) == false))) { try { prod.OrderQuantity = long.Parse(entries[18].Trim()); } catch (System.Exception x) { Console.WriteLine(entries[18] + "issue on " + file); } } if ((entries[21] == null || entries[21] == "")) { prod.GrossValue = 0; } else { try { prod.GrossValue = Decimal.Parse(entries[21].Trim().Replace(",", "."), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(entries[21] + " error parsing on " + file); prod.GrossValue = 0; } } if (((((entries[22] == null || entries[22] == "")) == false) || ((entries[22].Contains("***")) == false))) { try { prod.NetValue = Decimal.Parse(entries[24].Trim().Replace(",", "."), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(entries[22] + " error parsing on " + file); } } else { prod.NetValue = 0; } if (((entries[23]) == null || entries[23] == "") || entries[23].Contains("***")) { prod.VatValue = 0; } else { try { string vatval = entries[23].Trim().Replace(",", "."); prod.VatValue = Decimal.Parse(vatval, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(entries[23] + " error parsing on " + file); } } if (((entries[24] == null || entries[24] == "") || entries[24].Contains("***"))) { prod.TotalValue = 0; } else { try { string totalva = entries[24].Trim().Replace(",", "."); prod.TotalValue = Decimal.Parse(totalva, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(entries[24] + " error parsing on " + file); } } invoice.OrderNo = entries[13].Trim(); invoice.DeliveryLine_No = entries[6].Trim(); int orderlineno; if (int.TryParse(entries[14].Trim(), out orderlineno)) { invoice.OrderLine = orderlineno; } ; invoice.Products.Add(prod); invoice.Customer = new Customer(); invoice.Customer.CustomerCode = entries[1]; invoice.Document = file; invoice.Products.Add(prod); invoices.Add(invoice); } else { Product prod = new Product(); prod.Code = entries[15].Trim(); prod.SaleUnit = entries[20]; try { prod.BillingQuantity = Decimal.Parse(entries[19].Trim().Replace(",", "."), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { if (((entries[19] == null || entries[19] == ""))) { Console.WriteLine("19 is Null or Empty"); } else { Console.WriteLine("prod.BillingQuantity:" + entries[19] + " had Exception:" + x.Message); } } if (((((entries[18] == null || entries[18] == "")) == false))) { try { prod.OrderQuantity = long.Parse(entries[18].Trim().Replace(",", ".")); } catch (System.Exception x) { Console.WriteLine(entries[18] + " 18 on" + file); } } else { prod.OrderQuantity = 0; } if (((entries[21] == null || entries[21] == ""))) { prod.GrossValue = 0; } else { try { string something = entries[21].Trim().Replace(",", "."); prod.GrossValue = Decimal.Parse(something, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(x.Message); Console.WriteLine(entries[21] + "21"); } } if (((((entries[22] == null || entries[22] == "")) == false) || ((entries[22].Contains("***")) == false))) { try { string netval = entries[22].Trim().Replace(",", "."); prod.NetValue = Decimal.Parse(netval, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { prod.NetValue = 0; Console.WriteLine(entries[22] + " error parsing 22"); } } else { prod.NetValue = 0; } if (((entries[23] == null || entries[23] == "") || ((entries[23].Contains("***")) == false))) { prod.VatValue = 0; } else { try { string vatval = entries[23].Trim().Replace(",", "."); prod.VatValue = Decimal.Parse(vatval, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { prod.VatValue = 0; Console.WriteLine(entries[23] + " error parsing on " + file); } } if (((entries[24] == null || entries[24] == "") || ((entries[24].Contains("***")) == false))) { prod.TotalValue = 0; } else { try { string totalva = entries[24].Trim().Replace(",", "."); prod.TotalValue = Decimal.Parse(totalva, System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { prod.TotalValue = 0; Console.WriteLine(entries[24] + " error parsing"); } } invoice.Document = file; invoice.Products.Add(prod); rowCount = rowCount + 1; } } } foreach (var inv in invoices) { decimal total = 0; decimal vat = 0; decimal gross = 0; decimal net = 0; foreach (var prod in inv.Products) { vat = vat + (prod.VatValue); total = total + (prod.TotalValue); gross = gross + (prod.GrossValue); net = net + (prod.NetValue); } inv.NetValue = net; inv.GrossValue = gross; inv.TotalVAT = vat; inv.TotalValue = total; } string message = ConvertToPubSubMessage <Invoice>(invoices); Console.WriteLine(message); PostMessage(message, ""); invoices.Clear(); } }
private void BatchPaySend_Click(object sender, System.EventArgs e) { this.GetPaySetting(); if (string.IsNullOrEmpty(base.Request["CheckBoxGroup"])) { this.ShowMsg("参数错误!", false); return; } string text = base.Request["CheckBoxGroup"]; string value = this.PaybatchType.Value; if (value == "0") { string[] array = text.Split(new char[] { ',' }); System.Collections.Generic.List <OutPayWeiInfo> list = new System.Collections.Generic.List <OutPayWeiInfo>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string s = array2[i]; MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(int.Parse(s)); if (amountRequestDetail != null && amountRequestDetail.State == RequesState.已审核 && this.DrawMinNum <= amountRequestDetail.Amount) { list.Add(new OutPayWeiInfo { Amount = (int)amountRequestDetail.Amount * 100, Partner_Trade_No = amountRequestDetail.RedpackId, Openid = amountRequestDetail.AccountCode, Re_User_Name = amountRequestDetail.AccountName, Desc = " 用户余额发放", UserId = amountRequestDetail.UserId, Nonce_Str = OutPayHelp.GetRandomString(20), Sid = amountRequestDetail.Id }); } } if (list.Count < 1) { this.ShowMsg("没有满足条件的提现请求!", false); this.LoadParameters(); this.BindData(); return; } System.Collections.Generic.List <WeiPayResult> list2 = OutPayHelp.BatchWeiPay(list); if (list2.Count < 1) { this.ShowMsg("系统异常,请联系管理员!", false); return; } if (list2[0].return_code == "INITFAIL") { this.ShowMsg(list2[0].return_msg, false); return; } int num = 0; int num2 = 0; int num3 = 0; int num4 = list.Count; string text2 = "<div class='errRow'>支付失败信息如下:"; using (System.Collections.Generic.List <WeiPayResult> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { WeiPayResult rItem = enumerator.Current; int sid = list.FirstOrDefault((OutPayWeiInfo t) => t.Partner_Trade_No == rItem.partner_trade_no).Sid; if (rItem.result_code == "SUCCESS") { int[] serialids = new int[] { sid }; MemberAmountProcessor.SetAmountRequestStatus(serialids, 2, "微信企业付款:流水号" + rItem.payment_no, "", ManagerHelper.GetCurrentManager().UserName); int arg_298_0 = rItem.UserId; MemberAmountRequestInfo amountRequestDetail2 = MemberAmountProcessor.GetAmountRequestDetail(sid); if (amountRequestDetail2 != null) { string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail2.Id); try { Messenger.SendWeiXinMsg_MemberAmountDrawCashRelease(amountRequestDetail2, url); } catch { } } num3 += rItem.Amount / 100; num++; } else { if (rItem.err_code == "OPENID_ERROR" || rItem.err_code == "NAME_MISMATCH" || rItem.return_msg.Contains("openid字段") || rItem.err_code == "FATAL_ERROR") { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } else { MemberAmountProcessor.SetAmountRequestStatus(new int[] { sid }, 1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, "", ManagerHelper.GetCurrentManager().UserName); } string text3 = text2; text2 = string.Concat(new string[] { text3, "<br>ID:", rItem.partner_trade_no, ", 出错提示:", rItem.return_msg }); num2++; } } } num4 = num4 - num2 - num; text2 += "</div>"; if (num3 == num && num3 != 0) { this.ShowMsg("全部支付成功", true); } else { this.ShowMsg(string.Concat(new object[] { "本次成功支付金额", num3, "元,其中成功", num, "笔,失败", num2, "笔,异常放弃", num4, "笔", text2 }), false); } this.LoadParameters(); this.BindData(); return; } else { if (value == "1") { this.ShowMsg("接口暂未开通", false); return; } this.ShowMsg("未定义支付方式", false); return; } }
public static void ImportDepositorOrders(string directory, string pubsuburl) { if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl)) { throw new Exception("Arguments cannot be null"); } bool skipheaders = true; string[] entries = null; int rowCount = 0; bool fileerror; System.Collections.Generic.List <DepositorOrder> orders = new System.Collections.Generic.List <DepositorOrder>(); System.Collections.Generic.List <char> delim = new System.Collections.Generic.List <char>(); delim.Add('\r'); delim.Add('\n'); string[] files = System.IO.Directory.GetFiles(directory); foreach (var file in files) { if (!file.Contains("DLVRY")) { continue; } skipheaders = true; foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>()) { if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false))) { entries = row?.Split(';'); if ((skipheaders)) { skipheaders = false; continue; } if ((entries.Length > 0 && ((entries[0].Contains("Order")) == false) && ((entries[0].Contains("erdat")) == false))) { DepositorOrder order = orders?.FirstOrDefault((x) => x.DeliveryNo == entries[1]); if (((entries[0] == null || entries[0] == "") || entries[0].Length != 8)) { Console.WriteLine("Null creation date on " + file); continue; } if ((entries[0] == "00000000")) { Console.WriteLine("bad data on file" + file); continue; } if ((order == null)) { order = new DepositorOrder(); order.products = new List <Product>(); try { order.CreationDate = DateTime.ParseExact(entries[0], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(file + ": Error parsing CreationDate value: " + entries[0]); fileerror = true; continue; } order.DeliveryNo = entries[1]; try { order.DeliveryDateFrom = DateTime.ParseExact(entries[2], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(file + ": Error parsing DeliveryDateFrom value: " + entries[2]); continue; fileerror = true; } try { order.DeliveryDateTo = DateTime.ParseExact(entries[3], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); } catch (System.Exception x) { Console.WriteLine(file + ": Error parsing DeliveryDateTo value: " + entries[3]); fileerror = true; continue; } order.WareHouse = entries[6]; Product product = new Product(); product.Code = entries[7].Trim(); try { product.Quantity = int.Parse(entries[9]); } catch (System.Exception x) { if (((entries[9] == null || entries[9] == ""))) { Console.WriteLine(file + ": ProductQuantity is Null or Empty"); } else { Console.WriteLine(file + ": product.Quantity:" + entries[9] + " failed to int parse"); } } order.products.Add(product); order.customer = new Customer(); order.customer.CustomerCode = entries[10]; order.Comments = entries[19]; order.Document = file; if (((((entries[23] == null || entries[23] == "")) == false))) { order.PayerCode = entries[23]; } orders?.Add(order); } else { Product product = new Product(); product.Code = entries[7].Trim(); product.Quantity = int.Parse(entries[9]); order.products.Add(product); } } } if (orders.Count != 0) { string message = ConvertToPubSubMessage(orders); PostMessage(message, ""); orders.Clear(); } } } }
public System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> LoadAssociatedItemsForAccount(Account itemCompareToCurrent, ObservableCollection<GroupByCreateTimeAccountItemViewModel> out_container) { this.HasLoadAssociatedItemsForCurrentViewAccount = true; System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> container = new System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel>(); int recordCount = 0; int num = 0; System.Action<Int32, String> action = delegate(int count, string name) { recordCount += count; Deployment.Current.Dispatcher.BeginInvoke(delegate { GlobalIndicator.Instance.BusyForWork(AppResources.NowLoadingFormatter.FormatWith(new object[] { AppResources.RecordCountTipsFormatter.FormatWith(new object[] { count, name }) }), new object[0]); }); }; if ((this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.All) || (this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.Transcations)) { IQueryable<AccountItem> source = from p in ViewModelLocator.AccountItemViewModel.AccountBookDataContext.AccountItems where p.AccountId == itemCompareToCurrent.Id select p; if (this.searchingConditionForAssociatedItemsForCurrentViewAccount.SearchingScope != SearchingScope.All) { source = from p in source where (p.CreateTime.Date > this.searchingConditionForAssociatedItemsForCurrentViewAccount.StartDate.Value.Date) && (p.CreateTime.Date <= this.searchingConditionForAssociatedItemsForCurrentViewAccount.EndDate.Value.Date) select p; } source = from p in source orderby p.Type descending select p into p orderby p.CreateTime.Date descending select p; num = source.Count<AccountItem>(); action(num, AppResources.SelectAccountItemsLabel); using (System.Collections.Generic.List<DateTime>.Enumerator enumerator = (from p in source select p.CreateTime.Date).Distinct<System.DateTime>().ToList<System.DateTime>().GetEnumerator()) { System.DateTime item; while (enumerator.MoveNext()) { item = enumerator.Current; GroupByCreateTimeAccountItemViewModel agvm = new GroupByCreateTimeAccountItemViewModel(item); ((System.Collections.Generic.IEnumerable<AccountItem>)(from p in source where p.CreateTime.Date == item.Date select p)).ForEach<AccountItem>(delegate(AccountItem x) { AccountItem item1 = new AccountItem { Account = x.Account, Money = x.Money, CreateTime = x.CreateTime, Category = x.Category, CategoryId = x.CategoryId, Description = x.Description, Id = x.Id, State = x.State, PageNameGetter = "AccountItems", Type = x.Type, TypeInfo = LocalizedStrings.GetLanguageInfoByKey(x.Type.ToString()) }; if (x.Type == ItemType.Expense) { item1.Money = -x.Money; } item1.SecondInfo = x.NameInfo; item1.ThirdInfo = x.Description; agvm.Add(item1); }); container.Add(agvm); } } } if ((this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.All) || (this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.TransferingAccount)) { IQueryable<TransferingItem> queryable2 = from p in ViewModelLocator.TransferingHistoryViewModel.AccountBookDataContext.TransferingItems where (p.ToAccountId == itemCompareToCurrent.Id) || (p.FromAccountId == itemCompareToCurrent.Id) select p; if (this.searchingConditionForAssociatedItemsForCurrentViewAccount.SearchingScope != SearchingScope.All) { queryable2 = from p in queryable2 where (p.TransferingDate.Date > this.searchingConditionForAssociatedItemsForCurrentViewAccount.StartDate.Value.Date) && (p.TransferingDate.Date <= this.searchingConditionForAssociatedItemsForCurrentViewAccount.EndDate.Value.Date) select p; } queryable2 = from p in queryable2 orderby p.TransferingDate.Date descending select p; num = queryable2.Count<TransferingItem>(); string exchange = AppResources.TransferingAccount; action(num, exchange); using (System.Collections.Generic.List<DateTime>.Enumerator enumerator2 = (from p in queryable2 select p.TransferingDate.Date).Distinct<System.DateTime>().ToList<System.DateTime>().GetEnumerator()) { System.Func<GroupByCreateTimeAccountItemViewModel, Boolean> predicate = null; System.DateTime item; while (enumerator2.MoveNext()) { item = enumerator2.Current; if (predicate == null) { predicate = p => p.Key.Date == item.Date; } GroupByCreateTimeAccountItemViewModel agvm = container.FirstOrDefault<GroupByCreateTimeAccountItemViewModel>(predicate); bool flag = false; if (agvm == null) { flag = true; agvm = new GroupByCreateTimeAccountItemViewModel(item); } ((System.Collections.Generic.IEnumerable<TransferingItem>)(from p in queryable2 where p.TransferingDate.Date == item.Date select p)).ForEach<TransferingItem>(delegate(TransferingItem x) { AccountItem item1 = new AccountItem { Account = itemCompareToCurrent, TypeInfo = exchange }; flag = x.FromAccountId == itemCompareToCurrent.Id; item1.Money = flag ? -x.Amount : x.Amount; string str = flag ? AppResources.RolloutToSomeAccountName.FormatWith(new object[] { x.ToAccountName }) : AppResources.TransferFromAccountName.FormatWith(new object[] { x.FromAccountName }); item1.SecondInfo = str; item1.PageNameGetter = "TransferingItems"; item1.ThirdInfo = x.Notes; agvm.Add(item1); }); if (flag) { container.Add(agvm); } } } } if ((this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.All) || (this.searchingConditionForAssociatedItemsForCurrentViewAccount.DataType == AssociatedItemType.BorrowAndLean)) { IQueryable<Repayment> queryable3 = from p in ViewModelLocator.BorrowLeanViewModel.AccountBookDataContext.Repayments where (p.FromAccountId == itemCompareToCurrent.Id) && (((int?)p.RepaymentRecordType) == ((int?)RepaymentType.MoneyBorrowOrLeanRepayment)) select p; SearchingScope searchingScope = this.searchingConditionForAssociatedItemsForCurrentViewAccount.SearchingScope; queryable3 = from p in queryable3 orderby ((System.DateTime)p.ExecuteDate).Date descending select p; num = queryable3.Count<Repayment>(); string borrowLoanName = AppResources.BorrowAndLean; action(num, borrowLoanName); using (System.Collections.Generic.List<DateTime>.Enumerator enumerator3 = (from p in queryable3 select p.ExecuteDate.Value.Date).Distinct<System.DateTime>().ToList<System.DateTime>().GetEnumerator()) { System.Func<GroupByCreateTimeAccountItemViewModel, Boolean> func2 = null; System.DateTime item; while (enumerator3.MoveNext()) { item = enumerator3.Current; if (func2 == null) { func2 = p => p.Key.Date == item.Date; } GroupByCreateTimeAccountItemViewModel agvm = container.FirstOrDefault<GroupByCreateTimeAccountItemViewModel>(func2); bool flag2 = false; if (agvm == null) { flag2 = true; agvm = new GroupByCreateTimeAccountItemViewModel(item); } ((System.Collections.Generic.IEnumerable<Repayment>)(from p in queryable3 where ((System.DateTime)p.ExecuteDate).Date == item.Date select p)).ForEach<Repayment>(delegate(Repayment x) { LeanType? borrowOrLean = LeanType.BorrowIn; AccountItem item1 = new AccountItem { Id = x.Id, Account = itemCompareToCurrent, TypeInfo = borrowLoanName }; if (((LeanType)x.BorrowOrLean) != LeanType.LoanOut) { borrowOrLean = x.BorrowOrLean; } bool flag = (((LeanType)borrowOrLean.GetValueOrDefault()) != LeanType.Repayment) || borrowOrLean.HasValue; item1.Money = flag ? -x.Amount : x.Amount; string borrowLoanInfoWithoutAmountInfo = x.BorrowLoanInfoWithoutAmountInfo; item1.PageNameGetter = x.IsRepaymentOrReceieve ? "RepaymentsTableForReceieveOrPayBack" : "Repayments"; item1.SecondInfo = borrowLoanInfoWithoutAmountInfo; item1.ThirdInfo = x.Notes; agvm.Add(item1); }); if (flag2) { container.Add(agvm); } } } } Deployment.Current.Dispatcher.BeginInvoke(delegate { (from p in container orderby p.Key descending select p).ToList<GroupByCreateTimeAccountItemViewModel>().ForEach(new System.Action<GroupByCreateTimeAccountItemViewModel>(out_container.Add)); }); return container; }
public static decimal?CalculatePathTime(this BO.Shipment @this) { using (new zAppDev.DotNet.Framework.Profiling.Profiler("Shipment", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "CalculatePathTime")) { System.Collections.Generic.List <string> coordinates = new System.Collections.Generic.List <string>(); coordinates.Add((@this?.DeparturePoint?.Coordinates?.CoordinateY ?? 0) + "," + (@this?.DeparturePoint?.Coordinates?.CoordinateX ?? 0)); zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Shipment", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, coordinates.FirstOrDefault()); foreach (var i in @this?.ShippingOrders ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>()) { string departure = (i?.DeparturePoint?.Coordinates?.CoordinateY ?? 0) + "," + (i?.DeparturePoint?.Coordinates?.CoordinateX ?? 0); string arrival = (i?.ArrivalPoint?.Coordinates?.CoordinateY ?? 0) + "," + (i?.ArrivalPoint?.Coordinates?.CoordinateX ?? 0); if ((((coordinates.Contains(departure)) == false) && i?.DeparturePoint != @this?.FinalDestination)) { coordinates.Add(departure); } if ((((coordinates.Contains(arrival)) == false) && i?.ArrivalPoint != @this?.FinalDestination)) { coordinates.Add(arrival); } } string FinalCoordinate = (@this?.FinalDestination?.Coordinates?.CoordinateY ?? 0) + "," + (@this?.FinalDestination?.Coordinates?.CoordinateX ?? 0); coordinates.Add(FinalCoordinate); while ((coordinates.Contains("0,0"))) { coordinates.Remove("0,0"); } string coord = ""; foreach (var i in coordinates ?? Enumerable.Empty <string>()) { if (coord == "") { coord = coord + i; } else { coord = coord + "," + i; } } DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot response = DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.Router_MapotempoRestService.route("time", "true", "true", "true", "200", "EUR", "en", coord, "inlecom-1-pe3io4Ui5aimobich1oot0eilothongo"); return(((zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(response.features, 0)).properties.router.total_time / 60 + 10 * coordinates.Count()) / 60); } }
public static decimal?CalculatePathCost(this BO.Shipment @this, System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder> Orders) { using (new zAppDev.DotNet.Framework.Profiling.Profiler("Shipment", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "CalculatePathCost")) { System.Collections.Generic.List <string> coordinates = new System.Collections.Generic.List <string>(); coordinates.Add((@this?.DeparturePoint?.Coordinates?.CoordinateY ?? 0) + "," + (@this?.DeparturePoint?.Coordinates?.CoordinateX ?? 0)); zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Shipment", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, coordinates.FirstOrDefault()); foreach (var i in Orders ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>()) { string departure = (i?.DeparturePoint?.Coordinates?.CoordinateY ?? 0) + "," + (i?.DeparturePoint?.Coordinates?.CoordinateX ?? 0); string arrival = (i?.ArrivalPoint?.Coordinates?.CoordinateY ?? 0) + "," + (i?.ArrivalPoint?.Coordinates?.CoordinateX ?? 0); if ((((coordinates.Contains(departure)) == false) && i?.DeparturePoint != @this?.FinalDestination)) { coordinates.Add(departure); } if ((((coordinates.Contains(arrival)) == false) && i?.ArrivalPoint != @this?.FinalDestination)) { coordinates.Add(arrival); } } string FinalCoordinate = (@this?.FinalDestination?.Coordinates?.CoordinateY ?? 0) + "," + (@this?.FinalDestination?.Coordinates?.CoordinateX ?? 0); coordinates.Add(FinalCoordinate); while ((coordinates.Contains("0,0"))) { coordinates.Remove("0,0"); } string coord = ""; foreach (var i in coordinates ?? Enumerable.Empty <string>()) { if (coord == "") { coord = coord + i; } else { coord = coord + "," + i; } } DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot response = DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.Router_MapotempoRestService.route("time", "true", "true", "true", "200", "EUR", "en", coord, "inlecom-1-pe3io4Ui5aimobich1oot0eilothongo"); zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot> serializer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot>(); zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Shipment", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, serializer.ToJson(response)); decimal?time = (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(response.features, 0)).properties.router.total_time / 3600; decimal?distance = (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(response.features, 0)).properties.router.total_distance / 1000; decimal?DistanceCost = distance.GetValueOrDefault(0) * (@this?.VehiculeType?.CalculatedDistanceCost ?? 0); decimal?TimeCost = time.GetValueOrDefault(0) * (@this?.VehiculeType?.CalculatedTimeCost ?? 0); decimal?TotalCost = new decimal?(); if (@this?.VehiculeType?.AmortizationType1?.Label == "technical") { TotalCost = TimeCost.GetValueOrDefault(0) + DistanceCost.GetValueOrDefault(0) + (@this?.VehiculeType?.CalculatedOwnershipCost ?? 0) * distance.GetValueOrDefault(0); } else { TotalCost = TimeCost.GetValueOrDefault(0) + DistanceCost.GetValueOrDefault(0) + (@this?.VehiculeType?.CalculatedOwnershipCost ?? 0) * time.GetValueOrDefault(0); } TotalCost = TotalCost.GetValueOrDefault(0) * (1 + (@this?.VehiculeType?.OverHeadCost ?? 0) / 100); return(TotalCost); } }
private void BatchPaySend_Click(object sender, System.EventArgs e) { this.GetPaySetting(); if (string.IsNullOrEmpty(base.Request["CheckBoxGroup"])) { this.ShowMsg("参数错误!", false); return; } string text = base.Request["CheckBoxGroup"]; string value = this.PaybatchType.Value; if (value == "0") { string[] array = text.Split(new char[] { ',' }); System.Collections.Generic.List <OutPayWeiInfo> list = new System.Collections.Generic.List <OutPayWeiInfo>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; BalanceDrawRequestInfo balanceDrawRequestById = DistributorsBrower.GetBalanceDrawRequestById(text2.ToString()); if (balanceDrawRequestById != null && balanceDrawRequestById.IsCheck == "1" && this.DrawMinNum <= balanceDrawRequestById.Amount && !string.IsNullOrEmpty(balanceDrawRequestById.RedpackId)) { list.Add(new OutPayWeiInfo { Amount = (int)balanceDrawRequestById.Amount * 100, Partner_Trade_No = balanceDrawRequestById.RedpackId, Sid = balanceDrawRequestById.SerialId, Openid = balanceDrawRequestById.MerchantCode, Re_User_Name = balanceDrawRequestById.AccountName, Desc = " 分销商佣金发放", UserId = balanceDrawRequestById.UserId, Nonce_Str = OutPayHelp.GetRandomString(20) }); } } if (list.Count < 1) { this.ShowMsg("没有满足条件的提现请求!", false); this.LoadParameters(); this.BindData(); return; } System.Collections.Generic.List <WeiPayResult> list2 = OutPayHelp.BatchWeiPay(list); if (list2.Count < 1) { this.ShowMsg("系统异常,请联系管理员!", false); return; } if (list2[0].return_code == "INITFAIL") { this.ShowMsg(list2[0].return_msg, false); return; } int num = 0; int num2 = 0; int num3 = 0; int num4 = list.Count; string text3 = "<div class='errRow'>支付失败信息如下:"; using (System.Collections.Generic.List <WeiPayResult> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { WeiPayResult rItem = enumerator.Current; int sid = list.FirstOrDefault((OutPayWeiInfo t) => t.Partner_Trade_No == rItem.partner_trade_no).Sid; if (rItem.result_code == "SUCCESS") { VShopHelper.UpdateBalanceDrawRequest(sid, "微信企业付款:流水号" + rItem.payment_no); int arg_290_0 = rItem.UserId; decimal num5 = rItem.Amount / 100; VShopHelper.UpdateBalanceDistributors(rItem.UserId, num5); if (num5 > 0m && sid > 0) { BalanceDrawRequestInfo balanceDrawRequestById2 = DistributorsBrower.GetBalanceDrawRequestById(sid.ToString()); if (balanceDrawRequestById2 != null) { try { Messenger.SendWeiXinMsg_DrawCashRelease(balanceDrawRequestById2); } catch { } } } num3 += rItem.Amount / 100; num++; } else { if (rItem.err_code == "OPENID_ERROR" || rItem.err_code == "NAME_MISMATCH" || rItem.return_msg.Contains("openid字段") || rItem.err_code == "FATAL_ERROR") { DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { sid }, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, null); } else { DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { sid }, 1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + rItem.return_msg, null); } object obj = text3; text3 = string.Concat(new object[] { obj, "<br>ID:", sid, ", 出错提示:", rItem.return_msg }); num2++; } } } num4 = num4 - num2 - num; text3 += "</div>"; if (num3 == num && num3 != 0) { this.ShowMsg("全部支付成功", true); } else { this.ShowMsg(string.Concat(new object[] { "本次成功支付金额", num3, "元,其中成功", num, "笔,失败", num2, "笔,异常放弃", num4, "笔", text3 }), false); } this.LoadParameters(); this.BindData(); return; } else { if (value == "1") { this.ShowMsg("接口暂未开通", false); return; } this.ShowMsg("未定义支付方式", false); return; } }