Ejemplo n.º 1
0
 public void Delete(DN_StatusEmail mailSscStatusEmail)
 {
     FDIDB.DN_StatusEmail.Remove(mailSscStatusEmail);
 }
Ejemplo n.º 2
0
        public ActionResult AddCustomer(string key, string code)
        {
            if (key == Keyapi)
            {
                string url     = "Utility/GetContentEmail?key=" + code;
                var    urlJson = string.Format("{0}", UrlCustomer + url);
                var    email   = Utility.GetObjJson <DNMailSSCItem>(urlJson);
                email.AgencyID = Agencyid();
                if (email.ListUserReceiveIds != null)
                {
                    // insert file đính kèm
                    var lstImage = email.ListUrlPicture.Split(',');
                    var listfile = lstImage.Select(item => new DN_File_Mail
                    {
                        IsShow      = true,
                        IsDeleted   = false,
                        DateCreated = DateTime.Now,
                        Url         = item,
                        Name        = item,
                        Folder      = "/Uploads/Mail/",
                        AgencyId    = Agencyid()
                    }).ToList();
                    foreach (var item in listfile)
                    {
                        _mailBl.Add(item);
                    }
                    _mailBl.Save();

                    var strId = string.Join(",", listfile.Select(m => m.ID));
                    var list  = new List <DN_Mail_SSC>();
                    _mailBl.Save();

                    var lstId = FDIUtils.StringToListInt(email.ListUserReceiveIds);
                    // người gửi

                    foreach (var item in lstId)
                    {
                        var obj1 = new DN_Mail_SSC();
                        email.CustomerReceiveId = item;
                        email.StatusEmail       = true;
                        UpdateBase(obj1, email);
                        list.Add(obj1);
                        _dnMailSscda.Add(obj1);

                        var obj2 = new DN_Mail_SSC();
                        email.CustomerReceiveId = item;
                        email.StatusEmail       = false;
                        UpdateBase(obj2, email);
                        list.Add(obj2);
                        _dnMailSscda.Add(obj2);
                    }

                    var check1 = true;
                    foreach (var item in list)
                    {
                        if (check1)
                        {
                            check1 = false;
                            var lstFileMail = _dnMailSscda.GetFileMailArrId(strId);
                            foreach (var itemf in lstFileMail)
                            {
                                item.DN_File_Mail.Add(itemf);
                            }
                        }
                        _dnMailSscda.Add(item);
                    }

                    _dnMailSscda.Save();

                    // bảng status
                    foreach (var item in list)
                    {
                        var objStatus1 = new DN_StatusEmail
                        {
                            CustomerId = item.StatusEmail == true ? item.CustomerSendId : item.CustomerReceiveId,
                            Status     = item.StatusEmail,
                            MailId     = item.ID
                        };
                        _dnMailStatusDa.Add(objStatus1);
                    }
                    _dnMailStatusDa.Save();

                    return(Json(1, JsonRequestBehavior.AllowGet));
                }
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
            return(Json(0, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
 public void Add(DN_StatusEmail mailSscStatusEmail)
 {
     FDIDB.DN_StatusEmail.Add(mailSscStatusEmail);
 }