public static ENTPRJPROJECTTASKRESOURSEACTIVITY GetValueTaskResourseActivityForUpdate(Guid ID)//Aktivite güncellemek için verileri getirme { con = SQL.GetConnection(); cmd = SQL.SetCommand("SELECT * FROM PRJ_PROJECTTASKUSERACTIVITY WHERE ID=@ID", con); cmd.Parameters.AddWithValue("@ID", ID); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); ENTPRJPROJECTTASKRESOURSEACTIVITY activity = null; byte?resourseduration = null; while (dr.Read()) { if (!string.IsNullOrEmpty(dr["RESOURSEDURATION"].ToString())) { resourseduration = Convert.ToByte(dr["RESOURSEDURATION"].ToString()); } activity = new ENTPRJPROJECTTASKRESOURSEACTIVITY(Guid.Parse(dr["ID"].ToString()), resourseduration, dr["DESCRIPTION"].ToString(), Convert.ToDateTime(dr["DATE"].ToString()), Guid.Parse(dr["PROJECTTASKRESOURSEID"].ToString())); break; } con.Close(); return(activity); }
public static void UpdateActivity(ENTPRJPROJECTTASKRESOURSEACTIVITY activity) { con = SQL.GetConnection(); if (con.State == ConnectionState.Closed) { con.Open(); } cmd = SQL.SetCommand("UPDATE PRJ_PROJECTTASKUSERACTIVITY SET RESOURSEDURATION=@RESOURSEDURATION, DESCRIPTION=@DESCRIPTION, DATE=@DATE,PROJECTTASKRESOURSEID=@PROJECTTASKRESOURSEID WHERE ID=@ID", con); cmd.Parameters.AddWithValue("@ID", activity.ID); if (String.IsNullOrEmpty(activity.RESOURSEDURATION.ToString()))//RAYNARD { cmd.Parameters.AddWithValue("@RESOURSEDURATION", DBNull.Value); } else { cmd.Parameters.AddWithValue("@RESOURSEDURATION", activity.RESOURSEDURATION); } cmd.Parameters.AddWithValue("@DESCRIPTION", activity.DESCRIPTION); cmd.Parameters.AddWithValue("@DATE", activity.DATE); cmd.Parameters.AddWithValue("@PROJECTTASKRESOURSEID", activity.PROJECTTASKRESOURSEID); cmd.ExecuteNonQuery(); }
public static void InsertTable(ENTPRJPROJECTTASKRESOURSEACTIVITY activity) { try { con = SQL.GetConnection(); if (con.State == ConnectionState.Closed) { con.Open(); } cmd = SQL.SetCommand("INSERT INTO PRJ_PROJECTTASKUSERACTIVITY (ID,RESOURSEDURATION,DESCRIPTION,DATE,PROJECTTASKRESOURSEID) VALUES (@ID,@RESOURSEDURATION,@DESCRIPTION,@DATE,@PROJECTTASKRESOURSEID)", con); cmd.Parameters.AddWithValue("@ID", activity.ID); if (String.IsNullOrEmpty(activity.RESOURSEDURATION.ToString())) { cmd.Parameters.AddWithValue("@RESOURSEDURATION", DBNull.Value); } else { cmd.Parameters.AddWithValue("@RESOURSEDURATION", activity.RESOURSEDURATION); } cmd.Parameters.AddWithValue("@DESCRIPTION", activity.DESCRIPTION); cmd.Parameters.AddWithValue("@DATE", activity.DATE); cmd.Parameters.AddWithValue("@PROJECTTASKRESOURSEID", activity.PROJECTTASKRESOURSEID); cmd.ExecuteNonQuery(); } catch (Exception ex) { } finally { if (con.State == ConnectionState.Open) { con.Close(); } } }
public static List <ENTPRJPROJECTTASKRESOURSEACTIVITY> GetAllListTaskResoursesActivityID(Guid PROJECTTASKRESOURSEID) { con = SQL.GetConnection(); cmd = SQL.SetCommand("SELECT * FROM PRJ_PROJECTTASKUSERACTIVITY WHERE PROJECTTASKRESOURSEID=@PROJECTTASKRESOURSEID", con); cmd.Parameters.AddWithValue("@PROJECTTASKRESOURSEID", PROJECTTASKRESOURSEID); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); ENTPRJPROJECTTASKRESOURSEACTIVITY ptsk = null; byte?resourseduration = null; List <ENTPRJPROJECTTASKRESOURSEACTIVITY> ptsklist = new List <ENTPRJPROJECTTASKRESOURSEACTIVITY>(); while (dr.Read()) { if (!string.IsNullOrEmpty(dr["RESOURSEDURATION"].ToString())) { resourseduration = Convert.ToByte(dr["RESOURSEDURATION"].ToString()); } ptsk = new ENTPRJPROJECTTASKRESOURSEACTIVITY(Guid.Parse(dr["ID"].ToString()), resourseduration, dr["DESCRIPTION"].ToString(), Convert.ToDateTime(dr["DATE"].ToString()), Guid.Parse(dr["PROJECTTASKRESOURSEID"].ToString())); ptsklist.Add(ptsk); } con.Close(); return(ptsklist); }