Exemple #1
0
        public static Kullanici Giris(string kullaniciadi, string parola, string platform, string platformToken, string deviceId = "")

        {
            string ip        = ContextObject.Current.Connection.RemoteIpAddress.ToString();
            string port      = ContextObject.Current.Connection.RemotePort.ToString();
            string userAgent = ContextObject.Current.Request.Headers["User-Agent"].ToString();

            Kullanici kullanici = new Kullanici();

            Sql.GetInstance().Set("sp_kullanici_giris", new List <object> {
                kullaniciadi, parola, ip, port, userAgent, platform, platformToken, deviceId
            }, (ds) =>
            {
                if (ds.Tables.Count <= 0)
                {
                    return;
                }

                if (ds.Tables[0].Rows.Count <= 0)
                {
                    return;
                }

                if (!"SUCCEED".Equals(ds.Tables[0].Rows[0].GetString("Result")))
                {
                    return;
                }

                kullanici = Parse(ds.Tables[0].Rows[0]);

                if (ds.Tables.Count > 1)
                {
                    foreach (DataRow row in ds.Tables[1].Rows)
                    {
                        kullanici.Yetkiler.Add(Yetki.Parse(row));
                    }
                }

                if (Platform.WEB.ToLower().Equals(platform.ToLower()))
                {
                    string sessionId = string.IsNullOrEmpty(Config.Get("Logging:SessionId")) ? "LogId" : Config.Get("Logging:SessionId");

                    ContextObject.Current.Session.SetString("Kullanici", JsonConvert.SerializeObject(kullanici));
                    ContextObject.Current.Session.SetString(sessionId, kullanici.Id.ToString());
                }

                Sql.ResetInstance();
            });



            return(kullanici);
        }
Exemple #2
0
 public static string Olustur(Yetki param)
 {
     return(Sql.GetInstance().Get("sp_yetki_olustur", new List <object> {
         Kullanici.Oturum().Id,
         param.Platform,
         param.Controller,
         param.Action,
         param.Label
     }, (row) => {
         return row.GetString("Result");
     }));
 }
        public static KullaniciGrup Detay(int id)
        {
            KullaniciGrup kullaniciGrup = new KullaniciGrup();

            Sql.GetInstance().Set("sp_kullanici_grup_detay", new List <object> {
                Kullanici.Oturum().Id, id
            }, (ds) =>
            {
                kullaniciGrup = Parse(ds.Tables[0].Rows[0]);

                if (ds.Tables.Count <= 1)
                {
                    return;
                }

                foreach (DataRow row in ds.Tables[1].Rows)
                {
                    kullaniciGrup.YetkiListesi.Add(Yetki.Parse(row));
                }
            });

            return(kullaniciGrup);
        }