Example #1
0
        private void goster()
        {
            if (drdDurum.SelectedValue != null)
            {
                string secilen = drdDurum.SelectedValue;


                string gonderen = "";
                string mesaj    = "";

                if (secilen.Equals("yaklasan_taksit"))
                {
                    using (Radius.radiusEntities dc = Radius.MyContext.Context(firma))
                    {
                        Radius.sms_ayars ayar = dc.sms_ayars.Where(x => x.tur == secilen).FirstOrDefault();

                        if (ayar != null)
                        {
                            gonderen = ayar.gonderen;
                            mesaj    = ayar.mesaj;
                            if (ayar.aktif == true)
                            {
                                chcAktif.Checked = true;
                            }
                            else
                            {
                                chcAktif.Checked = false;
                            }
                        }
                    }
                }
                else if (secilen.Equals("sec"))
                {
                    chcAktif.Checked = false;
                }
                else
                {
                    int id = Convert.ToInt32(drdDurum.SelectedValue);
                    using (Radius.radiusEntities dc = Radius.MyContext.Context(firma))
                    {
                        Radius.sms_ayars ayar = dc.sms_ayars.Where(x => x.iliski_id == id).FirstOrDefault();
                        if (ayar != null)
                        {
                            gonderen = ayar.gonderen;
                            mesaj    = ayar.mesaj;
                            if (ayar.aktif == true)
                            {
                                chcAktif.Checked = true;
                            }
                            else
                            {
                                chcAktif.Checked = false;
                            }
                        }
                    }
                }
                txtMesaj.Text    = mesaj;
                txtGonderen.Text = gonderen;
            }
        }
Example #2
0
        public void lisanla(int ay, Radius.radiusEntities dc)
        {
            //eski expire bugünden küçükse bugüne ekle
            //bugünden büyükse expirın üstüne ekle

            ayargenel ag      = dc.ayargenels.FirstOrDefault();
            DateTime? eskiExp = ag.lisanstarih;
            DateTime  yeniExp = DateTime.Now.AddMonths(ay);

            if (eskiExp != null && ((DateTime)eskiExp).Date > DateTime.Now.Date)
            {
                yeniExp = ((DateTime)eskiExp).AddMonths(ay);
            }
            if (calismatipi.Checked == true)
            {
                ag.calismatipi = true;
            }
            else
            {
                ag.calismatipi = false;
            }
            ag.kullanicisinir = Int32.Parse(kullanicisinir.Text);
            ag.makinesinir    = Int32.Parse(makinesinir.Text);


            ag.lisanstarih = yeniExp;
            dc.SaveChanges();
        }
Example #3
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("lisansla"))
            {
                string[] gelenler = e.CommandArgument.ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                hdnID.Value     = gelenler[0];
                hdnConfig.Value = gelenler[1];

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#editModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddShowModalScript2", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("sil"))
            {
                string        confirmValue = Request.Form["confirm_value"];
                List <string> liste        = confirmValue.Split(new char[] { ',' }).ToList();
                int           sayimiz      = liste.Count - 1;
                string        deger        = liste[sayimiz];

                if (deger == "Yes")
                {
                    string[] gelenler = e.CommandArgument.ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    hdnID.Value     = gelenler[0];
                    hdnConfig.Value = gelenler[1];

                    using (Radius.radiusEntities dc = Radius.MyContext.Context(hdnConfig.Value))
                    {
                        //ayargenele kayıt
                        lisanla(-12, dc);
                    }
                    using (firmaEntities df = new firmaEntities())
                    {
                        //firmasa kayıt
                        //göster
                        var f = df.firmas.FirstOrDefault(x => x.config == (hdnConfig.Value));
                        if (f != null)
                        {
                            f.expiration      = DateTime.Now.AddMonths(-12);
                            f.yenileme_tarihi = DateTime.Now;

                            df.SaveChanges();
                            Goster(df);

                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            sb.Append(@"<script type='text/javascript'>");
                            sb.Append(" alertify.error('Lisans iptal edildi');");
                            sb.Append("$('#editModal').modal('hide');");
                            sb.Append(@"</script>");
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript2", sb.ToString(), false);
                        }
                    }
                }
                //lisansı iptal etmek için lisans süresini geriye alacaz
            }
        }
