Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["id"]))
            {
                AddEdit = Convert.ToInt32(Request.QueryString["id"]);
            }
            else
            {
                AddEdit = 0;
            }

            if (!Page.IsPostBack)
            {
                if (AddEdit != 0)
                {
                    btnKaydet.Text = "Düzenle";
                    MUSTERI mst = MUSTERICRUD.IdyeGoreMUSTERIGetir(AddEdit);
                    tbK_Ad.Text  = mst.K_AD;
                    tbAd.Text    = mst.AD;
                    tbCep.Text   = mst.CEP_TEL;
                    tbTel.Text   = mst.TEL;
                    tbAdres.Text = mst.ADRES;
                }
                MUSGetir();
            }
        }
Exemplo n.º 2
0
 protected void btnKaydet_Click(object sender, EventArgs e)
 {
     try
     {
         MUSTERI mn = new MUSTERI();
         mn.K_AD    = tbK_Ad.Text;
         mn.AD      = tbAd.Text;
         mn.CEP_TEL = tbCep.Text;
         mn.TEL     = tbTel.Text;
         mn.ADRES   = tbAdres.Text;
         string sonuc = String.Empty;
         if (AddEdit == 0)
         {
             MUSTERICRUD.Kaydet(mn);
             sonuc = "Kaydetme";
             Temizle();
         }
         else
         {
             mn.ID = AddEdit;
             MUSTERICRUD.Guncelle(mn);
             sonuc = "Güncelleme";
         }
         Page.ClientScript.RegisterStartupScript(this.GetType(), "bilgi", "$.jGrowl('" + sonuc + " Başarılı" + "', { header: 'Sonuç' });", true);
         MUSGetir();
     }
     catch
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "bilgi", "$.jGrowl('" + "İşleminizde Hata Oluştu Lütfen Kontrol Ediniz!" + "', { header: 'Sonuç' });", true);
     }
 }
Exemplo n.º 3
0
        public bool Update(MusteriDetayDTO entity)
        {
            MUSTERI musteri = new MUSTERI();

            musteri.ID       = entity.ID;
            musteri.MusterAd = entity.MusteriAd;
            return(dao.Update(musteri));
        }
Exemplo n.º 4
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            MUSTERI musteri = db.MUSTERI.Find(id);

            db.MUSTERI.Remove(musteri);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        public bool Insert(MusteriDetayDTO entity)
        {
            MUSTERI musteri = new MUSTERI();

            musteri.MusterAd  = entity.MusteriAd;
            musteri.isDeleted = false;
            return(dao.Insert(musteri));
        }
Exemplo n.º 6
0
        public ActionResult Details(decimal id = 0)
        {
            MUSTERI musteri = db.MUSTERI.Find(id);

            if (musteri == null)
            {
                return(HttpNotFound());
            }
            return(View(musteri));
        }
Exemplo n.º 7
0
 public ActionResult Edit(MUSTERI musteri)
 {
     if (ModelState.IsValid)
     {
         db.Entry(musteri).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ILID = new SelectList(db.IL, "ID", "ILADI", musteri.ILID);
     return(View(musteri));
 }
Exemplo n.º 8
0
        public ActionResult Edit(decimal id = 0)
        {
            MUSTERI musteri = db.MUSTERI.Find(id);

            if (musteri == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ILID = new SelectList(db.IL, "ID", "ILADI", musteri.ILID);
            return(View(musteri));
        }
Exemplo n.º 9
0
        public ActionResult Create(MUSTERI musteri)
        {
            if (ModelState.IsValid)
            {
                db.MUSTERI.Add(musteri);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ILID = new SelectList(db.IL, "ID", "ILADI", musteri.ILID);
            return(View(musteri));
        }
Exemplo n.º 10
0
        public bool Delete(MusteriDetayDTO entity)
        {
            MUSTERI musteri = new MUSTERI();

            musteri.ID = entity.ID;
            dao.Delete(musteri);
            SATIM satis = new SATIM();

            satis.MusteriID = entity.ID;
            satisdao.Delete(satis);

            return(true);
        }
Exemplo n.º 11
0
        public static void Guncelle(MUSTERI p)
        {
            SQLiteCommand cm = DBCon.KomutOlustur("update MUSTERI set K_AD=@K_AD,AD=@AD,ADRES=@ADRES,CEP_TEL=@CEP_TEL,TEL=@TEL where ID=@ID");

            cm.Parameters.AddWithValue("@K_AD", p.K_AD);
            cm.Parameters.AddWithValue("@AD", p.AD);
            cm.Parameters.AddWithValue("@ADRES", p.ADRES);
            cm.Parameters.AddWithValue("@CEP_TEL", p.CEP_TEL);
            cm.Parameters.AddWithValue("@TEL", p.TEL);
            cm.Parameters.AddWithValue("@ID", p.ID);
            cm.Connection.Open();
            cm.ExecuteNonQuery();
            cm.Connection.Close();
        }
Exemplo n.º 12
0
        public static void Kaydet(MUSTERI p)
        {
            SQLiteCommand cm = DBCon.KomutOlustur("insert into MUSTERI(ID,K_AD,AD,ADRES,CEP_TEL,TEL)values (@ID,@K_AD,@AD,@ADRES,@CEP_TEL,@TEL)");

            cm.Parameters.AddWithValue("@ID", null);
            cm.Parameters.AddWithValue("@K_AD", p.K_AD);
            cm.Parameters.AddWithValue("@AD", p.AD);
            cm.Parameters.AddWithValue("@ADRES", p.ADRES);
            cm.Parameters.AddWithValue("@CEP_TEL", p.CEP_TEL);
            cm.Parameters.AddWithValue("@TEL", p.TEL);
            cm.Connection.Open();
            cm.ExecuteNonQuery();
            cm.Connection.Close();
        }
Exemplo n.º 13
0
        public static MUSTERI IdyeGoreMUSTERIGetir(int ID)
        {
            SQLiteDataAdapter da = new SQLiteDataAdapter("select * from MUSTERI where ID=@ID", DBCon.BaglantiYap());

            da.SelectCommand.Parameters.AddWithValue("@ID", ID);
            DataTable dt = new DataTable();

            da.Fill(dt);
            if (dt.Rows.Count != 0)
            {
                MUSTERI m = new MUSTERI();
                m.ID      = Convert.ToInt32(dt.Rows[0]["ID"]);
                m.K_AD    = Convert.ToString(dt.Rows[0]["K_AD"]);
                m.AD      = Convert.ToString(dt.Rows[0]["AD"]);
                m.ADRES   = Convert.ToString(dt.Rows[0]["ADRES"]);
                m.CEP_TEL = Convert.ToString(dt.Rows[0]["CEP_TEL"]);
                m.TEL     = Convert.ToString(dt.Rows[0]["TEL"]);
                return(m);
            }
            else
            {
                return(null);
            }
        }