Example #1
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            EEmployees silinecekEmployee = (EEmployees)dataGridView1.SelectedRows[0].DataBoundItem;

            if (silinecekEmployee != null)
            {
                DialogResult result = MessageBox.Show("Silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    EEmployees employee = new EEmployees();
                    employee.ID = silinecekEmployee.ID;

                    if (BLLEmployees.Delete(employee))
                    {
                        MessageBox.Show("Silme işleminiz başarıyla tamamlanmıştır.");
                        dataGridView1.DataSource = BLLEmployees.GetAll();
                    }
                    else
                    {
                        MessageBox.Show("Bir hata oluştu!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Lütfen silmek istediğiniz personeli seçiniz!");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (Request.QueryString["ID"] != null)
            {
                EEmployees member = new EEmployees();
                member.ID = int.Parse(Request.QueryString["ID"]);
                bool sonuc = BLLEmployees.Delete(member);
                if (sonuc)
                {
                    Response.Write("<script>alert('Harika! Silindi!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('Hay Aksi! Silinemedi!')</script>");
                }
            }

            rptPersoneller.DataSource = BLLEmployees.GetAll();
            rptPersoneller.DataBind();

            if (Request.QueryString["scs"] != null)
            {
                int scsID = Convert.ToInt32(Request.QueryString["scs"].ToString());
                if (scsID == 1)
                {
                    Response.Write("<script>alert('Harika! Güncellendi!');</script>");
                }
            }
        }
        public static List <EEmployees> GetAll()
        {
            SqlCommand cmd = new SqlCommand("spEmployees_GetAll", Baglanti.conn);

            Baglanti.conn.Open();
            SqlDataReader     dr     = cmd.ExecuteReader();
            List <EEmployees> eliste = new List <EEmployees>();

            while (dr.Read())
            {
                EEmployees e = new EEmployees();
                e.ID        = Convert.ToInt32(dr["ID"]);
                e.TCNo      = dr["TC No"].ToString();
                e.FirstName = dr["FirstName"].ToString();
                e.LastName  = dr["LastName"].ToString();
                e.FullName  = e.FirstName + " " + e.LastName;
                e.Phone     = dr["Phone"].ToString();
                e.Address   = dr["Adres"].ToString();
                e.UserName  = dr["UserName"].ToString();
                e.Password  = dr["Password"].ToString();
                eliste.Add(e);
            }
            dr.Close();
            Baglanti.conn.Close();
            return(eliste);
        }
        public static void Delete(EEmployees employee)
        {
            SqlCommand cmd = new SqlCommand("spEmployees_Delete", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("employeeID", employee.ID);
            Baglanti.conn.Open();
            cmd.ExecuteNonQuery();
            Baglanti.conn.Close();
        }
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtKullaniciAdi.Text) & !string.IsNullOrEmpty(txtSifre.Text))
            {
                if (txtTCNo.Text.Length == 11)
                {
                    List <EEmployees> employeeeList = BLLEmployees.GetAll();

                    employeeeList = (from l in employeeeList
                                     where l.TCNo.Trim().ToLower().Equals(txtTCNo.Text.Trim().ToLower())
                                     select l).ToList();

                    if (employeeeList.Count == 0)
                    {
                        EEmployees member = new EEmployees();
                        member.TCNo      = txtTCNo.Text;
                        member.FirstName = txtAdi.Text;
                        member.LastName  = txtSoyadi.Text;
                        member.Phone     = txtCepNo.Text;
                        member.Address   = txtAdres.Text;
                        member.UserName  = txtKullaniciAdi.Text;
                        member.Password  = txtSifre.Text;

                        if (BLLEmployees.InsertNewEmployee(member))
                        {
                            Response.Write("<script>alert('Personel kayıt işleminiz başarıyla gerçekleşmiştir.')</script>");
                        }
                        else
                        {
                            Response.Write("<script>alert('Hata Oluştu!')</script>");
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('Kaydetmek istediğiniz personel zaten kayıtlı!')</script>");
                    }
                    txtTCNo.Text         = String.Empty;
                    txtAdi.Text          = String.Empty;
                    txtSoyadi.Text       = String.Empty;
                    txtCepNo.Text        = String.Empty;
                    txtAdres.Text        = String.Empty;
                    txtKullaniciAdi.Text = String.Empty;
                    txtSifre.Text        = String.Empty;
                    txtTCNo.Focus();
                }
                else
                {
                    Response.Write("<script>alert('TC Kimlik Numarası 11 hane olmalıdır!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>");
            }
        }
Example #6
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            seciliPersonel = (EEmployees)dataGridView1.SelectedRows[0].DataBoundItem;

            txtTCNo.Text     = seciliPersonel.TCNo;
            txtAdi.Text      = seciliPersonel.FirstName;
            txtSoyadi.Text   = seciliPersonel.LastName;
            txtCepNo.Text    = seciliPersonel.Phone;
            txtAdres.Text    = seciliPersonel.Address;
            txtUserName.Text = seciliPersonel.UserName;
        }
Example #7
0
 public static bool InsertNewEmployee(EEmployees employee)
 {
     if (employee.TCNo == "" || employee.FirstName == "" || employee.LastName == "" || employee.Phone == "")
     {
         return(false);
     }
     else
     {
         DALEmployees.InsertNewEmployee(employee);
         return(true);
     }
 }
Example #8
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtUserName.Text) & !string.IsNullOrEmpty(txtPassword.Text))
            {
                if (txtTCNo.Text.Length == 11)
                {
                    List <EEmployees> employeeList = BLLEmployees.GetAll();
                    employeeList = (from l in employeeList
                                    where l.TCNo.Trim().ToLower().Equals(txtTCNo.Text.Trim().ToLower())
                                    select l).ToList();

                    if (employeeList.Count == 0)
                    {
                        EEmployees employee = new EEmployees();
                        employee.TCNo      = txtTCNo.Text;
                        employee.FirstName = txtAdi.Text;
                        employee.LastName  = txtSoyadi.Text;
                        employee.Phone     = txtCepNo.Text;
                        employee.Address   = txtAdres.Text;
                        employee.UserName  = txtUserName.Text;
                        employee.Password  = txtPassword.Text;

                        bool sonuc = BLLEmployees.InsertNewEmployee(employee);
                        if (sonuc)
                        {
                            MessageBox.Show("Yeni personel kaydı başarıyla tamamlanmıştır!");
                            dataGridView1.DataSource = BLLEmployees.GetAll();
                            Clear();
                        }
                        else
                        {
                            MessageBox.Show("Bir hata oluştu!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Aynı TC kimlik numarasına sahip personel zaten kayıtlıdır!");
                    }
                }
                else
                {
                    MessageBox.Show("TC kimlik numarası 11 haneli olmalıdır!");
                }
            }
            else
            {
                MessageBox.Show("Eksik bilgi girdiniz. Lütfen kontrol ediniz!");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int personelID = Convert.ToInt32(Request.QueryString["personelID"].ToString());

                EEmployees employee = new EEmployees();
                employee             = BLLEmployees.GetIdOnly(personelID);
                txtAdi.Text          = employee.FirstName;
                txtSoyadi.Text       = employee.LastName;
                txtTCNo.Text         = employee.TCNo;
                txtCepNo.Text        = employee.Phone;
                txtAdres.Text        = employee.Address;
                txtKullaniciAdi.Text = employee.UserName;
            }
        }
