Пример #1
0
 public UnitOfWork()
 {
     _context = new FxContext();
     Devices = new DeviceRepository(_context);
     Suppliers = new SupplierRepository(_context);
     Categories = new CategoryRepository(_context);
     PointNames = new PointNameRepository(_context);
     Sockets = new SocketRepository(_context);
     ProductTypes = new ProductTypeRepository(_context);
     IncludedProducts = new IncludedProductRepository(_context);
     SignalTypes = new SignalTypeRepository(_context);
     CableTypes = new CableTypeRepository(_context);
 }
Пример #2
0
 public UnitOfWork(FxContext context)
 {
     _context = context;
     // client of unitOfWork uses same context on all properties
     Devices = new DeviceRepository(_context);
     Suppliers = new SupplierRepository(_context);
     Categories = new CategoryRepository(_context);
     PointNames = new PointNameRepository(_context);
     Sockets = new SocketRepository(_context);
     ProductTypes = new ProductTypeRepository(_context);
     IncludedProducts = new IncludedProductRepository(_context);
     SignalTypes = new SignalTypeRepository(_context);
     CableTypes = new CableTypeRepository(_context);
 }
        public List <PostalCode> AutoFillPostalCode()
        {
            ISupplierRepository repo = new SupplierRepository();

            return(repo.AutoFillPostalCode());
        }
        public List <City> AutoFillCity()
        {
            ISupplierRepository repo = new SupplierRepository();

            return(repo.AutoFillCity());
        }
        public List <State> AutoFillState()
        {
            ISupplierRepository repo = new SupplierRepository();

            return(repo.AutoFillState());
        }
        void OnSaveSupplier(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            SupplierDetailEntity supplier = new SupplierDetailEntity();

            supplier.ID                    = this.SelectedSearchSupplier;
            supplier.SupplierName          = this.SupplierName;
            supplier.Email                 = this.Email;
            supplier.Fax                   = this.Fax;
            supplier.Telephone             = this.Telephone;
            supplier.Supp_Reg_No           = this.Supp_Reg_No;
            supplier.Sup_Bill_to_city      = this.Sup_Bill_to_city;
            supplier.Sup_Bill_to_country   = this.Sup_Bill_to_country;
            supplier.Sup_Bill_to_line1     = this.Sup_Bill_to_line1;
            supplier.Sup_Bill_to_line2     = this.Sup_Bill_to_line2;
            supplier.Sup_Bill_to_post_code = this.Sup_Bill_to_post_code;
            supplier.Sup_Bill_to_state     = this.Sup_Bill_to_state;
            supplier.ShipAddressLine1      = this.ShipAddressLine1;
            supplier.ShipAddressLine2      = this.ShipAddressLine2;
            supplier.ShipCity              = this.ShipCity;
            supplier.ShipCountry           = this.ShipCountry;
            supplier.ShipState             = this.ShipState;
            supplier.ShipPostalCode        = this.ShipPostalCode;
            supplier.ContactPerson         = this.ContactPerson;
            supplier.GstRegistrationNo     = this.GstRegistrationNo;
            supplier.Remarks               = this.Remarks;
            supplier.IsInActive            = this.IsInActive;
            supplier.ChangeSupplierGST     = this.ChangeSupplierGST;
            supplier.Balance               = this.Balance;
            supplier.ID                    = this.ID;
            supplier.CreditLimitAmount     = this.CreditLimitAmount;
            supplier.CreditLimitDays       = this.CreditLimitDays;
            supplier.TaxId                 = this.SelectedTaxId;
            MessageBoxResult result = MessageBox.Show("Do you want to save changes?", "Save Content", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                ISupplierRepository supplierRepository = new SupplierRepository();
                var savesupplier = supplierRepository.CreateSupplier(supplier);
                if (savesupplier)
                {
                    if (this.ID == 0)
                    {
                        //this.SearchSupplier = supplierRepository.GetAllSupplier().ToList();
                        //var SupplierIdSelected = this.SearchSupplier[this.SearchSupplier.Count - 1].ID;
                        //this.SelectedSearchSupplier = SupplierIdSelected;
                        RefreshData();
                    }
                    else
                    {
                        this.TotalSupplier    = supplierRepository.GetAllSupplier().Count();
                        this.InActiveSupplier = supplierRepository.GetSupplierCount("Y");
                        this.ActiveSupplier   = TotalSupplier - InActiveSupplier;
                    }
                }
                else
                {
                    MessageBox.Show("There was some problem while updating the values, Kindly try again later.");
                }
                break;

            case MessageBoxResult.No:
                break;
            }
            //if (supplier.ChangeSupplierGST == true)
            //{
            //    this.ChangeSupplierGSTTrue = supplier.ChangeSupplierGST;
            //    this.ChangeSupplierGSTFalse = false;
            //}
            //else
            //{
            //    this.ChangeSupplierGSTTrue = false;
            //    this.ChangeSupplierGSTFalse = true;
            //}
            Mouse.OverrideCursor = null;
        }
