Exemplo n.º 1
0
        public ActionResult Value(int value)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();

            DSRCManagementSystem.Models.Email obj = new DSRCManagementSystem.Models.Email();
            var Path = objdb.EmailTemplates.Where(x => x.EmailTemplateID == value).Select(o => o.TemplatePath).FirstOrDefault();

            return(Json(new { Name = Path }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult AddNewEdit(int Id)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();

            DSRCManagementSystem.Models.Email obj = new DSRCManagementSystem.Models.Email();

            var EmailList = (from p in objdb.Users.Where(x => x.IsActive == true)
                             select new
            {
                UserId = p.UserID,
                UserName = p.UserName
            }).ToList();

            var EmailList1 = (from p in objdb.Users.Where(x => x.IsActive == true)
                              select new
            {
                Id1 = p.UserID,
                UserName1 = p.UserName
            }).ToList();

            var EmailList2 = (from p in objdb.Users.Where(x => x.IsActive == true)
                              select new
            {
                Id2 = p.UserID,
                UserName2 = p.UserName
            }).ToList();

            obj = (from p in objdb.EmailPurposes.Where(x => x.EmailPurposeID == Id)
                   join t in objdb.EmailTemplates on p.EmailTemplateID equals t.EmailTemplateID
                   select new DSRCManagementSystem.Models.Email
            {
                PurposeId = t.EmailTemplateID,
                Purpose = p.EmailPurposeName,
                To = p.To,
                CC = p.CC,
                BCC = p.BCC,
                Subject = p.Subject,
                Template = t.TemplatePath
            }).FirstOrDefault();

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

            if (obj.To != null)
            {
                string[] tokens = obj.To.Split(new string[] { "," }, StringSplitOptions.None);
                foreach (var i in tokens)
                {
                    int val;
                    int.TryParse(i, out val);
                    selectedEmail.Add(val);
                }
            }
            List <int> selectedEmail1 = new List <int>();

            if (obj.CC != null)
            {
                string[] tokens1 = obj.CC.Split(new string[] { "," }, StringSplitOptions.None);
                foreach (var i in tokens1)
                {
                    int val;
                    int.TryParse(i, out val);
                    selectedEmail1.Add(val);
                }
            }

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

            if (obj.BCC != null)
            {
                string[] tokens2 = obj.BCC.Split(new string[] { "," }, StringSplitOptions.None);
                foreach (var i in tokens2)
                {
                    int val;
                    int.TryParse(i, out val);
                    selectedEmail2.Add(val);
                }
            }



            var value = (from pi in objdb.EmailTemplates.Where(x => x.IsActive == true)
                         select new
            {
                Id3 = pi.EmailTemplateID,
                Template = pi.TemplatePurpose
            }).ToList();


            return(View(obj));
        }