Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        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;
            }
            }
        }