Example #4
0
        protected void btnLisansKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtAy.Text))
            {
                using (Radius.radiusEntities dc = Radius.MyContext.Context(hdnConfig.Value))
                {
                    //ayargenele kayıt
                    lisanla(Int32.Parse(txtAy.Text), dc);
                }
                using (firmaEntities df = new firmaEntities())
                {
                    //firmasa kayıt
                    //göster
                    var f = df.firmas.FirstOrDefault(x => x.config == (hdnConfig.Value));
                    if (f != null)
                    {
                        DateTime eskiExp = (DateTime)f.expiration;
                        DateTime yeniExp = DateTime.Now.AddMonths(Int32.Parse(txtAy.Text));
                        if (eskiExp != null && ((DateTime)eskiExp).Date > DateTime.Now.Date)
                        {
                            yeniExp = ((DateTime)eskiExp).AddMonths(Int32.Parse(txtAy.Text));
                        }
                        f.expiration      = yeniExp;
                        f.yenileme_tarihi = DateTime.Now;
                        if (calismatipi.Checked == true)
                        {
                            f.calismatipi = true;
                        }
                        else
                        {
                            f.calismatipi = false;
                        }

                        f.kullanicisinir = Int32.Parse(kullanicisinir.Text);
                        f.makinesinir    = Int32.Parse(makinesinir.Text);

                        df.SaveChanges();
                        Goster(df);

                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        sb.Append(@"<script type='text/javascript'>");
                        sb.Append(" alertify.error('Kayıt yapıldı');");
                        sb.Append("$('#editModal').modal('hide');");
                        sb.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript2", sb.ToString(), false);
                    }
                }
            }
        }
Example #5
0
        public void lisanla(int ay, Radius.radiusEntities dc)
        {
            //eski expire bugünden küçükse bugüne ekle
            //bugünden büyükse expirın üstüne ekle

            ayargenel ag      = dc.ayargenels.FirstOrDefault();
            DateTime? eskiExp = ag.lisanstarih;
            DateTime  yeniExp = DateTime.Now.AddMonths(ay);

            if (eskiExp != null && ((DateTime)eskiExp).Date > DateTime.Now.Date)
            {
                yeniExp = ((DateTime)eskiExp).AddMonths(ay);
            }
            ag.lisanstarih = yeniExp;
            dc.SaveChanges();
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated || (!User.IsInRole("Admin") && !User.IsInRole("mudur")))
            {
                System.Web.HttpContext.Current.Response.Redirect("/Account/Giris");
            }
            string firma = KullaniciIslem.firma();
            //if (kullanici.UserName != "*****@*****.**")
            //{
            string     key = "panel-" + firma;
            PanelDetay p;

            if (Cache[key] != null)
            {
                p = (PanelDetay)Cache[key];
            }
            else
            {
                using (Radius.radiusEntities dc = Radius.MyContext.Context(firma))
                {
                    TekPanel pan = new TekPanel(dc);
                    p = pan.Goster();
                    Cache.Insert(key, p, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero);
                }
            }


            netBorc.InnerHtml      = p.netBorc.ToString("C");
            netAlacak.InnerHtml    = p.netAlacak.ToString("C");
            netBakiye.InnerHtml    = p.netBakiye.ToString("C");
            onayBekleyen.InnerHtml = p.onayBekleyen.ToString();
            servisSayisi.InnerHtml = p.servisSayisi.ToString();
            emanetSayisi.InnerHtml = p.emanetSayisi.ToString();
            musteriler.InnerHtml   = p.musteriSayisi.ToString() + " Adet";

            yaklasanOdeme.InnerHtml = p.yaklasanOdeme.ToString() + " Adet";
            kasa.InnerHtml          = p.kasaBakiye.ToString("C");
            bankahesap.InnerHtml    = p.bankaBakiye.ToString("C");
            poshesaplari.InnerHtml  = p.posBakiye.ToString("C");

            //}
        }
