Пример #1
0
        /// <summary>
        /// Add conditions to choose from list by given field's values
        /// </summary>
        /// <param name="oChooseFromList"></param>
        /// <param name="fieldAlias"></param>
        /// <param name="values"></param>
        public static void AddConditionValues(ChooseFromList oChooseFromList, string fieldAlias, string[] values)
        {
            Condition  oCondition  = null;
            Conditions oConditions = new Conditions();

            try {
                if (values != null && values.Length > 0)
                {
                    for (int i = 1; i < values.Length + 1; i++)
                    {
                        oCondition           = oConditions.Add();
                        oCondition.Alias     = fieldAlias;
                        oCondition.Operation = BoConditionOperation.co_EQUAL;
                        oCondition.CondVal   = values[i - 1];

                        if (values.Length > i)
                        {
                            oCondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
                        }
                    }
                }
                else
                {
                    oCondition           = oConditions.Add();
                    oCondition.Alias     = fieldAlias;
                    oCondition.Operation = BoConditionOperation.co_EQUAL;
                    oCondition.CondVal   = "none";
                }
                oChooseFromList.SetConditions(oConditions);
            }
            catch (Exception ex) {
                SAPException.Handle(ex, "AddConditionValues");
            }
        }
Пример #2
0
        public ChooseFromList SetConditionCFLWareHouse()
        {
            TicketDAO     lObjTicketDAO = new TicketDAO();
            string        lStrWareHouse = lObjTicketDAO.GetWareHouse(DIApplication.Company.UserSignature.ToString());
            List <string> lLstWareHouse = lObjTicketDAO.GetWareHousePather(lStrWareHouse).ToList();

            SAPbouiCOM.ChooseFromListCollection lObjCFLs = null;
            ChooseFromList lObjCFL = null;

            SAPbouiCOM.Conditions lObjCons = new Conditions();
            SAPbouiCOM.Condition  lObjCon  = null;

            lObjCFL = lObjCFLs.Item("CFL_Ware");

            int i = 1;

            foreach (string lStrWareHousePather in lLstWareHouse)
            {
                lObjCon           = lObjCons.Add();
                lObjCon.Alias     = "WhsCode";
                lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                lObjCon.CondVal   = lStrWareHousePather;

                if (lLstWareHouse.Count() > i)
                {
                    lObjCon.Relationship = BoConditionRelationship.cr_OR;
                }
                i++;
            }

            lObjCFL.SetConditions(lObjCons);

            return(lObjCFL);
        }
Пример #3
0
        public static void AddConditions2(ChooseFromList oChooseFromList, Dictionary <string, string> conditions)
        {
            Condition  oCondition  = null;
            Conditions oConditions = new Conditions();

            for (int i = 0; i < conditions.Count; i++)
            {
                oCondition           = oConditions.Add();
                oCondition.Alias     = conditions.ElementAt(i).Key;
                oCondition.Operation = BoConditionOperation.co_EQUAL;
                oCondition.CondVal   = conditions.ElementAt(i).Value;

                if (i < conditions.Count - 1)
                {
                    oCondition.Relationship = BoConditionRelationship.cr_AND;
                }
            }

            oCondition.Relationship = BoConditionRelationship.cr_OR;
            oCondition           = oConditions.Add();
            oCondition.Alias     = "Series";
            oCondition.Operation = BoConditionOperation.co_EQUAL;
            oCondition.CondVal   = new FoodTransferDAO().GetSeries("CUAP", "59", "Series").ToString();

            oCondition.Relationship = BoConditionRelationship.cr_AND;

            oCondition           = oConditions.Add();
            oCondition.Alias     = "U_GLO_Status";
            oCondition.Operation = BoConditionOperation.co_EQUAL;
            oCondition.CondVal   = "O";

            oChooseFromList.SetConditions(oConditions);
        }
Пример #4
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);
        }
Пример #5
0
        private void LoadChooseFromList(string id, string code, Dictionary <string, string> conditions, EditText txt)
        {
            ChooseFromList oCFLFolio = SAPChooseFromList.Init(false, code, id, this);

            if (!Object.ReferenceEquals(conditions, null) && conditions.Count > 0)
            {
                SAPChooseFromList.AddConditions(oCFLFolio, conditions);
            }
            //bind choose from list to editText
            SAPChooseFromList.Bind(id, txt);
        }
Пример #6
0
 private void LoadChooseFromList()
 {
     try
     {
         ChooseFromList lObjCFLProjectArea = InitChooseFromLists(false, "61", "CFL_Area", this.UIAPIRawForm.ChooseFromLists);
         AddConditionChoseFromListArea(lObjCFLProjectArea);
     }
     catch (Exception ex)
     {
         LogService.WriteError("(LoadChooseFromList): " + ex.Message);
         LogService.WriteError(ex);
     }
 }
