private void AddRiseCommissionDetail(CommissionDriverDetailsDTO pObjCommissionDetail)
        {
            try
            {
                if (pObjCommissionDetail == null)
                {
                    return;
                }

                dtCommissions.Rows.Add();
                dtCommissions.SetValue("#", dtCommissions.Rows.Count - 1, dtCommissions.Rows.Count);
                dtCommissions.SetValue("FolioCms", dtCommissions.Rows.Count - 1, pObjCommissionDetail.Folio);
                dtCommissions.SetValue("EmpId", dtCommissions.Rows.Count - 1, pObjCommissionDetail.EmployeeId);
                dtCommissions.SetValue("EmpNm", dtCommissions.Rows.Count - 1, pObjCommissionDetail.Employee);
                dtCommissions.SetValue("Import", dtCommissions.Rows.Count - 1, pObjCommissionDetail.Import);
                dtCommissions.SetValue("Acct", dtCommissions.Rows.Count - 1, pObjCommissionDetail.Account);

                mtxCommissions.LoadFromDataSource();
                mtxCommissions.AutoResizeColumns();
            }
            catch (Exception lObjException)
            {
                throw new Exception(string.Format("Error al agregar el detalle de la comisión: {0}", lObjException.Message));
            }
        }
Example #2
0
        public IList <CommissionDriverDetailsDTO> GetCommissionDriversDetails(string pStrFolio, string pStrAccount)
        {
            SAPbobsCOM.Recordset lObjResults = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            IList <CommissionDriverDetailsDTO> lLstCommissiosDTO = new List <CommissionDriverDetailsDTO>();

            try
            {
                Dictionary <string, string> lLstParams = new Dictionary <string, string>();
                lLstParams.Add("Folio", pStrFolio);
                lLstParams.Add("Account", pStrAccount);

                string lStrQuery = this.GetSQL("GetCommissionDriverDetails").Inject(lLstParams);

                lObjResults.DoQuery(lStrQuery);
                if (lObjResults.RecordCount > 0)
                {
                    for (int i = 0; i < lObjResults.RecordCount; i++)
                    {
                        CommissionDriverDetailsDTO lObjCommission = new CommissionDriverDetailsDTO();
                        lObjCommission.Folio      = lObjResults.GetColumnValue <string>("Folio");
                        lObjCommission.EmployeeId = lObjResults.GetColumnValue <string>("EmpId");
                        lObjCommission.Employee   = lObjResults.GetColumnValue <string>("EmployeeName");
                        lObjCommission.Import     = lObjResults.GetColumnValue <double>("Import");
                        lObjCommission.Account    = lObjResults.GetColumnValue <string>("Account");
                        lLstCommissiosDTO.Add(lObjCommission);
                        lObjResults.MoveNext();
                    }
                }
                return(lLstCommissiosDTO);
            }
            catch (Exception e)
            {
                LogUtility.WriteError(string.Format("[CommissionDriverDAO - GetCommissionsDriversDetails] Error al obtener los detalles de la comisión: {0}", e.Message));
                throw new Exception(string.Format("Error al obtener los detalles de la comisión: {0}", e.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjResults);
            }
        }