예제 #1
0
        public List <SupplierOrderDTO> GetSupplierOrdersDTO(int SupplierID)
        {
            List <SupplierOrderDTO> result = new List <SupplierOrderDTO>();
            SupplierOrderDTO        dto;

            using (BadgerDataModel ctx = new BadgerDataModel())
            {
                // Get all the Suppliers Orders --
                var pOrders = ctx.PurchaseOrder.Where(p => p.SupplierId == SupplierID).ToList();

                foreach (var P in pOrders)
                {
                    dto = new SupplierOrderDTO();
                    dto.PurchaserName = P.Employee.Lastname;
                    if (P.Job != null)
                    {
                        dto.JobName = P.Job.Jobname;
                    }

                    dto.OrderDate     = P.OrderDate;
                    dto.OrderNum      = P.OrderNum;
                    dto.Received      = P.Recieved;
                    dto.SupplierName  = P.Supplier.SupplierName;
                    dto.ReceiveStatus = "none";
                    result.Add(dto);
                }
            }

            return(result);
        }
        public InventoryLookupItem(Inventory inventory, BadgerDataModel ctx)
        {
            if (inventory == null)
            {
                return;
            }
            _context        = ctx;
            jobService      = new JobsService(_context);
            orderService    = new OrdersService(_context);
            recieptService  = new OrderRecieptService(_context);
            employeeService = new EmployeeService(_context);

            po = orderService.GetOrderByID(recieptService.GetOrderReciept
                                               (inventory.OrderReceiptID.Value).OrderNum.Value);
            job = jobService.Find(inventory.JobId.Value);

            receipt = recieptService.GetOrderReciept(inventory.OrderReceiptID.Value);
            emp     = employeeService.Find(receipt.EmployeeId.Value);

            orderNum        = po.OrderNum.ToString();
            orderDate       = po.OrderDate.Value.ToShortDateString();
            jobName         = job.Jobname.ToString();
            quantity        = inventory.Qnty.ToString();
            unitCost        = "0.0";
            itemDescription = inventory.Description;
            supplierName    = po.Supplier.SupplierName.ToString();
            receivedDate    = receipt.ReceiptDate.Value.ToShortDateString();
            receivedBy      = emp.Firstname + " " + emp.Lastname;
            orderedBy       = po.Employee.Firstname.ToString() + " " + po.Employee.Lastname.ToString();
        }
예제 #3
0
 public void SetContext(BadgerDataModel context)
 {
     ctx                      = context;
     _partService             = new PartsService(ctx);
     tvPartTypes.AfterSelect += TvPartTypes_AfterSelect;
     LoadTree();
 }
예제 #4
0
        public OrderEditControl()
        {
            InitializeComponent();
            _context      = new BadgerDataModel();
            _orderService = new OrdersService(_context);
            _partService  = new PartsService(_context);
            //disable AutoGenerate Columns on grids
            dgOrderLineItem.AutoGenerateColumns = false;
            dgOrderFees.AutoGenerateColumns     = false;
            dgAttachments.AutoGenerateColumns   = false;
            // Event wiring -------------------------------------------------------------------
            dgOrderLineItem.DataError         += DgOrderLineItem_DataError;
            dgOrderLineItem.CellValidating    += DgOrderLineItem_CellValidating;
            dgOrderLineItem.CellEndEdit       += DgOrderLineItem_CellEndEdit;
            dgOrderLineItem.CellValueChanged  += DgOrderLineItem_CellValueChanged;
            bslineItems.ListChanged           += BslineItems_ListChanged;
            bsOrderFees.ListChanged           += BsOrderFees_ListChanged;
            bsAttachments.ListChanged         += BsAttachments_ListChanged;
            partFinderControl1.OnJobPartAdded += PartFinderControl1_OnJobPartAdded;
            partFinderControl1.OnPartAdded    += PartFinderControl1_OnPartAdded;
            // Event Wiring -------------------------------------------------------------------

            InitializeGrid();
            btnSave.Enabled = _isDirty;
        }
예제 #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username = txtUserName.Text;
            string password = txtPassWord.Text;

            using (_context = new BadgerDataModel())
            {
                _employeeService = new EmployeeService(_context);

                var user = _context.Employee.Where(c => c.Login == username).FirstOrDefault();
                if (user != null)
                {
                    if (password == user.Password)
                    {
                        this.DialogResult           = System.Windows.Forms.DialogResult.OK;
                        isValidated                 = true;
                        this._employeeID            = user.EmployeeId;
                        Globals.CurrentLoggedUserID = user.EmployeeId;
                        Globals.CurrentUserName     = _employeeService.FullName(user.EmployeeId);
                    }
                    else
                    {
                        isValidated = false;
                        txtPassWord.Clear();
                    }
                }
                else
                {
                    txtUserName.Clear();
                    txtPassWord.Clear();
                    txtUserName.Focus();
                }
            }
        }
