123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class SearchResult : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void rbListFunction_SelectedIndexChanged(object sender, EventArgs e) { try { if (rbListFunction.SelectedValue == "ReviseComponent") { // Response.Write(gvResult.SelectedValue.ToString()); Server.Transfer("~/ReviseComponent.aspx?componentID=" + gvResult.SelectedValue); } else if (rbListFunction.SelectedValue == "Comment") { Server.Transfer("~/Comment.aspx?componentID=" + gvResult.SelectedValue); } else { Server.Transfer("~/wantToDownloadComponent.aspx?componentID=" + gvResult.SelectedValue); } } catch (Exception ex) { Response.Write(ex.Message); } } protected void gvResult_SelectedIndexChanged(object sender, EventArgs e) { if (gvResult.SelectedValue.ToString() != "") { rbListFunction.Visible = true; //button list } else { rbListFunction.Visible = false; } string strUserID = Context.User.Identity.Name; if (!isThisPersionHadDownloadTheComponent(gvResult.SelectedValue.ToString(), strUserID)) { rbListFunction.Items[1].Enabled = false; } //OO줸}o if (!isThisPersonTheOrigianlDeveloperOfComponent(gvResult.SelectedValue.ToString(), strUserID)) { rbListFunction.Items[0].Enabled = false; } } private bool isThisPersonTheOrigianlDeveloperOfComponent(string strComponentID, string strUserIDNow) { bool isTheSameDeveloper = false; ConnectionStringSettings connSettings = ConfigurationManager.ConnectionStrings["CCSConnectionString"]; string CCSConnectionString = connSettings.ConnectionString; SqlDataReader reader = null; string theUserID = ""; //lȵ SqlConnection conn = new SqlConnection(CCSConnectionString); SqlCommand cmd = new SqlCommand("SELECT CONTRIBUTOR FROM COMPONENT WHERE COMPONENT_ID = '" + strComponentID +"'", conn); try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { theUserID = reader["CONTRIBUTOR"].ToString(); } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { reader.Close(); conn.Close(); } if (!String.IsNullOrEmpty(theUserID) && theUserID == strUserIDNow) { isTheSameDeveloper = true; } return isTheSameDeveloper; } private bool isThisPersionHadDownloadTheComponent(string strComponentID, string strUserID) { bool hasBeenDownloaded = false; ConnectionStringSettings connSettings = ConfigurationManager.ConnectionStrings["CCSConnectionString"]; string CCSConnectionString = connSettings.ConnectionString; SqlDataReader reader = null; int iQualifyCounter = 0; //lȵs SqlConnection conn = new SqlConnection(CCSConnectionString); SqlCommand cmd = new SqlCommand("SELECT * FROM DOWNLOAD_LIST WHERE COMPONENT_ID = '" + strComponentID + "' AND USER_ID ='" + strUserID + "'", conn); try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { iQualifyCounter++; } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { reader.Close(); conn.Close(); } if (iQualifyCounter > 0) { hasBeenDownloaded = true; } return hasBeenDownloaded; } }