Example #7
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("lisansla"))
            {
                //string[] gelenler = e.CommandArgument.ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                string[] arg = new string[3];
                arg = e.CommandArgument.ToString().Split(';');

                hdnID.Value     = arg[0];
                hdnConfig.Value = arg[1];

                int         index = Convert.ToInt32(arg[2]);
                GridViewRow row   = GridView1.Rows[index];
                bool?       islem = Convert.ToBoolean(row.Cells[11].Text);
                int         kul   = Convert.ToInt32(row.Cells[12].Text);
                int         mak   = Convert.ToInt32(row.Cells[13].Text);
                if (islem == true)
                {
                    calismatipi.Checked = true;
                }
                else
                {
                    calismatipi.Checked = false;
                }

                makinesinir.Text    = mak.ToString();
                kullanicisinir.Text = kul.ToString();

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#editModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddShowModalScript2", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("admin"))
            {
                string config = e.CommandArgument.ToString();
                Response.Redirect("/AdminSuper/AdminDuzenle?config=" + config);
            }
            else if (e.CommandName.Equals("sil"))
            {
                string        confirmValue = Request.Form["confirm_value"];
                List <string> liste        = confirmValue.Split(new char[] { ',' }).ToList();
                int           sayimiz      = liste.Count - 1;
                string        deger        = liste[sayimiz];

                if (deger == "Yes")
                {
                    string[] gelenler = e.CommandArgument.ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    hdnID.Value     = gelenler[0];
                    hdnConfig.Value = gelenler[1];

                    using (Radius.radiusEntities dc = Radius.MyContext.Context(hdnConfig.Value))
                    {
                        //ayargenele kayıt
                        lisanla(-12, dc);
                    }
                    using (firmaEntities df = new firmaEntities())
                    {
                        //firmasa kayıt
                        //göster
                        var f = df.firmas.FirstOrDefault(x => x.config == (hdnConfig.Value));
                        if (f != null)
                        {
                            f.expiration      = DateTime.Now.AddMonths(-12);
                            f.yenileme_tarihi = DateTime.Now;

                            df.SaveChanges();
                            Goster(df);

                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            sb.Append(@"<script type='text/javascript'>");
                            sb.Append(" alertify.error('Lisans iptal edildi');");
                            sb.Append("$('#editModal').modal('hide');");
                            sb.Append(@"</script>");
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript2", sb.ToString(), false);
                        }
                    }
                }
                //lisansı iptal etmek için lisans süresini geriye alacaz
            }
        }
