예제 #1
0
 private Content GetContent(object obj)
 {
     var text = obj as string;
     var contentList = new List<Content>() { Content1, Content2, Content3, Content4 };
     var content = contentList.Where(c => c.Value == text).FirstOrDefault();
     return content;
 }
 public  List<Book> GetByYear(int Year)
   {
       List<Book> books = new List<Book>();
       books = GetAll();
       return books.Where(x => x.YearOfCreating
       == Year).ToList(); ;
   }
       public List<Book> GetByTitle(string Title)
        {
            List<Book> books = new List<Book>();
            books = GetAll();

            return books.Where(x => x.Title == Title).ToList(); ;
        }
        public IList<CustomProcessTransitionByEntity> Select(CustomProcessTransitionByEntity data)
        {
            IList<CustomProcessTransitionByEntity> datos = new List<CustomProcessTransitionByEntity>();
            datos = GetHsql(data).List<CustomProcessTransitionByEntity>();
            if (!Factory.IsTransactional)
                Factory.Commit();

            try { datos = datos.Where(f => f.GetType() == typeof(CustomProcessTransitionByEntity)).ToList(); }
            catch { }
            return datos;

        }
예제 #5
0
 public List<DistributeList> GetDistrListWithoutUsers(List<DistributeList> lists, User selectedUser)
 {
     var selectedLists =
         lists.Where(list => list.SubscribersList.TrueForAll(user => user.Id != selectedUser.Id));
     return selectedLists.ToList();
 }
