Exemplo n.º 1
0
        /// <summary>
        /// GET Accion para crear un nuevo documento
        /// </summary>
        /// <param name="modulo">Modulo que se esta trabajando:
        ///                         Cotizaciones
        ///                         Reovaciones
        ///                         Polizas
        /// </param>
        /// <returns></returns>
        public ActionResult CreateDocumento(string modulo)
        {
            try
            {
                GenericoViewModel gm = new GenericoViewModel();
                gm.VendidaPor = "Internet";
                gm.cVendida = "I";
                ViewBag.IsNew = gm.IsNew = true;

                // Seteo las propiedades de lista
                SetCotizacionListProperties(ref gm);

                // Seteo los valores por defecto
                var logged = (DataSet)Session["UserObj"];
                gm.ModulodeTrabajo = modulo;
                gm.meses = 12;
                gm.cobertura = 12;
                gm.AplicaTERSSA = true;
                gm.AplicaCobertura100 = false;
                gm.AplicaERA = false;
                gm.conductorRestringido = 1;
                gm.EsHombre = true;
                gm.EsPersonaFisica = true;
                gm.QuiereCederComision = false;
                gm.strchkCedeComision = "N";
                gm.chkCedeComision = "N";
                gm.porcentajecomision = 0;
                gm.cEndosoCancela = "N";
                gm.control = 30;
                gm.fechaCotizacion = DateTime.Now;
                gm.oficinaID = Convert.ToInt32(logged.Tables["catAgentes"].Rows[0]["nOficinaID"]);
                gm.agente = Convert.ToInt32(logged.Tables["catAgentes"].Rows[0]["nAgenteID"]);
                gm.clienteID = 1;
                gm.tipoPago = "C";

                // Seteo los datos relacionados
                SetRelatedData(ref gm);

                // Default nFormaPago = 1
                gm.formaPago = 1;
                gm.cFormaPago = "T";
                gm.ValidaFormaPago(gm.formaPago.ToString());

                //Agente Responsable
                var agenteResponsable = VarProcInterfazX.arrAgentes.Where(agente => agente.lngAgente == gm.agente).First().cresponsa;
                gm.responsable = agenteResponsable == "" ? "XX" : agenteResponsable;

                var descOfc = "agentes " + (gm.oficinaID == 1 ? "df" : gm.OficinasSource.First(o => o.strCve == gm.oficinaID.ToString()).strDesc.ToLower());
                var campain = gm.CampañasSource.FirstOrDefault(c => c.strDesc.ToLower().Trim() == descOfc);
                if (campain != null)
                    gm.campaña = Convert.ToInt32(campain.strCve);

                // Guardo el modelo
                GuardaEnMemoria(gm);

                // Retorno la vista
                return PartialView("DatosGenerales", gm);
            }
            catch (Exception err)
            {
                Response.StatusCode = (int)(System.Net.HttpStatusCode.InternalServerError);
                LogDeErrores.RegistroErrorWeb(err, DatoUsuario.idAgente, DatoUsuario.nomAgente, DatoUsuario.sIp, DatoUsuario.sHostName);
                return Json("ErrInterno");
            }
        }