Ejemplo n.º 1
0
    protected void OnRunReferenceItemDialog(object sender, Reference.RunReferenceItemDlgEventArgs e)
    {
        ResponseType Result;
        switch (e.TableName) {
        case "meter_types":
            MeterType MeterTypeEdit = new MeterType (e.NewItem);
            if (!e.NewItem)
                MeterTypeEdit.Fill (e.ItemId);
            MeterTypeEdit.Show ();
            Result = (ResponseType)MeterTypeEdit.Run ();
            MeterTypeEdit.Destroy ();
            break;
        case "contact_persons":
            Contact ContactEdit = new Contact ();
            ContactEdit.NewContact = e.NewItem;
            if (!e.NewItem)
                ContactEdit.ContactFill (e.ItemId);
            ContactEdit.Show ();
            Result = (ResponseType)ContactEdit.Run ();
            ContactEdit.Destroy ();
            break;
        case "lessees":
            lessee LesseeEdit = new lessee ();
            LesseeEdit.NewLessee = e.NewItem;
            if (!e.NewItem)
                LesseeEdit.LesseeFill (e.ItemId);
            LesseeEdit.Show ();
            Result = (ResponseType)LesseeEdit.Run ();
            LesseeEdit.Destroy ();
            break;
        case "services":
            Service ServiceEdit = new Service ();
            ServiceEdit.NewService = e.NewItem;
            if (!e.NewItem)
                ServiceEdit.ServiceFill (e.ItemId);
            ServiceEdit.Show ();
            Result = (ResponseType)ServiceEdit.Run ();
            ServiceEdit.Destroy ();
            break;
        case "cash":
            Cash CashEdit = new Cash ();
            CashEdit.NewItem = e.NewItem;
            if (!e.NewItem)
                CashEdit.Fill (e.ItemId);
            CashEdit.Show ();
            Result = (ResponseType)CashEdit.Run ();
            CashEdit.Destroy ();
            break;

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