Esempio n. 1
0
        public async Task <IActionResult> Putproje(long id, proje proje)
        {
            if (id != proje.proje_id)
            {
                return(BadRequest());
            }

            _context.Entry(proje).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!projeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <proje> > Postproje(proje proje)
        {
            _context.projeler.Add(proje);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getproje", new { id = proje.proje_id }, proje));
        }
Esempio n. 3
0
        public ActionResult ProjeDetay(int id)
        {
            proje projecik = projeRepository.idyegorecek(id);


            return(View(projecik));
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["kullaniciAdi"] == null)
            {
                Response.Redirect("Login.aspx");
                Response.End();
            }
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();
            string islemcik = Request.QueryString["islem"];

            if (islemcik == "sil")
            {
                int        silincekId = Convert.ToInt32(Request.QueryString["id"]);
                SqlCommand komut1     = new SqlCommand("Delete from projeler where id=" + silincekId, baglan);

                komut1.ExecuteNonQuery();
            }
            SqlCommand    komut             = new SqlCommand("select projeler.*, projeKategori.ad as kategori from projeler inner join projeKategori on projeler.kategoriId = projeKategori.id", baglan);
            SqlDataReader projedengelenveri = komut.ExecuteReader();

            while (projedengelenveri.Read())
            {
                proje projecik = new proje();
                projecik.id       = Convert.ToInt32(projedengelenveri["id"]);
                projecik.ad       = projedengelenveri["ad"].ToString();
                projecik.aciklama = projedengelenveri["aciklama"].ToString();
                projecik.resim    = projedengelenveri["resim"].ToString();
                projecik.kategori = projedengelenveri["kategori"].ToString();
                projecik.tarih    = Convert.ToDateTime(projedengelenveri["tarih"]);
                projeList.Add(projecik);
            }
            baglan.Close();
        }
Esempio n. 5
0
        public void ProjeGuncelleDb(proje gelen, HttpPostedFileBase projeResim, string yol)
        {
            string resimIsmi = "";

            if (projeResim != null && projeResim.ContentLength > 0)
            {
                resimIsmi = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + projeResim.FileName;
                var path = Path.Combine(yol, resimIsmi);
                projeResim.SaveAs(path);

                SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=Insaat;Integrated Security=true;");
                baglan.Open();
                SqlCommand komut = new SqlCommand("update proje set ad=@ad,aciklama=@acıklama,resim=@resimi,kategori=@kategorisi where id=" + gelen.id, baglan);
                komut.Parameters.Add("@ad", SqlDbType.NVarChar, 50).Value = gelen.ad;
                komut.Parameters.Add("@acıklama", SqlDbType.Text).Value   = gelen.aciklama;
                komut.Parameters.Add("@resimi", SqlDbType.Text).Value     = resimIsmi;
                komut.Parameters.Add("@kategorisi", SqlDbType.Int).Value  = gelen.kategori;
                komut.ExecuteNonQuery();
            }

            else
            {
                SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=Insaat;Integrated Security=true;");
                baglan.Open();
                SqlCommand komut = new SqlCommand("update proje set ad=@ad,aciklama=@acıklama,kategori=@kategorisi where id=" + gelen.id, baglan);
                komut.Parameters.Add("@ad", SqlDbType.NVarChar, 50).Value = gelen.ad;
                komut.Parameters.Add("@acıklama", SqlDbType.Text).Value   = gelen.aciklama;
                komut.Parameters.Add("@kategorisi", SqlDbType.Int).Value  = gelen.kategori;
                komut.ExecuteNonQuery();
            }
        }
    public uint projeyeAitCozulmemisHataSayisi(string projeIsmi)
    {
        proje p = new proje();

        projeIsmi = projeIsmi.ToUpper().Trim();

        return(p.projeyeAitCozulmemisHataSayisi(projeIsmi));
    }