예제 #6
0
        public NewOrderDialog(BadgerDataModel context)
        {
            InitializeComponent();
            _context                  = context;
            _jobService               = new JobsService(_context);
            _supplierService          = new SuppliersService(context);
            tbSupplier.Validated     += TbSupplier_Validated;
            tbJobSelection.Validated += TbJobSelection_Validated;

            AutoCompleteStringCollection jobNames = new AutoCompleteStringCollection();

            foreach (var item in _jobService.All())
            {
                jobNames.Add(item.JobName);
            }
            this.tbJobSelection.AutoCompleteMode    = AutoCompleteMode.Suggest;
            this.tbJobSelection.AutoCompleteSource  = AutoCompleteSource.CustomSource;
            tbJobSelection.AutoCompleteCustomSource = jobNames;

            AutoCompleteStringCollection supplierNames = new AutoCompleteStringCollection();

            foreach (var item in _supplierService.GetAll())
            {
                supplierNames.Add(item.SupplierName);
            }
            this.tbSupplier.AutoCompleteMode    = AutoCompleteMode.Suggest;
            this.tbSupplier.AutoCompleteSource  = AutoCompleteSource.CustomSource;
            tbSupplier.AutoCompleteCustomSource = supplierNames;
            CheckState();
        }
 public OrderEditSplitPanelControl(BadgerDataModel context, BindingSource BSorder)
 {
     InitializeComponent();
     ctx      = context;
     orderDTO = (OrderDetailDto)BSorder.DataSource;
     this.orderHeaderVerticalControl1.OnSaveHandler  += OrderHeaderVerticalControl1_OnSaveHandler;
     this.orderHeaderVerticalControl1.OnPrintHandler += OrderHeaderVerticalControl1_OnPrintHandler;
 }
 public OrderReceiptControl(OrderReciept receipt, BadgerDataModel ctx)
 {
     InitializeComponent();
     this._context = ctx;
     _receipt      = receipt;
     jService      = new JobsService(ctx);
     oService      = new OrdersService(ctx);
 }
예제 #9
0
 public SupplierEditForm(int supplierID)
 {
     InitializeComponent();
     ctx = new BadgerDataModel();
     _supplierService = new SuppliersService(ctx);
     _supplierToEdit  = _supplierService.Find(supplierID);
     BindText();
 }
예제 #10
0
 public PartEditor(BadgerDataModel ctx)
 {
     InitializeComponent();
     dgPartsList.AutoGenerateColumns = false;
     _context     = ctx;
     partsService = new PartsService(_context);
     labelService = new LabelService();
     dgResources.AutoGenerateColumns = false;
 }
예제 #11
0
 public AssemblyManagerControl(BadgerDataModel context)
 {
     InitializeComponent();
     _context             = context;
     productionRepository = new ProductionRepository(_context);
     jobsService          = new JobsService(_context);
     // testing only
     _selectedJob = jobsService.Find(1172);
 }
예제 #12
0
 public Main()
 {
     InitializeComponent();
     // This should be the main contect wireup for everything else
     _context       = new BadgerDataModel();
     _ordersService = new OrdersService(_context);
     MainTabs       = MainTabControl;
     Mediator.GetInstance().OrderOpen += Main_OrderOpen;
 }
예제 #13
0
        public OrderManager(BadgerDataModel context)
        {
            InitializeComponent();
            ctx = context;

            ordersService   = new OrdersService(ctx);
            supplierService = new SuppliersService(ctx);
            jobsService     = new JobsService(ctx);
            dgOrders.AutoGenerateColumns = false;
        }
예제 #14
0
        //BindingSource BSorder = new BindingSource();

        //OrderDetailDto orderDTO = new OrderDetailDto();
        //OrdersService _orderService;

        public Harness()
        {
            InitializeComponent();
            ctx = new BadgerDataModel();

            PartResourceEditorControl ctr = new PartResourceEditorControl();

            this.Controls.Add(ctr);
            ctr.SetDataSource(ctx, 7991);
        }
예제 #15
0
            public void Get_All_Job_list()
            {
                var ctx = new BadgerDataModel();


                JobsService service = new JobsService(ctx);

                var jobs = service.All();

                Assert.IsTrue(jobs.Count > 100);
            }