예제 #6
0
        public List<Equipment> GetAllEquips()
        {
            List<Equipment> Equipments = new List<Equipment>();
            Equipments.AddRange(new Equipment[] { this.Necklace, this.Ring, this.Head, this.Body, this.Hand, this.Cape, this.Feet, this.Charm, this.Mirror });

            var equips = Equipments.Where(x => x != null);

            return equips.ToList();
        }
 private void GenerateMenuConsultant(List<MenuLeft> menus, StringBuilder htmlMenu, StringBuilder htmlMenuDropdown, int subType)
 {
     string caption = "Phần hiển thị chung cho Kiến trúc và Nội thất";
     var parent = menus.Where(t => t.SubType == 2).ToList();
     GenerateMenuConsultant(parent, htmlMenu, caption);
     switch (subType)
     {
         case 0:
         case 1:
             parent = menus.Where(t => t.SubType == subType).OrderByDescending(t => t.SubType).ToList();
             if(parent.Count == 0)
                 break;
             caption = string.Format("Các câu hỏi tư vấn phần {0}", subType == 0 ? "Kiến trúc" : "Nội thất");
             GenerateMenuConsultant(parent, htmlMenu, caption);
             break;
     }
     parent = menus.Where(t => t.ParentId == null && t.SubType == subType).OrderBy(t => t.Position).ToList();
     GenerateMenuDropdow(parent, htmlMenuDropdown);
 }
 private string GetMenuProject(List<MenuLeft> menus)
 {
     var parents = menus.Where(t => t.ParentId == null).OrderBy(t => t.Position);
     var parentses = new List<Parents>();
     foreach (var parent in parents.Where(parent => parent != null))
     {
         var menuParent = new Parents
                              {
                                  Id = parent.Id,
                                  Name = parent.Name
                              };
         var childs = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
         if(childs.Count == 0)
         {
             menuParent.Childs = new List<Childs>();
         }
         else
         {
             foreach (var menuChild in childs.Select(child => new Childs
                                                                  {
                                                                      Id = child.Id,
                                                                      Name = child.Name
                                                                  }))
             {
                 menuParent.Childs.Add(menuChild);
             }
         }
         parentses.Add(menuParent);
     }
     object json = new
         {
             parent = parentses
         };
     var res = Utils.ConvertToJsonString(json);
     return res;
 }
 private List<Parents> GetMenuParents(List<MenuLeft> menus)
 {
     var parentses = new List<Parents>();
     foreach (var parent in menus.Where(parent => parent != null))
     {
         var menuParent = new Parents
                              {
                                  Id = parent.Id,
                                  Name = parent.Name
                              };
         var childs = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
         if (childs.Count == 0)
         {
             menuParent.Childs = new List<Childs>();
         }
         else
         {
             foreach (var menuChild in childs.Select(child => new Childs{ Id = child.Id, Name = child.Name}))
             {
                 menuParent.Childs.Add(menuChild);
             }
         }
         parentses.Add(menuParent);
     }
     return parentses;
 }
        private string GetMenuConsultant(List<MenuLeft> menus, int subType)
        {
            var parent = menus.Where(t => t.SubType == subType).ToList();
            var commonParents = parent.Where(t => t.ParentId == null).OrderBy(t => t.Position).ToList();
            var commons = GetMenuParents(commonParents);

            var sperateParents = parent.OrderByDescending(t => t.SubType).ToList();
            var sperates = GetMenuParents(sperateParents);

            var dropdown = menus.Where(t => t.ParentId == null && t.SubType == subType).OrderBy(t => t.Position).ToList();

            object json = new
                              {
                                  commons,
                                  sperates,
                                  dropdown
                              };
            var res = Utils.ConvertToJsonString(json);
            return res;
        }
        private void GenerateMenuProject(List<MenuLeft> menus, StringBuilder htmlMenu, int cateId)
        {
            htmlMenu.Append("<ul>");
            var menuParents = menus.Where(t => t.ParentId == null).OrderBy(t => t.Position);
            foreach (MenuLeft parent in menuParents.Where(parent => parent != null))
            {

                htmlMenu.AppendFormat("<li>" +
                                      "<div>" +
                                      "<div style='float: left;'>{0}</div>" +
                                      "</div>", parent.Name);
                List<MenuLeft> menuChilds = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
                if (menuChilds.Count == 0)
                {
                    htmlMenu.Append("</li>");
                }
                else
                {
                    htmlMenu.Append("<ul>");
                    foreach (MenuLeft child in menuChilds)
                    {
                        htmlMenu.AppendFormat("<li>" +
                                              "<div>" +
                                              "<input id='rd{0}' type='radio' name='rdKind' value='{1}' {2}>" +
                                              "<label for='rd{3}'>{4}</label>" +
                                              "</div>" +
                                              "</li>",
                                              child.Id, child.Id,
                                              cateId == child.Id ? "checked='checked'" : string.Empty, child.Id,
                                              child.Name);
                    }
                    htmlMenu.Append("</ul>");
                }
            }
            htmlMenu.Append("</ul>");
        }
        private void GenerateMenuConsultant(List<MenuLeft> menus, StringBuilder htmlMenu, string caption)
        {
            htmlMenu.Append(string.Format("<label>{0}</label>", caption));
            htmlMenu.Append("<ul>");
            var menuParents = menus.Where(t => t.ParentId == null).OrderBy(t => t.Position);
            foreach (var parent in menuParents.Where(parent => parent != null))
            {
                GenerateMenuParent(parent, htmlMenu);

                var menuChilds = menus.Where(t => t.ParentId != null && t.ParentId == parent.Id).ToList();
                if (menuChilds.Count == 0)
                {
                    htmlMenu.Append("</li>");
                }
                else
                {
                    htmlMenu.Append("<ul>");
                    foreach (var child in menuChilds)
                    {
                        var imgLink = child.Link > 0 ? string.Format("<a href='/tu-van/tu-van-cong-trinh/{0}/2/{1}' target='_blank' ><img id='link{2}' title='{3}' src='../Images/link.png' width='16' /></a>"
                                                             , child.SubType == 2 ? 1 : child.SubType, child.Link, child.Id, child.Title) : string.Empty;
                        htmlMenu.AppendFormat("<li>" +
                                              "<div>" +
                                              "<span>{0}</span>" +
                                              "<div>" +
                                              "<img onclick='editMenu({1}, false)' src='../Images/iEdit.png' width='16' title='Sửa' />" +
                                              "<img onclick='deleteMenu({2})' src='../Images/iDelete.png' width='16' title='Xóa' />" +
                                              imgLink +
                                              "</div>" +
                                              "</div>" +
                                              "</li>",
                                              child.Name, child.Id, child.Id);
                    }
                    htmlMenu.Append("</ul>");
                }
            }
            htmlMenu.Append("</ul>");
        }
