Example #1
0
        public OutExecutiveChilds GetExecutiveChilds(string executiveID, int level)
        {
            OutExecutiveChilds response = new OutExecutiveChilds();

            try
            {
                ExecutiveDAO dao = new ExecutiveDAO();
                response = dao.GetExecutiveChilds(executiveID, level);
            }
            catch (Exception ex)
            {
                //escribir en el log
                LogHelper.WriteLog("Models", "ManageExecutive", "GetExecutiveChilds", ex, "");
            }
            return(response);
        }
Example #2
0
        public OutExecutiveChilds GetExecutiveChilds(string executiveID, int level)
        {
            string             connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutExecutiveChilds response         = new OutExecutiveChilds();
            var ora = new OracleServer(connectionString);

            ExecutiveChilds        executiveChilds;
            List <ExecutiveChilds> list = new List <ExecutiveChilds>();
            string command = string.Empty;

            try
            {
                command = "SELECT BBS_LIQCOM_V_ASECARGO.codigo_asesor_hijo, BBS_LIQCOM_V_ASECARGO.cedula_asesor_hijo, BBS_LIQCOM_V_ASECARGO.nombre_asesor_hijo FROM   BBS_LIQCOM_V_ASECARGO ";
                command = command + string.Format(" WHERE BBS_LIQCOM_V_ASECARGO.cedula_asesor_superior =  '{0}' and BBS_LIQCOM_V_ASECARGO.nivel = {1} ", executiveID, level);
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    executiveChilds            = new ExecutiveChilds();
                    executiveChilds.Code       = DBNull.Value.Equals(rdr["codigo_asesor_hijo"]) ? 0 : double.Parse(rdr["codigo_asesor_hijo"].ToString());
                    executiveChilds.Name       = DBNull.Value.Equals(rdr["nombre_asesor_hijo"]) ? string.Empty : rdr["nombre_asesor_hijo"].ToString();
                    executiveChilds.DocumentID = DBNull.Value.Equals(rdr["cedula_asesor_hijo"]) ? string.Empty : rdr["cedula_asesor_hijo"].ToString();
                    list.Add(executiveChilds);
                }
                rdr.Close();
                response.lstExecutiveChilds = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ExecutiveDAO.GetExecutiveChilds", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }