Пример #1
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Label IdLabel = e.Item.FindControl("IdLabel") as Label;
        int   id      = Convert.ToInt32(IdLabel.Text);

        if (e.CommandName == "sil")
        {
            bayi ur = bayi.Select(id);
            if (ur == null)
            {
                Labelbilgi.Text = "<p class='msg error'><b>KAYIT BULUNAMADI !</b></p>";
                return;
            }


            Result <int> sonuc = ur.Delete();

            if (sonuc.HasError)
            {
                Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
                return;
            }
            else
            {
                Labelbilgi.Text = "<p class='msg done'><b>BAŞARIYLA SİLİNDİ...</b></p>";
                AccessDataSource1.Select(DataSourceSelectArguments.Empty);
                ListView1.DataBind();
            }
        }
        else if (e.CommandName == "duzenle")
        {
            Response.Redirect("bayiler-duzenle.aspx?Id=" + id.ToString());
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request["Id"].ToString()))
            {
                int id = Convert.ToInt32(Request["Id"].ToString());

                bayi duzenle = bayi.Select(id);

                adiTextBox.Text = duzenle.Bayi_adi;

                Image1.ImageUrl = duzenle.Resim;

                aciklamaCKEditorControl.Text = duzenle.Bayi_aciklama;
            }
        }
    }
Пример #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request["Id"].ToString());

        bayi duzenle = bayi.Select(id);


        string resim = "", mesaj = "";

        if (FileUpload1.HasFile)
        {
            if (ClassBLL.resimKaydet(FileUpload1, "~/panel/imgUrun", 700, out resim, out mesaj))
            {
                Image1.ImageUrl = resim;
            }
            if (FileUpload1.HasFile && mesaj != "")
            {
                Labelbilgi.Text = mesaj;
                return;
            }
            resim = Image1.ImageUrl;
        }


        duzenle.Bayi_adi      = adiTextBox.Text;
        duzenle.Resim         = Image1.ImageUrl;
        duzenle.Bayi_aciklama = aciklamaCKEditorControl.Text;



        Result <int> sonuc = duzenle.Update();

        if (sonuc.HasError)
        {
            Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
            return;
        }
        else
        {
            Labelbilgi.Text = "<p class='msg done'><b>Kayıt Başarılı...</b></p>";
        }
    }
Пример #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string resim = "", mesaj = "";

        if (!FileUpload1.HasFile)
        {
            Labelbilgi.Text = "<p class='msg warning'><b>Resim Seçmelisiniz</b></p>";
            return;
        }

        if (ClassBLL.resimKaydet(FileUpload1, "~/panel/imgUrun", 700, out resim, out mesaj))
        {
            Image1.ImageUrl = resim;
        }
        if (FileUpload1.HasFile && mesaj != "")
        {
            Labelbilgi.Text = mesaj;
            return;
        }
        bayi yeni = new bayi();

        yeni.Bayi_adi = adiTextBox.Text;

        yeni.Resim = Image1.ImageUrl;

        yeni.Bayi_aciklama = aciklamaCKEditorControl.Text;


        Result <int> sonuc = yeni.Insert();

        if (sonuc.HasError)
        {
            Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
            return;
        }
        else
        {
            Response.Redirect("bayiler.aspx");
        }
    }