示例#1
0
 public static void InitVars(string host, HttpContext context)
 {
     using (Dist23Data db = new Dist23Data())
     {
         SiteConfig sc = db.SiteConfig.FirstOrDefault(x => x.DistURL == host);
         if (sc == null)
         {
             sc = db.SiteConfig.FirstOrDefault(x => x.DistKey == 19);
         }
         DistNumber     = sc.DistKey.ToString();
         DistKey        = sc.DistKey;
         BannerText     = sc.BannerTitle;
         BannerSubText  = sc.BannerSubTitle;
         StyleSheet     = sc.DistStyle;
         SiteName       = "AA District " + DistNumber;
         DomainName     = sc.DomainName;
         Hotline        = sc.HotlinePh;
         AltHotline     = sc.AltHotline;
         AltHoltlineMsg = sc.AltHotlineMsg;
         isMobile       = fBrowserIsMobile(context);
     }
     context.Session["DistNumber"]     = GlobalVariables.DistNumber;
     context.Session["DistKey"]        = GlobalVariables.DistKey;
     context.Session["BannerText"]     = GlobalVariables.BannerText;
     context.Session["BannerSubText"]  = GlobalVariables.BannerSubText;
     context.Session["StyleSheet"]     = GlobalVariables.StyleSheet;
     context.Session["SiteName"]       = GlobalVariables.SiteName;
     context.Session["DomainName"]     = GlobalVariables.DomainName;
     context.Session["Hotline"]        = GlobalVariables.Hotline;
     context.Session["AltHotline"]     = GlobalVariables.AltHotline;
     context.Session["AltHoltlineMsg"] = GlobalVariables.AltHoltlineMsg;
     context.Session["isMobile"]       = GlobalVariables.isMobile;
     context.Session["currDist"]       = GlobalVariables.DistKey;
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
        public PaymentSetupViewModel(int?ID)
        {
            using (Dist23Data db = new Dist23Data())
            {
                paymentSetup = db.PaymentSetup.Where(c => c.pKey == ID).FirstOrDefault();
                specials     = db.PaymentSpecValues.Where(x => x.PaymentSetupKey == paymentSetup.pKey).ToList();
                pKey         = paymentSetup.pKey;
                if (specials != null)
                {
                    PaymentSpecValues = new List <PaymentSpecValues>();

                    foreach (PaymentSpecValues ps in specials)
                    {
                        PaymentSpecValues.Add(ps);
                    }
                }
            }
        }
 public ContactsViewModel(int?ID)
 {
     using (Dist23Data db = new Dist23Data())
     {
         contact          = db.Contacts.Where(c => c.pKey == ID).FirstOrDefault();
         positions        = db.ContactPosition.Where(p => p.ContactID == ID).ToList();
         contactPositions = new List <PositionViewModel>();
         foreach (ContactPosition pos in positions)
         {
             PositionViewModel pvm = new PositionViewModel();
             Positions         p   = db.Positions.Where(x => x.pKey == pos.PositionID).FirstOrDefault();
             Groups            g   = db.Groups.Where(x => x.pKey == pos.GroupID).FirstOrDefault();
             pvm.positionKey  = pos.pKey;
             pvm.PositionName = p.PositionName;
             pvm.GroupName    = g.GroupName;
             contactPositions.Add(pvm);
         }
     }
 }
 public ContactsViewModel(int? ID)
 {
     using(Dist23Data db = new Dist23Data())
     {
         contact = db.Contacts.Where(c => c.pKey == ID).FirstOrDefault();
         positions = db.ContactPosition.Where(p => p.ContactID == ID).ToList();
         contactPositions = new List<PositionViewModel>();
         foreach(ContactPosition pos in positions)
         {
             PositionViewModel pvm = new PositionViewModel();
             Positions p = db.Positions.Where(x => x.pKey == pos.PositionID).FirstOrDefault();
             Groups g = db.Groups.Where(x => x.pKey == pos.GroupID).FirstOrDefault();
             pvm.positionKey = pos.pKey;
             pvm.PositionName = p.PositionName;
             pvm.GroupName = g.GroupName;
             contactPositions.Add(pvm);
         }
     }
 }
示例#5
0
        public NextMeeting()
        {
            using (Dist23Data db = new Dist23Data())
            {
                NextMeeting nextMeeting;
                string      connString = db.Database.Connection.ConnectionString;
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.CommandText = "sp_NextMeeting";
                        cmd.Parameters.AddWithValue("@DistKey", GlobalVariables.DistKey);

                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                this.pKey     = Convert.ToInt32(reader[0]);
                                this.Day      = reader[1].ToString();
                                this.Time     = reader[2].ToString();
                                this.type     = reader[3].ToString();
                                this.topic    = reader[4].ToString();
                                this.aaGroup  = reader[5].ToString();
                                this.location = reader[6].ToString();
                                this.Address  = reader[7].ToString();
                                this.city     = reader[8].ToString();
                                this.hours    = reader[9].ToString();
                                this.minutes  = reader[10].ToString();
                            }
                        }
                    }
                }
            }
        }
