Пример #1
0
        public ActionResult Detalle(int Email_ID)
        {
            try { this.EmailProxy = new ADESCOMBUSINESS.Areas.Email.Methods.EmailBusiness((ADESCOMBUSINESS.DataAccess.Models.LoginRS)Session["InfoUser"]); }
            catch (Exception ex) { return(RedirectToAction("SesionExpired", "Inicio", new { Area = "", Mensaje = ex.Message })); }
            ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails Email = new ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails();
            Email = EmailProxy.GetViewByEmail_ID(Email_ID);

            ViewBag.AdjuntoName = Email.EMA_AdjuntoName;
            ViewBag.AdjuntoFile = Email.EMA_AdjuntoURL;

            ADESCOMBUSINESS.DataAccess.Models.CompanyInfo CompanyInfo = (ADESCOMBUSINESS.DataAccess.Models.CompanyInfo)Session["CompanyInfo"];

            int cantLlaves = CompanyInfo.CantLlaves;

            ViewBag.DescLlave1 = CompanyInfo.LabelLlave1;
            ViewBag.DescLlave2 = CompanyInfo.LabelLlave2;
            ViewBag.DescLlave3 = CompanyInfo.LabelLlave3;

            switch (cantLlaves)
            {
            case 1:
                return(View("Detalle1", Email));

            case 2:
                return(View("Detalle2", Email));

            case 3:
                return(View("Detalle3", Email));
            }

            return(null);
        }
Пример #2
0
        public ActionResult Index()
        {
            try { this.EmailProxy = new ADESCOMBUSINESS.Areas.Email.Methods.EmailBusiness((ADESCOMBUSINESS.DataAccess.Models.LoginRS)Session["InfoUser"]); }
            catch (Exception ex) { return(RedirectToAction("SesionExpired", "Inicio", new { Area = "", Mensaje = ex.Message })); }
            List <ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails> Lista = new List <ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails>();

            Lista = EmailProxy.GetAll();

            ADESCOMBUSINESS.DataAccess.Models.CompanyInfo CompanyInfo = (ADESCOMBUSINESS.DataAccess.Models.CompanyInfo)Session["CompanyInfo"];

            int cantLlaves = CompanyInfo.CantLlaves;

            ViewBag.DescLlave1 = CompanyInfo.LabelLlave1;
            ViewBag.DescLlave2 = CompanyInfo.LabelLlave2;
            ViewBag.DescLlave3 = CompanyInfo.LabelLlave3;

            switch (cantLlaves)
            {
            case 1:
                return(View("Index1", Lista));

            case 2:
                return(View("Index2", Lista));

            case 3:
                return(View("Index3", Lista));
            }

            return(null);
        }
Пример #3
0
        public ActionResult Descargar(int Email_ID)
        {
            try { this.EmailProxy = new ADESCOMBUSINESS.Areas.Email.Methods.EmailBusiness((ADESCOMBUSINESS.DataAccess.Models.LoginRS)Session["InfoUser"]); }
            catch (Exception ex) { return(RedirectToAction("SesionExpired", "Inicio", new { Area = "", Mensaje = ex.Message })); }
            ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails Email = new ADESCOMBUSINESS.Areas.Email.Models.VwEMA_Emails();
            Email = EmailProxy.GetViewByEmail_ID(Email_ID);

            try
            {
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);

                // Create the blob client.
                var blobClient = storageAccount.CreateCloudBlobClient();

                // Get a reference to a container, which may or may not exist.
                var container = blobClient.GetContainerReference("archivosadjuntos");

                // Get a reference to a blob, which may or may not exist.
                var blob = container.GetBlockBlobReference(Email.EMA_AdjuntoName);

                var fileStream = new System.IO.MemoryStream();
                blob.DownloadToStream(fileStream);

                //var imgPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + Email.EMA_AdjuntoName);
                //blob.DownloadToFile(imgPath, FileMode.Create);

                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Email.EMA_AdjuntoName);
                fileStream.WriteTo(Response.OutputStream);
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }

            return(null);
        }