Esempio n. 7
0
    protected void sil_Click(object sender, EventArgs e)
    {
        proje p = new proje();

        lblHata.Text = p.sil(Convert.ToUInt32(projeler.SelectedItem.Value), projeler.SelectedItem.Text);

        projeler.DataBind();
    }
        public ActionResult DeleteConfirmed(int id)
        {
            proje proje = db.projes.Find(id);

            db.projes.Remove(proje);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
        //
        // GET: /proje/Delete/5

        public ActionResult Delete(int id = 0)
        {
            proje proje = db.proje.Find(id);

            if (proje == null)
            {
                return(HttpNotFound());
            }
            return(View(proje));
        }
Esempio n. 10
0
 public ActionResult Edit(proje proje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(proje));
 }
Esempio n. 11
0
        /// <summary>
        /// projeden sorumlu kiþilere yeni bir ahat geldiðinde mail ile bildirim yapar
        /// </summary>
        /// <param name="hataId"></param>
        /// <param name="projeId"></param>
        /// <returns>0: baþarýlý
        /// 1: sorumlu kimse yok
        /// 2: exception</returns>
        public uint bildir(uint hataId, uint projeId)
        {
            string sql = "SELECT DISTINCT Kullanici.MAIL FROM KTip INNER JOIN Kullanici ON KTip.ID = Kullanici.TIPID INNER JOIN ProjeSorumlusu ON Kullanici.ID = ProjeSorumlusu.SORUMLUID INNER JOIN Proje ON Proje.ID = ProjeSorumlusu.PROJEID WHERE KTip.TIP = 'sorumlu' AND Proje.ID = " + projeId;

            proje  p         = new proje();
            string projeIsmi = p.isimGetir(projeId);

            DataSet ds = new DataSet();

            ds = db.fillDataset(sql);

            uint sonuc = 0;

            try
            {
                string fromEmail = "*****@*****.**";
                string fromName  = "Hata Takip Yazýlýmý";
                string mail      = projeIsmi + " projesine yeni bir hata eklendi.<br><br><a href=\"http://localhost/1/Incele.aspx?id=" + hataId + "\" target=\"_blank\">Buradan</a> eriþebilirsiniz.";
                mail += "<br><br>Hata Takip Yazýlýmý (2006)";

                SmtpClient  smtpClient  = new SmtpClient();
                MailMessage message     = new MailMessage();
                MailAddress fromAddress = new MailAddress(fromEmail, fromName);

                smtpClient.Host = "160.75.96.32";
                smtpClient.Port = 25;
                message.From    = fromAddress;

                if (ds.Tables[0].DefaultView.Table.Rows.Count != 0)
                {
                    for (int i = 0; i < ds.Tables[0].DefaultView.Table.Rows.Count; i++)
                    {
                        message.To.Add(ds.Tables[0].DefaultView.Table.Rows[i].ItemArray.GetValue(0).ToString());
                    }
                }
                else
                {
                    sonuc = 1;
                    return(sonuc);
                }
                message.Subject    = "Yeni bir hata var (" + projeIsmi + ")";
                message.IsBodyHtml = true;
                message.Body       = mail;
                smtpClient.Send(message);

                sonuc = 0;
            }
            catch (Exception ex)
            {
                string hata = ex.ToString();
                sonuc = 2;
            }

            return(sonuc);
        }
        public async Task <IActionResult> Edit(int id, [Bind("projeID,projeAdi,projeBasligi,imgFile,icerik")] proje proje, string fname)
        {
            if (id != proje.projeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string wwwRootPath = _hostEnvironment.WebRootPath;

                    string fileName  = Path.GetFileNameWithoutExtension(proje.imgFile.FileName);
                    string extension = Path.GetExtension(proje.imgFile.FileName);
                    proje.imgYol = fileName = fileName + DateTime.Now.ToString("yymmssffff") + extension;
                    //proje.imgYol = fileName = proje.imgFile.FileName;
                    string path = Path.Combine(wwwRootPath + "/resimler/", fileName);
                    proje.projeID = id;
                    using (var fileStream = new FileStream(path, FileMode.Create))
                    {
                        await proje.imgFile.CopyToAsync(fileStream);
                    }

                    var imgid = await _context.projes.FindAsync(id);

                    _context.projes.Remove(imgid);
                    fname = Path.Combine(wwwRootPath + "/resimler/", fileName);
                    FileInfo fi = new FileInfo(fname);
                    if (fi.Exists)
                    {
                        System.IO.File.Delete(fname);
                        fi.Delete();
                    }

                    createImage(proje);

                    _context.Update(proje);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!projeExists(proje.projeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(List)));
            }
            return(View(proje));
        }
