public void GetSaveCoords(int id, string lat, string lng)
        {
            double pLat = 0;
            double pLng = 0;

            string strLat = StringHelper.FixDecimalSeparator(lat);
            string strLng = StringHelper.FixDecimalSeparator(lng);


            if (!double.TryParse(strLat, out pLat))
            {
                return;
            }
            if (!double.TryParse(strLng, out pLng))
            {
                return;
            }
            using (var context = new BusProjectEntities())
            {
                var st = context.tblStudents.FirstOrDefault(z => z.pk == id);
                if (st != null)
                {
                    st.Lat = pLat;
                    st.Lng = pLng;
                    try
                    {
                        context.SaveChanges();
                    }
                    catch (DbEntityValidationException e)
                    {
                        Console.WriteLine(e);
                    }
                }
            }
        }
示例#2
0
 public static void SetSettingValue(string ns, string key, string value)
 {
     using (var context = new BusProjectEntities())
     {
         var entity =
             context.tblSystems.FirstOrDefault(
                 z => z.strNamespace.ToLower() == ns.ToLower() && z.strKey.ToLower() == key.ToLower());
         if (entity != null)
         {
             entity.strValue   = value;
             entity.LastModify = DateTime.UtcNow;
             if (AccountManager.LoginInfo != null)
             {
                 entity.ModifedBy = AccountManager.LoginInfo.UserId;
             }
         }
         else
         {
             entity = new tblSystem()
             {
                 strNamespace = ns,
                 strKey       = key,
                 strValue     = value,
                 LastModify   = DateTime.UtcNow
             };
             if (AccountManager.LoginInfo != null)
             {
                 entity.ModifedBy = AccountManager.LoginInfo.UserId;
             }
             context.tblSystems.Add(entity);
         }
         context.SaveChanges();
     }
 }
示例#3
0
        public static void create(tblAlertsQueue c)
        {
            try
            {
                BusProjectEntities db = new BusProjectEntities();
                c.id = 9999;

                db.SaveChanges();
            }
            catch
            {
            }
        }