private void SaveInfo_Click(object sender, RoutedEventArgs e)
        {
            //保存供应商信息
            SupplierAdapter adapter = new SupplierAdapter(SQLConnection.GetDataBase());

            try
            {
                if (bAddNewSupplier)    //添加新的供应商信息
                {
                    adapter.AddOneSupplier(supplierInfo);
                    MessageBox.Show("添加供应商成功", "提醒",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else   //修改供应商信息
                {
                    adapter.UpdateOneSupplier(supplierInfo);
                    MessageBox.Show("更新供应商成功", "提醒",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常发生,请检查数据库连接或数据是否符合标准", "提醒", MessageBoxButton.OK,
                                MessageBoxImage.Information);
                //写入日志
            }
        }
Esempio n. 2
0
        public IQueryable <BL.DomainModel.Supplier> GetAll()
        {
            var suppliers = from c in this.db.SupplierSet.AsEnumerable()
                            select SupplierAdapter.AdaptSupplier(c);

            return(suppliers.AsQueryable());
        }
        public IQueryable <BL.DomainModel.Supplier> GetAll()
        {
            var suppliers = from p in this.db.Suppliers
                            select SupplierAdapter.AdaptSupplier(p);

            return(suppliers);
        }
Esempio n. 4
0
        public Supplier GetSupplierById(int supplierId)
        {
            var suppliers = from s in this.db.Suppliers.AsEnumerable()
                            where s.SupplierId == supplierId
                            select SupplierAdapter.AdaptSupplier(s);

            return(suppliers.Single());
        }
Esempio n. 5
0
        public IQueryable <Supplier> GetSuppliersByProductId(int id)
        {
            var suppliers = from sc in this.db.SupplierConditions.AsEnumerable()
                            where sc.ProductId == id
                            join s in this.db.Suppliers on sc.SupplierId equals s.SupplierId
                            select SupplierAdapter.AdaptSupplier(s);

            return(suppliers.AsQueryable());
        }
Esempio n. 6
0
        public IQueryable <Supplier> GetAllSuppliers()
        {
            var suppliers = from s in this.db.Suppliers.AsEnumerable()
                            select SupplierAdapter.AdaptSupplier(s);

            var queryable = suppliers.AsQueryable();

            return(queryable);
        }
Esempio n. 7
0
        public StoreSupplierResponse StoreSupplier(StoreSupplierRequest request)
        {
            StoreSupplierResponse     response = new StoreSupplierResponse();
            SupplierBusinessComponent bc       = DependencyInjectionHelper.GetSupplierBusinessComponent();
            Supplier supplier = SupplierAdapter.DtoToSupplier(request.Supplier);

            response.SupplierId = bc.StoreSupplier(supplier);

            return(response);
        }
Esempio n. 8
0
        public GetSuppliersResponse GetSuppliersByCriteria(GetSuppliersRequest request)
        {
            GetSuppliersResponse      response = new GetSuppliersResponse();
            SupplierBusinessComponent bc       = DependencyInjectionHelper.GetSupplierBusinessComponent();

            IQueryable <Supplier> suppliers = bc.GetSuppliersByCriteria(request.SearchType, request.Name);

            response.Suppliers = SupplierAdapter.SuppliersToDtos(suppliers);

            return(response);
        }
Esempio n. 9
0
        public GetSupplierResponse GetSupplierById(GetSupplierRequest request)
        {
            GetSupplierResponse       response = new GetSupplierResponse();
            SupplierBusinessComponent bc       = DependencyInjectionHelper.GetSupplierBusinessComponent();

            Supplier supplier = bc.GetSupplierById(request.Id);

            response.Supplier = SupplierAdapter.SupplierToDto(supplier);

            return(response);
        }
Esempio n. 10
0
        public StoreSupplierResponse StoreSupplier(StoreSupplierRequeset request)
        {
            var response = new StoreSupplierResponse();
            var bc       = DependencyInjectionHelper.GetBusinessComponent <SupplierBusinessComponent>();

            var supplier = SupplierAdapter.DtoToSupplier(request.Supplier);

            response.Id = bc.StoreSupplier(supplier);

            return(response);
        }
Esempio n. 11
0
        public GetSuppliersResponse GetSuppliersByProductId(GetSuppliersRequest request)
        {
            var bc        = DependencyInjectionHelper.GetBusinessComponent <SupplierBusinessComponent>();
            var suppliers = bc.GetSuppliersByProductId(request.ProductId);

            var response = new GetSuppliersResponse();

            response.Suppliers = SupplierAdapter.SuppliersToDtos(suppliers);

            return(response);
        }
Esempio n. 12
0
        public GetSupplierResponse GetSupplierById(GetSupplierRequest request)
        {
            var bc       = DependencyInjectionHelper.GetBusinessComponent <SupplierBusinessComponent>();
            var supplier = bc.GetSupplierById(request.SupplierId);

            var response = new GetSupplierResponse();

            response.Supplier = SupplierAdapter.SupplierToDTO(supplier);

            return(response);
        }
Esempio n. 13
0
        public StoreSupplierResponse StoreSupplier(StoreSupplierRequest request)
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                throw new FaultException <NotAuthenticatedFault>(new NotAuthenticatedFault());
            }
            StoreSupplierResponse     response = new StoreSupplierResponse();
            SupplierBusinessComponent bc       = DependencyInjectionHelper.GetSupplierBusinessComponent();
            Supplier supplier = SupplierAdapter.DtoToSupplier(request.Supplier);

            response.SupplierId = bc.StoreSupplier(supplier);

            return(response);
        }
Esempio n. 14
0
 //加载数据
 private void LoadData()
 {
     try
     {
         SupplierAdapter adapter = new SupplierAdapter(SQLConnection.GetDataBase());
         Suppliers = adapter.GetAllSupplier();        //获取所有供应商信息
         LV_Supplier.ItemsSource = Suppliers.Tables[0].DefaultView;
     }
     catch (Exception ex)
     {
         MessageBox.Show("异常发生,请检查数据库连接", "错误", MessageBoxButton.OK,
                         MessageBoxImage.Error);
         //写入日志
     }
 }
Esempio n. 15
0
        public BL.DomainModel.Supplier GetById(int id)
        {
            try
            {
                var suppliers = from c in this.db.SupplierSet.AsEnumerable()
                                where c.SupplierId == id
                                select SupplierAdapter.AdaptSupplier(c);

                return(suppliers.First());
            }
            catch (ArgumentNullException ex)
            {
                if (ExceptionPolicy.HandleException(ex, "DA Policy"))
                {
                    throw;
                }
                return(new MissingSupplier());
            }
        }
        //加载数据
        private void LoadData()
        {
            try
            {
                DataSet         SupplierList;
                SupplierAdapter sadapter = new SupplierAdapter(
                    SQLConnection.GetDataBase());
                PurchaseAdapter padapter = new PurchaseAdapter(
                    SQLConnection.GetDataBase());

                SupplierList = sadapter.GetAllSupplier();           //获取所有供应商信息
                PurchaseList = padapter.GetAllPurchase();           //获取所有进货信息

                DataTable     table   = SupplierList.Tables["Supplier"];
                DataSetHelper phelper = new DataSetHelper(ref PurchaseList);

                SupplierList.Tables.Remove("Supplier");
                PurchaseList.Tables.Add(table);    //添加子表
                PurchaseList.Relations.Add("PAndS", PurchaseList.Tables["Supplier"].Columns["Sno"],
                                           PurchaseList.Tables["Purchase"].Columns["Sno"]);

                phelper.SelectJoinInto("PurchaseAndSupplier", PurchaseList.Tables["Purchase"],
                                       "Pno,Sno,PAndS.Sname,Pdate", "1=1", "Pno");

                //加载进货信息
                LV_PurchaseAndSupplier.ItemsSource = PurchaseList.Tables["PurchaseAndSupplier"].DefaultView;

                //加载进货细节
                if (LV_PurchaseAndSupplier.Items.Count != 0)
                {
                    //选择第一项
                    LV_PurchaseAndSupplier.SelectedIndex = 0;
                    LoadPurchaseDetailData(0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常发生,请检查数据库连接", "错误", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                //写入日志
            }
        }