//  proses id ye göre proses değerlerini getir
        public List <ProsesDegerleri> ProsesDegeriListelewithProsesId(string pdId)
        {
            List <ProsesDegerleri> ProsesDegerList = new List <ProsesDegerleri>();

            using (SqlConnection connect = new SqlConnection(base.ConnectionString))
            {
                string sql = "SELECT Id,ProsesId,Gorev,Durum FROM ProsesDegerleri WHERE Silindi=0 AND ProsesId=@PROSESDEGER";
                connect.Open();

                SqlCommand command = new SqlCommand(sql, connect);
                command.Parameters.AddWithValue("@PROSESDEGER", pdId);
                SqlDataReader read = command.ExecuteReader();
                while (read.Read())
                {
                    ProsesDegerleri B = new ProsesDegerleri();
                    B.Id       = (int)read["Id"];
                    B.ProsesId = (int)read["ProsesId"];
                    B.Gorev    = (string)read["Gorev"];
                    B.Durum    = (Boolean)read["Durum"];

                    ProsesDegerList.Add(B);
                }
                connect.Close();
            }
            return(ProsesDegerList);
        }
        // proses değer güncellemek için buton
        protected void ProsesDegerGuncelleButton_Click(object sender, EventArgs e)
        {
            ProsesDegerleri pd        = new ProsesDegerleri();
            string          Proses_Id = Request.QueryString["P_Id"];

            pd.Id       = int.Parse(ProsesDegerId.Text);
            pd.Gorev    = GorevData.Value;
            pd.ProsesId = int.Parse(Proses_Id);

            bool result = base.Get_ProsesDeger_bl.ProsesDegeri_Guncelle(pd);

            if (result)
            {
                ProsesDegerEkleDiv.Visible    = false;
                ProsesDegerListeleDiv.Visible = true;
                // güncellemeden sonra proses id ye göre değer getiriyor.
                ProsesDegerDG.DataSource = base.Get_ProsesDeger_bl.ProsesDegeriListelewithProsesId(Proses_Id);
                ProsesDegerDG.DataBind();
                islem_basarili.Visible = true;
            }

            else
            {
                islem_basarisiz.Visible = true;
            }
        }
        public ProsesDegerleri Id_Ile_ProsesDegeri_Getir(string prosesDeger_id)
        {
            ProsesDegerleri B = new ProsesDegerleri();

            using (SqlConnection connect = new SqlConnection(base.ConnectionString))
            {
                string sql = "SELECT Id,ProsesId,Gorev,Durum FROM ProsesDegerleri WHERE Silindi=0  AND Id=@PROSESDEGER";
                connect.Open();

                SqlCommand command = new SqlCommand(sql, connect);

                command.Parameters.AddWithValue("@PROSESDEGER", prosesDeger_id);
                SqlDataReader read = command.ExecuteReader();
                while (read.Read())
                {
                    B.Id       = (int)read["Id"];
                    B.ProsesId = (int)read["ProsesId"];
                    B.Gorev    = (string)read["Gorev"];
                    B.Durum    = (Boolean)read["Durum"];
                }
                connect.Close();
            }

            return(B);
        }
        public bool ProsesDegeri_Guncelle(ProsesDegerleri ProsesDegeri)
        {
            bool result = false;

            using (SqlConnection connect = new SqlConnection(base.ConnectionString))
            {
                try
                {
                    string sql = "UPDATE ProsesDegerleri SET ProsesId=@PROSES,Gorev=@SERVICE WHERE Id=@ID";
                    connect.Open();

                    SqlCommand command = new SqlCommand(sql, connect);
                    command.Parameters.AddWithValue("@PROSES", ProsesDegeri.ProsesId);
                    command.Parameters.AddWithValue("@SERVICE", ProsesDegeri.Gorev);
                    command.Parameters.AddWithValue("@ID", ProsesDegeri.Id);
                    command.ExecuteNonQuery();

                    connect.Close();
                    result = true;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (connect.State == System.Data.ConnectionState.Open)
                    {
                        connect.Close();
                    }
                }

                return(result);
            }
        }
        public bool ProsesDegeri_Ekle(ProsesDegerleri P)
        {
            int id = 0;

            using (SqlConnection connect = new SqlConnection(base.ConnectionString))
            {
                string sql;
                try
                {
                    sql = "INSERT INTO  ProsesDegerleri (ProsesId,Gorev) OUTPUT INSERTED.Id VALUES(@PROSES,@SERVICE)";
                    connect.Open();

                    SqlCommand command = new SqlCommand(sql, connect);
                    command.Parameters.AddWithValue("@PROSES", P.ProsesId);
                    command.Parameters.AddWithValue("@SERVICE", P.Gorev);
                    id = (int)command.ExecuteScalar();

                    connect.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (connect.State == System.Data.ConnectionState.Open)
                    {
                        connect.Close();
                    }
                }
            }

            return(id > 0 ? true : false);
        }
        // proses değerleri listenmiş düzenle sil işlemleri
        protected void ProsesDegerlerDG_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "ProsesDeger_Duzenle")
            {
                string Proses_Id = Request.QueryString["P_Id"];
                Hosgeldiniz_label.Text = hesap_ismi + " -> <a href='islemler.aspx'>İşlemler</a> -> <a href='?Proses=listele'>Proses Listele</a> -> <a href='?ProsesDeger=listele&P_Id=" + Proses_Id + "'>Proses Deger Listele</a> -> <a href='#'>Proses Deger Güncelle</a>";
                string          id = ((Label)((DataGridItem)e.Item).FindControl("Label_pd_Id")).Text;
                ProsesDegerleri pd = base.Get_ProsesDeger_bl.Id_Ile_ProsesDegeri_Getir(id);
                ProsesDegerListeleDiv.Visible     = false;
                ProsesDegerEkleDiv.Visible        = true;
                ProsesDegerGuncelleButton.Visible = true;
                ProsesDegerId.Text = pd.Id.ToString();
                GorevData.Value    = pd.Gorev;
                // buradan güncelle butonuna gidiyor
            }

            if (e.CommandName == "ProsesDeger_Sil")
            {
                string id        = ((Label)((DataGridItem)e.Item).FindControl("Label_pd_Id")).Text;
                string Proses_Id = Request.QueryString["P_Id"];
                bool   result    = base.Get_ProsesDeger_bl.ProsesDegeri_Sil(id);//GetPGet_BirimSorumlusu_bl.BirimSorumlusu_Sil(id);

                if (result)
                {
                    islem_basarili.Visible        = true;
                    ProsesDegerListeleDiv.Visible = true;
                    // silme işleminden sonra ilgili proses ait değerlerin gelmesi için
                    ProsesDegerDG.DataSource = base.Get_ProsesDeger_bl.ProsesDegeriListelewithProsesId(Proses_Id);
                    ProsesDegerDG.DataBind();
                }
                else
                {
                    islem_basarisiz.Visible = true;
                }
            }
        }
        // proses değer kaydı yapılıyor
        protected void ProsesDegerKaydetButton_Click(object sender, EventArgs e)
        {
            try
            {
                string          Proses_Id = Request.QueryString["P_Id"];
                ProsesDegerleri pd        = new ProsesDegerleri();
                Deger_link.HRef = "?ProsesDeger=Ekle&P_Id=" + Proses_Id;
                pd.ProsesId     = int.Parse(Proses_Id);
                pd.Gorev        = GorevData.Value;

                bool result = base.Get_ProsesDeger_bl.ProsesDegeri_Ekle(pd);
                if (result)
                {
                    ProsesDegerEkleDiv.Visible = false;
                    Uyari_Division.Visible     = true;
                    Literal_Uyari.Text         = "<h2>Kayıt Başarılı bir şekilde gerçekleştirilmiştir.</h2>";
                    Response.Redirect("islemler.aspx?ProsesDeger=listele&P_Id=" + Proses_Id);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
        }
Example #8
0
 public bool ProsesDegeri_Guncelle(ProsesDegerleri deger)
 {
     return(base.ProsesDegerIslemleri.ProsesDegeri_Guncelle(deger));
 }
Example #9
0
 public bool ProsesDegeri_Ekle(ProsesDegerleri F)
 {
     return(base.ProsesDegerIslemleri.ProsesDegeri_Ekle(F));
 }