예제 #16
0
 //cTor
 public ClaimControl(int claimID, BadgerDataModel context)
 {
     InitializeComponent();
     _ctx             = context;
     _claimService    = new ClaimService(_ctx);
     _employeeService = new EmployeeService(_ctx);
     _claim           = _claimService.Find(claimID);
     bsClaimBindingSource.DataSource = _claim;
     ///TODO need claim child navigation added to claim class
     // bsClaimItemBindingSource.DataSource = _claim.ClaimItems;
 }
 public JobOrdersControl(BadgerDataModel ctx)
 {
     InitializeComponent();
     _context = ctx;
     dgJobOrders.AutoGenerateColumns     = false;
     dgJobOrderItems.AutoGenerateColumns = false;
     _jobService  = new JobsService(_context);
     _lineService = new LineItemsService(_context);
     // Use last entered search term ---
     txtJobNameSearch.Text = (InventoryFerret.Properties.Settings.Default.LastJobSearch != String.Empty)?
                             Properties.Settings.Default.LastJobSearch : string.Empty;
 }
예제 #18
0
 public DataForm()
 {
     InitializeComponent();
     ctx = new BadgerDataModel();
     _selectedMeasure = new UnitOfMeasure {
         UID = 1, Uom = "Each"
     };
     _partService   = new PartsService(ctx);
     _ordersService = new OrdersService(ctx);
     bsLineItems    = new BindingSource();
     this.Size      = new Size(800, 450);
 }
예제 #19
0
 public MyOrdersControl(BadgerDataModel context, int employeeID)
 {
     InitializeComponent();
     ctx              = context;
     _employeeID      = employeeID;
     _ordersService   = new OrdersService(ctx);
     _employeeService = new EmployeeService(ctx);
     //---
     dgMyOrdersGrid.AutoGenerateColumns = false;
     //---
     dgMyOrdersGrid.CellFormatting += DgMyOrdersGrid_CellFormatting;
 }
예제 #20
0
        /// <summary>
        /// TODO  use PartID and DTO to hydrate the control
        /// </summary>
        /// <param name="part"></param>
        /// <param name="ctx"></param>
        public PartView(Part part, BadgerDataModel ctx)
        {
            InitializeComponent();
            _context = ctx;
            ISuppliersService var = new SuppliersService(_context);

            inventoryService = new InventoryService(_context);
            partsService     = new PartsService(_context);
            this.dataGridView1.AutoGenerateColumns   = false;
            this.dgvTransactions.AutoGenerateColumns = false;
            if (part.PartID > 0)
            {
                _part = partsService.Find(part.PartID);
            }
            else
            {
                _part           = partsService.New();
                _part.AddedBy   = Globals.CurrentUserName;
                _part.DateAdded = DateTime.Today;
            }
            cboSuppliers.DisplayMember = "SupplierName";
            cboSuppliers.ValueMember   = "SupplierID";
            cboSuppliers.SelectedItem  = _part.SupplierId;
            cboSuppliers.DataSource    = var.GetAll();

            cboUnits.DisplayMember = "UOM";
            cboUnits.ValueMember   = "UID";
            cboUnits.SelectedItem  = _part.UID;
            cboUnits.DataSource    = partsService.Units();

            cboManus.DisplayMember = "Manufacturer";
            cboManus.ValueMember   = "ManuID";
            cboManus.SelectedItem  = _part.ManuId;
            cboManus.DataSource    = partsService.Manufacturers();


            bsPart.DataSource = _part;

            // This triggers the Save Button On changed--
            bsPart.CurrentItemChanged += BsPart_CurrentItemChanged;

            this.btnSave.Enabled         = _isDirty;
            this.txtSupplierDesc.Enabled = false;
            _documents = _context.Document.Where(r => r.PartID == _part.PartID).ToList();
            // _documents = _part.Document.ToList();
            bsDocuments.DataSource        = _documents;
            this.dataGridView1.DataSource = bsDocuments;

            LoadTransaction();

            this.rbRecieved.Checked = true;
        }
예제 #21
0
        public OrderReceiptsControl(BadgerDataModel Context)
        {
            InitializeComponent();
            dgRecieptItems.AutoGenerateColumns = false;

            context          = Context;
            ordersService    = new OrderRecieptService(context);
            suppliersService = new SuppliersService(context);
            jobsService      = new JobsService(context);
            inventoryService = new InventoryService(context);
            poService        = new OrdersService(context);
            empService       = new EmployeeService(context);
        }
 public ClaimDetailControl(BadgerDataModel context)
 {
     InitializeComponent();
     _ctx          = context;
     supService    = new SuppliersService(_ctx);
     ordersService = new OrdersService(_ctx);
     claimService  = new ClaimService(_ctx);
     dgSupplierOrders.AutoGenerateColumns = false;
     bsLineItems.DataSource               = supplierOrders;
     dgSupplierOrders.DataSource          = bsLineItems;
     dgSupplierClaims.AutoGenerateColumns = false;
     tbSupplierSearch.Text = Properties.Settings.Default.LastSupplierSearch;
 }