Пример #7
0
        public AppPresenter(AppShell view, CategoryRepository categoryRepository, CustomerRepository customerRepository, GeneralSettingsRepository generalSettingsRepository, ItemRepository itemRepository, SalesTransactionRepository salesTransactionRepository, SupplierRepository supplierRepository, UserRepository userRepository, UserRightRepository userRightRepository)
            : base(view)
        {
            this._categoryRepository         = categoryRepository;
            this._customerRepository         = customerRepository;
            this._generalSettingsRepository  = generalSettingsRepository;
            this._itemRepository             = itemRepository;
            this._salesTransactionRepository = salesTransactionRepository;
            this._supplierRepository         = supplierRepository;
            this._userRepository             = userRepository;
            this._userRightRepository        = userRightRepository;

            this._currentCategoryCollection         = new ObservableCollection <Category>(categoryRepository.FindAll());
            this._currentCustomerCollection         = new ObservableCollection <Customer>(customerRepository.FindAll());
            this._currentItemCollection             = new ObservableCollection <Item>(itemRepository.FindAllItem());
            this._currentSalesTransactionCollection = new ObservableCollection <SalesTransaction>(salesTransactionRepository.FindAllTransaction());
            this._currentSupplierCollection         = new ObservableCollection <Supplier>(supplierRepository.FindAll());
            this._currentUserCollection             = new ObservableCollection <User>(userRepository.FindAll());
            this._currentUserRightCollection        = new ObservableCollection <UserRight>(userRightRepository.FindAll());

            this._currentTItemCollection = new ObservableCollection <Item>();;

            this._currentGeneralSettings = new ObservableCollection <GeneralSettings>();
            this._currentGeneralSettings.Add(generalSettingsRepository.FindGeneralSettings());

            this._currentLogin = (Application.Current.MainWindow.DataContext as MainPresenter).CurrentLogin;

            this._profileBoxState = false;
        }
Пример #8
0
        public bool Delete(int id)
        {
            SupplierRepository repo = new SupplierRepository();

            return(repo.Delete(id));
        }
 public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
     supplierRepo  = new SupplierRepository(new MyDbContext());
 }
 public AccountController()
 {
     supplierRepo = new SupplierRepository(new MyDbContext());
 }
Пример #11
0
 public SupplierRepositoryBus()
 {
     this.supplierRepository = new SupplierRepository();
 }
Пример #12
0
 public SuppliersController(SupplierRepository supplierRepository)
 {
     _supplierRepository = supplierRepository;
 }
Пример #13
0
 public SupplierController()
 {
     _supplierRepo = new SupplierRepository();
 }
Пример #14
0
 public SupplierManager()
 {
     _supplierRepository = new SupplierRepository();
 }
Пример #15
0
 public StorageController()
 {
     sRep   = new StorageRepository();
     cRep   = new StorageCategoryRepository();
     supRep = new SupplierRepository();
 }
        //private void GetCustomerCreditLimit()
        //{
        //    ICustomerRepository customerRepository = new CustomerRepository();
        //    this.CreditLimitDays = customerRepository.GetCatagoryType("CCLD").ToList();
        //    this.CreditLimitAmount = customerRepository.GetCatagoryType("CCLA").ToList();
        //    this.Discount = customerRepository.GetCatagoryType("CD").ToList();
        //    if (this.ID == -1)
        //    {
        //        var data = CreditLimitDays.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data != null)
        //        {
        //            SelectedCreditLimitDays = Convert.ToInt32(data);
        //        }
        //        var data2 = CreditLimitAmount.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data2 != null)
        //        {
        //            SelectedCreditLimitAmount = Convert.ToInt32(data2);
        //        }
        //        var data3 = Discount.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data3 != null)
        //        {
        //            SelectedDiscount = Convert.ToInt32(data3);
        //        }
        //    }

        //}
        private void RefreshData()
        {
            ISupplierRepository supplierRepository = new SupplierRepository();

            this.TotalSupplier    = supplierRepository.GetAllSupplier().Count();
            this.InActiveSupplier = supplierRepository.GetSupplierCount("Y");
            this.ActiveSupplier   = TotalSupplier - InActiveSupplier;
            this.SearchSupplier   = supplierRepository.GetAllSupplier().ToList();
            this.IsAllowedToChangeCLA_and_Discount = supplierRepository.AllowedToChangeLimit();
            string setdateFormat = this.DateFormat == null ? "{0:dd/MM/yyyy}" : "{0:" + this.DateFormat + "}";
            int    supId         = 0;

            ChangeSupplierGSTTrue  = false;
            ChangeSupplierGSTFalse = true;
            DateTime?dtRefresh = DateTime.UtcNow;

            if (SharedValues.getValue == "New" || SharedValues.getValue == "SupplierDetailTab")
            {
                NewSupplier(null);
            }
            else
            {
                if (SearchSupplier.Count > 0)
                {
                    int SupplierSelectedId = 0;
                    if (SharedValues.getValue != null)
                    {
                        bool isValid = Int32.TryParse(SharedValues.getValue, out SupplierSelectedId);
                    }
                    // int SupplierSelectedId = Convert.ToInt32(SharedValues.getValue);
                    if (SupplierSelectedId != 0)
                    {
                        this.SelectedSearchSupplier = SupplierSelectedId;
                    }
                    else
                    {
                        //var dataRefresh = SearchSupplier.Find(x => x.IsRefreshed != null && x.IsRefreshed == true);
                        //if (dataRefresh != null)
                        //{
                        //    supId = dataRefresh.ID;
                        //    this.SelectedSearchSupplier = supId;
                        //    dtRefresh = (dataRefresh.RefreshedDate != null) ? DateTime.UtcNow : dataRefresh.RefreshedDate;
                        //}
                        //else
                        //{

                        supId = SearchSupplier[0].ID;
                        this.SelectedSearchSupplier = supId;
                        this.LastUpdateDate         = String.Format(setdateFormat, this.SearchSupplier.OrderByDescending(x => x.Createddate).FirstOrDefault().Createddate);
                        //}
                        this.LastUpdateDate = String.Format(setdateFormat, dtRefresh);
                    }
                }
                else
                {
                    this.SelectedSearchSupplier = supId;
                    //this.ChangeCustomerGST = IsCompanyRegisteredForGST;
                    this.LastUpdateDate = String.Format(setdateFormat, System.DateTime.Now);
                }
                this.GetData(this.SelectedSearchSupplier);
            }
        }
        public void GetData(int supplierId)
        {
            ISupplierRepository repo = new SupplierRepository();

            var supplier = repo.GetAllSupplier().Where(x => x.ID == supplierId).FirstOrDefault();

            if (supplier != null)
            {
                if (supplier.TaxId == null && supplier.ChangeSupplierGST == false)
                {
                    this.SelectedTaxId = 0;
                }
                else
                {
                    this.SelectedTaxId = supplier.TaxId;
                }
                this.SelectedSearchSupplier = supplier.ID;
                this.SupplierName           = supplier.SupplierName;
                this.Email = supplier.Email;
                this.Fax   = supplier.Fax;
                //this.SelectedSalesman = supplier.Cus_Salesman;
                //this.SelectedCustomerType = supplier.Cus_Type;
                //this.SelectedCreditLimitDays = supplier.Cus_Credit_Limit_Days;
                //this.SelectedCreditLimitAmount = supplier.Cus_Credit_Limit_Amount;
                this.Telephone = supplier.Telephone;
                //this.SelectedDiscount = supplier.Discount;
                this.CreditLimitDays = supplier.CreditLimitDays;
                //this.CreditLimitAmount = Math.Round(Convert.ToDecimal(supplier.CreditLimitAmount), Convert.ToInt32(this.DecimalPlaces));
                this.CreditLimitAmount     = supplier.CreditLimitAmount;
                this.Supp_Reg_No           = supplier.Supp_Reg_No;
                this.Sup_Bill_to_city      = supplier.Sup_Bill_to_city;
                this.Sup_Bill_to_country   = supplier.Sup_Bill_to_country;
                this.Sup_Bill_to_line1     = supplier.Sup_Bill_to_line1;
                this.Sup_Bill_to_line2     = supplier.Sup_Bill_to_line2;
                this.Sup_Bill_to_post_code = supplier.Sup_Bill_to_post_code;
                this.Sup_Bill_to_state     = supplier.Sup_Bill_to_state;
                this.ShipAddressLine1      = supplier.ShipAddressLine1;
                this.ShipAddressLine2      = supplier.ShipAddressLine2;
                this.ShipCity          = supplier.ShipCity;
                this.ShipCountry       = supplier.ShipCountry;
                this.ShipState         = supplier.ShipState;
                this.ShipPostalCode    = supplier.ShipPostalCode;
                this.ContactPerson     = supplier.ContactPerson;
                this.GstRegistrationNo = supplier.GstRegistrationNo;
                this.Remarks           = supplier.Remarks;
                this.IsInActive        = supplier.IsInActive;
                this.ChangeSupplierGST = supplier.ChangeSupplierGST;
                this.Balance           = supplier.Balance;
                this.ID = supplier.ID;

                //this.IsInActive = supplier.IsInActive;
                if (supplier.ChangeSupplierGST == true)
                {
                    this.ChangeSupplierGSTTrue  = supplier.ChangeSupplierGST;
                    this.ChangeSupplierGSTFalse = false;
                }
                else
                {
                    this.ChangeSupplierGSTTrue  = false;
                    this.ChangeSupplierGSTFalse = true;
                }

                ///Disable Privous button
                var current = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

                int index = SearchSupplier.IndexOf(current);
                if (index - 1 <= 0)
                {
                    this.BackwardEnabled = false;
                    if (index >= SearchSupplier.Count - 1)
                    {
                        this.ForwardEnabled = false;
                    }
                    else
                    {
                        this.ForwardEnabled = true;
                    }
                }
                else
                {
                    this.BackwardEnabled = true;
                    if (index >= SearchSupplier.Count - 1)
                    {
                        this.ForwardEnabled = true;
                    }
                    else
                    {
                        this.ForwardEnabled = true;
                    }
                }
                ///disable next button
                var current1 = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

                int index1 = SearchSupplier.IndexOf(current);


                if (index1 >= SearchSupplier.Count - 1)
                {
                    this.ForwardEnabled = false;
                    if (index1 <= 0)
                    {
                        this.BackwardEnabled = false;
                    }
                    else
                    {
                        this.BackwardEnabled = true;
                    }
                }

                else
                {
                    this.ForwardEnabled = true;
                    if (index1 <= 0)
                    {
                        this.BackwardEnabled = false;
                    }
                    else
                    {
                        this.BackwardEnabled = true;
                    }
                }
            }
            else
            {
                this.ID            = 0;
                this.SupplierName  = string.Empty;
                this.Balance       = string.Empty;
                this.ContactPerson = string.Empty;
                //this.CreditLimitAmount = null as decimal?;
                this.CreditLimitAmount = string.Empty;
                this.ContactPerson     = string.Empty;

                this.CreditLimitDays        = string.Empty;
                this.Email                  = string.Empty;
                this.Fax                    = string.Empty;
                this.GstRegistrationNo      = string.Empty;
                this.IsInActive             = string.Empty;
                this.ShipAddressLine1       = string.Empty;
                this.ShipAddressLine2       = string.Empty;
                this.ShipCity               = string.Empty;
                this.ShipCountry            = string.Empty;
                this.ShipPostalCode         = string.Empty;
                this.ShipState              = string.Empty;
                this.Supp_Reg_No            = string.Empty;
                this.Sup_Bill_to_city       = string.Empty;
                this.Sup_Bill_to_country    = string.Empty;
                this.Sup_Bill_to_line1      = string.Empty;
                this.Sup_Bill_to_line2      = string.Empty;
                this.Sup_Bill_to_post_code  = string.Empty;
                this.Sup_Bill_to_state      = string.Empty;
                this.Telephone              = string.Empty;
                this.IsInActive             = "N";
                this.SelectedSearchSupplier = 0;
                this.SelectedTaxId          = 0;
            }
        }
