Ejemplo n.º 1
0
    protected void OnRunReferenceItemDialog(object sender, Reference.RunReferenceItemDlgEventArgs e)
    {
        ResponseType Result;
        switch (e.TableName)
        {
            case "models":
                CarModel ItemModel = new CarModel();
                if(e.NewItem)
                    ItemModel.NewItem = true;
                else
                    ItemModel.Fill(e.ItemId);
                ItemModel.Show();
                Result = (ResponseType)ItemModel.Run();
                ItemModel.Destroy();
                break;
            case "status":
                Status StatusEdit = new Status();
                if(e.NewItem)
                    StatusEdit.NewItem = true;
                else
                    StatusEdit.Fill(e.ItemId);
                StatusEdit.Show();
                Result = (ResponseType)StatusEdit.Run();
                StatusEdit.Destroy();
                break;
            case "services":
                Service ServiceEdit = new Service();
                if(e.NewItem)
                    ServiceEdit.NewItem = true;
                else
                    ServiceEdit.Fill(e.ItemId);
                ServiceEdit.Show();
                Result = (ResponseType)ServiceEdit.Run();
                ServiceEdit.Destroy();
                break;
            case "stocks":
                OrderStock StocksEdit = new OrderStock();
                if(e.NewItem)
                    StocksEdit.NewItem = true;
                else
                    StocksEdit.Fill(e.ItemId);
                StocksEdit.Show();
                Result = (ResponseType)StocksEdit.Run();
                StocksEdit.Destroy();
                break;

            default:
                Result = ResponseType.None;
                break;
        }
        e.Result = Result;
    }