Пример #4
0
        public ActionResult Crear(FormCollection Form)
        {
            ADESCOMBUSINESS.DataAccess.Models.CompanyInfo CompanyInfo = (ADESCOMBUSINESS.DataAccess.Models.CompanyInfo)Session["CompanyInfo"];
            int cantLlaves = CompanyInfo.CantLlaves;

            ADESCOMBUSINESS.Areas.Configuracion.Models.VwTVI_Direcciones Direccion = new ADESCOMBUSINESS.Areas.Configuracion.Models.VwTVI_Direcciones();
            ADESCOMBUSINESS.Areas.Email.Models.EMA_Emails Registro = new ADESCOMBUSINESS.Areas.Email.Models.EMA_Emails();

            try { this.EmailProxy = new ADESCOMBUSINESS.Areas.Email.Methods.EmailBusiness((ADESCOMBUSINESS.DataAccess.Models.LoginRS)Session["InfoUser"]); } catch (Exception ex) { return(RedirectToAction("SesionExpired", "Inicio", new { Area = "", Mensaje = ex.Message })); }

            if (!string.IsNullOrEmpty(Form["Residente_ID"]) && Form["Residente_ID"] != "0")
            {
                Registro.Residente_ID = Convert.ToInt32(Form["Residente_ID"]);
            }

            if (!string.IsNullOrEmpty(Form["Llave1_ID"]) && Form["Llave1_ID"] != "0")
            {
                Registro.Llave1_ID = Convert.ToInt32(Form["Llave1_ID"]);
            }

            if (cantLlaves > 1)
            {
                if (!string.IsNullOrEmpty(Form["Llave2_ID"]) && Form["Llave2_ID"] != "0")
                {
                    Registro.Llave2_ID = Convert.ToInt32(Form["Llave2_ID"]);
                }
            }

            if (cantLlaves > 2)
            {
                if (!string.IsNullOrEmpty(Form["Llave3_ID"]) && Form["Llave3_ID"] != "0")
                {
                    Registro.Llave3_ID = Convert.ToInt32(Form["Llave3_ID"]);
                }
            }

            if (string.IsNullOrEmpty(Form["EMA_Remitente"]))
            {
                ModelState.AddModelError("EMA_Remitente", "Campo Requerido");
            }
            else
            {
                Registro.EMA_Remitente = Form["EMA_Remitente"];
            }

            if (string.IsNullOrEmpty(Form["EMA_Asunto"]))
            {
                ModelState.AddModelError("EMA_Asunto", "Campo Requerido");
            }
            else
            {
                Registro.EMA_Asunto = Form["EMA_Asunto"];
            }

            if (string.IsNullOrEmpty(Form["EMA_Cuerpo"]))
            {
                ModelState.AddModelError("EMA_Cuerpo", "Campo Requerido");
            }
            else
            {
                Registro.EMA_Cuerpo = Form["EMA_Cuerpo"];
            }

            //Archivo adjunto
            if (!String.IsNullOrEmpty(Form["SavedFile"]))
            {
                Registro.EMA_AdjuntoURL  = Form["SavedFile"];
                Registro.EMA_AdjuntoName = Form["fileName"];
                Registro.EMA_AdjuntoType = Form["fileType"];
                Registro.EMA_AdjuntoSize = Convert.ToInt32(Form["fileSize"]);
            }

            if (ModelState.IsValid)
            {
                try
                {
                    EmailProxy.Crear(Registro);
                    ViewBag.Error = "OK";
                }
                catch (Exception ex)
                {
                    ViewBag.Error = ex.Message;
                }
            }

            ViewBag.AdjuntoName  = Form["fileName"];
            ViewBag.AdjuntoFile  = Form["SavedFile"];
            ViewBag.AdjuntoSize  = Form["fileSize"];
            ViewBag.AdjuntoType  = Form["fileType"];
            ViewBag.Residente_ID = Registro.Residente_ID;

            ViewBag.DescLlave1 = CompanyInfo.LabelLlave1;
            ViewBag.DescLlave2 = CompanyInfo.LabelLlave2;
            ViewBag.DescLlave3 = CompanyInfo.LabelLlave3;

            switch (cantLlaves)
            {
            case 1:
                ViewBag.Llave1_ID    = new SelectList(GetLlave1(0, "Elija una opción"), "Llave1_ID", "LL1_Descripcion", Registro.Llave1_ID);
                ViewBag.Residente_ID = new SelectList(GetResidentes1(Registro.Llave1_ID, "(Todos)"), "Residente_ID", "RES_Nombre", Registro.Residente_ID);
                return(View("Crear1", Registro));

            case 2:
                ViewBag.Llave1_ID    = new SelectList(GetLlave1(0, "Elija una opción"), "Llave1_ID", "LL1_Descripcion", Registro.Llave1_ID);
                ViewBag.Llave2_ID    = new SelectList(GetLlave2(Registro.Llave1_ID, "Elija una opción"), "Llave2_ID", "LL2_Descripcion", Registro.Llave2_ID);
                ViewBag.Residente_ID = new SelectList(GetResidentes2(Registro.Llave1_ID, Registro.Llave2_ID, "(Todos)"), "Residente_ID", "RES_Nombre", Registro.Residente_ID);
                return(View("Crear2", Registro));

            case 3:
                ViewBag.Llave1_ID    = new SelectList(GetLlave1(0, "Elija una opción"), "Llave1_ID", "LL1_Descripcion", Registro.Llave1_ID);
                ViewBag.Llave2_ID    = new SelectList(GetLlave2(Registro.Llave1_ID, "Elija una opción"), "Llave2_ID", "LL2_Descripcion", Registro.Llave2_ID);
                ViewBag.Llave3_ID    = new SelectList(GetLlave3(Registro.Llave1_ID, Registro.Llave2_ID, "Elija una opción"), "Llave3_ID", "LL3_Descripcion", Registro.Llave3_ID);
                ViewBag.Residente_ID = new SelectList(GetResidentes3(Registro.Llave1_ID, Registro.Llave2_ID, Registro.Llave3_ID, "(Todos)"), "Residente_ID", "RES_Nombre", Registro.Residente_ID);
                return(View("Crear3", Registro));
            }

            return(null);
        }