private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtYayineviAdi.Text))
            {
                List <EPublisher> publisherList = BLLPublisher.GetAll();
                publisherList = (from l in publisherList
                                 where l.Name.Trim().ToLower().Equals(txtYayineviAdi.Text.Trim().ToLower())
                                 select l).ToList();
                if (publisherList.Count == 0)
                {
                    EPublisher publisher = new EPublisher();
                    publisher.Name = txtYayineviAdi.Text;

                    if (BLLPublisher.InsertNewPublisher(new EPublisher(0, txtYayineviAdi.Text)))
                    {
                        MessageBox.Show("Yeni yayınevi kayıt işlemi başarıyla tamamlanmıştır!");
                        txtYayineviAdi.Clear();
                        listBox1.DataSource = BLLPublisher.GetAll();
                        txtYayineviAdi.Focus();
                    }
                    else
                    {
                        MessageBox.Show("Bir hata oluştu!");
                    }
                }
                else
                {
                    MessageBox.Show("Kaydetmek istediğiniz yayınevi zaten kayıtlı!");
                }
            }
            else
            {
                MessageBox.Show("Yayınevi adı boş geçilemez!");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (Request.QueryString["ID"] != null)
            {
                EPublisher publisher = new EPublisher();
                publisher.ID = int.Parse(Request.QueryString["ID"]);
                bool sonuc = BLLPublisher.Delete(publisher);
                if (sonuc)
                {
                    Response.Write("<script>alert('Harika! Silindi!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('Hay Aksi! Silinemedi!')</script>");
                }
            }

            rptYayinevleri.DataSource = BLLPublisher.GetAll();
            rptYayinevleri.DataBind();

            if (Request.QueryString["scs"] != null)
            {
                int scsID = Convert.ToInt32(Request.QueryString["scs"].ToString());
                if (scsID == 1)
                {
                    Response.Write("<script>alert('Harika! Güncellendi!');</script>");
                }
            }
        }
        private void btnSil_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItems.Count > 0)
            {
                int          silinecekPublisherID = (int)listBox1.SelectedValue;
                DialogResult result = MessageBox.Show("Silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    EPublisher publisher = new EPublisher();

                    publisher.ID = silinecekPublisherID;
                    if (BLLPublisher.Delete(publisher))
                    {
                        MessageBox.Show("Silme işleminiz başarıyla tamamlanmıştır.");
                        listBox1.DataSource = BLLPublisher.GetAll();
                    }
                    else
                    {
                        MessageBox.Show("Bir hata oluştu!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Lütfen silmek istediğiniz yayınevini seçiniz!");
            }
        }
Example #4
0
        public void Update(EPublisher entity)
        {
            var collection = _database.GetCollection <EPublisher>(_collectionName);

            collection.ReplaceOneAsync(x => x.Id.Equals(entity.Id), entity, new UpdateOptions
            {
                IsUpsert = true
            });
        }
Example #5
0
        public static void Delete(EPublisher publisher)
        {
            SqlCommand cmd = new SqlCommand("spPublisher_Delete", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("publisherID", publisher.ID);
            Baglanti.conn.Open();
            cmd.ExecuteNonQuery();
            Baglanti.conn.Close();
        }
Example #6
0
        public static void InsertNewPublisher(EPublisher publisher)
        {
            SqlCommand cmd = new SqlCommand("spPublisher_Insert", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Name", publisher.Name);

            Baglanti.conn.Open();
            cmd.ExecuteNonQuery();
            Baglanti.conn.Close();
        }
        public ESeries CreateSeriesIfNotExists(string v, EPublisher publisher)
        {
            if (string.IsNullOrEmpty(v))
            {
                throw new ArgumentException("Name can not be empty", nameof(v));
            }

            return(DbContext.Set <ESeries>().FirstOrDefault(x => x.Name == v) ?? CreateEntity(new ESeries {
                Name = v, Publisher = publisher, CreatedDateTime = DateTime.Now
            }));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int publisherID = Convert.ToInt32(Request.QueryString["yayineviID"].ToString());

                EPublisher publisher = new EPublisher();
                publisher           = BLLPublisher.GetIdOnly(publisherID);
                txtYayineviAdi.Text = publisher.Name;
            }
        }
        public void UpdatePublisher(UpdatePublisherServiceRequest request)
        {
            var entity = new EPublisher
            {
                Id             = request.Id,
                Name           = request.Name,
                Series         = request.Series,
                UpdateDateTime = DateTime.Now
            };

            _publisherRepository.Update(entity);
        }
Example #10
0
 public static bool InsertNewPublisher(EPublisher publisher)
 {
     if (publisher.Name == "")
     {
         return(false);
     }
     else
     {
         DALPublisher.InsertNewPublisher(publisher);
         return(true);
     }
 }
        public void InsertPublisher(InsertPublisherServiceRequest request)
        {
            var entity = new EPublisher
            {
                Name           = request.Name,
                Series         = request.Series,
                CreateDateTime = DateTime.Now,
                UpdateDateTime = null
            };

            _publisherRepository.Insert(entity);
        }
Example #12
0
        public static EPublisher GetIdOnly(int publisherID)
        {
            SqlCommand cmd = new SqlCommand("spPublisher_GetIdOnly", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PublisherID", publisherID);
            Baglanti.conn.Open();
            SqlDataReader dr        = cmd.ExecuteReader();
            EPublisher    publisher = new EPublisher();

            while (dr.Read())
            {
                publisher.ID   = Convert.ToInt32(dr["ID"]);
                publisher.Name = dr["Name"].ToString();
            }
            dr.Close();
            Baglanti.conn.Close();
            return(publisher);
        }
Example #13
0
        public static List <EPublisher> GetAll()
        {
            SqlCommand cmd = new SqlCommand("spPublisher_GetAll", Baglanti.conn);

            Baglanti.conn.Open();
            SqlDataReader     dr     = cmd.ExecuteReader();
            List <EPublisher> pliste = new List <EPublisher>();

            while (dr.Read())
            {
                EPublisher p = new EPublisher();
                p.ID   = Convert.ToInt32(dr["ID"]);
                p.Name = dr["Name"].ToString();
                pliste.Add(p);
            }
            dr.Close();
            Baglanti.conn.Close();
            return(pliste);
        }
 protected void btnGuncelle_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtYayineviAdi.Text))
     {
         EPublisher guncellenecek = new EPublisher();
         guncellenecek.ID   = int.Parse(Request.QueryString["yayineviID"]);
         guncellenecek.Name = txtYayineviAdi.Text;
         bool sonuc = BLLPublisher.Update(guncellenecek);
         if (sonuc)
         {
             Response.Write("<script>alert('Harika! Güncellendi!');</script>");
             Response.Redirect("Yayinevleri.aspx?scs=1");
         }
         else
         {
             Response.Write("<script>alert('Hay Aksi! Hata Oluştu!')</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('Yayınevi adı boş geçilemez!')</script>");
     }
 }
Example #15
0
 public static bool Delete(EPublisher publisher)
 {
     DALPublisher.Delete(publisher);
     return(true);
 }
Example #16
0
 public static bool Update(EPublisher publisher)
 {
     DALPublisher.Update(publisher);
     return(true);
 }
Example #17
0
        public void Insert(EPublisher entity)
        {
            var collection = _database.GetCollection <EPublisher>(_collectionName);

            collection.InsertOne(entity);
        }