Пример #1
0
        protected void grdSubjectMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete_Paper")
            {
                int         rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                GridViewRow grid     = grdPaperMaster.Rows[rowIndex];
                int         id       = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text);

                obj1 = new PaperMasterDataManager();
                obj1.DeletePaperDetail(id);
                Clear();
                bind(ddlSubject.SelectedValue);
                msgbox("Paper Deleted successfully!!!");
            }
            if (e.CommandName == "Disable_QUESTION")
            {
                int         rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                GridViewRow grid     = grdPaperMaster.Rows[rowIndex];
                int         id       = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text);
                LinkButton  btn      = ((LinkButton)e.CommandSource);

                obj1 = new PaperMasterDataManager();
                obj1.DisablePaperDetail(id, btn.Text.ToUpper().Equals("DISABLE QUESTION") ? "QUESTION" : "NONE");
                Clear();
                bind(ddlSubject.SelectedValue);
                msgbox("Paper Question Enabled/Disabled successfully!!!");
            }
            if (e.CommandName == "Disable_HELP")
            {
                int         rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                GridViewRow grid     = grdPaperMaster.Rows[rowIndex];
                int         id       = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text);
                LinkButton  btn      = ((LinkButton)e.CommandSource);

                obj1 = new PaperMasterDataManager();
                obj1.DisablePaperDetail(id, btn.Text.ToUpper().Equals("DISABLE HELP") ? "ANSWER" : "NONE");
                Clear();
                bind(ddlSubject.SelectedValue);
                msgbox("Paper help Enabled/Disabled successfully!!!");
            }
            if (e.CommandName == "Disable_BOTH")
            {
                int         rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                GridViewRow grid     = grdPaperMaster.Rows[rowIndex];
                int         id       = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text);
                LinkButton  btn      = ((LinkButton)e.CommandSource);

                obj1 = new PaperMasterDataManager();
                obj1.DisablePaperDetail(id, btn.Text.ToUpper().Equals("DISABLE BOTH") ? "BOTH" : "NONE");
                Clear();
                bind(ddlSubject.SelectedValue);
                msgbox("Paper question and help Enabled/Disabled successfully!!!");
            }
        }
Пример #2
0
 private void bind(string id)
 {
     try
     {
         if (id.Equals("0") || string.IsNullOrEmpty(id))
         {
             grdPaperMaster.DataSource = null;
         }
         else
         {
             obj1 = new PaperMasterDataManager();
             grdPaperMaster.DataSource = obj1.GetPaperListWithSubjectID(Convert.ToInt16(id));
         }
         grdPaperMaster.DataBind();
     }
     catch (Exception ex) { }
 }
Пример #3
0
        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"]);
                }
            }
        }
Пример #4
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"]);
                }
            }
        }
Пример #5
0
        protected void btnAddPaper_Click(object sender, EventArgs e)
        {
            DateTime dt, dt1;

            //   System.Threading.Thread.Sleep(5000);
            obj             = new PaperMaster();
            obj.Name        = txtName.Text;
            obj.Description = txtDescription.Text;
            obj.SubjectId   = Convert.ToInt16(ddlSubject.SelectedValue);
            //obj.TopicID = Convert.ToInt16(ddlTopic.SelectedValue);
            obj.GradeID    = 0;
            obj.Year       = Convert.ToInt16(txtYear.Text);
            obj.Month      = Convert.ToInt16(txtMonth.Text);
            obj.IsYearwise = chkYearwise.Checked == true ? 1 : 0;
            obj.IsSample   = chkSample.Checked == true ? 1 : 0;
            //obj.IsVisible = chkVisible.Checked;
            obj.CreatedBy = 1;
            obj.UpdatedBy = 1;
            obj.PaperID   = Convert.ToInt16(lblPaperID.Text);

            if (chkSample.Checked && Convert.ToDouble("0" + txtPrice.Text) > 0)
            {
                msgbox("For Sample paper Price should be 0");
                return;
            }

            if (!chkSample.Checked && Convert.ToDouble("0" + txtPrice.Text) <= 0)
            {
                msgbox("For Non-Sample paper Price should be greater than 0");
                return;
            }

            if (chkSample.Checked)
            {
                obj.Price = 0.00;
            }
            else
            {
                obj.Price = Convert.ToDouble("0" + txtPrice.Text);
            }
            obj.BaseCurrency = ddlCurrency.SelectedValue;
            obj.DiscountID   = Convert.ToInt16(ddlDiscount.SelectedValue);
            if (DateTime.TryParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
            {
                obj.ValidFrom = dt;
            }
            else
            {
                msgbox("Invalid ValidFrom Date");
                return;
            }
            if (DateTime.TryParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt1))
            {
                obj.ValidUpto = dt1;
            }
            else
            {
                msgbox("Invalid ValidTo Date");
                return;
            }

            if (dt.Date > dt1.Date)
            {
                msgbox("ValidFrom date should be less than ValidTo date");
                return;
            }

            if (lblPaperID.Text.Equals("-1"))
            {
                obj1 = new PaperMasterDataManager();
                obj1.AddPaperDetail(obj);
                msgbox("Paper Added successfully!!!");
            }
            else
            {
                obj1 = new PaperMasterDataManager();
                obj1.UpdatePaperDetail(obj);
                msgbox("Paper updated successfully!!!");
            }
            Clear();
            BindDropdown();
            bind(ddlSubject.SelectedValue);
        }