Esempio n. 13
0
        public ActionResult ProjeGuncelleDb(proje gelen, HttpPostedFileBase projeResim)
        {
            if (Session["kullaniciAdi"] == null)
            {
                return(RedirectToAction("Giris", "Login"));
            }
            string yol = Server.MapPath("~/resimler/proje/");

            projeRepository.ProjeGuncelleDb(gelen, projeResim, yol);
            return(RedirectToAction("ProjeListele"));
        }
Esempio n. 14
0
        public ActionResult Create(proje proje)
        {
            if (ModelState.IsValid)
            {
                db.proje.Add(proje);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(proje));
        }
Esempio n. 15
0
 public ActionResult Edit([Bind(Include = "ID,miteahhitID,ad,adres,isSayisi,foto")] proje proje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.miteahhitID = new SelectList(db.muteahhit, "ID", "ad", proje.miteahhitID);
     return(View(proje));
 }
Esempio n. 16
0
        public ActionResult ProjeGuncelle(int?id)
        {
            if (Session["kullaniciAdi"] == null)
            {
                return(RedirectToAction("Giris", "Login"));
            }
            proje projecik = new proje();

            if (id.HasValue)
            {
                projecik = projeRepository.idyegorecek(id.Value);
            }
            return(View(projecik));
        }
Esempio n. 17
0
    protected void ekle_Click(object sender, EventArgs e)
    {
        projeismi.Text = projeismi.Text.Replace("'", " ");
        projeturu.Text = projeturu.Text.Replace("'", " ");

        proje p = new proje();

        lblHata.Text = p.ekle(projeismi.Text.Trim().ToUpper(), projeturu.Text.Trim().ToUpper());

        projeler.DataBind();

        projeismi.Text = "";
        projeturu.Text = "";
    }
 public ActionResult Edit([Bind(Include = "proje_id,kullanici_id,urun_id,tarih,yorum_id,resim,kategori_id")] proje proje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.kategori_id  = new SelectList(db.kategorilers, "kategori_id", "kategori_adi", proje.kategori_id);
     ViewBag.kullanici_id = new SelectList(db.kullanicilars, "kullanici_id", "ad_soyad", proje.kullanici_id);
     ViewBag.urun_id      = new SelectList(db.urunlers, "urun_id", "urun_adi", proje.urun_id);
     ViewBag.yorum_id     = new SelectList(db.yorums, "yorum_id", "icerik", proje.yorum_id);
     return(View(proje));
 }
        // GET: AdminProje/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            proje proje = db.projes.Find(id);

            if (proje == null)
            {
                return(HttpNotFound());
            }
            return(View(proje));
        }
        public async Task <IActionResult> Create(IFormFile file, [Bind("projeID,projeAdi,projeBasligi,imgFile,icerik")] proje proje)
        {
            if (ModelState.IsValid)
            {
                //save image to wwwroot/image
                createImage(proje);

                //Insert record
                _context.Add(proje);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(List)));
            }
            return(View(proje));
        }
        public async void createImage(proje proje)
        {
            string wwwRootPath = _hostEnvironment.WebRootPath;
            string fileName    = Path.GetFileNameWithoutExtension(proje.imgFile.FileName);
            string extension   = Path.GetExtension(proje.imgFile.FileName);

            proje.imgYol = fileName = fileName + DateTime.Now.ToString("yymmssffff") + extension;
            //proje.imgYol = fileName = proje.imgFile.FileName;
            string path = Path.Combine(wwwRootPath + "/resimler/", fileName);

            using (var fileStream = new FileStream(path, FileMode.Create))
            {
                await proje.imgFile.CopyToAsync(fileStream);
            }
        }
Esempio n. 22
0
        // GET: proje/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            proje proje = db.proje.Find(id);

            if (proje == null)
            {
                return(HttpNotFound());
            }
            ViewBag.miteahhitID = new SelectList(db.muteahhit, "ID", "ad", proje.miteahhitID);
            return(View(proje));
        }
