Exemplo n.º 1
0
        //switch (e.get_data().ToString().ToLower()) {
        //    case "lepeso":
        //        if (bsoItemTrans.BSOItemTransactionDetail != null) {
        //            bsoItemTrans.BSOItemTransactionDetail.HandleItemDetail("9.99", TransDocFieldIDEnum.fldQuantity);

        //            e.result.Success = true;
        //            e.result.ResultMessage = string.Empty;
        //        }
        //        else {
        //            e.result.Success = false;
        //            e.result.ResultMessage = "Não foi posivel obter o controlador da linha (BSOItemTransactionDetail)";
        //        }
        //        break;
        //}
        //}

        #endregion


        /// <summary>
        /// EXEMPLO DE VALIDAÇÃO NA LINHA
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void DetailEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList  properties            = (ExtendedPropertyList)e.get_data();
            ItemTransactionDetail itemTransactionDetail = (ItemTransactionDetail)properties.get_Value("Data");
            string errorMessage = string.Empty;

            //Navigate home
            bsoItemTrans.ExecuteFunction("GOTOPAGE", "-1");

            //TODO:
            //Insert line handling code HERE
            //------------------------------
            //if (itemTransactionDetail.UnitOfSaleID.Equals("kg", StringComparison.CurrentCultureIgnoreCase)) {
            //    itemTransactionDetail.Quantity = 9.99;
            //}
            //------------------------------

            //if (itemTransactionDetail.Quantity > 100) {
            //    e.result.Success = false;
            //    e.result.R    esultMessage = string.Format("Atenção! Quantidade {0} superior ao permitido", itemTransactionDetail.Quantity);
            //}
            //else {
            //    e.result.Success = true;
            //    e.result.ResultMessage = string.Empty;
            //}

            //// Uncomment to force a taxable group. In this case, it is necessary to recalculate all the detail
            //itemTransactionDetail.TaxableGroupID = 3;
            //bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);

            properties            = null;
            itemTransactionDetail = null;
        }
        //switch (e.get_data().ToString().ToLower()) {
        //    case "lepeso":
        //        if (bsoItemTrans.BSOItemTransactionDetail != null) {
        //            bsoItemTrans.BSOItemTransactionDetail.HandleItemDetail("9.99", TransDocFieldIDEnum.fldQuantity);

        //            e.result.Success = true;
        //            e.result.ResultMessage = string.Empty;
        //        }
        //        else {
        //            e.result.Success = false;
        //            e.result.ResultMessage = "Não foi posivel obter o controlador da linha (BSOItemTransactionDetail)";
        //        }
        //        break;
        //}
        //}

        #endregion


        /// <summary>
        /// EXEMPLO DE VALIDAÇÃO NA LINHA   
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        void DetailEvents_OnValidating(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = (ExtendedPropertyList)e.get_data();
            ItemTransactionDetail itemTransactionDetail = (ItemTransactionDetail)properties.get_Value("Data");
            string errorMessage = string.Empty;

            var mainProvider = MyApp.DataManager.MainProvider;
            double priceWithDiscount = 0;

            try
            {
                string query = string.Format("Select PriceWithDiscount from UXDiscounColorAndSize Where ItemID='{0}' and SizeId={1} and ColorID={2}",
                                            itemTransactionDetail.ItemID, itemTransactionDetail.Size.SizeID, itemTransactionDetail.Color.ColorID);
                priceWithDiscount = Convert.ToDouble(mainProvider.ExecuteScalar(query));
            }
            catch (Exception ex)
            {
                string tableToCreateInSQL = string.Format("CREATE TABLE [dbo].[UXDiscounColorAndSize]([ItemID] [nvarchar](25) NOT NULL, [SizeID] [int] NOT NULL, [ColorID] [int] NOT NULL, [PriceWithDiscount] [float] NOT NULL ) ON [PRIMARY]", Environment.NewLine);
                MessageBox.Show(String.Format("{0}{1}{1}{1}Crie uma tabela no SQL com a seguinte informação:{1}{1}{2}", ex.Message.ToString(), Environment.NewLine, tableToCreateInSQL), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                priceWithDiscount = 0;
            }

            if (priceWithDiscount != 0)
            {
                itemTransactionDetail.TaxIncludedPrice = priceWithDiscount;
                bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);
            }


            //TODO:
            //Insert line handling code HERE
            //------------------------------
            //if (itemTransactionDetail.UnitOfSaleID.Equals("kg", StringComparison.CurrentCultureIgnoreCase)) {
            //    itemTransactionDetail.Quantity = 9.99;
            //}
            //------------------------------

            //if (itemTransactionDetail.Quantity > 100) {
            //    e.result.Success = false;
            //    e.result.R    esultMessage = string.Format("Atenção! Quantidade {0} superior ao permitido", itemTransactionDetail.Quantity);
            //}
            //else {
            //    e.result.Success = true;
            //    e.result.ResultMessage = string.Empty;
            //}

            // When forcing a taxable group,
            // it is necessary to recalculate all the detail
            //itemTransactionDetail.TaxableGroupID = 3;
            //bsoItemTrans.BSOItemTransactionDetail.Calculate(itemTransactionDetail);

            properties = null;
            itemTransactionDetail = null;
        }