Пример #7
0
        /// <summary>
        /// Initialize choose from list by the given id
        /// </summary>
        /// <param name="isMultiSelection"></param>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <param name="frm"></param>
        /// <returns></returns>
        public static ChooseFromList Init(bool isMultiSelection, string type, string id, FormBase frm)
        {
            ChooseFromList lObjoCFL = null;

            try {
                ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(BoCreatableObjectType.cot_ChooseFromListCreationParams);
                oCFLCreationParams.MultiSelection = isMultiSelection;
                oCFLCreationParams.ObjectType     = type;
                oCFLCreationParams.UniqueID       = id;

                lObjoCFL = frm.UIAPIRawForm.ChooseFromLists.Add(oCFLCreationParams);
                frm.UIAPIRawForm.DataSources.UserDataSources.Add(id, BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex) {
                UIApplication.ShowMessageBox(String.Format("InitCustomerChooseFromListException: {0}", ex.Message));
            }
            return(lObjoCFL);
        }
Пример #8
0
        /// <summary>
        /// Add conditions to the choose from list
        /// </summary>
        /// <param name="oChooseFromList"></param>
        /// <param name="conditions"></param>
        public static void AddConditions(ChooseFromList oChooseFromList, Dictionary <string, string> conditions)
        {
            Condition  oCondition  = null;
            Conditions oConditions = new Conditions();

            for (int i = 0; i < conditions.Count; i++)
            {
                oCondition           = oConditions.Add();
                oCondition.Alias     = conditions.ElementAt(i).Key;
                oCondition.Operation = BoConditionOperation.co_EQUAL;
                oCondition.CondVal   = conditions.ElementAt(i).Value;

                if (i < conditions.Count - 1)
                {
                    oCondition.Relationship = BoConditionRelationship.cr_AND;
                }
            }

            oChooseFromList.SetConditions(oConditions);
        }
Пример #9
0
        public ChooseFromList InitChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs)
        {
            ChooseFromList lObjoCFL = null;

            try {
                ChooseFromListCreationParams oCFLCreationParams = null;
                oCFLCreationParams = (ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams);

                oCFLCreationParams.MultiSelection = pbol;
                oCFLCreationParams.ObjectType     = pStrType;
                oCFLCreationParams.UniqueID       = pStrID;

                lObjoCFL = pObjCFLs.Add(oCFLCreationParams);

                this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, BoDataType.dt_SHORT_TEXT, 254);
            }
            catch (Exception ex) {
                UIApplication.ShowMessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message));
            }
            return(lObjoCFL);
        }
Пример #10
0
        private void AddConditionChoseFromListEmployee(ChooseFromList pCFL, string pStrDept)
        {
            try
            {
                SAPbouiCOM.Condition  lObjCon  = null;
                SAPbouiCOM.Conditions lObjCons = new Conditions();
                pCFL.SetConditions(lObjCons);

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

                pCFL.SetConditions(lObjCons);
            }
            catch (Exception ex)
            {
                LogService.WriteError("frmSearchRefunds (AddConditionChoseFromListEmployee) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #11
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);
            }
        }
Пример #12
0
        public override void OnAfterChooseFromList(SAPbouiCOM.Form form, ChooseFromListEvent chooseEvent, ChooseFromList choose, ref ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            var dataTable = chooseEvent.SelectedObjects;
            var mtx       = ((Matrix)form.Items.Item(_matriz.ItemUID).Specific);

            var itemcode = dataTable.GetValue("ItemCode", 0);
            var itemname = dataTable.GetValue("ItemName", 0);

            if (ItemJaFoiUsado(itemcode, mtx))
            {
                Dialogs.PopupError($"O Item '{itemcode}' - '{itemname}' já foi usado.");
            }
            else
            {
                mtx.SetCellWithoutValidation(pVal.Row, _matriz._codigoItem.ItemUID, itemcode);
                mtx.SetCellWithoutValidation(pVal.Row, _matriz._nomeItem.ItemUID, itemname);

                ChangeFormMode(form);
            }
        }
Пример #13
0
 public override void OnBeforeChooseFromList(SAPbouiCOM.Form form, ChooseFromListEvent chooseEvent, ChooseFromList choose, ref ItemEvent pVal, out bool BubbleEvent)
 {
     BubbleEvent = FormContrato.TemGrupoDeItemConfiguradoParaChoose();
 }
Пример #14
0
        private void LoadChoosesFromList()
        {
            ChooseFromList lObjCFLItem = InitChooseFromLists(false, "2", "CFL_Client", this.UIAPIRawForm.ChooseFromLists);

            SetChooseFromListToTxt();
        }
Пример #15
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));
                }
            }
        }