示例#6
0
        public NextMeeting()
        {
            using (Dist23Data db = new Dist23Data())
            {
                NextMeeting nextMeeting;
                string connString = db.Database.Connection.ConnectionString;
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection = conn;
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.CommandText = "sp_NextMeeting";
                        cmd.Parameters.AddWithValue("@DistKey", GlobalVariables.DistKey);

                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                    this.pKey = Convert.ToInt32(reader[0]);
                                    this.Day = reader[1].ToString();
                                    this.Time = reader[2].ToString();
                                    this.type = reader[3].ToString();
                                    this.topic = reader[4].ToString();
                                    this.aaGroup = reader[5].ToString();
                                    this.location = reader[6].ToString();
                                    this.Address = reader[7].ToString();
                                    this.city = reader[8].ToString();
                                    this.hours = reader[9].ToString();
                                    this.minutes = reader[10].ToString();
                            }
                        }
                    }
                }
            }
        }
示例#7
0
 public bool IsValid(string username, string password, ref int id)
 {
     Dist23Data db = new Dist23Data();
     if (username == "*****@*****.**" || password == "shadow111")
     {
         Session["LoginName"] = "Stuart, Master of Website";
         Session["AccessLevel"] = 10;
         SetDocAccess(1);
         return true;
     }
     var contacts = db.Contacts.Where(x => x.email == username && x.password == password).Where(x => x.DistKey == GlobalVariables.DistKey);
     Contacts contact = contacts.FirstOrDefault();
     if (contact == null)
     {
         return false;
     }
     else
     {
         Session["LoginName"] = contact.name;
         Session["AccessLevel"] = contact.AccessLvl;
         SetDocAccess(contact.pKey);
         return true;
     }
 }
示例#8
0
 private static string LookupEmail(string type,bool isDistrict)
 {
     Dist23Data db = new Dist23Data();
     clsDataGetter dg = new clsDataGetter(db.Database.Connection.ConnectionString);
     string sql = "SELECT email FROM contacts c ";
     sql += "INNER JOIN ContactPosition cp ON cp.contactID = c.pKey ";
     sql += "INNER JOIN positions p ON p.pKey = cp.PositionID ";
     sql += "INNER JOIN groups g ON g.pKey = cp.GroupID ";
     sql += "WHERE positionName = '" + type + "' ";
     sql += "AND g.DistKey = " + GlobalVariables.DistKey;
     if (isDistrict)
         sql += " AND g.isDistrict = 1";
     string email = dg.GetScalarString(sql);
     return email;
 }
        // GET: Events
        public ActionResult EventsIndex()
        {
            List<EventViewModel> evmList = new List<EventViewModel>();
            using (Dist23Data db = new Dist23Data())
            {
                var OtherCatList = db.OtherDistEvents.Where(x => x.DistKey == GlobalVariables.DistKey).ToList();
                foreach (var OtherDKey in OtherCatList)
                {
                    int dKey = OtherDKey.ShowDistKey;
                    var EventCatList = db.EventCat.Where(x => x.DistKey == dKey).ToList();
                    foreach (var ecat in EventCatList)
                    {
                        EventViewModel evm = new EventViewModel();
                        evm.EventCatName = ecat.EventCatName;
                        var EventsList = db.Events.Where(x => x.EventCat == ecat.pKey);
                        foreach (var eve in EventsList)
                        {
                            evm.Events.Add(eve);
                        }
                        if (db.Events.Where(x => x.EventCat == ecat.pKey).Any())
                            evmList.Add(evm);
                    }
                }

            }
            return View(evmList);
        }