public static void InsertTable(ENTREQREQUESTS rqst) { try { con = SQL.GetConnection(); if (con.State == ConnectionState.Closed) { con.Open(); } cmd = SQL.SetCommand("INSERT INTO REQ_REQUEST (ID,PROJECTID,NAME,TYPEREQUESTID,USERID,REQUESTDATE,DESCRIPTION) VALUES (@ID,@PROJECTID,@NAME,@TYPEREQUESTID,@USERID,@REQUESTDATE,@DESCRIPTION)", con); cmd.Parameters.AddWithValue("@ID", rqst.ID); cmd.Parameters.AddWithValue("@PROJECTID", rqst.PROJECTID); cmd.Parameters.AddWithValue("@NAME", rqst.NAME); cmd.Parameters.AddWithValue("@TYPEREQUESTID", rqst.TYPEREQUESTID); cmd.Parameters.AddWithValue("@USERID", rqst.USERID); cmd.Parameters.AddWithValue("@REQUESTDATE", rqst.REQUESTDATE); cmd.Parameters.AddWithValue("@DESCRIPTION", rqst.DESCRIPTION); cmd.ExecuteNonQuery(); } catch (Exception ex) { } finally { if (con.State == ConnectionState.Open) { con.Close(); } } }
public static void UpdateStatus(ENTREQREQUESTS rqst) { con = SQL.GetConnection(); cmd = SQL.SetCommand("UPDATE REQ_REQUEST SET TYPEREQUESTID=@TYPEREQUESTID WHERE ID = @ID", con); cmd.Parameters.AddWithValue("@ID", rqst.ID); cmd.Parameters.AddWithValue("@TYPEREQUESTID", rqst.TYPEREQUESTID); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
public static ENTREQREQUESTS GetValueStatus(Guid ID) { con = SQL.GetConnection(); cmd = SQL.SetCommand("SELECT * FROM REQ_Request WHERE ID=@ID", con); cmd.Parameters.AddWithValue("@ID", ID); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); ENTREQREQUESTS rqst = null; while (dr.Read()) { rqst = new ENTREQREQUESTS(Guid.Parse(dr["ID"].ToString()), Guid.Parse(dr["PROJECTID"].ToString()), dr["NAME"].ToString(), Convert.ToByte(dr["TYPEREQUESTID"].ToString()), Guid.Parse(dr["USERID"].ToString()), Convert.ToDateTime(dr["REQUESTDATE"].ToString()), dr["DESCRIPTION"].ToString()); break; } con.Close(); return(rqst); }
public static List <ENTREQREQUESTS> GetAllListFirmRequestsID(Guid USERID) { con = SQL.GetConnection(); cmd = SQL.SetCommand("SELECT * FROM REQ_REQUEST WHERE USERID=@USERID", con); cmd.Parameters.AddWithValue("@USERID", USERID); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); ENTREQREQUESTS ptsk = null; List <ENTREQREQUESTS> ptsklist = new List <ENTREQREQUESTS>(); while (dr.Read()) { ptsk = new ENTREQREQUESTS(Guid.Parse(dr["ID"].ToString()), Guid.Parse(dr["PROJECTID"].ToString()), dr["NAME"].ToString(), Convert.ToByte(dr["TYPEREQUESTID"].ToString()), Guid.Parse(dr["USERID"].ToString()), Convert.ToDateTime(dr["REQUESTDATE"].ToString()), dr["DESCRIPTION"].ToString()); ptsklist.Add(ptsk); } con.Close(); return(ptsklist); }