public override int GetHashCode() { var hashCode = 926796717; hashCode = hashCode * -1521134295 + OrderId.GetHashCode(); hashCode = hashCode * -1521134295 + ClientId.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ExecId); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Time); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(AcctNumber); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Exchange); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Side); hashCode = hashCode * -1521134295 + Shares.GetHashCode(); hashCode = hashCode * -1521134295 + Price.GetHashCode(); hashCode = hashCode * -1521134295 + PermId.GetHashCode(); hashCode = hashCode * -1521134295 + Liquidation.GetHashCode(); hashCode = hashCode * -1521134295 + CumQty.GetHashCode(); hashCode = hashCode * -1521134295 + AvgPrice.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(OrderRef); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(EvRule); hashCode = hashCode * -1521134295 + EvMultiplier.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ModelCode); hashCode = hashCode * -1521134295 + EqualityComparer <Liquidity> .Default.GetHashCode(LastLiquidity); return(hashCode); }
private void LoadBatchNoCombo() { Liquidation objLiquidationBiz = new Liquidation(); try { DataTable dtBatch = new DataTable(); DataRow drBatch = dtBatch.NewRow(); dtBatch = objLiquidationBiz.GetBatchNoForLiquidation(); DataRow row = dtBatch.NewRow(); row["Collection_Batch_Name"] = "Please select Batch"; row["Collection_Batch_No"] = -1; dtBatch.Rows.InsertAt(row, 0); if (dtBatch.Rows.Count > 0) { cboBatchNo.ItemsSource = ((System.ComponentModel.IListSource)dtBatch).GetList(); } cboBatchNo.DataContext = dtBatch; cboBatchNo.DisplayMemberPath = "Collection_Batch_Name"; cboBatchNo.SelectedValuePath = "Collection_Batch_No"; cboBatchNo.SelectedValue = -1; } catch (Exception ex) { ExceptionManager.Publish(ex); } }
public async void OnLiquidationDetail_Tapped(object sender, EventArgs e) { Grid stack = sender as Grid; TapGestureRecognizer tap = stack.GestureRecognizers[0] as TapGestureRecognizer; Liquidation item = tap.CommandParameter as Liquidation; await Navigation.PushAsync(new LiquidationDetailPage(item.Id)); }
private async void OnLiquidationDetail_Tapped(object sender, EventArgs e) { Grid stack = sender as Grid; TapGestureRecognizer tap = stack.GestureRecognizers[0] as TapGestureRecognizer; Liquidation item = tap.CommandParameter as Liquidation; await Shell.Current.GoToAsync("//LiquidationListPage"); await Shell.Current.Navigation.PushAsync(new LiquidationDetailPage(item.Id)); }
public async void InitUpdate() { StackLayoutStatus.IsVisible = true; ApiResponse response = await ApiHelper.Get <Liquidation>(ApiRouter.LIQUIDATION_GETBYID + "/" + this.liquidationId + "?IncludeProvince=true"); if (response.IsSuccess) { Liquidation liquidation = response.Content as Liquidation; Title = liquidation.Name; viewModel.LiquidationModel = new AddLiquidationModel() { Id = liquidation.Id, Code = liquidation.Code, Name = liquidation.Name, Description = liquidation.Description, Price = liquidation.Price, LiquidationCategory = viewModel.LiquidationCategories.SingleOrDefault(x => x.Id == liquidation.CategoryId), Province = liquidation.Province, ProvinceId = liquidation.ProvinceId, District = liquidation.District, DistrictId = liquidation.DistrictId, Ward = liquidation.Ward, WardId = liquidation.WardId, Street = liquidation.Street, Address = liquidation.Address }; await Task.WhenAll( viewModel.GetProvinceAsync(), viewModel.GetDistrictAsync(), viewModel.GetWardAsync() ); string[] imageList = liquidation.Images.Split(','); foreach (var image in imageList) { viewModel.Media.Add(new MediaFile() { PreviewPath = ImageHelper.GetImageUrl("liquidation", image), }); } if (liquidation.Type == 1) { TypeChoTang_Checked(null, EventArgs.Empty); //set type =1 } LblStatus.Text = liquidation.StatusFormat; loadingPopup.IsVisible = false; } }
private CryptoLiquidation ConvertLiquidation(BitmexAction action, Liquidation trade) { return(new CryptoLiquidation() { ExchangeName = "bitmex", Amount = Convert.ToDouble(trade.leavesQty ?? 0), AmountQuote = Convert.ToDouble(trade.leavesQty ?? 0 * trade.Price ?? 0), Side = ConvertTradeSide(trade.Side ?? BitmexSide.Undefined), Id = trade.OrderID, Price = Convert.ToDouble(trade.Price ?? 0), Timestamp = DateTime.Now, Pair = trade.Symbol, Liquidation = true, Action = ConvertAction(action) }); }
public async Task <Liquidation> GetOrCreateById(string userId) { var liquidation = await context .Liquidations .FirstOrDefaultAsync(l => l.ReadyByRepresentative == false && l.RepresentativeId == userId); if (liquidation is null) { liquidation = new Liquidation() { RepresentativeId = userId }; await context.Liquidations.AddAsync(liquidation); } return(liquidation); }
private async void Save_Clicked(object sender, EventArgs e) { if (viewModel.LiquidationModel.LiquidationCategory == null) { await DisplayAlert("", Language.vui_long_chon_danh_muc_san_pham, Language.dong); return; } if (string.IsNullOrWhiteSpace(viewModel.LiquidationModel.Name)) { await DisplayAlert("", Language.vui_long_nhap_ten_san_pham, Language.dong); return; } if (type == 0 && viewModel.LiquidationModel.Price == 0) { await DisplayAlert("", Language.vui_long_nhap_gia_thanh_ly, Language.dong); return; } if (viewModel.LiquidationModel.Province == null || viewModel.LiquidationModel.District == null || viewModel.LiquidationModel.Ward == null) { await DisplayAlert("", Language.vui_long_cung_cap_thong_tin_dia_chi, Language.dong); return; } if (viewModel.Media.Any() == false) { await DisplayAlert("", Language.vui_long_chon_hinh_anh_san_pham, Language.dong); return; } loadingPopup.IsVisible = true; bool ImageUploaded = true; MultipartFormDataContent form = new MultipartFormDataContent(); string[] imageList = new string[viewModel.Media.Count]; for (int i = 0; i < viewModel.Media.Count; i++) { var item = viewModel.Media[i]; // chua upload. upload roi link = null if (string.IsNullOrEmpty(item.Path) == false) // co link la co chon tu dien thoai. { imageList[i] = $"{Guid.NewGuid().ToString()}.jpg"; var stream = new MemoryStream(File.ReadAllBytes(item.Path)); var content = new StreamContent(stream); content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "files" + i, FileName = imageList[i] }; form.Add(content); } else { imageList[i] = item.PreviewPath.Replace(ApiConfig.CloudStorageApiCDN + "/liquidation/", ""); } } // bat dau up hinh. if (viewModel.Media.Any(x => x.Path != null)) { ApiResponse uploadImageResponse = await UploadImage(form); if (!uploadImageResponse.IsSuccess) { await DisplayAlert("", Language.hinh_anh_vuot_qua_dung_luong_vui_long_thu_lai, Language.dong); ImageUploaded = false; loadingPopup.IsVisible = false; } } if (ImageUploaded) { Liquidation liquidation = new Liquidation(); liquidation.Id = viewModel.LiquidationModel.Id; liquidation.Name = viewModel.LiquidationModel.Name; liquidation.Code = viewModel.LiquidationModel.Code; liquidation.CategoryId = viewModel.LiquidationModel.LiquidationCategory.Id; liquidation.Type = type; liquidation.Price = type == 0 ? viewModel.LiquidationModel.Price : 0; liquidation.Status = 0; liquidation.Description = viewModel.LiquidationModel.Description; liquidation.ProvinceId = viewModel.LiquidationModel.Province.Id; liquidation.DistrictId = viewModel.LiquidationModel.District.Id; liquidation.WardId = viewModel.LiquidationModel.Ward.Id; liquidation.Street = viewModel.LiquidationModel.Street; liquidation.Address = viewModel.LiquidationModel.Address; liquidation.Avatar = imageList[0]; liquidation.Images = string.Join(",", imageList); ApiResponse apiResponse = null; if (liquidationId == Guid.Empty) { liquidationId = liquidation.Id; apiResponse = await ApiHelper.Post(ApiRouter.LIQUIDATION_SAVE, liquidation, true); } else { apiResponse = await ApiHelper.Put(ApiRouter.LIQUIDATION_SAVE, liquidation, true); } if (apiResponse.IsSuccess) { try { await Navigation.PopAsync(false); MessagingCenter.Send <AddLiquidationPage>(this, "OnSaveItem"); MessagingCenter.Send <AddLiquidationPage, Guid>(this, "OnSaveItem", liquidation.Id); ToastMessageHelper.ShortMessage(Language.luu_san_pham_thanh_cong); } catch { } } else { loadingPopup.IsVisible = false; await DisplayAlert("", Language.khong_the_luu_san_pham_vui_long_thu_lai, Language.dong); } } loadingPopup.IsVisible = false; }
private async void Save_Clicked(object sender, EventArgs e) { if (EntryPrice.Text.HasValue == false || EntryPrice.Text.Value == 0) { await DisplayAlert("", Language.vui_long_nhap_gia_thanh_ly_trong_ngay, Language.dong); return; } loadingPopup.IsVisible = true; ApiResponse response = await ApiHelper.Get <Liquidation>(ApiRouter.LIQUIDATION_GETBYID + "/" + this.SelectedId); Liquidation liquidation = response.Content as Liquidation; ApiResponse copyResponse = await this.CopyImage(liquidation.Images); if (copyResponse == null) { await DisplayAlert("", Language.loi_hinh_anh_vui_long_thu_lai_sau, Language.dong); } else if (copyResponse.IsSuccess == false) { await DisplayAlert("", Language.loi_hinh_anh_vui_long_thu_lai_sau, Language.dong); } else { LiquidationToDay liquidationToDay = new LiquidationToDay() { LiquidationId = liquidation.Id, // xac dinh la tu liquation thanh ly qua. Code = liquidation.Code, Name = liquidation.Name, CategoryId = liquidation.CategoryId, Price = liquidation.Price, PriceToDay = EntryPrice.Text.Value, Status = 0, Description = liquidation.Description, ProvinceId = liquidation.ProvinceId, DistrictId = liquidation.DistrictId, WardId = liquidation.WardId, Street = liquidation.Street, Address = liquidation.Address, Avatar = liquidation.Avatar, Images = liquidation.Images }; var addResponse = await ApiHelper.Post(ApiRouter.LIQUIDATIONTODAY_SAVE, liquidationToDay, true); if (addResponse.IsSuccess) { if (_fromProfilePage) { await Navigation.PopAsync(); await Navigation.PopAsync(); } else { await Navigation.PopToRootAsync(); // tu danh sach qua thi back ve list.. } MessagingCenter.Send <PickerLiquidationPage>(this, "OnSaveItem"); ToastMessageHelper.ShortMessage(Language.dang_tin_thanh_ly_thanh_cong); } else { CloseModal(); await DisplayAlert("", Language.loi_dang_tin_thanh_ly_vui_long_thu_lai, Language.dong); } } loadingPopup.IsVisible = false; }