private void showSTD_ChapterData() { STD_Chapter sTD_Chapter = new STD_Chapter (); sTD_Chapter = STD_ChapterManager.GetSTD_ChapterByChapterID(Int32.Parse(Request.QueryString["ID"])); ddlSubjectID.SelectedValue =sTD_Chapter.SubjectID.ToString(); txtChapterName.Text =sTD_Chapter.ChapterName.ToString(); txtDescription.Text =sTD_Chapter.Description.ToString(); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { STD_Chapter sTD_Chapter = new STD_Chapter (); sTD_Chapter.ChapterID= int.Parse(Request.QueryString["ID"].ToString()); sTD_Chapter.SubjectID= int.Parse(ddlSubjectID.SelectedValue); sTD_Chapter.ChapterName= txtChapterName.Text; sTD_Chapter.Description= txtDescription.Text; sTD_Chapter.AddedBy= Profile.card_id; sTD_Chapter.AddedDate= DateTime.Now; sTD_Chapter.UpdatedBy= Profile.card_id; sTD_Chapter.UpdateDate = DateTime.Now; bool resutl =STD_ChapterManager.UpdateSTD_Chapter(sTD_Chapter); }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_Chapter.aspx"); }
public bool UpdateSTD_Chapter(STD_Chapter sTD_Chapter) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateSTD_Chapter", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = sTD_Chapter.ChapterID; cmd.Parameters.Add("@SubjectID", SqlDbType.Int).Value = sTD_Chapter.SubjectID; cmd.Parameters.Add("@ChapterName", SqlDbType.NVarChar).Value = sTD_Chapter.ChapterName; cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Chapter.Description; //cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Chapter.Description; //cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Chapter.Description; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_Chapter.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_Chapter.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public STD_Chapter GetSTD_ChapterFromReader(IDataReader reader) { try { STD_Chapter sTD_Chapter = new STD_Chapter ( DataAccessObject.IsNULL<int>(reader["ChapterID"]), DataAccessObject.IsNULL<int>(reader["SubjectID"]), DataAccessObject.IsNULL<string>(reader["ChapterName"]), DataAccessObject.IsNULL<string>(reader["Description"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]) ); return sTD_Chapter; } catch(Exception ex) { return null; } }