Esempio n. 23
0
        public ActionResult Create([Bind(Include = "ID,miteahhitID,ad,adres,isSayisi,foto")] proje proje)
        {
            if (User.IsInRole("M2"))
            {
                var muteahhitdb = db.muteahhit.Where(x => x.hesap.mail == User.Identity.Name).FirstOrDefault();
                proje.miteahhitID = muteahhitdb.ID;
            }
            if (ModelState.IsValid)
            {
                db.proje.Add(proje);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.miteahhitID = new SelectList(db.muteahhit, "ID", "ad", proje.miteahhitID);
            return(View(proje));
        }
        // GET: AdminProje/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            proje proje = db.projes.Find(id);

            if (proje == null)
            {
                return(HttpNotFound());
            }
            ViewBag.kategori_id  = new SelectList(db.kategorilers, "kategori_id", "kategori_adi", proje.kategori_id);
            ViewBag.kullanici_id = new SelectList(db.kullanicilars, "kullanici_id", "ad_soyad", proje.kullanici_id);
            ViewBag.urun_id      = new SelectList(db.urunlers, "urun_id", "urun_adi", proje.urun_id);
            ViewBag.yorum_id     = new SelectList(db.yorums, "yorum_id", "icerik", proje.yorum_id);
            return(View(proje));
        }
Esempio n. 25
0
        public proje idyegorecek(int duzenlencekId)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=Insaat;Integrated Security=true;");

            baglan.Open();
            SqlCommand    komut             = new SqlCommand("Select * From proje where id=" + duzenlencekId, baglan);
            SqlDataReader projedengelenveri = komut.ExecuteReader();
            proje         projecik          = new proje();

            while (projedengelenveri.Read())
            {
                projecik.id       = Convert.ToInt32(projedengelenveri["id"]);
                projecik.ad       = projedengelenveri["ad"].ToString();
                projecik.aciklama = projedengelenveri["aciklama"].ToString();
                projecik.resim    = projedengelenveri["resim"].ToString();
                projecik.kategori = Convert.ToInt32(projedengelenveri["kategori"]);
            }
            return(projecik);
        }
Esempio n. 26
0
        public List <proje> Listele()
        {
            List <proje>  projeList = new List <proje>();
            SqlConnection baglan    = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=Insaat;Integrated Security=true;");

            baglan.Open();

            SqlCommand    komut             = new SqlCommand("select *from proje", baglan);
            SqlDataReader projedengelenveri = komut.ExecuteReader();

            while (projedengelenveri.Read())
            {
                proje projecik = new proje();
                projecik.id       = Convert.ToInt32(projedengelenveri["id"]);
                projecik.ad       = projedengelenveri["ad"].ToString();
                projecik.aciklama = projedengelenveri["aciklama"].ToString();
                projecik.resim    = projedengelenveri["resim"].ToString();
                projecik.kategori = Convert.ToInt32(projedengelenveri["kategori"]);
                projeList.Add(projecik);
            }

            return(projeList);
        }
Esempio n. 27
0
    public string[] projeleriListele()
    {
        DataSet ds = new DataSet();
        proje   p  = new proje();

        string[] projeler;                       //sonuçlarýn içine atýlacaðý dizi


        //veritabanýndan mevcut projelerin id lerini ve isimlerini çek
        ds = p.isimListesi();


        //proje varsa diziye alacaðýz
        if (ds.Tables[0].Rows.Count != 0)
        {
            //dizi için yer ayýr
            projeler = new string[ds.Tables[0].DefaultView.Table.Rows.Count];

            for (int j = 0; j < ds.Tables[0].DefaultView.Table.Rows.Count; j++)
            {
                string isim = ds.Tables[0].DefaultView.Table.Rows[j].ItemArray.GetValue(0).ToString();

                //her isim, döndürülecek projeler dizisinin bir elemaný
                projeler[j] = isim;
            }
        }
        //hiç proje yoksa dizi boþ olacak
        else
        {
            projeler = null;
        }


        //proje id ve isim listesini dondur
        return(projeler);
    }
Esempio n. 28
0
 internal Task UpdateAsync(proje proje)
 {
     throw new NotImplementedException();
 }