Exemple #1
0
        public static void init()
        {
            QuoteLineItemEditorViewModel vm = new QuoteLineItemEditorViewModel();

            List <Column> columns = new List <Column>();

            GridDataViewBinder.AddEditIndicatorColumn(columns);


            XrmNumberEditor.BindReadOnlyColumn(
                GridDataViewBinder.AddColumn(columns, "#", 40, "lineitemnumber"),
                0);

            XrmLookupEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, "Existing Product", 200, "productid"),
                vm.ProductSearchCommand, "productid", "name", "");

            XrmLookupEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, "Units", 100, "uomid"),
                vm.UoMSearchCommand, "uomid", "name", "");

            XrmTextEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, "Write-In Product", 200, "productdescription"));

            XrmMoneyEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, "Price Per Unit", 200, "priceperunit"),
                0,
                1000);

            XrmNumberEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, "Quantity", 200, "quantity"),
                0,
                1000,
                2);

            XrmMoneyEditor.BindReadOnlyColumn(
                GridDataViewBinder.AddColumn(columns, "Extended Amount", 100, "extendedamount"));


            GridDataViewBinder contactGridDataBinder = new GridDataViewBinder();
            Grid contactsGrid = contactGridDataBinder.DataBindXrmGrid(vm.Lines, columns, "quoteproductGrid", "quoteproductPager", true, true);

            contactGridDataBinder.BindCommitEdit(vm);

            ViewBase.RegisterViewModel(vm);
            Window.SetTimeout(delegate()
            {
                vm.Lines.Refresh();
            }, 0);
        }
        public static void Init()
        {
            vm = new ContactViewModel();

            List <Column> columns = new List <Column>();

            GridDataViewBinder.AddEditIndicatorColumn(columns);

            //Creacion de columnas para el grid
            XrmTextEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, ResourceStrings.FirstName, 200, "firstname"));
            XrmTextEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, ResourceStrings.LastName, 200, "lastname"));

            XrmOptionSetEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, ResourceStrings.PreferredContactType, 200, "preferredcontactmethodcode"), "contact", "preferredcontactmethodcode", false);

            XrmMoneyEditor.BindColumn(
                GridDataViewBinder.AddColumn(columns, ResourceStrings.CreditLimit, 200, "creditlimit"), -1000, 100000000);

            //Montar grid
            GridDataViewBinder contactGridDataBinder = new GridDataViewBinder();
            Grid contactsGrid = contactGridDataBinder.DataBindXrmGrid(vm.Contacts, columns, "container", "pager", true, false);

            contactGridDataBinder.BindCommitEdit(vm);

            contactGridDataBinder.BindClickHandler(contactsGrid);

            ViewBase.RegisterViewModel(vm);
            Window.SetTimeout(delegate()
            {
                vm.Search();
                vm.Contacts.Refresh();
            }, 0);


            /*CAMBIO DE IDIOMA A TRAVES DE JAVASCRIPT*/
            //int lcid = OrganizationServiceProxy.GetUserSettings().UILanguageId.Value;

            //LocalisedContentLoader.LoadContent("fmp_/js/Res.metadata.js", lcid, delegate ()
            //{

            //    ViewBase.RegisterViewModel(vm);
            //});
        }