Exemple #1
0
        public ActionResult KullaniciOku(string Durum, string Key)
        {
            SonucModel <KullaniciAraModel> oSonucModel = new SonucModel <KullaniciAraModel>()
            {
                Durum = "H", Aciklama = ""
            };

            if (string.IsNullOrEmpty(Durum) && string.IsNullOrEmpty(Key))
            {
                oSonucModel.Aciklama = "Hatalı parametre";
                return(PartialView(oSonucModel));
            }
            else
            {
                string sSQL = "SELECT * FROM public.\"KULLANICI\"";
                sSQL += " where \"KullaniciKey\" = " + Key;
                DataSet ds = DBUtilPostger.VeriGetirDS(sSQL);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow           dr                 = ds.Tables[0].Rows[0];
                    int               KullaniciTipNo     = Convert.ToInt32(dr["KullaniciTipNo"]);
                    int               AktifPasifTipNo    = Convert.ToInt32(dr["AktifPasifTipNo"]);
                    KullaniciAraModel oKullaniciAraModel = new KullaniciAraModel()
                    {
                        KullaniciKey          = Convert.ToInt32(dr["KullaniciKey"]),
                        KullaniciAd           = dr["KullaniciAd"].ToString(),
                        Ad                    = dr["Ad"].ToString(),
                        Soyad                 = dr["Soyad"].ToString(),
                        KullaniciTipNo        = KullaniciTipNo,
                        KullaniciTipNoUzunAd  = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, KullaniciTipNo),
                        AktifPasifTipNo       = AktifPasifTipNo,
                        AktifPasifTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, AktifPasifTipNo)
                    };

                    List <KullaniciAraModel> aryKullaniciAraModel = new List <KullaniciAraModel>();
                    aryKullaniciAraModel.Add(oKullaniciAraModel);

                    oSonucModel.Durum = Durum;
                    oSonucModel.Data  = aryKullaniciAraModel;
                }
                else
                {
                    oSonucModel.Aciklama = "Kayıt bulunamadı";
                }
            }

            return(PartialView(oSonucModel));
        }
Exemple #2
0
        public JsonResult KullaniciAraSonuc(int SayfaKayitAdet, int AktifSayfaNo, int SiraTip, string SiraAlan, KullaniciModel oKullaniciModel)
        {
            // System.Threading.Thread.Sleep(2000);
            SonucModel <KullaniciAraModel> oSonucModel = new SonucModel <KullaniciAraModel>()
            {
                Durum = "H", Aciklama = ""
            };
            int ToplamKayitAdet = 0;

            ArgemSQL oSQL = new ArgemSQL();

            oSQL.CommandText =
                "select *, count(*) OVER() as \"Adet\" " +
                "from   public.\"KULLANICI\"";

            // string s = "ddsdf";
            // int i = Convert.ToInt32(s);

            if (!string.IsNullOrEmpty(oKullaniciModel.KullaniciAd))
            {
                oSQL.Gecen("KullaniciAd", oKullaniciModel.KullaniciAd);
            }
            else if (!string.IsNullOrEmpty(oKullaniciModel.Ad))
            {
                oSQL.Gecen("Ad", oKullaniciModel.Ad);
            }
            else if (!string.IsNullOrEmpty(oKullaniciModel.Soyad))
            {
                oSQL.Gecen("Soyad", oKullaniciModel.Soyad);
            }

            oSQL.Esit("KullaniciTipNo", oKullaniciModel.KullaniciTipNo, KolonTipi.Int, false);
            oSQL.Esit("AktifPasifTipNo", oKullaniciModel.AktifPasifTipNo, KolonTipi.Int, false);

            if (SiraAlan == "")
            {
                oSQL.OrderByAsc("Ad,Soyad");
            }
            else if (SiraTip == 1)
            {
                oSQL.OrderByAsc(SiraAlan);
            }
            else
            {
                oSQL.OrderByDesc(SiraAlan);
            }

            if (SayfaKayitAdet != 0 && AktifSayfaNo != 0)
            {
                oSQL.KayitSayisiLimit(SayfaKayitAdet, AktifSayfaNo);
            }

            using (DBUtil2 oData = new DBUtil2(DataBaseTipi.Yetki))
            {
                DataTable dt = new DataTable();
                oData.DataGetir(ref dt, oSQL);

                if (dt.Rows.Count > 0)
                {
                    ToplamKayitAdet = Convert.ToInt32(dt.Rows[0]["Adet"].ToString());

                    List <KullaniciAraModel> aryKullaniciAraModel = new List <KullaniciAraModel>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        int KullaniciTipNo  = Convert.ToInt32(dr["KullaniciTipNo"]);
                        int AktifPasifTipNo = Convert.ToInt32(dr["AktifPasifTipNo"]);
                        KullaniciAraModel oKullaniciAraModel = new KullaniciAraModel()
                        {
                            KullaniciKey          = Convert.ToInt32(dr["KullaniciKey"]),
                            KullaniciAd           = dr["KullaniciAd"].ToString(),
                            Ad                    = dr["Ad"].ToString(),
                            Soyad                 = dr["Soyad"].ToString(),
                            KullaniciTipNo        = KullaniciTipNo,
                            KullaniciTipNoUzunAd  = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, KullaniciTipNo),
                            AktifPasifTipNo       = AktifPasifTipNo,
                            AktifPasifTipNoUzunAd = CacheHelper.LookUzunAdGetir(CacheHelper.DatabaseTipNo.Yetki, AktifPasifTipNo)
                        };
                        aryKullaniciAraModel.Add(oKullaniciAraModel);
                    }

                    oSonucModel.Durum = "";
                    oSonucModel.Data  = aryKullaniciAraModel;
                }
                else
                {
                    oSonucModel.Aciklama = "Aradığınız kritere uygun kullanıcı kaydı bulunamadı";
                }

                oSonucModel.ToplamKayitAdet = ToplamKayitAdet;

                Stopwatch _stopwatch = (Stopwatch)TempData["ServerCalismaSure"];
                _stopwatch.Stop();
                oSonucModel.SCS = _stopwatch.ElapsedMilliseconds.ToString();

                return(Json(oSonucModel, JsonRequestBehavior.AllowGet));
            }
        }