public List<AuthorizationStatus> GetAuthorizationStatusReport(string producerFrom, string producerTo, string approverFrom, string approverTo, string templateFrom, string templateTo, DateTime dateFrom, DateTime dateTo, string cardFrom, string cardTo, string totalFrom, string totalTo, string statusWait, string statusApproved, string statusRejected, string statusProduced, string statusCanceled, string statusApprProduced, string objectsList, int numObjects, string docTable, int absEntry)
        {
            List<AuthorizationStatus> authorizationsStatus = new List<AuthorizationStatus>();
            List<WorkflowConfirmationLevel> confirmationLevels = GetWorkflowConfirmationLevelList();
            List<User> users = GetUserList();

            StringBuilder oSQL = new StringBuilder();

            oSQL.Append(string.Format("Exec TmSp_GetWDD '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', {19}, '{20}', {21}",
                producerFrom, producerTo, approverFrom, approverTo, templateFrom, templateTo, dateFrom.ToString("yyyyMMdd"), dateTo.ToString("yyyyMMdd"), cardFrom, cardTo, totalFrom, totalTo, statusWait, statusApproved, statusRejected, statusProduced, statusCanceled, statusApprProduced, objectsList, numObjects.ToString(), docTable, absEntry.ToString()));

            DbCommand sqlCommand = this.dataBase.GetSqlStringCommand(oSQL.ToString());

            using (this.reader = this.dataBase.ExecuteReader(sqlCommand))
            {
                while (this.reader.Read())
                {
                    authorizationsStatus.Add(new AuthorizationStatus()
                    {
                        wddCode = int.Parse(this.reader.GetValue(0).ToString()),
                        wtmCode = int.Parse(this.reader.GetValue(1).ToString()),
                        ownerId = int.Parse(this.reader.GetValue(2).ToString()),
                        ownerName = users.Where(x => x.userId.Equals(int.Parse(this.reader.GetValue(2).ToString()))).Select(x => x.uName).FirstOrDefault(),
                        docEntry = int.Parse(this.reader.GetValue(3).ToString()),
                        objType = int.Parse(this.reader.GetValue(4).ToString()),
                        docDate = DateTime.Parse(this.reader.GetValue(5).ToString()),
                        currStep = int.Parse(this.reader.GetValue(6).ToString()),
                        currStepName = confirmationLevels.Where(x => x.wstCode.Equals(int.Parse(this.reader.GetValue(6).ToString()))).Select(x => x.name).FirstOrDefault(),
                        status = this.reader.GetValue(7).ToString(),
                        remarks = this.reader.GetValue(8).ToString(),
                        userSing = int.Parse(this.reader.GetValue(9).ToString()),
                        createDate = DateTime.Parse(this.reader.GetValue(10).ToString()),
                        createTime = int.Parse(this.reader.GetValue(11).ToString()),
                        isDraft = this.reader.GetValue(12).ToString(),
                        maxReqr = int.Parse(this.reader.GetValue(13).ToString()),
                        maxRejReqr = int.Parse(this.reader.GetValue(14).ToString())
                    });
                }
            }

            List<int> docEntries = new List<int>();

            foreach (AuthorizationStatus item in authorizationsStatus)
            {
                docEntries.Add(item.docEntry);
            }

            MarketingDocumentData mkgtData = new MarketingDocumentData(this.connectionStringStringName);
            Dictionary<int, int> docNums = mkgtData.GetDocNum(SapDocumentType.Draft, docEntries);

            if (docNums.Count > 0)
                foreach (AuthorizationStatus item in authorizationsStatus)
                    foreach (KeyValuePair<int, int> docInfo in docNums)
                        if (item.docEntry.Equals(docInfo.Key))
                            item.docNum = docInfo.Value;

            return authorizationsStatus;
        }
        public int GetOrderNum(int docEntry, AppConnData oAppConnData)
        {
            try
            {
                if (!BizUtilities.ValidateServiceConnection(oAppConnData))
                    throw new BusinessException(15, "Nombre de Usuario o Contraseña incorrecta para el Servicio");

                oAppConnData = BizUtilities.GetDataConnection(oAppConnData);
                SaleOrderAccess = new MarketingDocumentData(oAppConnData.adoConnString);

                return SaleOrderAccess.GetDocNum(SapDocumentType.SalesOrder, docEntry); ;
            }
            catch (DbException ex)
            {
                Exception outEx;
                if (ExceptionPolicy.HandleException(ex, "Politica_SQLServer", out outEx))
                {
                    outEx.Data.Add("1", "14");
                    outEx.Data.Add("2", "NA");
                    //outEx.Data.Add("3", outEx.Message);
                    outEx.Data.Add("3", outEx.Message + " Descripción: " + ex.Message);
                    throw outEx;
                }
                else
                {
                    throw ex;
                }
            }
            catch (BusinessException ex)
            {
                BizUtilities.ProcessBusinessException(ex);
            }
            catch (Exception ex)
            {
                Exception outEx;
                if (ExceptionPolicy.HandleException(ex, "Politica_ExcepcionGenerica", out outEx))
                {
                    outEx.Data.Add("1", "3");
                    outEx.Data.Add("2", "NA");
                    outEx.Data.Add("3", outEx.Message);
                    throw outEx;
                }
                else
                {
                    throw ex;
                }
            }
            return -1;
        }