Exemple #1
0
        public string GetWareHouse(string pStrUserID)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            string lStrWareHouse = "";

            try
            {
                TicketDAO mObjTicketDAO = new TicketDAO();
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("UserID", pStrUserID);
                string lStrQuery = this.GetSQL("GetWarehouse").Inject(lLstStrParameters);
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrWareHouse = lObjRecordset.Fields.Item(0).Value.ToString();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(string.Format("[GetWareHouse]: {0} ", ex.Message));
                LogService.WriteError(ex);
                UIApplication.ShowError(string.Format("[GetWareHouse]: {0}", ex.Message));
                // UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lStrWareHouse);
        }
Exemple #2
0
        public IList <string> GetProjects()
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            IList <string>       lLstProjects  = new List <string>();

            try
            {
                TicketDAO mObjTicketDAO = new TicketDAO();

                string lStrQuery = this.GetSQL("GetProjects");
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    for (int i = 0; i < lObjRecordset.RecordCount; i++)
                    {
                        lLstProjects.Add(lObjRecordset.Fields.Item("PrjCode").Value.ToString());

                        lObjRecordset.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError(string.Format("[GetProjects]: {0} ", ex.Message));
                LogService.WriteError(ex);
                UIApplication.ShowError(string.Format("[GetProjects]: {0}", ex.Message));
                // UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lLstProjects);
        }