Exemplo n.º 3
0
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //MyApp.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow)properties.get_Value("ChildWindow");
            }
            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }


            // CUSTOM MENUS
            // Definir os menus
            menuItem = new ExtenderMenuItems();
            var childItems = menuItem.Add("miExtensibilidade", "&Extensibilidade").ChildItems;

            childItems.Add("miXItem1", "Item &1");
            childItems.Add("miXItem2", "Item &2");
            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }
Exemplo n.º 4
0
        private void MyEvents_OnInitialize(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList propList = null;

            propList = (ExtendedPropertyList)e.get_data();


            if (propList.PropertyExists("IManagementConsole"))
            {
                managementConsole = (IManagementConsole)propList.get_Value("IManagementConsole");

                formProps = new FormProps();
                managementConsole.AddChildPanel(formProps);
            }
        }
Exemplo n.º 5
0
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //APIEngine.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow2)properties.get_Value("ChildWindow");
            }

            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }

            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("UITransactionManager"))
            {
                generalUITransactionManager = (IUITransaction)properties.get_Value("UITransactionManager");
            }

            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("UIMasterTableManager"))
            {
                generalUIMasterTableManager = (IUIMasterTable)properties.get_Value("UIMasterTableManager");
            }

            if (properties.PropertyExists("UIMenuManager"))
            {
                generalUIMenuManager = (IUIMenu)properties.get_Value("UIMenuManager");
            }

            // CUSTOM MENUS
            // Definir os menus
            // Botão simples
            menuItem = new ExtenderMenuItems();
            var simpleButton = menuItem.Add("miSimpleButton", "Exemplo de janela");

            // Colocar o caminho para o icone.
            // Não usar os nomes de ficheiro da Sage em:
            //      TARGETDIR\Icons50c
            //      TARGETDIR\Images
            var myTargetDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            myTargetDir = System.IO.Path.Combine(myTargetDir, "Icons");
            simpleButton.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-01.png");
            var simpleButton2 = menuItem.Add("miSimpleButton1", "Exemplo 2 de janela");

            simpleButton2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-02.png");

            // Botão com submenu
            var parentButton = menuItem.Add("miComplexButton", "Grupo");
            var parentBtn1   = parentButton.ChildItems.Add("miComplexButtonItem1", "Clique aqui para ver uma mensagem do Grupo!");

            parentBtn1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            //menuItem.Add("miItemView", "Alterar Artigos");

            var parentButton2 = menuItem.Add("miComplexButton2", "Grupo");
            var child1        = parentButton2.ChildItems.Add("miComplexButtonItem2", "SubGrupo");
            var childItem1    = child1.ChildItems.Add("miComplexButtonItem3", "Clique aqui para ver uma mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            var childItem2 = child1.ChildItems.Add("miComplexButtonItem4", "Clique aqui para ver outra mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-save.ico");

            // Custom Functions
            // Remember, all functions declared here will not recorded on physical base
            AddMyFunction("XFunctionA", "PTG");
            AddMyFunction("XPosDisplay", "PTG");

            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Change RibbonTab Title
            object oRibbonCaption = "My caption";

            properties.set_Value("RibbonCaption", ref oRibbonCaption);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }
Exemplo n.º 6
0
 /// <summary>
 /// EXEMPLO DE VALIDAÇÃO NA LINHA
 /// </summary>
 /// <param name="Sender"></param>
 /// <param name="e"></param>
 void DetailEvents_OnValidating(object Sender, ExtenderEventArgs e)
 {
     ExtendedPropertyList    properties = (ExtendedPropertyList)e.get_data();
     TenderTransactionDetail _tenderTransactionDetail = (TenderTransactionDetail)properties.get_Value("Data");
     string errorMessage = string.Empty;
 }