Esempio n. 1
0
 public int AddParca(Parca p)
 {
     db.Parcas.Add(p);
     p.KayitTarihi = DateTime.Now;
     p.KayitEden   = Environment.UserName;
     return(db.SaveChanges());
 }
Esempio n. 2
0
        public int moveParca(int pid, int kid)
        {
            Parca pd = db.Parcas.Where(x => x.Id == pid).FirstOrDefault();

            pd.Kategori_Id     = kid;
            db.Entry(pd).State = System.Data.Entity.EntityState.Modified;
            return(db.SaveChanges());
        }
Esempio n. 3
0
        public int SaveParca(Parca p)
        {
            Parca pd = db.Parcas.Where(x => x.Id == p.Id).FirstOrDefault();

            pd.KayitTarihi = DateTime.Now;
            pd.KayitEden   = Environment.UserName;

            db.Entry(pd).State = System.Data.Entity.EntityState.Modified;
            return(db.SaveChanges());
        }
Esempio n. 4
0
        void getVeri()
        {
            richTextBox1.Text = textBox1.Text = tsl.Text = "";
            if (bListBoxEdit == true || bMove == true || listBox1.SelectedItem == null)
            {
                return;
            }
            Parca p = srv.GetParca(((bbItems)listBox1.SelectedItem).Value);

            tsl.Text          = textBox1.Text = p.Aciklama;
            tsl.Text         += "   (" + p.KayitTarihi + " => " + p.KayitEden + ")";
            richTextBox1.Text = p.Veri.Trim(' ');
        }
Esempio n. 5
0
 public ActionResult Duzenle(Parca prc)
 {
     using (OtoContext ptx = new OtoContext())
     {
         ptx.Entry(prc).State = EntityState.Modified;
         int sonuc = ptx.SaveChanges();
         if (sonuc > 0)
         {
             return(RedirectToAction("Index"));
         }
         return(View());
     }
 }
Esempio n. 6
0
        private void saveToolStripButton_Click(object sender, EventArgs e)
        {
            #region veriKontrol
            if (treeView1.SelectedNode.Tag == null)
            {
                tsl.Text = "Önce Bir Kategori Seçmelisiz.";
                return;
            }
            if (string.IsNullOrEmpty(richTextBox1.Text))
            {
                tsl.Text = "Kod Paneli boş olamaz.";
                return;
            }
            if (string.IsNullOrEmpty(textBox1.Text.Trim()) || textBox1.Text.Trim() == "Başlık Giriniz")
            {
                tsl.Text = "Kod için bir başlık/açıklama girmelisiz";
                return;
            }
            #endregion

            if (bListBoxEdit == false)
            {
                p          = srv.GetParca(((bbItems)listBox1.SelectedItem).Value);
                p.Aciklama = textBox1.Text.Trim();
                p.Veri     = richTextBox1.Text;
                if (srv.SaveParca(p) != 0)
                {
                    tsl.Text = "Bilgiler Başarıyla Güncellendi.";
                }
                bListBoxEdit = true;
            }
            else
            {
                p             = new Parca();
                p.Aciklama    = textBox1.Text.Trim();
                p.Veri        = richTextBox1.Text;
                p.Kategori_Id = (int)treeView1.SelectedNode.Tag;

                if (srv.AddParca(p) != 0)
                {
                    listBox1.Items.Insert(0, p.Aciklama);
                    richTextBox1.Text = textBox1.Text = "";
                    tsl.Text          = "Bilgiler Başarıyla Eklendi.";
                }
                bListBoxEdit     = false;
                textBox1.Enabled = bListBoxEdit;
                listBox1.Enabled = !bListBoxEdit;
            }
        }
Esempio n. 7
0
 public bool Ekle(Parca p)
 {
     if (ModelState.IsValid)
     {
         using (OtoContext ptx = new OtoContext())
         {
             ptx.Parcalar.Add(p);
             int sonuc = ptx.SaveChanges();
             if (sonuc > 0)
             {
                 return(true);
             }
         }
     }
     else
     {
         ModelState.AddModelError("ParcaId", "Bos");
     }
     return(false);
 }