Example #8
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.Redirect("/Account/Giris");
            }
            //aqyery stringle tipe göre fatura makbuz vb bütün tasarım kayıtları burada yapılacak
            if (!IsPostBack)
            {
                string tip   = Request.QueryString["tip"];
                string firma = KullaniciIslem.firma();


                if (tip.Equals("fatura"))
                {
                    //fatura yolunu bulalım
                    bool?tek = false;
                    using (Radius.radiusEntities dc = Radius.MyContext.Context(KullaniciIslem.firma()))
                    {
                        AyarCurrent ay = new AyarCurrent(dc);
                        tek = ay.get().cift_taraf;
                    }
                    if (tek == true)
                    {
                        string     path   = "/Raporlar/" + KullaniciIslem.firma() + "fatura.repx";
                        string     yol    = Server.MapPath(path);
                        XtraReport report = new faturaX();
                        if (File.Exists(yol))
                        {
                            report.LoadLayout(yol);
                        }

                        ASPxReportDesigner1.OpenReport(report);
                    }
                    else
                    {
                        string     path   = "/Raporlar/" + KullaniciIslem.firma() + "faturaTek.repx";
                        string     yol    = Server.MapPath(path);
                        XtraReport report = new faturaTekX();
                        if (File.Exists(yol))
                        {
                            report.LoadLayout(yol);
                        }

                        ASPxReportDesigner1.OpenReport(report);
                    }
                }
                else if (tip.Equals("makbuz"))
                {
                    //fatura yolunu bulalım
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "makbuz.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new makbuzX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("servis"))
                {
                    //fatura yolunu bulalım
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "servis.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new baslamaX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("servis_maliyet"))
                {
                    //fatura yolunu bulalım
                    string path = "/Raporlar/" + KullaniciIslem.firma() + "servis_maliyet.repx";
                    string yol  = Server.MapPath(path);
                    ServisDAL.Raporlama.ServisMaliyetlerX report = new ServisDAL.Raporlama.ServisMaliyetlerX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("extre"))
                {
                    //fatura yolunu bulalım
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "extre.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new extreX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }


                else if (tip.Equals("gelirgider"))
                {
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "gelirgider.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new GelirGiderX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("gelirgiderozet"))
                {
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "gelirgiderozet.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new GelirGiderOzetX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }

                else if (tip.Equals("gelirgidergruplu"))
                {
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "gelirgidergruplu.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new GelirGiderGrupluX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("gelirgideraylik"))
                {
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "gelirgideraylik.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new GelirGiderAylikX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
                else if (tip.Equals("makineanaliz"))
                {
                    string     path   = "/Raporlar/" + KullaniciIslem.firma() + "makine.repx";
                    string     yol    = Server.MapPath(path);
                    XtraReport report = new makineX();
                    if (File.Exists(yol))
                    {
                        report.LoadLayout(yol);
                    }

                    ASPxReportDesigner1.OpenReport(report);
                }
            }
        }
Example #9
0
        protected void ASPxReportDesigner1_SaveReportLayout(object sender, SaveReportLayoutEventArgs e)
        {
            string tip   = Request.QueryString["tip"];
            string firma = KullaniciIslem.firma();


            if (tip.Equals("fatura"))
            {
                //fatura yolunu bulalım
                bool?ciftTaraf = false;
                using (Radius.radiusEntities dc = Radius.MyContext.Context(KullaniciIslem.firma()))
                {
                    AyarCurrent ay = new AyarCurrent(dc);
                    ciftTaraf = ay.get().cift_taraf;
                }
                if (ciftTaraf == true)
                {
                    string path = "/Raporlar/" + KullaniciIslem.firma() + "fatura.repx";
                    string yol  = Server.MapPath(path);
                    File.WriteAllBytes(yol, e.ReportLayout);
                }
                else
                {
                    string path = "/Raporlar/" + KullaniciIslem.firma() + "faturaTek.repx";
                    string yol  = Server.MapPath(path);
                    File.WriteAllBytes(yol, e.ReportLayout);
                }

                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("makbuz"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "makbuz.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("servis"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "servis.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("extre"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "extre.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("servis_maliyet"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "servis_maliyet.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }

            else if (tip.Equals("gelirgider"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "gelirgider.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("gelirgiderozet"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "gelirgiderozet.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("gelirgidergruplu"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "gelirgidergruplu.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("gelirgideraylik"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "gelirgideraylik.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
            else if (tip.Equals("makineanaliz"))
            {
                //fatura yolunu bulalım
                string path = "/Raporlar/" + KullaniciIslem.firma() + "makine.repx";
                string yol  = Server.MapPath(path);
                File.WriteAllBytes(yol, e.ReportLayout);
                ASPxWebControl.RedirectOnCallback("~/");
            }
        }
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            //ilk admini oluştur
            //ayargeneli kaydet
            //notification


            var    manager  = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
            string firmamiz = txtConfig.Text;
            string resimYol = "/Uploads/" + txtConfig.Text.ToLower() + ".png";
            var    user     = new ApplicationUser()
            {
                UserName = UserName.Text, Email = Email.Text, Firma = txtConfig.Text, Adres = Adres.Text, Tel = Telefon.Text, Web = Web.Text, TamFirma = TamFirma.Text, resimYol = resimYol
            };
            IdentityResult result = manager.Create(user, Password.Text);

            if (!manager.IsInRole(manager.FindByEmail(Email.Text).Id, "Admin"))
            {
                result = manager.AddToRole(manager.FindByEmail(Email.Text).Id, "Admin");
            }
            if (result.Succeeded)
            {
                using (Radius.radiusEntities dc = Radius.MyContext.Context(txtConfig.Text))
                {
                    //ayar geneli kaydet
                    Radius.ayargenel ay = new Radius.ayargenel();
                    ay.adi         = TamFirma.Text;
                    ay.adres       = Adres.Text;
                    ay.email       = Email.Text;
                    ay.fifo        = true;
                    ay.lisanstarih = DateTime.Now.AddMonths(Int32.Parse(txtAy.Text));
                    ay.tel         = Telefon.Text;
                    ay.web         = Web.Text;
                    dc.ayargenels.Add(ay);
                    dc.SaveChanges();
                }
                using (firmaEntities df = new firmaEntities())
                {
                    //firma kaydını oluştur
                    var f = df.firmas.Where(x => x.config == txtConfig.Text).FirstOrDefault();
                    if (f != null)
                    {
                        f.adres           = Adres.Text;
                        f.email           = Email.Text;
                        f.expiration      = DateTime.Now.AddMonths(Int32.Parse(txtAy.Text));
                        f.firma_kod       = Firma.Text;
                        f.firma_tam       = TamFirma.Text;
                        f.katilma_tarihi  = DateTime.Now;
                        f.web             = Web.Text;
                        f.tel             = Telefon.Text;
                        f.yenileme_tarihi = DateTime.Now;
                        df.SaveChanges();
                    }
                }

                Response.Redirect("/AdminSuper/Firmalar");
            }
            else
            {
                ErrorMessage.Text = result.Errors.FirstOrDefault();
            }
        }
Example #11
0
        private void kaydet()
        {
            if (drdDurum.SelectedValue != null)
            {
                string secilen = drdDurum.SelectedValue;


                if (secilen.Equals("yaklasan_taksit"))
                {
                    using (Radius.radiusEntities dc = Radius.MyContext.Context(firma))
                    {
                        Radius.sms_ayars ayarimiz = dc.sms_ayars.Where(x => x.tur == secilen).FirstOrDefault();
                        if (ayarimiz == null)
                        {
                            Radius.sms_ayars ayar = new Radius.sms_ayars();
                            ayar.tur       = secilen;
                            ayar.Firma     = firma;
                            ayar.gonderen  = txtGonderen.Text;
                            ayar.iliski_id = -1;
                            ayar.mesaj     = txtMesaj.Text;

                            ayar.kritik_gun = 1;
                            if (chcAktif.Checked == true)
                            {
                                ayar.aktif = chcAktif.Checked;
                            }
                            dc.sms_ayars.Add(ayar);
                        }
                        else
                        {
                            ayarimiz.gonderen  = txtGonderen.Text;
                            ayarimiz.iliski_id = -1;
                            ayarimiz.mesaj     = txtMesaj.Text;
                            if (chcAktif.Checked == true)
                            {
                                ayarimiz.aktif = chcAktif.Checked;
                            }
                        }

                        dc.SaveChanges();
                    }
                }
                else
                {
                    int id = Convert.ToInt32(drdDurum.SelectedValue);
                    using (radiusEntities dc = MyContext.Context(firma))
                    {
                        Radius.sms_ayars ayarimiz = dc.sms_ayars.Where(x => x.iliski_id == id).FirstOrDefault();

                        if (ayarimiz == null)
                        {
                            Radius.sms_ayars ayar = new Radius.sms_ayars();
                            ayar.tur       = "durum";
                            ayar.Firma     = firma;
                            ayar.gonderen  = txtGonderen.Text;
                            ayar.iliski_id = id;
                            ayar.mesaj     = txtMesaj.Text;

                            ayar.kritik_gun = 1;
                            if (chcAktif.Checked == true)
                            {
                                ayar.aktif = chcAktif.Checked;
                            }
                            dc.sms_ayars.Add(ayar);
                        }
                        else
                        {
                            ayarimiz.gonderen  = txtGonderen.Text;
                            ayarimiz.iliski_id = id;
                            ayarimiz.mesaj     = txtMesaj.Text;
                            if (chcAktif.Checked == true)
                            {
                                ayarimiz.aktif = chcAktif.Checked;
                            }
                        }

                        dc.SaveChanges();
                    }
                }
            }
        }