Example #1
0
 public void MusteriAra(object sender, EventArgs e)
 {
     using (firmaEntities dc = new firmaEntities())
     {
         Goster(dc);
     }
 }
Example #2
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 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //if (!IsPostBack)
     //{
     using (firmaEntities dc = new firmaEntities())
     {
         Goster(dc);
     }
     //}
 }
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);
                    }
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!User.Identity.IsAuthenticated || !User.IsInRole("canEdit"))
     {
         System.Web.HttpContext.Current.Response.Redirect("/Account/Giris");
     }
     if (!IsPostBack)
     {
         using (firmaEntities dc = new firmaEntities())
         {
             var siradaki = dc.firmas.Where(x => String.IsNullOrEmpty(x.firma_kod)).OrderBy(x => x.id).FirstOrDefault();
             if (siradaki != null)
             {
                 txtConfig.Text = siradaki.config;
             }
         }
     }
 }
Example #6
0
        private void Goster(firmaEntities dc)
        {
            string tip = Request.QueryString["tip"];

            if (!string.IsNullOrEmpty(tip))
            {
                if (!string.IsNullOrEmpty(txtAra.Value))
                {
                    if (tip.Equals("aktif"))
                    {
                        GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null && x.firma_kod.Contains(txtAra.Value) && ((DateTime)x.expiration) > DateTime.Now).ToList();
                    }
                    else if (tip.Equals("pasif"))
                    {
                        GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null && x.firma_kod.Contains(txtAra.Value) && ((DateTime)x.expiration) < DateTime.Now).ToList();
                    }
                }
                else
                {
                    if (tip.Equals("aktif"))
                    {
                        GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null && ((DateTime)x.expiration) > DateTime.Now).ToList();
                    }
                    else if (tip.Equals("pasif"))
                    {
                        GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null && ((DateTime)x.expiration) < DateTime.Now).ToList();
                    }
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(txtAra.Value))
                {
                    GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null && x.firma_kod.Contains(txtAra.Value)).ToList();
                }
                else
                {
                    GridView1.DataSource = dc.firmas.Where(x => x.firma_kod != null).ToList();
                }
            }


            GridView1.DataBind();
        }
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
            }
        }
        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();
            }
        }