示例#1
0
        public override Forwarding GetForwarding(string domainName)
        {
            var _tmp = new Forwarding();

            using (OleDbConnection _conn = new OleDbConnection(connectionString))
            {
                _conn.Open();
                using (OleDbCommand _cmd = new OleDbCommand(@"SELECT D.name, F.redirect
                                                                        FROM (domains D INNER JOIN
                                                                    forwarding F ON F.dom_id = D.id)
                                                                                WHERE (D.name = ?)", _conn))
                {
                    _cmd.Parameters.AddWithValue("@NAME", domainName);

                    using (OleDbDataReader _read = _cmd.ExecuteReader())
                    {
                        while (_read.Read())
                        {
                            _tmp.Name       = DataExtensions.GetColumnValue <string>(_read, "name");
                            _tmp.ForwardUrl = DataExtensions.GetColumnValue <string>(_read, "redirect");
                        }
                    }
                }
                _conn.Close();
            }

            return(_tmp);
        }
示例#2
0
        public override Forwarding GetForwarding(string domainName)
        {
            var frw = new Forwarding();

            using (SQLiteConnection _conn = new SQLiteConnection(connectionString))
            {
                _conn.Open();

                using (SQLiteCommand _cmd = new SQLiteCommand(@"SELECT DomainRedirection.Id, DomainRedirection.DomainId, DomainRedirection.Destination, DomainRedirection.Enabled, 
					                                                    DomainRedirection.childOnly, DomainRedirection.exactDestination, 
                                                            DomainRedirection.httpResponseStatus
                                                        FROM DomainRedirection INNER JOIN
                                                            Domain ON DomainRedirection.DomainId = Domain.DomainId 
                                            WHERE (Domain.Name = @NAME)", _conn))
                {
                    _cmd.Parameters.AddWithValue("@NAME", domainName);

                    using (SQLiteDataReader _read = _cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow))
                    {
                        _read.Read();

                        frw.Name       = domainName;
                        frw.ForwardUrl = DataExtensions.GetColumnValue <String>(_read, "Destination");
                    }
                }

                _conn.Close();
            }

            return(frw);
        }
 public Emailsettings() //public Reports()
 {
     delegation        = new Delegation();
     filters           = new Filters();
     forwarding        = new Forwarding();
     general           = new General();
     imap              = new Imap();
     labels            = new Labels();
     language          = new Language();
     pop               = new Pop();
     sendasAliases     = new SendasAliases();
     signature         = new Signature();
     vacationResponder = new VacationResponder();
     webClip           = new WebClip();
 }
        public EmailsettingsBase()
        {
            mainBase = new gEmailsettings();

            ServiceWrapperDictionary[mainBaseType] = mainBase;

            delegation        = new Delegation();
            filters           = new Filters();
            forwarding        = new Forwarding();
            general           = new General();
            imap              = new Imap();
            labels            = new Labels();
            language          = new Language();
            pop               = new Pop();
            sendasAliases     = new SendasAliases();
            signature         = new Signature();
            vacationResponder = new VacationResponder();
            webClip           = new WebClip();
        }
示例#5
0
        private string GetForwarding(Forwarding forwarding)
        {
            var result = new List <string>(2);

            if (forwarding.For != null)
            {
                result.Add($"for={forwarding.For}");
            }

            if (forwarding.Host != null)
            {
                result.Add($"host={forwarding.Host}");
            }

            if (forwarding.Protocol != null)
            {
                result.Add($"proto={forwarding.Protocol}");
            }

            return(string.Join("; ", result));
        }
示例#6
0
        public ActionResult ProcessForm(Forwarding forwarding)
        {
            int schedulerID, forwardingID;

            using (EDI_ReportConverterEntities entity = new EDI_ReportConverterEntities())
            {
                schedulerID = (int)Session["schedulerID"];
                entity.Forwardings.Add(forwarding);
                entity.SaveChanges();
                forwardingID = forwarding.Id;

                Scheduler updatedScheduler = (from c in entity.Schedulers
                                              where c.Id == schedulerID
                                              select c).FirstOrDefault();

                updatedScheduler.Forwarding_Id = forwardingID;
                entity.SaveChanges();
            }

            return(RedirectToAction("Index", "Landing"));
        }