Example #10
0
        public static void InsertNewEmployee(EEmployees employee)
        {
            SqlCommand cmd = new SqlCommand("spEmployees_Insert", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TCNo", employee.TCNo);
            cmd.Parameters.AddWithValue("@FirstName", employee.FirstName);
            cmd.Parameters.AddWithValue("@LastName", employee.LastName);
            cmd.Parameters.AddWithValue("Phone", employee.Phone);
            cmd.Parameters.AddWithValue("Adres", employee.Address);
            cmd.Parameters.AddWithValue("UserName", employee.UserName);
            cmd.Parameters.AddWithValue("Password", employee.Password);

            Baglanti.conn.Open();
            cmd.ExecuteNonQuery();
            Baglanti.conn.Close();
        }
Example #11
0
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            if (seciliPersonel != null)
            {
                if (txtTCNo.Text.Length == 11)
                {
                    if (!string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtUserName.Text) & !string.IsNullOrEmpty(txtPassword.Text))
                    {
                        EEmployees personel = new EEmployees();
                        personel.ID        = Convert.ToInt32(seciliPersonel.ID);
                        personel.TCNo      = txtTCNo.Text;
                        personel.FirstName = txtAdi.Text;
                        personel.LastName  = txtSoyadi.Text;
                        personel.Phone     = txtCepNo.Text;
                        personel.Address   = txtAdres.Text;
                        personel.UserName  = txtUserName.Text;
                        personel.Password  = txtPassword.Text;

                        bool sonuc = BLLEmployees.Update(personel);
                        if (sonuc)
                        {
                            MessageBox.Show("Güncelleme başarılı!");
                            dataGridView1.DataSource = BLLEmployees.GetAll();
                            Clear();
                        }
                        else
                        {
                            MessageBox.Show("Güncelleme başarısız oldu!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Eksik bilgi girdiniz. Lütfen kontrol ediniz!");
                    }
                }
                else
                {
                    MessageBox.Show("TC Kimlik numarası 11 haneli olmalıdır!");
                }
            }
            else
            {
                MessageBox.Show("Güncelleme işlemi yapmak istediğiniz personelin üzerine çift tıklayarak seçiniz.");
            }
        }
