/// <summary> /// Se encarga de serializar el objeto headr y el detalle en un dataset que pueda se deplegado /// por el reporting service /// </summary> /// <param name="document"></param> /// <returns></returns> private ReportHeaderFormat ProcessHeaderAndDetails(Document document) { ReportHeaderFormat header = ProcessHeader(document); #region Map Details for each document Line // //ReportDetailFormat detail; IList<ReportDetailFormat> detailList = new List<ReportDetailFormat>(); //TODO: Incluir Filtro por bodega zona en este punto para solo obtener los detalles del filtro int sequence = 1, subSequence = 1; double totWeight = 0, totCases = 0, totQtyOrder = 0, totQtyPending = 0; short binDirection = BinType.In_Out; //Bin Direction to use if (document.DocType.DocTypeID == SDocType.ReplenishPackTask) binDirection = BinType.In_Only; //Gettting document balance para qty pending, IList<DocumentBalance> docBalance = null; if (document.DocType.DocClass.DocClassID == SDocClass.Receiving) { docBalance = Factory.DaoDocumentBalance().DetailedBalance(new DocumentBalance { Document = document, Node = new Node { NodeID = NodeType.Received } }, false); } else if (document.DocType.DocClass.DocClassID == SDocClass.Shipping) { docBalance = Factory.DaoDocumentBalance().DetailedBalance(new DocumentBalance { Document = document, Node = new Node { NodeID = NodeType.Picked } }, document.CrossDocking == true ? true : false); } double kitTotalOrder = 0; foreach (DocumentLine dLine in Factory.DaoDocumentLine().Select(new DocumentLine { Document = new Document { DocID = document.DocID } }).OrderBy(f => f.LineNumber)) { //Adicionado en Dec 30 2009. if (dLine.Product.Status.StatusID != EntityStatus.Active) continue; //if (dLine.LineStatus.StatusID == DocStatus.Cancelled) //continue; if (dLine.LineStatus.StatusID != DocStatus.New && dLine.LineStatus.StatusID != DocStatus.InProcess) continue; if (dLine.Quantity <= 0 && dLine.LineNumber != 0) continue; //Product To build, el primero en la lista if (string.IsNullOrEmpty(header.ProductToBuild)) { header.ProductToBuild = dLine.Product.ProductCode + ", " + dLine.Product.Name; try { header.Barcode = GetAssignedBinsList(dLine.Product, document.Location).First().Bin.BinCode; } catch { header.Barcode = ""; } } //Si es el primer item del asembly se sale. if (document.DocType.DocTypeID == SDocType.KitAssemblyTask && dLine.LineNumber == 0) { kitTotalOrder = dLine.Quantity; continue; } IList<ReportDetailFormat> evaluatedLines = EvaluateLine(dLine, document, docBalance, binDirection, 1); foreach (ReportDetailFormat detail in evaluatedLines) { if (detail.IsSubDetail != true) { detail.SeqLine = sequence++; totWeight += detail.Weight; totCases++; // += detail.Cases; totQtyOrder += detail.QtyOrder; totQtyPending += detail.QtyPending; subSequence = 1; } else detail.SeqLine = subSequence++; detailList.Add(detail); } } #endregion // Totals header.TotalCases = totCases; header.TotalWeight = totWeight; header.TotalQtyOrder = (kitTotalOrder > 0) ? kitTotalOrder : totQtyOrder; header.TotalQtyPending = totQtyPending; if (document.DocType.DocTypeID == SDocType.SalesOrder || document.DocType.DocTypeID == SDocType.WarehouseTransferShipment || document.DocType.DocTypeID == SDocType.MergedSalesOrder) { //header.ReportDetails = detailList.OrderBy(f => f.Rank).ToList(); //Si tiene componente organiza por componentes y luego por Rank if (detailList.Any(f=>f.IsSubDetail == true)) { var sortedProducts = from p in detailList orderby p.CustNumber1, p.IsSubDetail, p.Rank select p; header.ReportDetails = sortedProducts.ToList(); } else { //Si no, solo por Rank. Aqui vienen las reglas de SORT var sortedProducts = from p in detailList orderby p.Rank select p; header.ReportDetails = sortedProducts.ToList(); } } else header.ReportDetails = detailList.OrderBy(f => f.AuxSequence).ToList(); return header; }
public bool UpdateTask(TaskDTO task, List<int> taskTagsId) { Task taskEntity = MapperService.Convert<BusinessObjects.TaskDTO, Task>(task); Task taskInDb = _taskRepository.Find(x => x.TaskId == taskEntity.TaskId).FirstOrDefault(); if (taskInDb != null) { _taskRepository.UpdateValue(taskInDb, taskEntity); ICollection<Tag> listTag = _tagRepository.GetList().Where(x => taskTagsId.Any(a => a == x.TagId)).ToList(); foreach (Tag tag in listTag) { taskEntity.Tags.Add(tag); } taskInDb.Tags.Clear(); foreach (Tag tag in listTag) { taskInDb.Tags.Add(tag); } _taskRepository.Save(); } return true; }
/// <summary> /// Processes the specified solution path. /// </summary> /// <param name="projectsViewModel">The projects view model.</param> /// <param name="applicationOptionsViewModel">The application options view model.</param> /// <param name="ninjaCoderOptionsViewModel">The ninja coder options view model.</param> /// <param name="applicationSamplesOptionsViewModel">The application samples options view model.</param> /// <param name="viewsViewModel">The views view model.</param> /// <param name="pluginsViewModel">The plugins view model.</param> /// <param name="nugetPackagesViewModel">The nuget packages view model.</param> /// <param name="xamarinFormsLabsViewModel">The xamarin forms labs view model.</param> internal void Process( ProjectsViewModel projectsViewModel, ApplicationOptionsViewModel applicationOptionsViewModel, NinjaCoderOptionsViewModel ninjaCoderOptionsViewModel, ApplicationSamplesOptionsViewModel applicationSamplesOptionsViewModel, ViewsViewModel viewsViewModel, PluginsViewModel pluginsViewModel, NugetPackagesViewModel nugetPackagesViewModel, XamarinFormsLabsViewModel xamarinFormsLabsViewModel) { TraceService.WriteLine("ProjectsController::Process"); foreach (SelectableItemViewModel<ProjectTemplateInfo> projectTemplateInfo in projectsViewModel.Projects) { TraceService.WriteLine(projectTemplateInfo.Item.Name + " project selected=" + projectTemplateInfo.IsSelected); } this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning); this.applicationService.SuspendResharperIfRequested(); this.projectsService.IsNewSolution = this.VisualStudioService.SolutionAlreadyCreated; //// create the solution if we don't have one! if (this.projectsService.IsNewSolution == false) { this.VisualStudioService.SolutionService.CreateEmptySolution(projectsViewModel.GetSolutionPath(), projectsViewModel.Project); } if (this.SettingsService.CreateTestProjectsSolutionFolder) { this.VisualStudioService.SolutionService.AddSolutionFolder(this.SettingsService.TestProjectsSolutionFolderName); this.VisualStudioService.DTEService.SaveAll(); } this.messages = this.projectsService.AddProjects( this.VisualStudioService, projectsViewModel.GetSolutionPath(), projectsViewModel.GetFormattedRequiredTemplates()) .ToList(); this.projectsService.SetStartUpProject(); //// there is a bug in the xamarin iOS code that means it doesnt apply a couple of xml elements //// in the info.plist - here we fix that issue. if (this.SettingsService.FixInfoPlist) { this.applicationService.FixInfoPList(projectsViewModel.GetFormattedRequiredTemplates() .FirstOrDefault(x => x.ProjectSuffix == this.SettingsService.iOSProjectSuffix)); } IEnumerable<string> viewNugetCommands = new List<string>(); if (this.SettingsService.FrameworkType != FrameworkType.NoFramework && viewsViewModel != null) { //// if we dont have a viewmodel and view in memory - add one //// user will have dont show views and viewmodel options selected. if (!viewsViewModel.Views.Any()) { viewsViewModel.Add(); } IEnumerable<string> viewModelMessages = this.viewModelViewsService.AddViewModelsAndViews(viewsViewModel.Views); this.messages.AddRange(viewModelMessages); viewNugetCommands = this.viewModelViewsService.GetNugetCommands(); } TraceService.WriteLine("ProjectsController::Process GetApplication Commands"); //// we need to get the post nuget commands that are now hosted in xml file that used to be in code CommandsList commandsList = this.applicationService.GetCommandsList(); if (commandsList != null) { this.postNugetCommands.AddRange(commandsList.Commands); this.postNugetFileOperations.AddRange(commandsList.FileOperations); } IEnumerable<ProjectTemplateInfo> projectTemplateInfos = projectsViewModel.GetFormattedRequiredTemplates(); this.commands += this.nugetService.GetNugetCommands(projectTemplateInfos); if (viewNugetCommands.Any()) { foreach (string viewNugetCommand in viewNugetCommands) { this.commands += viewNugetCommand + Environment.NewLine; } } this.PopulateNugetActions(applicationOptionsViewModel); this.PopulateNugetActions(ninjaCoderOptionsViewModel); this.PopulateNugetActions(applicationSamplesOptionsViewModel); this.PopulateNugetActions(pluginsViewModel); this.PopulateNugetActions(nugetPackagesViewModel); this.PopulateNugetActions(xamarinFormsLabsViewModel); this.cachingService.PostNugetCommands = this.postNugetCommands; this.cachingService.PostNugetFileOperations = this.postNugetFileOperations; //// a bit of (unnecessary) tidying up - replace double new lines! this.commands = this.commands.Replace(Environment.NewLine + Environment.NewLine, Environment.NewLine); this.CreateReadMe(false, false); TraceService.WriteHeader("RequestedNugetCommands=" + this.commands); if (this.SettingsService.ProcessNugetCommands) { this.ProcessNugetCommands(); } TraceService.WriteLine("ProjectsController::Process END"); }
public bool AddTask(TaskDTO task, List<Int32> taskTagsId) { Task taskEntity = MapperService.Convert<BusinessObjects.TaskDTO, Task>(task); taskEntity.Tags = new Collection<Tag>(); ICollection<Tag> listTag = _tagRepository.GetList().Where(x => taskTagsId.Any(a => a == x.TagId)).ToList(); foreach (Tag tag in listTag) { taskEntity.Tags.Add(tag); } _taskRepository.Add(taskEntity); _taskRepository.Save(); return true; }