예제 #13
0
        public Document ConfirmCountingTaskDocument(Document countTask, IList<CountTaskBalance> taskList, string user)
        {

            Bin NoCountBin = null;
            try { NoCountBin = Factory.DaoBin().Select(new Bin { BinCode = DefaultBin.NOCOUNT, Location = countTask.Location }).First(); }
            catch
            {
                NoCountBin = Factory.DaoBin().Save(new Bin
                {
                    Location = countTask.Location,
                    BinCode = DefaultBin.NOCOUNT,
                    Status = new Status { StatusID = EntityStatus.Active },
                    Rank = 0,
                    CreatedBy = WmsSetupValues.SystemUser,
                    CreationDate = DateTime.Now,
                    IsArea = true,
                    IsFromErp = false,
                    LevelCode = ""
                });
            }

            /* Recibe el balance de conteo y ejecuta los ajuste necesarios 

             LABELS 
             1. Envia los labels Printed que NO fueron reportados a NOCOUNT (label != null && conuted = 0)
             2. Los Labels encontrados son ajustados si hay diferencia  (label != null && Difference != 0)
                2a. A los labels encontrados se les ajusta el BIN y el status
              
             */

            Status posted = Factory.DaoStatus().Select(new Status { StatusID = DocStatus.Posted }).First();
            Status active = Factory.DaoStatus().Select(new Status { StatusID = EntityStatus.Active }).First();
            Status inActive = Factory.DaoStatus().Select(new Status { StatusID = EntityStatus.Inactive }).First();


            // CAA [2010/07/13]  Se activan los bines usados
            if (countTask.Notes == "0")
            {
                IList<BinByTask> binList = Factory.DaoBinByTask().Select(new BinByTask { TaskDocument = countTask });
                foreach (BinByTask bin in binList)
                {
                    try
                    {
                        bin.Bin.Status = active;
                        bin.Bin.Comment = "";
                        Factory.DaoBin().Update(bin.Bin);
                    }
                    catch { }
                }
            }
            else if (countTask.Notes == "1")
            {
                IList<BinByTaskExecution> binListE = Factory.DaoBinByTaskExecution().Select(
                    new BinByTaskExecution { BinTask = new BinByTask { TaskDocument = countTask } });

                foreach (BinByTaskExecution bin in binListE)
                {
                    try
                    {
                        bin.Bin.Status = active;
                        bin.Bin.Comment = "";
                        Factory.DaoBin().Update(bin.Bin);
                    }
                    catch { }
                }
            }


            IList<Document> negativeDocs = new List<Document>();
            DocumentLine addLine;
            Document postiveAdj = null;
            Document negativeAdj = null;
            int positiveLine = 1;

            //Ajustes Positivos en un solo documento
            if (taskList.Any(f => f.Difference > 0))
            {
                //Crear Ajustes de inventario positivos en un solo ajuste.
                postiveAdj = new Document
                {
                    DocType = new DocumentType { DocTypeID = SDocType.InventoryAdjustment },
                    CreatedBy = user,
                    Location = countTask.Location,
                    Company = countTask.Company,
                    IsFromErp = false,
                    CrossDocking = false,
                    Comment = "CountTask Posting (Postitive Adj) " + countTask.DocNumber + ", " + user,
                    Date1 = DateTime.Now,
                    CustPONumber = countTask.DocNumber,
                    Notes = WmsSetupValues.Counting_Bach
                };

                postiveAdj = DocMngr.CreateNewDocument(postiveAdj, false);
            }
            

            //Casetype
            //3. Label Contado (esperado y no Esperado)
            //4. Label Esperado no Contado Se meuve a No Count


            List<CountTaskBalance> labelsTotal, productTotal;

            try
            {

                try { labelsTotal = taskList.Where(f => f.Label != null && f.Label.LabelID > 0).ToList(); }
                catch { labelsTotal = new List<CountTaskBalance>(); }

                //LABELS
                foreach (CountTaskBalance r in labelsTotal.Where(f => f.CaseType == 4 || f.CaseType == 5 || f.CaseType == 6))
                {
                    
                    //Label Counted - Expected
                    if ((r.CaseType == 4 || r.CaseType == 5) && r.Mark == true)
                        UpdateLabelData(r.Label, r.Bin, countTask.DocNumber, active, user);

                    //Label no counted expected
                    if (r.CaseType == 6 && r.Mark == true)
                        UpdateLabelData(r.Label, NoCountBin, countTask.DocNumber, inActive, user);


                    //Hacer el ajuste de inventario si el label tiene diferencias.
                    if (r.Difference > 0 && r.Mark == true)
                        positiveLine = UpdatePositiveAdj(countTask, r, user, postiveAdj, positiveLine);

                    else if (r.Difference < 0 && r.Mark == true)
                    {
                        negativeAdj = UpdateNegativeAdj(countTask, r, user);
                        if (negativeAdj != null)
                            negativeDocs.Add(negativeAdj);
                    }

                }


                /* PRODUCTO
                 1. Ajusta las diferencias de producto en el mismo BIN (Positivo/Negativo) (Label == null && Expected > 0 && counted > 0)            
                 2. Aumenta el producto Encontrado (Ajuste Positivo) (Label == null && Expected == 0)
                 3. Disminuir el producto no encotrado pero esperado en el bin (Label = null && Expected > 0 && counted ==0)
                 */

                //Casetype
                //1. Producto Suelto en el BIN (contado o no Contado)
                //2. Producto No esperado ajuste positivo

                try { productTotal = taskList.Where(f => f.CaseType == 1 || f.CaseType == 2 || f.CaseType == 3 ).ToList(); }
                catch { productTotal = new List<CountTaskBalance>(); }


                foreach (CountTaskBalance r in productTotal.Where(f => f.Mark == true))
                {
                    if (r.Difference > 0) //r.QtyExpected == 0 && 
                        positiveLine = UpdatePositiveAdj(countTask, r, user, postiveAdj, positiveLine);

                    else if (r.Difference < 0) //r.QtyExpected > 0 && r.QtyCount == 0 && 
                    {
                        negativeAdj = UpdateNegativeAdj(countTask, r, user);
                        if (negativeAdj != null)
                            negativeDocs.Add(negativeAdj);
                    }
                }

                //Factory.Commit();
                Factory.IsTransactional = true;


                //Enviando Ajustes Positivos Al ERP
                if (postiveAdj != null)
                    try { ErpMngr.CreateInventoryAdjustment(postiveAdj, true); }
                    catch { }

                //Enviando Ajustes Negativos Al ERP
                if (negativeDocs.Count > 0)
                {
                    foreach (Document negAdj in negativeDocs)
                        try { ErpMngr.CreateInventoryAdjustment(negAdj, true); }
                        catch (Exception ex)
                        {
                            try
                            {
                                addLine = Factory.DaoDocumentLine().Select(new DocumentLine { Document = negAdj }).First();
                                addLine.Note = WriteLog.GetTechMessage(ex).Substring(0, 255);
                                Factory.DaoDocumentLine().Update(addLine);
                            }
                            catch { }
                        }
                }


                //Factory.IsTransactional = true;


                Status cancell = Factory.DaoStatus().Select(new Status { StatusID = DocStatus.Cancelled }).First();                

                //Cancel the BinExecution Completed Or New
                //Lista de Tareas Ejecutadas.
                //Poner las tareas en status completed.
                IList<BinByTask> executionList = taskList.Select(f=>f.BinByTask).Distinct().ToList();
                IList<BinByTaskExecution> exeChilds;
                foreach (BinByTask btExe in executionList)
                {
                    btExe.Status = posted;
                    btExe.ModDate = DateTime.Now;
                    btExe.ModifiedBy = user;
                    Factory.DaoBinByTask().Update(btExe);

                    //Actualizando los Hijos
                    exeChilds = Factory.DaoBinByTaskExecution().Select(new BinByTaskExecution { BinTask = new BinByTask { RowID = btExe.RowID } });
                    foreach (BinByTaskExecution ch in exeChilds)
                    {
                        ch.Status = posted;
                        ch.ModDate = DateTime.Now;
                        ch.ModifiedBy = user;
                        Factory.DaoBinByTaskExecution().Update(ch);
                    }

                }               

                //Factory.Commit();

                countTask.DocStatus = posted;
                countTask.ModDate = DateTime.Now;
                countTask.ModifiedBy = user;
                countTask.Date2 = DateTime.Now; //Confirmation Date
                Factory.DaoDocument().Update(countTask);


                Factory.Commit();



                return countTask;

            }
            catch (Exception ex)
            {
                Factory.Rollback();

                ExceptionMngr.WriteEvent("ConfirmCountingTaskDocument: " + countTask.DocNumber, ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpPosting);
                throw;
            }
        }
 public List<Book> GetByGenre(string Genre)
  {
      List<Book> books = new List<Book>();
      books = GetAll();
      return books.Where(x => x.Genre == Genre).ToList(); ;
  }
 public List<Book> GetByAuthor(string Author)
   {
       List<Book> books = new List<Book>();
       books = GetAll();
       return books.Where(x => x.Author == Author).ToList(); ;
   }
