public ActionResult GetBSOInvoice(BSOSaveDataModel model) { List <ReferenceUniversalItem> DP = referenceBusinessLogic.GetUniversalList(Constants.DeliveryPointRef); string deliveryPointName = DP.Where(m => m.Id == model.DeliveryPointId).FirstOrDefault().Name; long? deliveryPointHeadId = DP.Where(m => m.Id == model.DeliveryPointId).FirstOrDefault().DeliveryPointHeadId; List <SelectListItem> Users = ReferencesProvider.GetUsers(); string fio; if (deliveryPointHeadId != null) { fio = Users.Where(a => a.Value == deliveryPointHeadId.ToString()).Select(b => b.Text).FirstOrDefault(); } else { fio = CurrentUser.Fullname; } List <string> listBsoNumber = new List <string>(); listBsoNumber.Add(model.TemporaryPolicyNumber); BSOInvoice printedForm = new BSOInvoice(listBsoNumber, fio, deliveryPointName); return(File(printedForm.GetExcel(), System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Накладная БСО (ВС).xls"))); }
public ActionResult GetBSOInvoiceS(BSOListModel model) { List <ReferenceUniversalItem> DP = referenceBusinessLogic.GetUniversalList(Constants.DeliveryPointRef); string deliveryPointName = DP.Where(m => m.Id == model.SearchCriteriaModel.NewDeliveryPointId).FirstOrDefault().Name; long? deliveryPointHeadId = DP.Where(m => m.Id == model.SearchCriteriaModel.NewDeliveryPointId).FirstOrDefault().DeliveryPointHeadId; List <SelectListItem> Users = ReferencesProvider.GetUsers(); string fio; if (deliveryPointHeadId != null) { fio = Users.Where(a => a.Value == deliveryPointHeadId.ToString()).Select(b => b.Text).FirstOrDefault(); } else { fio = CurrentUser.Fullname; } model.SearchCriteriaModel.StatusId = model.SearchCriteriaModel.CurrentStatusId; model.SearchCriteriaModel.DeliveryPointIds = new List <long>(); model.SearchCriteriaModel.DeliveryPointIds.Add(model.SearchCriteriaModel.NewDeliveryPointId.Value); BSOSearchCriteria criteria = model.SearchCriteriaModel.GetBSOSearchCriteria(); List <BSOInfo> bsos = bsoBusinessLogic.BSO_Find( criteria, new List <SortCriteria <BSOSortField> >(), new PageRequest() { PageNumber = 1, PageSize = int.MaxValue }).Data; List <string> listBsoNumber = new List <string>(); foreach (var elem in bsos) { listBsoNumber.Add(elem.TemporaryPolicyNumber); } BSOInvoice printedForm = new BSOInvoice(listBsoNumber, fio, deliveryPointName); return(File(printedForm.GetExcel(), System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Накладная БСО (ВС).xls"))); }