protected void btnAddTopic_Click(object sender, EventArgs e) { obj = new TopicMaster(); obj.Name = txtName.Text; obj.Description = txtDescription.Text; obj.SubjectID = Convert.ToInt16(ddlSubject.SelectedValue); //obj.IsVisible = chkVisible.Checked; obj.CreatedBy = 1; obj.UpdatedBy = 1; obj.TopicID = Convert.ToInt16(lblTopicID.Text); if (lblTopicID.Text.Equals("-1")) { obj1 = new TopicMasterDataManager(); obj1.AddTopicDetail(obj); msgbox("Topic Added successfully!!!"); } else { obj1 = new TopicMasterDataManager(); obj1.UpdateTopicDetail(obj); msgbox("Topic updated successfully!!!"); } Clear(); BindDropdown(); bind(ddlSubject.SelectedValue); }
private void bind(string id) { if (id.Equals("0") || string.IsNullOrEmpty(id)) { grdTopicMaster.DataSource = null; } else { obj1 = new TopicMasterDataManager(); grdTopicMaster.DataSource = obj1.GetTopicsWithSubjectID(Convert.ToInt16(id)); } grdTopicMaster.DataBind(); }
protected void grdTopicMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete_Topic") { int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; GridViewRow grid = grdTopicMaster.Rows[rowIndex]; int id = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text); obj1 = new TopicMasterDataManager(); obj1.DeleteTopicDetail(id); Clear(); bind(ddlSubject.SelectedValue); msgbox("Topic Deleted successfully!!!"); } }
protected void grdMcqMater_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lbl1 = (Label)e.Row.FindControl("lblTopicId"); Label lbl2 = (Label)e.Row.FindControl("lblTopicName"); Label lbl3 = (Label)e.Row.FindControl("lblPaperId"); Label lbl4 = (Label)e.Row.FindControl("lblPaperName"); DataTable dt = new TopicMasterDataManager().GetTopicListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["Name"]); } dt = new PaperMasterDataManager().GetPaperListWithID(Convert.ToInt32(lbl3.Text)); if (dt.Rows.Count > 0) { lbl4.Text = Convert.ToString(dt.Rows[0]["Name"]); } dt = new SubjectMasterDataManager().GetSubjectListWithTopicID(Convert.ToInt32(lbl1.Text)); if (dt.Rows.Count > 0) { ((Label)e.Row.FindControl("lblSubjectID")).Text = Convert.ToString(dt.Rows[0]["SubjectID"]); ((Label)e.Row.FindControl("lblSubjectName")).Text = Convert.ToString(dt.Rows[0]["Name"]); } dt = new SubjectMasterDataManager().GetSubCourseListWithSubjectID(Convert.ToInt16(((Label)e.Row.FindControl("lblSubjectID")).Text)); if (dt.Rows.Count > 0) { ((Label)e.Row.FindControl("lblSubCourse")).Text = Convert.ToString(dt.Rows[0]["SubCourseID"]); ((Label)e.Row.FindControl("lblSubCourseName")).Text = Convert.ToString(dt.Rows[0]["Name"]); } dt = new SubCourseMasterDataManager().GetCourseListWithSubCourseID(Convert.ToInt16(((Label)e.Row.FindControl("lblSubCourse")).Text)); if (dt.Rows.Count > 0) { ((Label)e.Row.FindControl("lblCourse")).Text = Convert.ToString(dt.Rows[0]["CourseID"]); ((Label)e.Row.FindControl("lblCourseName")).Text = Convert.ToString(dt.Rows[0]["Name"]); } } }
protected void grdProductMaster_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lbl1 = (Label)e.Row.FindControl("lblSubjectID"); Label lbl2 = (Label)e.Row.FindControl("lblSubjectName"); DataTable dt = new SubjectMasterDataManager().GetSubjectListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["Name"]); } lbl1 = (Label)e.Row.FindControl("lblDiscountID"); lbl2 = (Label)e.Row.FindControl("lblDiscountName"); dt = new DiscountMasterDataManager().GetDiscountListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["Name"]); } lbl1 = (Label)e.Row.FindControl("lblCurrencyID"); lbl2 = (Label)e.Row.FindControl("lblCurrencyName"); dt = new CurrencyMasterDataManager().GetCurrencyListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["CurrencyName"]); } lbl1 = (Label)e.Row.FindControl("lblProductTypeID"); lbl2 = (Label)e.Row.FindControl("lblProductTypeName"); dt = new ProductTypeMasterDataManager().GetProductTypeListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["ProductTypeName"]); } lbl1 = (Label)e.Row.FindControl("lblTopicID"); lbl2 = (Label)e.Row.FindControl("lblTopicName"); dt = new TopicMasterDataManager().GetTopicListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["Name"]); } lbl1 = (Label)e.Row.FindControl("lblYearwisePaperID"); lbl2 = (Label)e.Row.FindControl("lblYearwisePaperName"); dt = new PaperMasterDataManager().GetPaperListWithID(Convert.ToInt16(lbl1.Text)); if (dt.Rows.Count > 0) { lbl2.Text = Convert.ToString(dt.Rows[0]["Name"]); } lbl1 = (Label)e.Row.FindControl("lblSample");//.Text.ToUpper().Equals("TRUE") ? true : false; LinkButton btn = (LinkButton)e.Row.FindControl("btnUpdate_Product"); if (lbl1.Text.ToUpper().Equals("TRUE")) { btn.Text = "Mark as Premium"; } else { btn.Text = "Mark as Sample"; } dt = new SubjectMasterDataManager().GetSubCourseListWithSubjectID(Convert.ToInt16(((Label)e.Row.FindControl("lblSubjectID")).Text)); if (dt.Rows.Count > 0) { ((Label)e.Row.FindControl("lblSubCourse")).Text = Convert.ToString(dt.Rows[0]["SubCourseID"]); ((Label)e.Row.FindControl("lblSubCourseName")).Text = Convert.ToString(dt.Rows[0]["Name"]); } dt = new SubCourseMasterDataManager().GetCourseListWithSubCourseID(Convert.ToInt16(((Label)e.Row.FindControl("lblSubCourse")).Text)); if (dt.Rows.Count > 0) { ((Label)e.Row.FindControl("lblCourse")).Text = Convert.ToString(dt.Rows[0]["CourseID"]); ((Label)e.Row.FindControl("lblCourseName")).Text = Convert.ToString(dt.Rows[0]["Name"]); } } }