public static STD_ComprehensionQuestion GetSTD_QuestionByQuestionID(int QuestionID)
 {
     STD_ComprehensionQuestion sTD_ComprehensionQuestion = new STD_ComprehensionQuestion();
     SqlSTD_ComprehensionQuestionProvider sqlSTD_ComprehensionQuestionProvider = new SqlSTD_ComprehensionQuestionProvider();
     sTD_ComprehensionQuestion = sqlSTD_ComprehensionQuestionProvider.GetSTD_ComprehensionQuestionByQuestionID(QuestionID);
     return sTD_ComprehensionQuestion;
 }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
     STD_ComprehensionQuestion sTD_ComprehensionQuestion = new STD_ComprehensionQuestion ();
     sTD_ComprehensionQuestion.ComprehensionQuestionID=  int.Parse(Request.QueryString["ID"].ToString());
     sTD_ComprehensionQuestion.QuestionID=  int.Parse(ddlQuestionID.SelectedValue);
     sTD_ComprehensionQuestion.ComprehensionID=  int.Parse(ddlComprehensionID.SelectedValue);
     sTD_ComprehensionQuestion.AddedBy=  "530038e1-cf38-4ddb-84a4-99b6974b4f9d";
     sTD_ComprehensionQuestion.AddedDate=  DateTime.Now;
     sTD_ComprehensionQuestion.UpdatedBy=  "530038e1-cf38-4ddb-84a4-99b6974b4f9d";
     sTD_ComprehensionQuestion.UpdateDate = DateTime.Now;
     bool  resutl =STD_ComprehensionQuestionManager.UpdateSTD_ComprehensionQuestion(sTD_ComprehensionQuestion);
     }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_ComprehensionQuestion.aspx");
 }
    public bool UpdateSTD_ComprehensionQuestion(STD_ComprehensionQuestion sTD_ComprehensionQuestion)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateSTD_ComprehensionQuestion", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ComprehensionQuestionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.ComprehensionQuestionID;
            cmd.Parameters.Add("@QuestionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.QuestionID;
            cmd.Parameters.Add("@ComprehensionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.ComprehensionID;
            //cmd.Parameters.Add("@ComprehensionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.ComprehensionID;
            //cmd.Parameters.Add("@ComprehensionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.ComprehensionID;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_ComprehensionQuestion.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_ComprehensionQuestion.UpdateDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
    public int InsertSTD_ComprehensionQuestion(STD_ComprehensionQuestion sTD_ComprehensionQuestion)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("InsertSTD_ComprehensionQuestion", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ComprehensionQuestionID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@QuestionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.QuestionID;
            cmd.Parameters.Add("@ComprehensionID", SqlDbType.Int).Value = sTD_ComprehensionQuestion.ComprehensionID;
            cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_ComprehensionQuestion.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_ComprehensionQuestion.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_ComprehensionQuestion.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_ComprehensionQuestion.UpdateDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return (int)cmd.Parameters["@ComprehensionQuestionID"].Value;
        }
    }
    public STD_ComprehensionQuestion GetSTD_ComprehensionQuestionFromReader(IDataReader reader)
    {
        try
        {
            STD_ComprehensionQuestion sTD_ComprehensionQuestion = new STD_ComprehensionQuestion
                (

                     DataAccessObject.IsNULL<int>(reader["ComprehensionQuestionID"]),
                     DataAccessObject.IsNULL<int>(reader["QuestionID"]),
                     DataAccessObject.IsNULL<int>(reader["ComprehensionID"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"])
                );
             return sTD_ComprehensionQuestion;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
 private void showSTD_ComprehensionQuestionData()
 {
     STD_ComprehensionQuestion sTD_ComprehensionQuestion  = new STD_ComprehensionQuestion ();
      	sTD_ComprehensionQuestion = STD_ComprehensionQuestionManager.GetSTD_ComprehensionQuestionByComprehensionQuestionID(Int32.Parse(Request.QueryString["ID"]));
      	ddlQuestionID.SelectedValue  =sTD_ComprehensionQuestion.QuestionID.ToString();
      	ddlComprehensionID.SelectedValue  =sTD_ComprehensionQuestion.ComprehensionID.ToString();
 }
 public static int InsertSTD_ComprehensionQuestion(STD_ComprehensionQuestion sTD_ComprehensionQuestion)
 {
     SqlSTD_ComprehensionQuestionProvider sqlSTD_ComprehensionQuestionProvider = new SqlSTD_ComprehensionQuestionProvider();
     return sqlSTD_ComprehensionQuestionProvider.InsertSTD_ComprehensionQuestion(sTD_ComprehensionQuestion);
 }
 public static bool UpdateSTD_ComprehensionQuestion(STD_ComprehensionQuestion sTD_ComprehensionQuestion)
 {
     SqlSTD_ComprehensionQuestionProvider sqlSTD_ComprehensionQuestionProvider = new SqlSTD_ComprehensionQuestionProvider();
     return sqlSTD_ComprehensionQuestionProvider.UpdateSTD_ComprehensionQuestion(sTD_ComprehensionQuestion);
 }