コード例 #1
0
        protected void rptrSlider_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Down":
            {
                MAINPAGESLIDER self  = DALMainPageSlider.Get(Int32.Parse(e.CommandArgument.ToString()));
                MAINPAGESLIDER upper = DALMainPageSlider.GetBySort(self.SORT + 1);
                self.SORT++;
                upper.SORT--;
                DALMainPageSlider.Update(self);
                DALMainPageSlider.Update(upper);
                fillSlider();
                break;
            }

            case "Up":
            {
                MAINPAGESLIDER self  = DALMainPageSlider.Get(Int32.Parse(e.CommandArgument.ToString()));
                MAINPAGESLIDER upper = DALMainPageSlider.GetBySort(self.SORT - 1);
                self.SORT--;
                upper.SORT++;
                DALMainPageSlider.Update(self);
                DALMainPageSlider.Update(upper);
                fillSlider();
                break;
            }
            }
        }
コード例 #2
0
 private void InitializePage()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         RECid = Convert.ToInt16(Request.QueryString["ID"]);
         MAINPAGESLIDER item = DALMainPageSlider.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"));
             txtAlt.Text                = item.ALT;
             txtMottto.Text             = item.MAINTEXT;
             txtTitle.Text              = item.TITLE;
             chkActive.Checked          = item.ISACTIVE;
             drpDirection.SelectedValue = item.DIRECTION;
             btnDelete.Visible          = true;
             btnSave.Text               = "Güncelle";
         }
     }
     else
     {
         tdImage.Visible = true;
     }
 }
コード例 #3
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         MAINPAGESLIDER rec = DALMainPageSlider.Get(Int32.Parse(Request.QueryString["ID"]));
         if (rec != null)
         {
             DALMainPageSlider.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;
         }
     }
 }
コード例 #4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateItem())
     {
         MAINPAGESLIDER rec = new MAINPAGESLIDER();
         if (RECid > 0)
         {
             rec = DALMainPageSlider.Get(RECid);
             if (!string.IsNullOrEmpty(IMAGE))
             {
                 rec.IMAGE = IMAGE;
             }
             rec.ALT       = txtAlt.Text;
             rec.ISACTIVE  = chkActive.Checked;
             rec.MAINTEXT  = txtMottto.Text;
             rec.TITLE     = txtTitle.Text;
             rec.DIRECTION = drpDirection.SelectedValue;
             DALMainPageSlider.Update(rec);
         }
         else
         {
             rec.IMAGE     = IMAGE;
             rec.SORT      = Convert.ToInt16(DALMainPageSlider.GetLastSort() + 1);
             rec.ALT       = txtAlt.Text;
             rec.ISACTIVE  = chkActive.Checked;
             rec.MAINTEXT  = txtMottto.Text;
             rec.TITLE     = txtTitle.Text;
             rec.DIRECTION = drpDirection.SelectedValue;
             DALMainPageSlider.Insert(rec);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         btnDelete.Visible = false;
         btnCancel.Visible = false;
     }
 }