Example #12
0
        public static List <EEmployees> GetMemberNames()
        {
            SqlCommand cmd = new SqlCommand("spEmployees_GetNames", Baglanti.conn);

            Baglanti.conn.Open();
            SqlDataReader     dr     = cmd.ExecuteReader();
            List <EEmployees> mliste = new List <EEmployees>();

            while (dr.Read())
            {
                EEmployees e = new EEmployees();
                e.ID       = Convert.ToInt32(dr["ID"]);
                e.FullName = dr["FullName"].ToString();
                mliste.Add(e);
            }
            dr.Close();
            Baglanti.conn.Close();
            return(mliste);
        }
        public IActionResult Edit(EmployeeRequest oModel)
        {
            Respuesta oRespuesta = new Respuesta();
            string    modo;

            try
            {
                EEmployees oEmployees = BEmployees.Getemployee(modo = "L", oModel.Id);
                oEmployees.EmployeeName   = oModel.EmployeeName;
                oEmployees.EmployeeSalary = oModel.EmployeeSalary;
                oEmployees.EmployeeAge    = oModel.EmployeeAge;
                BEmployees.crud(modo      = "U", oEmployees);
                oRespuesta.Exito          = 1;
            }
            catch (Exception ex)
            {
                oRespuesta.Mensaje = ex.Message;
            }
            return(Ok(oRespuesta));
        }
Example #14
0
        protected void btnGirisYap_Click(object sender, EventArgs e)
        {
            List <EEmployees> userList = BLLEmployees.GetAll();
            string            userName = txtKullaniciAdi.Text;
            string            password = txtSifre.Text;

            if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password))
            {
                if (userList != null && userList.Count() > 0)
                {
                    userList = (from l in userList
                                where l.UserName.Trim().ToLower().Equals(userName.Trim().ToLower()) &&
                                l.Password.Trim().ToLower().Equals(password.Trim().ToLower())
                                select l).ToList <EEmployees>();
                    if (userList != null && userList.Count() > 0)
                    {
                        EEmployees user = new EEmployees();
                        user = userList.FirstOrDefault();
                        Session.Add("UserName", user.FullName);

                        Response.Redirect("Default.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('Kullanıcı adı yada şifreyi yanlış girdiniz!')</script>");
                        txtKullaniciAdi.Text = String.Empty;
                        txtSifre.Text        = String.Empty;
                    }
                }
                else
                {
                    Response.Write("<script>alert('Sisteme kayıtlı kullanıcı bulunamadı!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Kullanıcı adı yada şifre boş geçilemez!')</script>");
                txtSifre.Text = String.Empty;
            }
        }
 protected void btnGuncelle_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtKullaniciAdi.Text) & !string.IsNullOrEmpty(txtSifre.Text))
     {
         if (txtTCNo.Text.Length == 11)
         {
             EEmployees guncellenecek = new EEmployees();
             guncellenecek.ID        = int.Parse(Request.QueryString["personelID"]);
             guncellenecek.TCNo      = txtTCNo.Text;
             guncellenecek.FirstName = txtAdi.Text;
             guncellenecek.LastName  = txtSoyadi.Text;
             guncellenecek.Phone     = txtCepNo.Text;
             guncellenecek.Address   = txtAdres.Text;
             guncellenecek.UserName  = txtKullaniciAdi.Text;
             guncellenecek.Password  = txtSifre.Text;
             bool sonuc = BLLEmployees.Update(guncellenecek);
             if (sonuc)
             {
                 Response.Write("<script>alert('Harika! Güncellendi!');</script>");
                 Response.Redirect("Personeller.aspx?scs=1");
             }
             else
             {
                 Response.Write("<script>alert('Hay Aksi! Hata Oluştu!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('TC kimlik numarası 11 haneli olmalıdır!')</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>");
     }
 }
Example #16
0
        public static EEmployees GetIdOnly(int employeeID)
        {
            SqlCommand cmd = new SqlCommand("spEmployees_GetIdOnly", Baglanti.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@EmployeeID", employeeID);
            Baglanti.conn.Open();
            SqlDataReader dr       = cmd.ExecuteReader();
            EEmployees    employee = new EEmployees();

            while (dr.Read())
            {
                employee.ID        = Convert.ToInt32(dr["ID"]);
                employee.TCNo      = dr["TC No"].ToString();
                employee.FirstName = dr["FirstName"].ToString();
                employee.LastName  = dr["LastName"].ToString();
                employee.Phone     = dr["Phone"].ToString();
                employee.Address   = dr["Adres"].ToString();
                employee.UserName  = dr["UserName"].ToString();
            }
            dr.Close();
            Baglanti.conn.Close();
            return(employee);
        }
Example #17
0
 public static bool Delete(EEmployees employee)
 {
     DALEmployees.Delete(employee);
     return(true);
 }
Example #18
0
 public static bool Update(EEmployees employee)
 {
     DALEmployees.Update(employee);
     return(true);
 }