protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strID = Request.QueryString.Get("id"); ViewState["mode"] = Request.QueryString.Get("mode"); if (ViewState["mode"].ToString() == "Insert") { if (!string.IsNullOrEmpty(strID)) { PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); PaperStrategySubject paperStrategySubject = paperStrategySubjectBLL.GetPaperStrategySubject(int.Parse(strID)); if (paperStrategySubject != null) { txtSubjectName.Text = paperStrategySubject.SubjectName; txtScore.Text = paperStrategySubject.UnitScore.ToString(); ddlType.SelectedValue = paperStrategySubject.ItemTypeId.ToString(); labelTotalCount.Text = paperStrategySubject.ItemCount.ToString(); } hfSubjectId.Value = strID; } } else { FillPage(int.Parse(strID)); } } }
private void FillPage(int nID) { PaperStrategyBookChapterBLL paperStrategyBookChapterBLL = new PaperStrategyBookChapterBLL(); PaperStrategyBookChapter paperStrategyBookChapter = paperStrategyBookChapterBLL.GetPaperStrategyBookChapter(nID); if (paperStrategyBookChapter != null) { txtMemo.Text = paperStrategyBookChapter.Memo; txtChapterName.Text = paperStrategyBookChapter.RangeName; HfRangeName.Value = paperStrategyBookChapter.RangeName; txtSubjectName.Text = paperStrategyBookChapter.SubjectName; txtExCludeChapters.Text = paperStrategyBookChapter.ExcludeChapterId; if (string.IsNullOrEmpty(paperStrategyBookChapter.ExcludeChapterId) == false) { FillExcludeCategorysID(paperStrategyBookChapter.ExcludeChapterId); } txtNd1.Text = paperStrategyBookChapter.ItemDifficulty1Count.ToString(); txtNd2.Text = paperStrategyBookChapter.ItemDifficulty2Count.ToString(); txtNd3.Text = paperStrategyBookChapter.ItemDifficulty3Count.ToString(); txtNd4.Text = paperStrategyBookChapter.ItemDifficulty4Count.ToString(); txtNd5.Text = paperStrategyBookChapter.ItemDifficulty5Count.ToString(); txtNDR.Text = paperStrategyBookChapter.ItemDifficultyRandomCount.ToString(); txtScore.Text = paperStrategyBookChapter.UnitScore.ToString(); txtSeconds.Text = paperStrategyBookChapter.UnitLimitTime.ToString(); hfSubjectId.Value = paperStrategyBookChapter.StrategySubjectId.ToString(); HfRangeType.Value = paperStrategyBookChapter.RangeType.ToString(); HfChapterId.Value = paperStrategyBookChapter.RangeId.ToString(); ddlType.SelectedValue = paperStrategyBookChapter.ItemTypeId.ToString(); PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); PaperStrategySubject paperStrategySubject = paperStrategySubjectBLL.GetPaperStrategySubject(int.Parse(hfSubjectId.Value)); if (paperStrategySubject != null) { labelTotalCount.Text = paperStrategySubject.ItemCount.ToString(); } } if (ViewState["mode"].ToString() == "ReadOnly") { SaveButton.Visible = false; CancelButton.Visible = true; ddlType.Enabled = false; txtNDR.Enabled = false; txtNd1.Enabled = false; txtNd2.Enabled = false; txtNd3.Enabled = false; txtNd4.Enabled = false; txtNd5.Enabled = false; txtSeconds.Enabled = false; txtMemo.Enabled = false; } }
private void FillPage(int nID) { PaperStrategyItemCategoryBLL paperStrategyItemCategoryBLL = new PaperStrategyItemCategoryBLL(); PaperStrategyItemCategory paperStrategyItemCategory = paperStrategyItemCategoryBLL.GetPaperStrategyItemCategory(nID); if (paperStrategyItemCategory != null) { if (paperStrategyItemCategory.ExcludeCategorysId != null) { FillExcludeCategorysID(paperStrategyItemCategory.ExcludeCategorysId); } txtMemo.Text = paperStrategyItemCategory.Memo; txtItemCategoryName.Text = paperStrategyItemCategory.CategoryName; txtSubjectName.Text = paperStrategyItemCategory.SubjectName; hfExCludeItemCategoryIDS.Value = paperStrategyItemCategory.ExcludeCategorysId; txtNd1.Text = paperStrategyItemCategory.ItemDifficulty1Count.ToString(); txtNd2.Text = paperStrategyItemCategory.ItemDifficulty2Count.ToString(); txtNd3.Text = paperStrategyItemCategory.ItemDifficulty3Count.ToString(); txtNd4.Text = paperStrategyItemCategory.ItemDifficulty4Count.ToString(); txtNd5.Text = paperStrategyItemCategory.ItemDifficulty5Count.ToString(); txtNDR.Text = paperStrategyItemCategory.ItemDifficultyRandomCount.ToString(); txtScore.Text = paperStrategyItemCategory.UnitScore.ToString(); txtSeconds.Text = paperStrategyItemCategory.UnitLimitTime.ToString(); hfSubjectId.Value = paperStrategyItemCategory.StrategySubjectId.ToString(); hfItemCategoryID.Value = paperStrategyItemCategory.ItemCategoryId.ToString(); ddlType.SelectedValue = paperStrategyItemCategory.ItemTypeId.ToString(); PaperStrategySubjectBLL paperStrategySubjectBLL = new PaperStrategySubjectBLL(); PaperStrategySubject paperStrategySubject = paperStrategySubjectBLL.GetPaperStrategySubject(int.Parse(hfSubjectId.Value)); if (paperStrategySubject != null) { labelTotalCount.Text = paperStrategySubject.ItemCount.ToString(); } } if (ViewState["mode"].ToString() == "ReadOnly") { SaveButton.Visible = false; CancelButton.Visible = true; ddlType.Enabled = false; txtNDR.Enabled = false; txtNd1.Enabled = false; txtNd2.Enabled = false; txtNd3.Enabled = false; txtNd4.Enabled = false; txtNd5.Enabled = false; txtSeconds.Enabled = false; txtMemo.Enabled = false; } }