Пример #1
0
        /// <summary>
        /// Create equal conditions
        /// </summary>
        /// <param name="oCFL">Choose from list in the form</param>
        /// <param name="bucket">Result query</param>
        public static void CreateConditionsEquals(ref ChooseFromList oCFL, Bucket bucket)
        {
            var oCons = oCFL.GetConditions();

            // Clear conditions
            oCons = new SAPbouiCOM.Conditions();


            for (int i = 0; i < bucket.CountRows; i++)
            {
                foreach (var field in bucket[i])
                {
                    var oCon = oCons.Add();

                    oCon.Alias     = field.Key;
                    oCon.Operation = BoConditionOperation.co_EQUAL;
                    oCon.CondVal   = field.Value;

                    if (bucket.CountRows > (i + 1))
                    {
                        oCon.Relationship = BoConditionRelationship.cr_OR;
                    }
                }
            }

            oCFL.SetConditions(oCons);
        }
Пример #2
0
        private void AddConditionChoseFromListArea(ChooseFromList pCFL)
        {
            try
            {
                SAPbouiCOM.Condition  lObjCon  = null;
                SAPbouiCOM.Conditions lObjCons = null;
                lObjCons = pCFL.GetConditions();

                //DimCode
                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "DimCode";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = "1";

                lObjCon.Relationship = BoConditionRelationship.cr_AND;

                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "Active";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = "Y";



                //lObjCon.Relationship = BoConditionRelationship.cr_AND;

                //lObjCon = lObjCons.Add();
                //lObjCon.Alias = "GrpCode";
                //lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_NULL;


                pCFL.SetConditions(lObjCons);
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (AddConditionChoseFromListArea) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #3
0
        internal static void FormLoad(ref MenuEvent oMenuEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;

            FormCreationParams FormCreationPackage;
            Form oForm = null;

            if (oMenuEvent.BeforeAction)
            {
                FormCreationPackage = (FormCreationParams)sbo_application.CreateObject(BoCreatableObjectType.cot_FormCreationParams);

                try
                {
                    if (string.IsNullOrEmpty(sessionId))
                    {
                        sessionId = sbo_application.Company.GetServiceLayerConnectionContext(ServiceLayer.Address);
                    }

                    string      contenidoArchivo = Properties.Resources.ResourceManager.GetString(pluginForm.FormType);
                    XmlDocument xmlFormulario    = new XmlDocument();
                    xmlFormulario.LoadXml(contenidoArchivo);

                    FormCreationPackage.XmlData = xmlFormulario.InnerXml;

                    FormCreationPackage.UniqueID = pluginForm.FormType + CommonFunctions.Random().ToString();
                    oForm = sbo_application.Forms.AddEx(FormCreationPackage);

                    FormCreationPackage.UniqueID = "ConsumoMP" + CommonFunctions.Random().ToString();
                    oForm = sbo_application.Forms.AddEx(FormCreationPackage);

                    oForm.Mode = BoFormMode.fm_OK_MODE;

                    for (int i = 3; i < oForm.Items.Count; i++)
                    {
                        oForm.Items.Item(i).AffectsFormMode = false;
                    }
                    // oForm.DataBrowser.BrowseBy = pluginForm.TxtNroOrden.Uid;
                    //SAPbouiCOM.StaticText Lote = (SAPbouiCOM.StaticText)oForm.Items.Item(pluginForm.StaticLote).Specific;
                    EditText Lote = (EditText)oForm.Items.Item(pluginForm.TxtNroLote.Uid).Specific;
                    Lote.Item.Top       = 90;
                    Lote.Item.Left      = 25;
                    Lote.Item.Height    = 100;
                    Lote.Item.Width     = 656;
                    Lote.Item.FontSize  = 60;
                    Lote.Item.BackColor = Colores.White;

                    //SAPbouiCOM.Item oLink;
                    //oLink = oForm.Items.Add("Link", BoFormItemTypes.it_LINKED_BUTTON);
                    //oLink.LinkTo = pluginForm.TxtNroOrden.Uid;
                    //SAPbouiCOM.LinkedButton Linked = (SAPbouiCOM.LinkedButton)oForm.Items.Item("Link").Specific;
                    //Linked.LinkedObject = BoLinkedObject.lf_ProductionOrder;

                    Item oItem;

                    oItem      = oForm.Items.Add("OF", BoFormItemTypes.it_EDIT);
                    oItem.Left = 800;
                    EditText OF = (EditText)oForm.Items.Item("OF").Specific;
                    OF.Item.Enabled = false;

                    oItem      = oForm.Items.Add("OV", BoFormItemTypes.it_EDIT);
                    oItem.Left = 800;
                    EditText OV = (EditText)oForm.Items.Item("OV").Specific;
                    OV.Item.Enabled = false;

                    LinkedButton Linked = (LinkedButton)oForm.Items.Item(pluginForm.LinkedNroOrden).Specific;
                    Linked.Item.LinkTo  = "OF";
                    Linked.LinkedObject = BoLinkedObject.lf_ProductionOrder;

                    Linked              = (LinkedButton)oForm.Items.Item(pluginForm.LinkedOV).Specific;
                    Linked.Item.LinkTo  = "OV";
                    Linked.LinkedObject = BoLinkedObject.lf_Order;

                    Linked              = (LinkedButton)oForm.Items.Item(pluginForm.LinkedCardCode).Specific;
                    Linked.Item.LinkTo  = pluginForm.TxtCardCode.Uid;
                    Linked.LinkedObject = BoLinkedObject.lf_BusinessPartner;

                    Linked              = (LinkedButton)oForm.Items.Item(pluginForm.LinkedItemCode).Specific;
                    Linked.Item.LinkTo  = pluginForm.TxtItemCode.Uid;
                    Linked.LinkedObject = BoLinkedObject.lf_Items;

                    oItem           = oForm.Items.Add("40", BoFormItemTypes.it_RECTANGLE);
                    oItem.Top       = 85;
                    oItem.Left      = 20;
                    oItem.Width     = 666;
                    oItem.Height    = 110;
                    oItem.BackColor = Colores.Green;

                    ChooseFromList oCFL  = oForm.ChooseFromLists.Item(pluginForm.CFLOrdenFab);
                    Conditions     oCons = oCFL.GetConditions();

                    Condition oCon = oCons.Add();
                    oCon.Alias     = "Status";
                    oCon.Operation = BoConditionOperation.co_EQUAL;
                    oCon.CondVal   = "R";

                    //oCon.Relationship = BoConditionRelationship.cr_AND;
                    //oCon = oCons.Add();
                    //oCon.Alias = "ItemCode";
                    //oCon.Operation = BoConditionOperation.co_CONTAIN;
                    //oCon.CondVal = "SE";

                    oCFL.SetConditions(oCons);

                    try
                    {
                        oForm.Freeze(true);

                        DataTable oDT  = oForm.DataSources.DataTables.Add(pluginForm.GridConsumo.Dt);
                        Grid      grid = (Grid)oForm.Items.Item(pluginForm.GridConsumo.Uid).Specific;
                        grid.DataTable = oDT;

                        Button ButtonAddConsumo = (Button)oForm.Items.Item(pluginForm.ButtonAddConsumo).Specific;
                        ButtonAddConsumo.Item.Enabled = true;
                    }
                    finally { oForm.Freeze(false); }

                    oForm.Visible = true;
                }
                catch (Exception e)
                {
                    throw new Exception(string.Format("FormLoad {0}", e.Message));
                }
            }
        }