protected void btnKrediKaydet_Click(object sender, EventArgs e)
        {
            string cusid = Request.QueryString["custID"];

            if (!string.IsNullOrEmpty(cusid))
            {
                using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma()))
                {
                    Abonelik a  = new Abonelik(dc);
                    int      id = Int32.Parse(drdPaketDuzen.SelectedValue);

                    decimal fiyat  = Decimal.Parse(txtFiyat.Text);
                    int     gun    = Int32.Parse(txtGun.Text);
                    int     adet   = Int32.Parse(txtPeriyot.Text);
                    int     custid = Int32.Parse(cusid);

                    DateTime islem_tarihi = DateTime.Now;
                    if (!String.IsNullOrEmpty(tarih2.Value))
                    {
                        islem_tarihi = DateTime.Parse(tarih2.Value);
                    }


                    customer cust = a.KrediYukleToplu(custid, id, adet, fiyat, gun, islem_tarihi, User.Identity.Name);
                    if (chcSms.Checked == true)
                    {
                        MesajGonder(dc, cust);
                    }
                    if (chcPesin.Checked == true)
                    {
                        pesin_tahsilat(dc, islem_tarihi, fiyat, "Peşin kredi yükleme", custid);

                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        sb.Append(@"<script type='text/javascript'>");
                        sb.Append(" alertify.success('Kredi yüklendi!');");
                        sb.Append(" alertify.error('Nakit tahsilat!');");
                        sb.Append("$('#editModalKredi').modal('hide');");
                        sb.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript4", sb.ToString(), false);
                    }
                    else
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        sb.Append(@"<script type='text/javascript'>");
                        sb.Append(" alertify.success('Kredi yüklendi!');");
                        sb.Append("$('#editModalKredi').modal('hide');");
                        sb.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript4", sb.ToString(), false);
                    }
                }
            }
        }
        protected void btnKrediIptal_Click(object sender, EventArgs e)
        {
            string cusid = Request.QueryString["custID"];

            if (!string.IsNullOrEmpty(cusid))
            {
                using (radiusEntities dc = MyContext.Context(KullaniciIslem.firma()))
                {
                    Abonelik a = new Abonelik(dc);

                    int custid = Int32.Parse(cusid);

                    a.SonFaturaIptal(custid);

                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append(" alertify.error('Son kredi yükleme iptal edildi!');");
                    sb.Append("$('#editModalKredi').modal('hide');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript4", sb.ToString(), false);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                System.Web.HttpContext.Current.Response.Redirect("/Account/Giris.aspx");
            }


            using (radiusEntities dc = MyContext.Context(firma))
            {
                goster(dc);
                if (!IsPostBack)
                {
                    Abonelik a = new Abonelik(dc);
                    drdPaketDuzen.AppendDataBoundItems = true;
                    drdPaketDuzen.DataSource           = a.paketler();
                    drdPaketDuzen.DataTextField        = "paket_adi";
                    drdPaketDuzen.DataValueField       = "paket_id";
                }
            }


            if (User.IsInRole("servis"))
            {
                btnTahsilat.Visible = false;
                btnOde.Visible      = false;
                btnExtre.Visible    = false;
                btnFatura.Visible   = false;

                panelOdeme.Visible = false;
                panelAlim.Visible  = false;
            }
            else if (User.IsInRole("dukkan"))
            {
                btnFatura.Visible = false;
            }
        }