예제 #23
0
        public static void RecieveOrder(PurchaseOrder order, BadgerDataModel ctx)
        {
            OrderReciept receipt = new OrderReciept();

            receipt.OrderNum    = order.OrderNum;
            receipt.ReceiptDate = DateTime.Today;
            receipt.EmployeeId  = 8;
            ctx.OrderReciept.Add(receipt);
            ctx.SaveChanges();

            foreach (PurchaseLineItem item in order.PurchaseLineItem)
            {
                Inventory inv = new Inventory();

                inv.OrderReceiptID = receipt.OrderReceiptId;
                inv.LineID         = item.LineID;
                if (item.PartID.HasValue)
                {
                    inv.PartID = item.PartID.Value;
                }
                inv.JobId     = item.PurchaseOrderId.Value;
                inv.DateStamp = DateTime.Today;
                if (item.AmountReceived.HasValue)
                {
                    inv.Qnty = item.AmountReceived.Value;
                }
                //inv.Note = item.N
                inv.Description = item.Description.ToString();
                if (inv.UnitOfMeasure.HasValue)
                {
                    inv.UnitOfMeasure = item.Uom;
                }
                receipt.Inventory.Add(inv);
            }

            order.Recieved     = true;
            order.RecievedDate = DateTime.Today;
            ctx.SaveChanges();

            //// Push the new Order Receipt to The New Tab
            //MainFrm f = (MainFrm)Application.OpenForms["MainFrm"];
            //TabControl.TabPageCollection col = f.tabMain.TabPages;

            //TabPage orderReceiptPage = new TabPage();
            //orderReceiptPage.Text = "Order Receipt -> " + receipt.OrderReceiptID.ToString();
            //OrderReceiptControl control = new OrderReceiptControl(receipt,ctx);
            //control.Dock = DockStyle.Fill;
            //orderReceiptPage.Controls.Add(control);
            //col.Add(orderReceiptPage);
            //f.tabMain.SelectedTab = orderReceiptPage;
        }
예제 #24
0
        public void Orders_OrdersFee_ShouldSaveNewOrderFee()
        {
            var      ctx      = new BadgerDataModel();
            OrderFee orderFee = new OrderFee();

            //orderFee.PurchaseOrderID = 23415;
            orderFee.FeeName   = "Big Fat Fee";
            orderFee.Cost      = 1.25m;
            orderFee.Qnty      = 5.0m;
            orderFee.Extension = decimal.Add(orderFee.Cost.Value, orderFee.Qnty.Value);
            ctx.OrderFee.Add(orderFee);

            ctx.SaveChanges();
            Assert.IsTrue(orderFee.OrderfeeID != default);
        }
예제 #25
0
        private void Main_Load(object sender, EventArgs e)
        {
            closeImage       = Properties.Resources.baseline_close_black_18dp;
            MainTabs.Padding = new System.Drawing.Point(26, 4);

            this.toolStripStatusLabel1.Text = "UserID=" + _loggedOnUserID.ToString();
            _context = new BadgerDataModel();

            var emp = _context.Employee.Where(p => p.EmployeeId == LoggedOnUserID).FirstOrDefault();

            this.toolStripStatusLabel1.Text = "User= "******" " + emp.Lastname;
            TabPage myOrdersTab = PageFactory.GetNewTabPage(_context, PageFactory.TabPageType.MyOrdersPage);

            myOrdersTab.Name = "myOrdersTab";
            MainTabControl.TabPages.Add(myOrdersTab);
        }
