protected void BtnTopicAdd_Click(object sender, EventArgs e) { obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.chapterid = Convert.ToInt16(ddlChapter.SelectedValue); obj_SYS_Chapter.topicindex = Convert.ToInt16(TxtToipcIndex.Text); obj_SYS_Chapter.topic = TxtTopicName.Text; obj_SYS_Chapter.employeeid = Convert.ToInt64(Session["EmpolyeeID"]); int Result = obj_BAL_SYS_Chapter.BAL_SYS_Topic_Insert(obj_SYS_Chapter); if (Result == ((int)EnumFile.Result.FileAdded)) { WebMsg.Show("Topic Added Successfully."); } else { WebMsg.Show("Topic Details already exists."); } object s = new object(); EventArgs ea = new EventArgs(); ddlSubject_SelectedIndexChanged(s, ea); }
protected void BtnSave_Click(object sender, EventArgs e) { try { SYS_Chapter = new SYS_Chapter(); BAL_SYS_Chapter = new SYS_Chapter_BLogic(); SYS_Chapter.bmsid = int.Parse(ddlBMS.SelectedValue); SYS_Chapter.subjectid = Convert.ToInt16(ddlSubject.SelectedValue); SYS_Chapter.chapterindex = Convert.ToInt16(txtChapterIndex.Text); SYS_Chapter.chapter = txtChapter.Text; SYS_Chapter.code = txtCode.Text; SYS_Chapter.description = txtDescription.Text; SYS_Chapter.createdby = AppSessions.EmpolyeeID; status = BAL_SYS_Chapter.BAL_SYS_Chapter_Insert_Admin(SYS_Chapter, "Insert"); if (status == 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('Record successfully inserted.')</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('Record not inserted.')</script>", false); } RefreshPageControls(); pnlSearch.CssClass = "Visible"; } catch (Exception ex) { throw ex; } finally { } }
protected void ibtnSetSeq_Click(object sender, ImageClickEventArgs e) { if (IsValidSequence()) { DataTable TbBmsSct = new DataTable("TbBmsSct"); TbBmsSct.Columns.Add("BMSSCTID", typeof(Int64)); TbBmsSct.Columns.Add("SequenceNo", typeof(Int32)); TbBmsSct.Columns.Add("EmployeeID", typeof(Int64)); for (int i = 0; i < grdChapter.Rows.Count; i++) { DataRow dr = TbBmsSct.NewRow(); dr["BMSSCTID"] = Convert.ToInt64(grdChapter.DataKeys[i].Values["BMSSCTID"].ToString()); TextBox tb1 = (TextBox)grdChapter.Rows[i].Cells[3].FindControl("TxtSequenceNo"); dr["SequenceNo"] = Convert.ToInt32(tb1.Text); dr["EmployeeID"] = Convert.ToInt64(Session["EmpolyeeID"]); TbBmsSct.Rows.Add(dr); } if (TbBmsSct.Rows.Count > ((int)EnumFile.AssignValue.Zero)) { try { SYS_Chapter_BLogic obj = new SYS_Chapter_BLogic(); String xmldata; StringWriter sw = new StringWriter(); TbBmsSct.TableName = "TbBmsSct"; TbBmsSct.WriteXml(sw); xmldata = sw.ToString(); obj.BAL_SYS_ChapterSeq_Update(xmldata); WebMsg.Show("Chapter Sequence Set Successfully."); } catch (Exception ex) { WebMsg.Show("Error Updating Chapter Sequence."); } } else { WebMsg.Show("No Data to Set."); } //ClearAll(); } else { WebMsg.Show(Convert.ToString(ViewState["MSG"])); } }
protected void BtnUploadContent_Click(object sender, EventArgs e) { obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.subjectid = Convert.ToInt16(ddlSubject.SelectedValue); obj_SYS_Chapter.chapterid = Convert.ToInt64(ddlChapter.SelectedValue); obj_SYS_Chapter.topicid = Convert.ToInt64(ddlTopic.SelectedValue); Int64 sctid = obj_BAL_SYS_Chapter.BAL_SYS_SCT_Insert(obj_SYS_Chapter); obj_SYS_Chapter.sctid = sctid; obj_SYS_Chapter.bmsid = Convert.ToInt64(ViewState["BMSID"]); Int64 bmssctid = obj_BAL_SYS_Chapter.BAL_SYS_BMS_SCT_Insert(obj_SYS_Chapter); WebMsg.Show("Generated BMS SCT ID is = " + bmssctid); }
public void BindGrid() { obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.bmsid = Convert.ToInt64(ViewState["BMSID"]); obj_SYS_Chapter.subjectid = Convert.ToInt16(ddlSubject.SelectedValue); DataSet ds = obj_BAL_SYS_Chapter.BAL_SYS_ChapterSeq_Select(obj_SYS_Chapter); GridViewOperations GrvOperation = new GridViewOperations(); GrvOperation.BindGridWithSorting(grdChapter, ds, this.SortField, this.SortDirection); //if (ds.Tables.Count > 0) //{ // grdChapter.DataSource = ds; // grdChapter.DataBind(); //} }
protected void btnUpdate_Click(object sender, EventArgs e) { try { SYS_Chapter = new SYS_Chapter(); BAL_SYS_Chapter = new SYS_Chapter_BLogic(); SYS_Chapter.chapterid = Convert.ToInt32(ViewState["chapterid"].ToString()); SYS_Chapter.bmsid = int.Parse(ddlBMSEdit.SelectedValue); SYS_Chapter.subjectid = Convert.ToInt16(ddlSubjectEdit.SelectedValue); SYS_Chapter.chapterindex = Convert.ToInt16(txtChapterIndexEdit.Text); SYS_Chapter.chapter = txtChapterEdit.Text; SYS_Chapter.code = txtCodeEdit.Text; SYS_Chapter.description = txtDescriptionEdit.Text; SYS_Chapter.modifiedby = AppSessions.EmpolyeeID; if (rlstEditActive.SelectedValue == "1") { SYS_Chapter.isactive = true; } else { SYS_Chapter.isactive = false; } status = BAL_SYS_Chapter.BAL_SYS_Chapter_Update(SYS_Chapter, "Update"); if (status == 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('Record successfully updated.')</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('Record not updated.')</script>", false); } RefreshPageControls(); bindgrvSYS_Chapterdetail(); } catch (Exception ex) { WebMsg.Show(ex.Message); } }
protected void BtnGenerate_Click(object sender, EventArgs e) { obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.subjectid = Convert.ToInt16(ddlSubject.SelectedValue); obj_SYS_Chapter.chapterid = Convert.ToInt64(ddlChapter.SelectedValue); obj_SYS_Chapter.topicid = Convert.ToInt64(ddlTopic.SelectedValue); Int64 sctid = obj_BAL_SYS_Chapter.BAL_SYS_SCT_Insert(obj_SYS_Chapter); obj_SYS_Chapter.sctid = sctid; obj_SYS_Chapter.bmsid = Convert.ToInt64(ViewState["BMSID"]); Int64 bmssctid = obj_BAL_SYS_Chapter.BAL_SYS_BMS_SCT_Insert(obj_SYS_Chapter); WebMsg.Show("Generated BMS SCT ID is = " + bmssctid); DropDownList[] disddl = { ddlTopic }; DisableDropDwon(disddl); ddlChapter.SelectedIndex = 0; }
protected void btnFileTypeAdd_Click(object sender, EventArgs e) { obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.filetype = TxtFileType.Text; obj_SYS_Chapter.employeeid = Convert.ToInt64(Session["EmpolyeeID"]); int Result = obj_BAL_SYS_Chapter.BAL_SYS_FileType_Insert(obj_SYS_Chapter); if (Result == ((int)EnumFile.Result.FileAdded)) { WebMsg.Show("File type Added Successfully."); } else { WebMsg.Show("File type Details already exists."); } object s = new object(); EventArgs ea = new EventArgs(); ddlTopic_SelectedIndexChanged(s, ea); }
/// <summary> /// Method will be used to bind grid view. /// </summary> private void bindgrvSYS_Chapterdetail() { try { SYS_Chapter = new SYS_Chapter(); BAL_SYS_Chapter = new SYS_Chapter_BLogic(); DataSet dsSelect = new DataSet(); dsSelect = BAL_SYS_Chapter.BAL_SYS_Chapter_Select(SYS_Chapter, "AdminSelect"); if (dsSelect.Tables.Count > 0) { string searchCondition = string.Empty; if (ddlBMSSearch.SelectedValue != "0") { searchCondition = "BMSID=" + ddlBMSSearch.SelectedValue; } if (ddlSubjectSearch.SelectedValue != "0") { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "SubjectID=" + ddlSubjectSearch.SelectedValue; } else { searchCondition = "SubjectID=" + ddlSubjectSearch.SelectedValue; } } if (txtChapterIndexSearch.Text != string.Empty) { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "ChapterIndex=" + txtChapterIndexSearch.Text; } else { searchCondition = "ChapterIndex=" + txtChapterIndexSearch.Text; } } if (txtChapterSearch.Text != string.Empty) { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "Chapter like '%" + txtChapterSearch.Text + "%'"; } else { searchCondition = "Chapter like '%" + txtChapterSearch.Text + "%'"; } } if (txtCodeSearch.Text != string.Empty) { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "Code like '%" + txtCodeSearch.Text + "%'"; } else { searchCondition = "Code like '%" + txtCodeSearch.Text + "%'"; } } if (txtDescriptionSearch.Text != string.Empty) { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "Description like '%" + txtDescriptionSearch.Text + "%'"; } else { searchCondition = "Description like '%" + txtDescriptionSearch.Text + "%'"; } } if (rlstActive.SelectedValue == "1") { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "IsActive=" + true; } else { searchCondition = "IsActive=" + true; } } else if (rlstActive.SelectedValue == "0") { if (searchCondition != string.Empty) { searchCondition = searchCondition + " and "; searchCondition = searchCondition + "IsActive=" + false; } else { searchCondition = "IsActive=" + false; } } DataView dv = new DataView(dsSelect.Tables[0]); dv.RowFilter = searchCondition; DataSet dsChapter = new DataSet(); dsChapter.Tables.Add(dv.ToTable()); GridViewOperations GrvOperation = new GridViewOperations(); GrvOperation.BindGridWithSorting(grvSYS_Chapterdetail, dsChapter, this.SortField, this.SortDirection); } else { grvSYS_Chapterdetail.DataSource = null; grvSYS_Chapterdetail.DataBind(); } } catch (Exception ex) { WebMsg.Show(ex.Message); } }
protected void BtnActDeactSub_Click(object sender, EventArgs e) { try { int CountChecked = 0; ////int GRrowIndex = 0; string ActiveDeactive = string.Empty; foreach (GridViewRow gr in grvSYS_Chapterdetail.Rows) { CheckBox chk = new CheckBox(); chk = (CheckBox)gr.FindControl("chkSelect"); if (chk.Checked == true) { if (CountChecked == 0) { ActiveDeactive = grvSYS_Chapterdetail.DataKeys[gr.RowIndex]["ChapterID"].ToString(); } else { ActiveDeactive = ActiveDeactive + ", " + grvSYS_Chapterdetail.DataKeys[gr.RowIndex]["ChapterID"].ToString(); } CountChecked = CountChecked + 1; } } if (CountChecked > 0) { SYS_Chapter = new SYS_Chapter(); BAL_SYS_Chapter = new SYS_Chapter_BLogic(); SYS_Chapter.Chpateridlist = ActiveDeactive; if (rbActive.Checked == true) { SYS_Chapter.isactive = true; } if (rbDeactive.Checked == true) { SYS_Chapter.isactive = false; } status = BAL_SYS_Chapter.BAL_SYS_Chapter_ActivateDeActivate_Admin_Chapter(SYS_Chapter, "ActivateDeactivate"); string status1 = string.Empty; if (status == 1) { if (rbActive.Checked == true) { status1 = "Active."; } else if (rbDeactive.Checked == true) { status1 = "Deactive."; } string message = string.Format("Selected records successfully {0}", status1); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('" + message + "')</script>", false); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert('Selected record not Active/Deactive.')</script>", false); } RefreshPageControls(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "<script> alert(' Please select one record to Active/Deactive.')</script>", false); } } catch (Exception ex) { WebMsg.Show(ex.Message); } }
protected void BtnUpload_Click(object sender, EventArgs e) { #region File Validation if (ddlType.SelectedItem.ToString().Equals("Activity")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".pdf") { WebMsg.Show("Please Select .pdf File only"); goto Exit; } } } else if (ddlType.SelectedItem.ToString().Equals("Video Presentation")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".flv") { if (ext != ".swf") { WebMsg.Show("Please Select .swf or .flv File only"); goto Exit; } } else if (ext != ".swf") { if (ext != ".flv") { WebMsg.Show("Please Select .swf or .flv File only"); goto Exit; } } } } else if (ddlType.SelectedItem.ToString().Equals("Question Paper")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".pdf") { WebMsg.Show("Please Select .pdf File only"); goto Exit; } } } else if (ddlType.SelectedItem.ToString().Equals("Worksheet")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".pdf") { WebMsg.Show("Please Select .pdf File only"); goto Exit; } } } else if (ddlType.SelectedItem.ToString().Equals("Teacher Resource")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".pdf") { WebMsg.Show("Please Select .pdf File only"); goto Exit; } } } else if (ddlType.SelectedItem.ToString().Equals("Glossary")) { if (fuChapters.PostedFile.ContentLength > ((int)EnumFile.AssignValue.Zero)) { string ext = System.IO.Path.GetExtension(fuChapters.PostedFile.FileName); ext = ext.ToLower(); if (ext != ".pdf") { WebMsg.Show("Please Select .pdf File only"); goto Exit; } } } #endregion obj_SYS_Chapter = new SYS_Chapter(); obj_BAL_SYS_Chapter = new SYS_Chapter_BLogic(); obj_SYS_Chapter.subjectid = Convert.ToInt16(ddlSubject.SelectedValue); obj_SYS_Chapter.chapterid = Convert.ToInt64(ddlChapter.SelectedValue); obj_SYS_Chapter.topicid = Convert.ToInt64(ddlTopic.SelectedValue); Int64 sctid = obj_BAL_SYS_Chapter.BAL_SYS_SCT_Insert(obj_SYS_Chapter); obj_SYS_Chapter.sctid = sctid; obj_SYS_Chapter.bmsid = Convert.ToInt64(ViewState["BMSID"]); Int64 bmssctid = obj_BAL_SYS_Chapter.BAL_SYS_BMS_SCT_Insert(obj_SYS_Chapter); String DirectoryPath = Server.MapPath("../EduResource/" + bmssctid); if (!Directory.Exists(DirectoryPath)) { Directory.CreateDirectory(DirectoryPath); } String ResourcePath = Server.MapPath("../EduResource/" + bmssctid + "/" + ddlType.SelectedItem.ToString()); if (!Directory.Exists(ResourcePath)) { Directory.CreateDirectory(ResourcePath); } string FilePath = ResourcePath + "\\" + fuChapters.FileName; fuChapters.PostedFile.SaveAs(FilePath); WebMsg.Show("File Uploaded successfully."); object s = new object(); EventArgs ea = new EventArgs(); btnReset_Click(s, ea); Exit: return; }