예제 #16
0
        private IList<DocumentLine> GetLinesWithKitAssemblyHeaders(IList<DocumentLine> shpLines)
        {
            DocumentLine ssLine = null;
            DocumentLine curLine = null;
            int kitLine;
            IList<DocumentLine> processeKits = new List<DocumentLine>();

            //Recorre los componentes para encontrar su Kit/Assembly Padre.
            foreach (DocumentLine dl in shpLines.Where(f => f.Note == "1").OrderBy(f=>f.LinkDocLineNumber))
            {
                try
                {
                    //Entrega la linea del KIT/ASSEMBLY en el Sales Order
                    kitLine = Factory.DaoDocumentLine().Select(
                        new DocumentLine
                        {
                            LineNumber = dl.LinkDocLineNumber,
                            Document = new Document { DocNumber = dl.LinkDocNumber, Company = dl.Document.Company }}
                        ).First().LinkDocLineNumber;

                    curLine = Factory.DaoDocumentLine().Select(
                        new DocumentLine {
                            LineNumber = kitLine,
                            Document = new Document { DocNumber = dl.LinkDocNumber, Company = dl.Document.Company }}
                         ).First();

                    //revisa si ese kit aun no ha sido procesado. Si fue procesado va al siguiente
                    if (processeKits.Where(f => f.LineNumber == curLine.LineNumber).Count() > 0)
                        continue;

                    processeKits.Add(curLine);
                }
                catch { continue; }


                int line = shpLines.Select(f=>f.LineNumber).Max() + 1;
                Status lineStatus = WType.GetStatus(new Status { StatusID = DocStatus.New });

                //Crea una linea para el documento de shipment
                ssLine = new DocumentLine
                {
                    Product = curLine.Product,
                    Quantity = 0, 
                    QtyAllocated = curLine.Quantity, //Guarda la cantidad a enviar al ERP para el Fulfill.
                    Unit = curLine.Unit,
                    Document = dl.Document,
                    CreationDate = DateTime.Now,
                    IsDebit = false,
                    LineNumber = line,
                    LineStatus = lineStatus,
                    Location = dl.Document.Location,
                    UnitBaseFactor = dl.Unit.BaseAmount,
                    LinkDocNumber = curLine.Document.DocNumber,
                    LinkDocLineNumber = curLine.LineNumber,
                    CreatedBy = dl.CreatedBy,
                    Note = "2",
                    Sequence = curLine.Sequence
                };

                shpLines.Add(ssLine);
                line++;
            }

            return shpLines;
        }