public string GetSlpcodeFromUserId(string userId) //user id si verilince slpcodu nu geri veriyor
        {
            HelperRecordset hrs = new HelperRecordset();
            string sql = string.Format("select ohem.SalesPrson as SlpCode from ousr inner join ohem on ousr.USERID=ohem.userId where OUSR.USERID='{0}'", userId);
            var oRecordSet = hrs.GetRecordSet();
            oRecordSet.DoQuery(sql);

            var slpCode = hrs.ReadRecordSetData(oRecordSet, "SlpCode");

            return slpCode;
        }
        public void FillComboBox(SAPbouiCOM.ComboBox cmbbox, string sql) //combo doldur
        {
            HelperRecordset hrs = new HelperRecordset();

            var oRecordSet = hrs.GetRecordSet();
            oRecordSet.DoQuery(sql);
            cmbbox.ValidValues.Add("", "");
            if (oRecordSet.RecordCount != 0)
            {
                oRecordSet.MoveFirst();
                for (int i = 0; i < oRecordSet.RecordCount; i++)
                {
                    cmbbox.ValidValues.Add(hrs.ReadRecordSetData(oRecordSet, "Description"), hrs.ReadRecordSetData(oRecordSet, "Value"));
                    oRecordSet.MoveNext();
                }
            }
        }
        public string GetCurrentBranchId() //Seçilmiş şube idsi geri veriyor
        {
            SAPbouiCOM.Form _MenuForm = SAPbouiCOM.Framework.Application.SBO_Application.Forms.GetForm("169", 0);
            SAPbouiCOM.StaticText _Text = (SAPbouiCOM.StaticText)_MenuForm.Items.Item("7").Specific;
            string _Caption = _Text.Caption;
            string[] strBranch;
            string _CurrentBranch;
            strBranch = _Caption.Split(':');
            _CurrentBranch = strBranch[1].Trim();

            HelperRecordset hrs = new HelperRecordset();
            string sql = string.Format("select BPLId from OBPL where BPLName like N'%{0}%'", _CurrentBranch);
            var oRecordSet = hrs.GetRecordSet();
            oRecordSet.DoQuery(sql);

            var BPLId = hrs.ReadRecordSetData(oRecordSet, "BPLId");

            return BPLId;
        }
        public bool SearchRecordset(SAPbobsCOM.Recordset oRecordSet, string field, string value)
        {
            HelperRecordset hrs = new HelperRecordset();

            if (oRecordSet.RecordCount != 0)
            {
                oRecordSet.MoveFirst();
                for (int i = 0; i < oRecordSet.RecordCount; i++)
                {
                    var val = oRecordSet.Fields.Item(field).Value.ToString();
                    if (val.Trim() == value.Trim())
                    {
                        return true;
                    }

                    oRecordSet.MoveNext();
                }

                return false;
            }
            else
                return false;
        }