protected void btnDelete_Click(object sender, EventArgs e) { try { SLIDER rec = DALSlider.Get(Int32.Parse(Request.QueryString["ID"])); if (rec != null) { DALSlider.Delete(rec.ID); } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true); NotificationAdd(NotificationType.success, "Kayıt Silindi."); } catch (Exception ex) { if (ex is SqlException) { if ((ex as SqlException).Number == 547) { NotificationAdd(NotificationType.error, "Kayıt başka yerlerde kullanıdı."); } } else { throw ex; } } }
protected void btnSave_Click(object sender, EventArgs e) { if (ValidateItem()) { SLIDER rec = new SLIDER(); if (RECid > 0) { rec = DALSlider.Get(RECid); if (!string.IsNullOrEmpty(IMAGE)) { rec.IMAGE = IMAGE; } rec.MAINTEXT_TR = txtMottto.Text; rec.TITLE_TR = txtTitle.Text; DALSlider.Update(rec); } else { rec.IMAGE = IMAGE; rec.SORT = Convert.ToInt16(DALSlider.GetLastSort() + 1); rec.MAINTEXT_TR = txtMottto.Text; rec.TITLE_TR = txtTitle.Text; DALSlider.Insert(rec); } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true); btnDelete.Visible = false; btnCancel.Visible = false; } }
private void InitializePage() { if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { RECid = Convert.ToInt16(Request.QueryString["ID"]); SLIDER item = DALSlider.Get(RECid); if (item != null) { if (string.IsNullOrEmpty(item.IMAGE)) { tdImage.Visible = true; } else { tdImage.Visible = true; tdImagePreview.Visible = true; } imgImage.ImageUrl = Functions.SITEURL.PathAndQuery + "Admin/assets/images/" + item.IMAGE + "_s.jpg"; imgImage.Width = new Unit(GetPrameterValue("SLIDERADMINWIDTH")); imgImage.Height = new Unit(GetPrameterValue("SLIDERADMINHEIGHT")); txtMottto.Text = item.MAINTEXT_TR; txtTitle.Text = item.TITLE_TR; btnDelete.Visible = true; btnSave.Text = "Güncelle"; } } else { tdImage.Visible = true; } }
protected void rptrSlider_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "Down": { SLIDER self = DALSlider.Get(Int32.Parse(e.CommandArgument.ToString())); SLIDER upper = DALSlider.GetBySort(self.SORT + 1); self.SORT++; upper.SORT--; DALSlider.Update(self); DALSlider.Update(upper); fillSlider(); break; } case "Up": { SLIDER self = DALSlider.Get(Int32.Parse(e.CommandArgument.ToString())); SLIDER upper = DALSlider.GetBySort(self.SORT - 1); self.SORT--; upper.SORT++; DALSlider.Update(self); DALSlider.Update(upper); fillSlider(); break; } } }