protected void btn_Click(object sender, EventArgs e) { TANIMIS IS = new TANIMIS(); if (db.TANIMIS.Any(i => i.AD_IS.ToUpper() == txtISADI.Text.ToUpper())) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('" + txtISADI.Text.ToString().ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız. !','fail');", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + txtISADI.Text.ToString().ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız.');", true); txtISADI.Text = string.Empty; } else { IS.AD_IS = txtISADI.Text.ToUpper(); IS.DURUM_IS = "Aktif"; db.TANIMIS.Add(IS); db.SaveChanges(); bind(); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Kayıt Eklendi!','succsess');", true); txtISADI.Text = string.Empty; } }
// POST api/<controller> public HttpResponseMessage Post([FromBody] UYGUNSUZLUK postUygunsuzluk) { if (postUygunsuzluk != null) { if (postUygunsuzluk.TESPIT_TARIH > DateTime.Now || postUygunsuzluk.TESPIT_TARIH > postUygunsuzluk.TERMIN_TARIH) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Uygunsuzluk Tespit Tarihi Bugündenden(" + DateTime.Now.ToShortDateString() + ") sonra olamaz.")); } else { db.UYGUNSUZLUK.Add(postUygunsuzluk); if (db.SaveChanges() > 0) { return(Request.CreateResponse(HttpStatusCode.Created, postUygunsuzluk)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Uygunsuzluk Ekleme İşlemi Yapılamadı!")); } } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Uygunsuzluk Ekleme İşlemi Yapılamadı! Bilgilerin Doğru bir şekilde doldurulduğundan emin olun")); } }
protected void btnEKLE_Click(object sender, EventArgs e) { BIRIM newBirim = new BIRIM(); if (db.BIRIM.Any(i => i.AD_BIRIM.ToUpper() == txtBirimAd.Text.ToUpper())) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('" + txtBirimAd.Text.ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız. !','fail');", true); } else { try { newBirim.AD_BIRIM = txtBirimAd.Text.ToUpper();; db.BIRIM.Add(newBirim); db.SaveChanges(); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('" + txtBirimAd.Text.ToUpper() + " eklendi !','succsess');", true); txtBirimAd.Text = string.Empty; grdBIRIM.DataSource = db.BIRIM.ToList(); grdBIRIM.DataBind(); } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Hay Aksi! Beklenmedik bir hata oluştu :(','fail');", true); txtBirimAd.Text = string.Empty; } } }
protected void btnNewVardiya_Click(object sender, EventArgs e) { //ISTANIM1 IS = new ISTANIM1(); VARDIYA newVardiya = new VARDIYA(); string vardiyaBaslangic = txtbaslangicSaat.Text; string vardiyaBitis = txtBitisSaat.Text; //ISTANIM IS = new ISTANIM(); string vardiyaFinal = vardiyaBaslangic + "/" + vardiyaBitis; newVardiya.AD_VARDIYA = vardiyaFinal; newVardiya.DURUM_VARDIYAa = "Aktif"; if (db.VARDIYA.Any(i => i.AD_VARDIYA.ToUpper() == vardiyaFinal.ToUpper())) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('" + vardiyaFinal.ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız. !','fail');", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + txtISADI.Text.ToString().ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız.');", true); } else { db.VARDIYA.Add(newVardiya); db.SaveChanges(); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Kayıt Eklendi!','succsess');", true); bind(); } }
protected void btnUygunsuzlukSave_Click(object sender, EventArgs e) { try { UYGUNSUZLUK yeniUyg = new UYGUNSUZLUK(); yeniUyg.TUR = ddlTur.Text; yeniUyg.BIRIM = ddlBirim.SelectedValue; yeniUyg.TESPIT_TARIH = Convert.ToDateTime(dtpTespitTarih.Text); yeniUyg.UYGUNSUZ_DURUM = txtUygnsuzDurum.Text; yeniUyg.ONERI_AKSIYON = txtAksiyon.Text; yeniUyg.TESPIT_EDEN_AD = ddlTespitEden.SelectedValue; yeniUyg.SORUMLU_AD = ddlSorumlu.SelectedValue; yeniUyg.AKTIFLIK = "Aktif"; yeniUyg.TERMIN_TARIH = Convert.ToDateTime(dateTerminTarihi.Text); db.UYGUNSUZLUK.Add(yeniUyg); if (db.SaveChanges() > 0) { MODUL_MAILAYAR mailOnay = new MODUL_MAILAYAR(); mailOnay = db.MODUL_MAILAYAR.FirstOrDefault(i => i.ID_MODUL == 2); MailSend ms = new MailSend(); PERSONEL per = new PERSONEL(); string fullad = ddlSorumlu.Text; string[] parce = fullad.Split(' '); string ad = parce[0]; per = db.PERSONEL.FirstOrDefault(i => i.PERSONEL_AD.ToUpper() == ad.ToUpper()); string MudahilMail = per.EMAIL; string mail = "<table width="100%" border="0" cellspacing="0"> <tbody> <tr> <td align="center" valign="top" style="background-color: #f0f0f0; padding: 20px"> <table width="100%" border="0" cellspacing="0" style="box-sizing: border-box;"> <tbody> <tr> <td style="background-color: #4791d2; border-bottom: 2px solid #367fbe; height: 6px;"></td> </tr> <tr> <td style="background-color: #fff; text-align: left; padding: 20px;"> <p style="font-family: Tahoma; font-size: 12px"> Sayın " + ddlSorumlu.SelectedValue + ",<br /> <br /> Adınıza uygunsuzluk kaydı oluşturulmuştur. Aşağıdaki tablodan detayları inceleyebilirsiniz. </p> <table style="width: 100%; border-width: 1px; border-style: solid; border-collapse: collapse; font-size: 10pt; font-family: Tahoma;" bordercolor="black"> <tbody> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Tespit Tarihi</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;"> " + dtpTespitTarih.Text + " </td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Termin Tarihi</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + dateTerminTarihi.Text + " </td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #F7FBFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Birim</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;"> " + ddlBirim.SelectedValue + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Uygunsuz Durum</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;"> " + txtUygnsuzDurum.Text + " </td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #F7FBFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Önerilen Aksiyon </td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;"> " + txtAksiyon.Text + " </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Tür</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlTur.SelectedValue + " </td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Tespit Eden</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlTespitEden.SelectedValue + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Sorumlu</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlSorumlu.Text + "</td> </tr> </tbody> </table> </td> </tr> <tr> <td style="background-color: #4791d2; border-top: 2px solid #367fbe; height: 6px;"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table>"; ms.MailGonder(mailOnay.YENI_KAYIT, MudahilMail, "Uygunsuzluk Bildirim Maili", HttpUtility.HtmlDecode(mail).ToString()); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Uygunsuzluk Eklendi','succsess');", true); bind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Uygunsuzluk Kaydı Oluşturulamadı','fail');", true); } } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Hay Aksi! Beklenmedik bir hata oluştu :(','fail');", true); } }
protected void btnLokasyonSave_Click(object sender, EventArgs e) { LOKASYONN newLocation = new LOKASYONN(); newLocation.AD_LOKASYON = txtLOKASYON_AD.Text; newLocation.ACIKLAMA_LOKASYON = txtAciklama.Text; newLocation.SEHIR_LOKASYON = ddlSehir.Text; newLocation.KROKI_LOKASYON = imgKroki.FileName.ToString(); db.LOKASYONN.Add(newLocation); db.SaveChanges(); grdLOKASYON.DataBind(); imgKroki.PostedFile.SaveAs(Server.MapPath("~/upload/") + imgKroki.FileName.ToString()); Response.Write("<script>alert('Lokasyon Eklenmiştir..');window.location = 'LOKASYON.aspx';</script>"); }
protected void btnNewUser_Click(object sender, EventArgs e) { try { if (!db.PERSONEL.Any(i => i.KULLANICI_ADI == txtUsername.Text)) { string a = ddllist.Text; ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + a + "');", true); PERSONEL per = new PERSONEL(); per = db.PERSONEL.FirstOrDefault(i => i.PERSONEL_AD + " " + i.PERSONEL_SOYAD == ddlPersonel.Text); per.KULLANICI_ADI = txtUsername.Text; per.UNVAN_PERSONEL = ddlUnvan.Text; per.Rol = ckblProfil.SelectedValue; per.BIRIM_PERSONEL = ckblBirim.SelectedValue; per.LOKASYON_PERSONEL = ddlLokasyon.Text; if (db.SaveChanges() > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Yeni Kullanıcı Eklendi!','succsess');", true); Bind(); //grdKullanici.DataSource = db.PERSONEL.Where(i => i.Rol != null).ToList(); //grdKullanici.DataBind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Kayıt esnasında bir hata oluştu.','fail');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Bu kullanıcı adına sahip kullanıcı halihazırda mevcut.','fail');", true); } } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Hay Aksi :( Beklenedik bir hata oluştu..','fail');", true); } }
protected void btnNewKategori_Click(object sender, EventArgs e) { try { KATEGORI newKategori = new KATEGORI(); //ISTANIM IS = new ISTANIM(); newKategori.AD_KATEGORI = txtKategoriAdi.Text.ToUpper(); newKategori.DURUM = "Aktif"; if (db.KATEGORI.Any(i => i.AD_KATEGORI == txtKategoriAdi.Text)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('" + txtKategoriAdi.Text.ToString().ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız. !','fail');", true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + txtISADI.Text.ToString().ToUpper() + " Kayıtlarda Var.. Ekleme işlemi başarısız.');", true); txtKategoriAdi.Text = string.Empty; } else { db.KATEGORI.Add(newKategori); db.SaveChanges(); bind(); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Kayıt Eklendi!','succsess');", true); txtKategoriAdi.Text = string.Empty; } } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Hay Aksi! Beklenmedik bir hata oluştu :(','fail');", true); } //ISTANIM1 IS = new ISTANIM1(); }
protected void btnEKLE_Click(object sender, EventArgs e) { try { BILDIRIMLVL1 yeniBildirim = new BILDIRIMLVL1(); string tarih = txtTarih.Text; string saat = txtSaat.Text; string Date = tarih + " " + saat; yeniBildirim.TARIHSAAT = Date; yeniBildirim.VARDIYA = ddlVardiya.Text; yeniBildirim.PERSONEL_AD = ddlBildirimYapan.Text; yeniBildirim.BIRIM = ddlBirim.Text; yeniBildirim.KATEGORI = ddlKategori.Text; yeniBildirim.LOKASYON = ddlLokasyon.Text; yeniBildirim.ONLEMBOOL = ddlOnlemBool.Text; yeniBildirim.ACIKLAMA = txtBildirimMetin.Text; yeniBildirim.AKSIYON = txtAksiyon.Text; yeniBildirim.GORSEL = imgBildirim.FileName.ToString(); yeniBildirim.MUDAHIL_PERSONEL = ddlMudahilPerson.Text; yeniBildirim.DURUM = "Aktif"; yeniBildirim.BILDIRIM_DURUM = "Onay Bekliyor"; uygunsuzlukEkle(kontrol); imgBildirim.PostedFile.SaveAs(Server.MapPath("~/upload/") + imgBildirim.FileName.ToString()); db.BILDIRIMLVL1.Add(yeniBildirim); if (db.SaveChanges() > 0) { MODUL_MAILAYAR mailOnay = new MODUL_MAILAYAR(); mailOnay = db.MODUL_MAILAYAR.FirstOrDefault(i => i.ID_MODUL == 1); MailSend ms = new MailSend(); PERSONEL per = new PERSONEL(); string fullad = ddlMudahilPerson.Text; string[] parce = fullad.Split(' '); string ad = parce[0]; per = db.PERSONEL.FirstOrDefault(i => i.PERSONEL_AD == ad); string MudahilMail = per.EMAIL; string c = "<table width="100%" border="0" cellspacing="0"> <tbody> <tr> <td align="center" valign="top" style="background-color: #f0f0f0; padding: 20px"> <table width="100%" border="0" cellspacing="0" style="box-sizing: border-box;"> <tbody> <tr> <td style="background-color: #4791d2; border-bottom: 2px solid #367fbe; height: 6px;"></td> </tr> <tr> <td style="background-color: #fff; text-align: left; padding: 20px;"> <p style="font-family: Tahoma; font-size: 12px"> Sayın " + ddlMudahilPerson.Text + ",<br /> Seviye 1 İSG Bildiriminde Müdahil Personel Olarak Atandınız. </p> <table style="width: 100%; border-width: 1px; border-style: solid; border-collapse: collapse; font-size: 10pt; font-family: Tahoma;" bordercolor="black"> <tbody> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Tarih ve Saat</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + Date + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #F7FBFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Lokasyon</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlLokasyon.Text + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Birim</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlBirim.Text + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #F7FBFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Kategori</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlKategori.Text + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Vardiya</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlVardiya.Text + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Bildiren Personel</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + ddlBildirimYapan.Text + "</td> </tr> <tr style="width: 100%; border: 1px solid black; border-collapse: collapse; background-color: #FFFFFF;"> <td style="width: 20%; border: 1px solid black; border-collapse: collapse; text-align: left; font-weight: bold;">Bildirim Metni</td> <td style="width: 80%; border: 1px solid black; border-collapse: collapse; text-align: left;">" + txtBildirimMetin.Text + "</td> </tr> </tbody> </table> </td> </tr> <tr> <td style="background-color: #4791d2; border-top: 2px solid #367fbe; height: 6px;"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table>"; ms.MailGonder(mailOnay.YENI_KAYIT, MudahilMail, "Seviye-1 İSG Bildirimi", HttpUtility.HtmlDecode(c).ToString()); ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Bildirim Eklendi','succsess');", true); bind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction(Hay Aksi :('Bildirim Kaydı Oluşturulamadı'fail');", true); } } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction(Hay Aksi :(','fail');", true); } }