Beispiel #1
0
        protected void rptrDiseases_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Down":
            {
                DISEASES self  = DALDiseases.Get(Int32.Parse(e.CommandArgument.ToString()));
                DISEASES upper = DALDiseases.GetBySort(self.SORT + 1);
                self.SORT++;
                upper.SORT--;
                DALDiseases.Update(self);
                DALDiseases.Update(upper);
                fillDiseases();
                break;
            }

            case "Up":
            {
                DISEASES self  = DALDiseases.Get(Int32.Parse(e.CommandArgument.ToString()));
                DISEASES upper = DALDiseases.GetBySort(self.SORT - 1);
                self.SORT--;
                upper.SORT++;
                DALDiseases.Update(self);
                DALDiseases.Update(upper);
                fillDiseases();
                break;
            }
            }
        }
Beispiel #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateItem())
     {
         DISEASES rec = new DISEASES();
         if (RECid > 0)
         {
             rec = DALDiseases.Get(RECid);
             if (!string.IsNullOrEmpty(IMAGE))
             {
                 rec.IMAGE = IMAGE;
             }
             rec.ALT      = txtAlt.Text;
             rec.ISACTIVE = chkActive.Checked;
             rec.MAINTEXT = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE    = txtTitle.Text;
             rec.URLSEO   = Code.Helper.SEOUrl(txtTitle.Text);
             DALDiseases.Update(rec);
         }
         else
         {
             rec.IMAGE    = IMAGE;
             rec.SORT     = Convert.ToInt16(DALDiseases.GetLastSort() + 1);
             rec.ALT      = txtAlt.Text;
             rec.ISACTIVE = chkActive.Checked;
             rec.MAINTEXT = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE    = txtTitle.Text;
             rec.URLSEO   = Code.Helper.SEOUrl(txtTitle.Text);
             DALDiseases.Insert(rec);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         btnDelete.Visible = false;
         btnCancel.Visible = false;
     }
 }
Beispiel #3
0
 private void InitializePage()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         RECid = Convert.ToInt16(Request.QueryString["ID"]);
         DISEASES item = DALDiseases.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;
             hdnDescription.Value = Server.HtmlDecode(item.MAINTEXT);
             txtTitle.Text        = item.TITLE;
             chkActive.Checked    = item.ISACTIVE;
             btnDelete.Visible    = true;
             btnSave.Text         = "Güncelle";
         }
     }
     else
     {
         tdImage.Visible = true;
     }
 }
Beispiel #4
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DISEASES rec = DALDiseases.Get(Int32.Parse(Request.QueryString["ID"]));
         if (rec != null)
         {
             DALDiseases.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;
         }
     }
 }