Exemple #1
0
        private void dgwRequestList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            AddProductionRequest addProductionRequest = new AddProductionRequest();
            DataGridViewRow      currentRow           = dgwRequestList.Rows[e.RowIndex];

            int id = ObjectHelper.GetValueFromAnonymousType <int>(currentRow.DataBoundItem, "Id");

            addProductionRequest.loadDataForEditProductRequest(id);

            addProductionRequest.CallFromUserControll = this;
            addProductionRequest.ShowDialog();
        }
        private void dgwStockEntranceList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (modeReport == 1)
            {
                DataGridViewRow currentRow = dgwStockEntranceList.Rows[e.RowIndex];
                string          RecordCode = ObjectHelper.GetValueFromAnonymousType <string>(currentRow.DataBoundItem, "RecordCode");
                string          prefix     = RecordCode.Substring(0, 2);
                switch (prefix)
                {
                case BHConstant.PREFIX_FOR_ORDER:
                {
                    OrderService orderService = new OrderService();
                    Order        order        = orderService.GetOrders().Where(o => o.OrderCode == RecordCode).FirstOrDefault();
                    if (order != null)
                    {
                        AddOrder frmAddOrder = new AddOrder();
                        frmAddOrder.loadDataForEditOrder(order.Id);

                        frmAddOrder.CallFromUserControll = this;
                        frmAddOrder.ShowDialog();
                    }
                } break;

                case BHConstant.PREFIX_FOR_ENTRANCE:
                {
                    EntranceStockService stockService = new EntranceStockService();
                    EntranceStock        stock        = stockService.GetEntranceStocks().Where(r => r.EntranceCode == RecordCode).FirstOrDefault();
                    if (stock != null)
                    {
                        AddEntranceStock frmAddEntranceStock = new AddEntranceStock();
                        frmAddEntranceStock.loadDataForEditEntranceStock(stock.Id);

                        frmAddEntranceStock.CallFromUserControll = this;
                        frmAddEntranceStock.ShowDialog();
                    }
                } break;

                case BHConstant.PREFIX_FOR_PRODUCTION:
                {
                    ProductionRequestService requestService = new ProductionRequestService();
                    ProductionRequest        request        = requestService.GetProductionRequests().Where(r => r.ReqCode == RecordCode).FirstOrDefault();
                    if (request != null)
                    {
                        AddProductionRequest addProductionRequest = new AddProductionRequest();
                        addProductionRequest.loadDataForEditProductRequest(request.Id);

                        addProductionRequest.CallFromUserControll = this;
                        addProductionRequest.ShowDialog();
                    }
                } break;
                }
            }
        }
        private void dgwRequestList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            AddProductionRequest addProductionRequest = new AddProductionRequest();
            DataGridViewRow currentRow = dgwRequestList.Rows[e.RowIndex];

            int id = ObjectHelper.GetValueFromAnonymousType<int>(currentRow.DataBoundItem, "Id");
            addProductionRequest.loadDataForEditProductRequest(id);

            addProductionRequest.CallFromUserControll = this;
            addProductionRequest.ShowDialog();
        }
        private void dgwStockEntranceList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (modeReport == 1)
            {
                DataGridViewRow currentRow = dgwStockEntranceList.Rows[e.RowIndex];
                string RecordCode = ObjectHelper.GetValueFromAnonymousType<string>(currentRow.DataBoundItem, "RecordCode");
                string prefix = RecordCode.Substring(0, 2);
                switch (prefix)
                {
                    case BHConstant.PREFIX_FOR_ORDER:
                        {
                            OrderService orderService = new OrderService();
                            Order order = orderService.GetOrders().Where(o => o.OrderCode == RecordCode).FirstOrDefault();
                            if (order != null)
                            {
                                AddOrder frmAddOrder = new AddOrder();
                                frmAddOrder.loadDataForEditOrder(order.Id);

                                frmAddOrder.CallFromUserControll = this;
                                frmAddOrder.ShowDialog();
                            }
                        } break;
                    case BHConstant.PREFIX_FOR_ENTRANCE:
                        {
                            EntranceStockService stockService = new EntranceStockService();
                            EntranceStock stock = stockService.GetEntranceStocks().Where(r => r.EntranceCode == RecordCode).FirstOrDefault();
                            if (stock != null)
                            {
                                AddEntranceStock frmAddEntranceStock = new AddEntranceStock();
                                frmAddEntranceStock.loadDataForEditEntranceStock(stock.Id);

                                frmAddEntranceStock.CallFromUserControll = this;
                                frmAddEntranceStock.ShowDialog();
                            }
                        } break;
                    case BHConstant.PREFIX_FOR_PRODUCTION:
                        {
                            ProductionRequestService requestService = new ProductionRequestService();
                            ProductionRequest request = requestService.GetProductionRequests().Where(r => r.ReqCode == RecordCode).FirstOrDefault();
                            if (request != null)
                            {
                                AddProductionRequest addProductionRequest = new AddProductionRequest();
                                addProductionRequest.loadDataForEditProductRequest(request.Id);

                                addProductionRequest.CallFromUserControll = this;
                                addProductionRequest.ShowDialog();
                            }
                        } break;
                }
            }
        }