示例#1
0
        public void AddNewAgent()
        {
            var foreignAgent = new ForeignAgents();

            foreignAgent.ShowDialog();

            Agents = new ObservableCollection <AgentDTO>(new ForeignAgentService(true, false).GetAll().ToList());

            if (Agents.Count == 0)
            {
                EmptyControlVisibility = false;
                MessageBox.Show("There should be at least 1 foreign agent registered!");
                return;
            }
            EmptyControlVisibility = true;
        }
示例#2
0
        public List <PRQChemicalPI> GetPIInformationForSearch()
        {
            using (_context)
            {
                var Data = (from p in _context.PRQ_ChemicalPI.AsEnumerable()

                            //from s in _context.Sys_Supplier.Where(x => x.SupplierID == p.SupplierID).DefaultIfEmpty()

                            join s in _context.Sys_Supplier on(p.SupplierID == null? null: p.SupplierID) equals s.SupplierID into Suppliers
                            from s in Suppliers.DefaultIfEmpty()

                            //from la in _context.Sys_Supplier.Where(x => x.SupplierID == p.LocalAgent).DefaultIfEmpty()

                            join la in _context.Sys_Supplier on(p.LocalAgent == null ? null : p.SupplierID) equals la.SupplierID into LocalAgents
                            from la in LocalAgents.DefaultIfEmpty()

                            //from fa in _context.Sys_Supplier.Where(x => x.SupplierID == p.ForeignAgent).DefaultIfEmpty()

                            join fa in _context.Sys_Supplier on(p.ForeignAgent == null ? null : p.SupplierID) equals fa.SupplierID into ForeignAgents
                            from fa in ForeignAgents.DefaultIfEmpty()

                            orderby p.PIID descending
                            select new PRQChemicalPI
                {
                    PIID = p.PIID,
                    PINo = p.PINo,
                    PIDate = (Convert.ToDateTime(p.PIDate)).ToString("dd'/'MM'/'yyyy"),
                    PICategory = (p.PICategory == "PI" ? "Proforma Invoice" : "Indent Order"),
                    SupplierName = (s == null ? null : s.SupplierName),
                    LocalAgentName = (la == null ? null : la.SupplierName),
                    ForeignAgentName = (fa == null ? null : fa.SupplierName),
                    RecordStatus = DalCommon.ReturnRecordStatus(p.RecordStatus)
                }).ToList();

                return(Data);
            }
        }