Пример #18
0
 public SupplierController(FarmboekContext T)
 {
     supplierRepository = new SupplierRepository(T);
 }
Пример #19
0
 public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new SupplierRepository(ctx);
 }
Пример #20
0
 public void Start()
 {
     context_db = new FinalProjectDatabase();
     supRep = new SupplierRepository(context_db);
     ShowViewSupplierSelection();
 }
Пример #21
0
 public SupplierBusinessLogic()
 {
     _repository = new SupplierRepository();
 }
Пример #22
0
        public static void CreateContextForCreateOrderFromConsignmentTest(
            Guid jobId, Guid supplierId, Guid consignmentId, Guid jobItem1Id, Guid jobItem2Id, Guid jobItem3Id)
        {
            var dispatcher     = MockRepository.GenerateMock <IQueueDispatcher <IMessage> >();
            var userRepository = new UserAccountRepository();
            var user           = userRepository.GetByEmail("*****@*****.**", false);
            var userContext    = new TestUserContext(user);

            var consignmentRepository     = new ConsignmentRepository();
            var consignmentItemRepository = new ConsignmentItemRepository();
            var supplierRepository        = new SupplierRepository();
            var jobRepository             = new JobRepository();
            var jobItemRepository         = new JobItemRepository();
            var listItemRepository        = new ListItemRepository();
            var customerRepository        = new CustomerRepository();
            var entityIdProvider          = new DirectEntityIdProvider();
            var instrumentRepository      = new InstrumentRepository();

            var instrumentId      = Guid.NewGuid();
            var instrumentService = new InstrumentService(userContext, instrumentRepository, dispatcher);

            instrumentService.Create(instrumentId, "Druck", "DPI601IS", "None", "Digital Pressure Indicator", 15);

            var customerId      = Guid.NewGuid();
            var customerService = new CustomerService(userContext, customerRepository, dispatcher);

            customerService.Create(customerId, "Gael Ltd", String.Empty, new Address(), new ContactInfo(), "Gael Ltd", new Address(), new ContactInfo(), "Gael Ltd", new Address(), new ContactInfo());

            var supplierService = new SupplierService(userContext, supplierRepository, dispatcher);

            supplierService.Create(supplierId, "Supplier 1", new Address(), new ContactInfo(), new Address(), new ContactInfo());

            var listItemService = new ListItemService(userContext, listItemRepository, dispatcher);
            var jobService      = new JobService(userContext, null, jobRepository, listItemRepository, customerRepository, entityIdProvider, dispatcher);

            jobService.CreateJob(jobId, "some instructions", "order no", "advice no", listItemService.GetAllByCategory(ListItemCategoryType.JobType).First().Id, customerId, "notes", "contact");

            var jobItemService = new JobItemService(userContext, jobRepository, jobItemRepository, listItemService, instrumentService, dispatcher);

            jobItemService.CreateJobItem(
                jobId, jobItem1Id, instrumentId, "12345", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobItemService.CreateJobItem(
                jobId, jobItem2Id, instrumentId, "123456", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobItemService.CreateJobItem(
                jobId, jobItem3Id, instrumentId, "123457", String.Empty,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemInitialStatus).First().Id,
                listItemService.GetAllByCategory(ListItemCategoryType.JobItemCategory).First().Id,
                12, "instructions", String.Empty, false, String.Empty, String.Empty);
            jobService.ApproveJob(jobId);

            var consignmentItemService = new ConsignmentItemService(
                userContext,
                consignmentRepository, consignmentItemRepository, jobItemRepository, new ListItemRepository(), supplierRepository, dispatcher);
            var consignmentService = new ConsignmentService(userContext, consignmentRepository, supplierRepository, new DirectEntityIdProvider(), consignmentItemService, dispatcher);

            consignmentService.Create(consignmentId, supplierId);
            consignmentItemService.Create(Guid.NewGuid(), jobItem1Id, consignmentId, "some consignment instructions");
            consignmentItemService.Create(Guid.NewGuid(), jobItem2Id, consignmentId, "some consignment instructions");
            consignmentItemService.Create(Guid.NewGuid(), jobItem3Id, consignmentId, "some consignment instructions");
        }