public int Draw(int iRow) { _excel.Row(iRow++).Height = ExcelConstants.DefaultRowHeight; var cultureInfo = CultureProvider.GetCultureInfo(); var money = _item.EventType == EventType.BalanceDecreased ? -_item.Money : _item.Money; _excel.Cells[iRow, _columnCount].Value = _item.EventType.ToLocalString(); var moneyCell = _excel.Cells[iRow, _columnCount + 1]; moneyCell.Value = money.ToString("N2") + CurrencyName.Euro; moneyCell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; if (_item.EventType == EventType.BalanceDecreased) { moneyCell.Style.Font.Color.SetColor(Color.Red); } _excel.Cells[iRow, _columnCount + 2].Value = LocalizationHelper.GetDate(_item.Timestamp, cultureInfo); _excel.Cells[iRow, _columnCount + 3].Value = _item.Comment; _excel.Row(iRow).Height = ExcelConstants.DefaultRowHeight; var range = _excel.Cells[iRow, 1, iRow, _columnCount]; range.Style.Fill.PatternType = ExcelFillStyle.Solid; range.Style.Fill.BackgroundColor.SetColor(_item.EventType == EventType.BalanceDecreased ? Color.Yellow : Color.LawnGreen); return(++iRow); }
private static ClientModel GetModel(ClientData client, string contractFileName) { return(new ClientModel { BIC = client.BIC, Phone = client.Phone, Emails = client.Emails, LegalEntity = client.LegalEntity, Bank = client.Bank, Contacts = client.Contacts, INN = client.INN, KPP = client.KPP, KS = client.KS, LegalAddress = client.LegalAddress, MailingAddress = client.MailingAddress, Nic = client.Nic, OGRN = client.OGRN, RS = client.RS, ContractFile = null, ContractFileName = contractFileName, Authentication = new AuthenticationModel(client.Login), ContractDate = LocalizationHelper.GetDate(client.ContractDate, CultureProvider.GetCultureInfo()), ContractNumber = client.ContractNumber, DefaultSenderId = client.DefaultSenderId, FactureCost = client.FactureCost, FactureCostEx = client.FactureCostEx, InsuranceRate = client.InsuranceRate * 100, PickupCost = client.PickupCost, TransitCost = client.TransitCost, TariffPerKg = client.TariffPerKg, ScotchCostEdited = client.ScotchCostEdited, Comments = client.Comments }); }
private void DrawRow(int iRow) { var money = CalculationDataHelper.GetMoney(_data, _data.InsuranceRate); var iColumn = 1; _excel.Cells[iRow, iColumn++].Value = _clientNick; _excel.Cells[iRow, iColumn++].Value = _data.ApplicationDisplay; _excel.Cells[iRow, iColumn++].Value = _data.FactoryName; _excel.Cells[iRow, iColumn++].Value = _data.MarkName; _excel.Cells[iRow, iColumn++].Value = _data.Class; _excel.Cells[iRow, iColumn++].Value = _data.Count; _excel.Cells[iRow, iColumn++].Value = _data.Weight; _excel.Cells[iRow, iColumn++].Value = _data.Invoice; _excel.Cells[iRow, iColumn++].Value = _data.Value; _excel.Cells[iRow, iColumn++].Value = _data.TariffPerKg; _excel.Cells[iRow, iColumn].Style.Font.Bold = true; _excel.Cells[iRow, iColumn++].Value = CalculationHelper.GetTotalTariffCost(_data.TotalTariffCost, _data.TariffPerKg, _data.Weight); _excel.Cells[iRow, iColumn++].Value = _data.ScotchCost; _excel.Cells[iRow, iColumn++].Value = CalculationHelper.GetInsuranceCost(_data.Value, _data.InsuranceRate); _excel.Cells[iRow, iColumn++].Value = _data.FactureCost; _excel.Cells[iRow, iColumn++].Value = _data.FactureCostEx; _excel.Cells[iRow, iColumn++].Value = _data.PickupCost; _excel.Cells[iRow, iColumn++].Value = _data.TransitCost; _excel.Cells[iRow, iColumn].Style.Font.Bold = true; _excel.Cells[iRow, iColumn].Value = money; _excel.Cells[iRow, iColumn + 1].Value = (-money).ToString("N2") + CurrencyName.Euro; _excel.Cells[iRow, iColumn + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; _excel.Cells[iRow, iColumn + 1].Style.Font.Color.SetColor(Color.Red); var cultureInfo = CultureProvider.GetCultureInfo(); _excel.Cells[iRow, _columnCount + 2].Value = LocalizationHelper.GetDate(_data.CreationTimestamp, cultureInfo); }
public ListCollection <AirWaybillListItem> List(int take, int skip, long?brokerId, long?senderUserId, string language) { var data = _awbs.GetRange(take, skip, brokerId, senderUserId); var ids = data.Select(x => x.Id).ToArray(); var aggregates = _awbs.GetAggregate(ids).ToDictionary(x => x.AirWaybillId, x => x); var states = _states.Get(language); var currentCulture = CultureProvider.GetCultureInfo(); var awbFiles = GetFileInfo(ids, AwbFileType.AWB); var packingFiles = GetFileInfo(ids, AwbFileType.Packing); var drawFiles = GetFileInfo(ids, AwbFileType.Draw); var gtdFiles = GetFileInfo(ids, AwbFileType.GTD); var gtdAddFiles = GetFileInfo(ids, AwbFileType.GTDAdditional); var invoiceFiles = GetFileInfo(ids, AwbFileType.Invoice); var otherFiles = GetFileInfo(ids, AwbFileType.Other); var items = data.Select(x => new AirWaybillListItem { Id = x.Id, PackingFiles = GetFileInfo(packingFiles, x.Id), InvoiceFiles = GetFileInfo(invoiceFiles, x.Id), State = new ApplicationStateModel { StateName = states[x.StateId].LocalizedName, StateId = x.StateId }, AWBFiles = GetFileInfo(awbFiles, x.Id), OtherFiles = GetFileInfo(otherFiles, x.Id), ArrivalAirport = x.ArrivalAirport, Bill = x.Bill, CreationTimestampLocalString = LocalizationHelper.GetDate(x.CreationTimestamp, currentCulture), DateOfArrivalLocalString = LocalizationHelper.GetDate(x.DateOfArrival, currentCulture), DateOfDepartureLocalString = LocalizationHelper.GetDate(x.DateOfDeparture, currentCulture), StateChangeTimestampLocalString = LocalizationHelper.GetDate(x.StateChangeTimestamp, currentCulture), DepartureAirport = x.DepartureAirport, GTD = x.GTD, GTDAdditionalFiles = GetFileInfo(gtdAddFiles, x.Id), GTDFiles = GetFileInfo(gtdFiles, x.Id), DrawFiles = GetFileInfo(drawFiles, x.Id), TotalCount = aggregates[x.Id].TotalCount, TotalWeight = aggregates[x.Id].TotalWeight, AdditionalCost = x.AdditionalCost, TotalCostOfSenderForWeight = x.TotalCostOfSenderForWeight, BrokerCost = x.BrokerCost, CustomCost = x.CustomCost, FlightCost = x.FlightCost, IsActive = x.IsActive }).ToArray(); var total = _awbs.Count(brokerId, senderUserId); return(new ListCollection <AirWaybillListItem> { Data = items, Total = total }); }
public static AwbSenderModel GetSenderModel(AirWaybillEditData data) { var currentCulture = CultureProvider.GetCultureInfo(); return(new AwbSenderModel { ArrivalAirport = data.ArrivalAirport, Bill = data.Bill, DateOfArrivalLocalString = LocalizationHelper.GetDate(data.DateOfArrival, currentCulture), DateOfDepartureLocalString = LocalizationHelper.GetDate(data.DateOfDeparture, currentCulture), DepartureAirport = data.DepartureAirport, FlightCost = data.FlightCost, TotalCostOfSenderForWeight = data.TotalCostOfSenderForWeight }); }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); var userId = requestContext.HttpContext.Request.Params["userId"]; if (!string.IsNullOrEmpty(userId)) { ViewBag.userInfo = new UserManager().GetUserById(int.Parse(userId)); } object cultureValue; if (requestContext.RouteData.Values.TryGetValue("culture", out cultureValue)) { try { CultureInfo culture = CultureProvider.GetCultureInfo(cultureValue.ToString()); if (culture == null) { culture = CultureProvider.GetCultureInfo(defaultLanguage); } Thread.CurrentThread.CurrentUICulture = culture; Thread.CurrentThread.CurrentCulture = culture; //requestContext.HttpContext.Response.Cookies.Add(new HttpCookie(CultureProvider.culturecookiekey, // culture.Name)); } catch (Exception) { } } else { try { Thread.CurrentThread.CurrentUICulture = CultureProvider.GetCultureInfo(defaultLanguage); Thread.CurrentThread.CurrentCulture = CultureProvider.GetCultureInfo(defaultLanguage); requestContext.HttpContext.Response.Cookies.Add(new HttpCookie(CultureProvider.culturecookiekey, defaultLanguage)); } catch (Exception) { } } }
public static AwbAdminModel GetAdminModel(AirWaybillEditData data) { var cultureInfo = CultureProvider.GetCultureInfo(); return(new AwbAdminModel { ArrivalAirport = data.ArrivalAirport, Bill = data.Bill, DateOfArrivalLocalString = LocalizationHelper.GetDate(data.DateOfArrival, cultureInfo), DateOfDepartureLocalString = LocalizationHelper.GetDate(data.DateOfDeparture, cultureInfo), DepartureAirport = data.DepartureAirport, GTD = data.GTD, BrokerId = data.BrokerId, AdditionalCost = data.AdditionalCost, BrokerCost = data.BrokerCost, CustomCost = data.CustomCost, FlightCost = data.FlightCost, TotalCostOfSenderForWeight = data.TotalCostOfSenderForWeight, SenderUserId = data.SenderUserId }); }
public ApplicationListItem[] Map(ApplicationData[] data, string language) { var appIds = data.Select(x => x.Id).ToArray(); var stateIds = data.Select(x => x.StateId).ToArray(); var countries = _countries.All(language).ToDictionary(x => x.Id, x => x.Name); var states = _states.Get(language, stateIds); var stateAvailability = _stateFilter.GetStateAvailabilityToSet(); var calculations = _applications.GetCalculations(appIds); var cps = _files.GetInfo(appIds, ApplicationFileType.CP); var deliveryBills = _files.GetInfo(appIds, ApplicationFileType.DeliveryBill); var invoices = _files.GetInfo(appIds, ApplicationFileType.Invoice); var packings = _files.GetInfo(appIds, ApplicationFileType.Packing); var otherFiles = _files.GetInfo(appIds, ApplicationFileType.Other); var swifts = _files.GetInfo(appIds, ApplicationFileType.Swift); var torg12 = _files.GetInfo(appIds, ApplicationFileType.Torg12); var t1 = _files.GetInfo(appIds, ApplicationFileType.T1); var ex1 = _files.GetInfo(appIds, ApplicationFileType.Ex1); var cities = _cities.All(language).ToDictionary(x => x.Id, x => x.Name); return(data.Select(x => new ApplicationListItem { CountryName = countries[x.CountryId], State = new ApplicationStateModel { StateId = x.StateId, StateName = states[x.StateId].LocalizedName }, CanClose = x.StateId == _stateConfig.CargoOnTransitStateId, CanSetState = stateAvailability.Contains(x.StateId), AddressLoad = x.AddressLoad, Id = x.Id, FactoryName = x.FactoryName, Invoice = x.Invoice, MarkName = x.MarkName, Volume = x.Volume, Count = x.Count, AirWaybill = x.AirWaybill, Characteristic = x.Characteristic, ClientLegalEntity = x.ClientLegalEntity, ClientNic = x.ClientNic, ClientId = x.ClientId, CreationTimestamp = x.CreationTimestamp, DateInStock = x.DateInStock, DateOfCargoReceipt = x.DateOfCargoReceipt, FactoryContact = x.FactoryContact, FactoryEmail = x.FactoryEmail, FactoryPhone = x.FactoryPhone, StateChangeTimestamp = x.StateChangeTimestamp, StateId = x.StateId, TermsOfDelivery = x.TermsOfDelivery, TransitAddress = x.TransitAddress, CarrierName = x.CarrierName, CarrierContact = x.CarrierContact, CarrierAddress = x.CarrierAddress, CarrierPhone = x.CarrierPhone, TransitId = x.TransitId, TransitCity = cities[x.TransitCityId], TransitDeliveryTypeString = x.TransitDeliveryType.ToLocalString(), TransitMethodOfTransitString = x.TransitMethodOfTransit.ToLocalString(), TransitPhone = x.TransitPhone, TransitRecipientName = x.TransitRecipientName, TransitReference = x.TransitReference, TransitWarehouseWorkingTime = x.TransitWarehouseWorkingTime, WarehouseWorkingTime = x.WarehouseWorkingTime, Weight = x.Weight, MethodOfDeliveryId = (int)x.MethodOfDelivery, IsPickup = x.IsPickup, TransitMethodOfTransitId = (int)x.TransitMethodOfTransit, Value = x.Value, CurrencyId = (int)x.CurrencyId, AirWaybillId = x.AirWaybillId, PickupCost = x.GetAdjustedPickupCost(), FactureCost = x.GetAdjustedFactureCost(), FactureCostEx = x.GetAdjustedFactureCostEx(), ScotchCost = x.GetAdjustedScotchCost(), SenderName = x.SenderName, ForwarderName = x.ForwarderName, SenderScotchCost = x.SenderScotchCost, TariffPerKg = x.TariffPerKg, TransitCost = x.GetAdjustedTransitCost(), ForwarderTransitCost = x.TransitCost, CanSetTransitCost = !calculations.ContainsKey(x.Id), CPFiles = cps.ContainsKey(x.Id) ? cps[x.Id].ToArray() : null, DeliveryBillFiles = deliveryBills.ContainsKey(x.Id) ? deliveryBills[x.Id].ToArray() : null, InvoiceFiles = invoices.ContainsKey(x.Id) ? invoices[x.Id].ToArray() : null, PackingFiles = packings.ContainsKey(x.Id) ? packings[x.Id].ToArray() : null, OtherFiles = otherFiles.ContainsKey(x.Id) ? otherFiles[x.Id].ToArray() : null, SwiftFiles = swifts.ContainsKey(x.Id) ? swifts[x.Id].ToArray() : null, Torg12Files = torg12.ContainsKey(x.Id) ? torg12[x.Id].ToArray() : null, T1Files = t1.ContainsKey(x.Id) ? t1[x.Id].ToArray() : null, Ex1Files = ex1.ContainsKey(x.Id) ? ex1[x.Id].ToArray() : null, DisplayNumber = x.GetApplicationDisplay(), DaysInWork = x.GetDaysInWork(), CreationTimestampLocalString = LocalizationHelper.GetDate(x.CreationTimestamp, CultureProvider.GetCultureInfo()), StateChangeTimestampLocalString = LocalizationHelper.GetDate(x.StateChangeTimestamp, CultureProvider.GetCultureInfo()), DateOfCargoReceiptLocalString = x.DateOfCargoReceipt.HasValue ? LocalizationHelper.GetDate(x.DateOfCargoReceipt.Value, CultureProvider.GetCultureInfo()) : null, DateInStockLocalString = x.DateInStock.HasValue ? LocalizationHelper.GetDate(x.DateInStock.Value, CultureProvider.GetCultureInfo()) : null, MethodOfDeliveryLocalString = x.MethodOfDelivery.ToLocalString(), ValueString = GetValueString(x.Value, x.CurrencyId), MRN = x.MRN, CountInInvoce = x.CountInInvoce, DocumentWeight = x.DocumentWeight }).ToArray()); }