Example #1
0
        protected void grdTopicMaster_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbl1 = (Label)e.Row.FindControl("lblSubject");
                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"]);
                }
                dt = new SubjectMasterDataManager().GetSubCourseListWithSubjectID(Convert.ToInt16(lbl1.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 btnAddSubject_Click(object sender, EventArgs e)
 {
     obj             = new SubjectMaster();
     obj.Name        = txtName.Text;
     obj.Description = txtDescription.Text;
     obj.SubCourseID = Convert.ToInt16(ddlSubCourse.SelectedValue);
     //obj.IsVisible = chkVisible.Checked;
     obj.CreatedBy = 1;
     obj.UpdatedBy = 1;
     obj.SubjectID = Convert.ToInt16(lblSubjectID.Text);
     if (lblSubjectID.Text.Equals("-1"))
     {
         obj1 = new SubjectMasterDataManager();
         obj1.AddSubjectDetail(obj);
         msgbox("Subject Added successfully!!!");
     }
     else
     {
         obj1 = new SubjectMasterDataManager();
         obj1.UpdateSubjectDetail(obj);
         msgbox("Subject updated successfully!!!");
     }
     Clear();
     BindDropdown();
     bind(ddlSubCourse.SelectedValue);
 }
Example #3
0
        protected void grdPaperMaster_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"]);
                }

                if (((Label)e.Row.FindControl("lblDisable")).Text.ToUpper().Equals("QUESTION"))
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_Question")).Text = "Enable Question";
                }
                else
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_Question")).Text = "Disable Question";
                }

                if (((Label)e.Row.FindControl("lblDisable")).Text.ToUpper().Equals("ANSWER"))
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_HELP")).Text = "Enable Help";
                }
                else
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_HELP")).Text = "Disable Help";
                }
                if (((Label)e.Row.FindControl("lblDisable")).Text.ToUpper().Equals("BOTH"))
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_Both")).Text = "Enable Both";
                }
                else
                {
                    ((LinkButton)e.Row.FindControl("btnDisable_Both")).Text = "Disable Both";
                }

                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"]);
                }
            }
        }
 private void bind(string id)
 {
     if (id.Equals("0") || string.IsNullOrEmpty(id))
     {
         grdSubjectMaster.DataSource = null;
     }
     else
     {
         obj1 = new SubjectMasterDataManager();
         grdSubjectMaster.DataSource = obj1.GetSubjectListWithSubCourseID(Convert.ToInt16(id));
     }
     grdSubjectMaster.DataBind();
 }
        protected void grdSubjectMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete_Subject")
            {
                int         rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                GridViewRow grid     = grdSubjectMaster.Rows[rowIndex];
                int         id       = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text);

                obj1 = new SubjectMasterDataManager();
                obj1.DeleteSubjectDetail(id);
                Clear();
                bind(ddlSubCourse.SelectedValue);
                msgbox("Subject Deleted successfully!!!");
            }
        }
Example #6
0
        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"]);
                }
            }
        }