예제 #26
0
        public void SetDataSource(BadgerDataModel context, int partID)
        {
            ctx         = context;
            partService = new PartsService(ctx);
            units       = partService.Units();
            // Load the Unit Combo ----
            cboUnitOfMeasure.DisplayMember = "Uom";
            cboUnitOfMeasure.ValueMember   = "UID";
            cboUnitOfMeasure.DataSource    = units;

            loadData(7991);

            bsPart.ListChanged      += BsPart_ListChanged;
            bsResources.ListChanged += BsResources_ListChanged;

            BindPart();
        }
        // Main preferred control datasource --
        public void SetDataSource(BadgerDataModel context, int orderID)
        {
            // reference the context object
            ctx = context;
            // create a new DTO to hold the order
            orderDTO      = new OrderDetailDto();
            _orderService = new OrdersService(ctx);
            // Init the mapper

            // Retrieve to PurchaseOrder Entity
            _purchaseOrder = _orderService.GetOrderByID(orderID);

            if (_purchaseOrder != null)
            {
                // Map to the DTO detached data transfer object
                mapper.Map(_purchaseOrder, orderDTO);
                // wire a BindingSource for the order binding
                bsOrder.DataSource = orderDTO;
                // Bind line items to the grid
                bsLineitems.DataSource = orderDTO.LineItems;
                BindLineItemsToGrid(bsLineitems);
                bsOrderFees.DataSource   = orderDTO.OrderFees;
                bsAttachments.DataSource = orderDTO.Attachments;
            }

            // Event wiring -------------------------------------------------------------------

            // dgOrderLineItem.DataError += DgOrderLineItem_DataError;
            dgOrderLineItem.CellValidating   += DgOrderLineItem_CellValidating;
            dgOrderLineItem.CellEndEdit      += DgOrderLineItem_CellEndEdit;
            dgOrderLineItem.CellValueChanged += DgOrderLineItem_CellValueChanged;
            bsLineitems.ListChanged          += BslineItems_ListChanged;


            bsOrder.ListChanged       += BsOrder_ListChanged;
            bsOrderFees.ListChanged   += BsOrderFees_ListChanged;;
            bsAttachments.ListChanged += BsAttachments_ListChanged;

            // Event Wiring -------------------------------------------------------------------

            // start with the PartFinder
            //    partFinderControl
            //         .LoadDatasource(ctx, orderDTO.SupplierID);
            orderHeaderVerticalControl1.LoadDataSource(bsOrder);
        }
예제 #28
0
        public void Resource_Add_ResourceVersion()
        {
            var ctx = new BadgerDataModel();


            ResourceVersion _version = new ResourceVersion();

            _version.ResourceID     = 5;
            _version.RVersion       = 1;
            _version.VersionComment = "Revised for some reason";
            _version.ModifiedBy     = "dick";
            _version.ModDate        = DateTime.Today;

            ctx.ResourceVersion.Add(_version);


            ctx.SaveChanges();
            Assert.IsTrue(_version.ResourceVersionID != default);
        }
예제 #29
0
 private void OpenPartDetails(int PartID, BadgerDataModel ctx)
 {
     if (PartID != 0)
     {
         Main    main    = (Main)Application.OpenForms["Main"];
         var     tabs    = main.MainTabControl.TabPages;
         TabPage newPage = PageFactory.GetNewTabPage(_context, PageFactory.TabPageType.PartDetailEdit, PartID);
         tabs.Add(newPage);
         main.MainTabControl.SelectTab(newPage);
     }
     //The part is new/added
     else
     {
         Main    main    = (Main)Application.OpenForms["Main"];
         var     tabs    = main.MainTabControl.TabPages;
         TabPage newPage = PageFactory.GetNewTabPage(_context, PageFactory.TabPageType.PartDetailEdit, PartID);
         tabs.Add(newPage);
         main.MainTabControl.SelectTab(newPage);
     }
 }
예제 #30
0
        /// <summary>
        /// Create a new Claim Document
        /// </summary>
        /// <param name="OrderNum"></param>
        /// <returns>Claim</returns>
        public Claim NewClaim(int OrderNum, int Employee)
        {
            Claim _claim = null;

            if (OrderNum > 0)
            {
                _claim            = new Claim();
                _claim.ClaimDate  = DateTime.Today;
                _claim.OrderNum   = OrderNum;
                _claim.EmployeeId = Employee;

                using (_ctx = new BadgerDataModel())
                {
                    var po = _ctx.PurchaseOrder.Where(p => p.OrderNum == OrderNum).First();
                    _claim.SupplierId = po.SupplierId.Value;
                    _ctx.Claim.Add(_claim);
                    _ctx.SaveChanges();
                    int claimID  = _claim.ClaimId;
                    var lineitem = po.PurchaseLineItem.ToList();

                    foreach (PurchaseLineItem l in lineitem)
                    {
                        ClaimItem cItem = new ClaimItem();
                        cItem.ClaimId = claimID;

                        cItem.LineID          = l.LineID;
                        cItem.PartID          = l.PartID;
                        cItem.Bcode           = l.Bcode;
                        cItem.Description     = l.Description;
                        cItem.TransActionType = 1;
                        _ctx.ClaimItem.Add(cItem);
                    }

                    _ctx.SaveChanges();
                }
            }
            return(_claim);
        }