Exemplo n.º 1
0
        //Item Category
        #region [Item Category Grid Bind]

        private void GrdCategoryBind()
        {
            try
            {
                objEWA.OrgId = Convert.ToInt32(Session["OrgId"]);
                DataSet ds = objBL.CategoryGridBind_BL(objEWA);
                if (ds.Tables[0].Rows.Count == 0 || ds == null)
                {
                    ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                    GrdCategory.DataSource = ds;
                    GrdCategory.DataBind();
                    int columncount = GrdCategory.Rows[0].Cells.Count;
                    GrdCategory.Rows[0].Cells.Clear();
                    GrdCategory.Rows[0].Cells.Add(new TableCell());
                    GrdCategory.Rows[0].Cells[0].ColumnSpan = columncount;
                    GrdCategory.Rows[0].Cells[0].Text       = "No Records Found";
                }
                else
                {
                    GrdCategory.DataSource = ds;
                    GrdCategory.DataBind();
                }
            }

            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Exemplo n.º 2
0
 protected void GrdCategory_RowUpdated(object sender, GridViewUpdatedEventArgs e)
 {
     try
     {
         GrdCategory.DataBind();
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 3
0
 protected void lnkBtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         GrdCategory.DataBind();
         GrdCategory.ShowFooter = true;
         lnkBtnAdd.Visible      = false;
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Exemplo n.º 4
0
        //Grid Index Changed
        #region GrdIndexChanged

        protected void GrdCategory_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            try
            {
                GrdCategory.PageIndex = e.NewPageIndex;

                GrdCategory.DataSource = objBL.CategoryGridBind_BL(objEWA);
                GrdCategory.DataBind();
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Exemplo n.º 5
0
 protected void BindAVMaster()
 {
     try
     {
         DataTable dt = new DataTable();
         dt = objBL_ExamMaster.BL_BindAVMaster(objML_ExamMaster);
         if (dt.Rows.Count > 0)
         {
             GrdCategory.DataSource = dt;
             GrdCategory.DataBind();
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message.ToString() + "');", true);
     }
 }
Exemplo n.º 6
0
        private void BindProgramsInfo()
        {
            DataTable dt = new DataTable();

            objML_StudentProfile.ID = Session["UserName"].ToString();
            //objML_StudentProfile.ExamName = Session["ExamName"].ToString();
            dt = objBL_StudentProfile.BL_Result(objML_StudentProfile);
            if (dt.Rows.Count > 0)
            {
                GrdCategory.DataSource = dt;
                GrdCategory.DataBind();
                int i = 0;
                int y = 0;
                foreach (GridViewRow row in GrdCategory.Rows)
                {
                    Label lblTick              = (Label)row.FindControl("lbl");
                    Label lblStudentAns        = (Label)row.FindControl("StudentAns");
                    Label lblCorrctAns         = (Label)row.FindControl("CorrectAns");
                    Label lblStudentPreviewAns = (Label)row.FindControl("lblCorrect");
                    if (lblCorrctAns.Text == lblStudentAns.Text)
                    {
                        lblTick.Text = "✔";
                        i            = i + 1;
                    }
                    else if (lblStudentAns.Text == "")
                    {
                        lblTick.Text = "🏳️";
                    }
                    else
                    {
                        lblTick.Text = "❌";
                        lblStudentPreviewAns.Text = lblCorrctAns.Text;
                        y = y + 1;
                    }
                }
                lblCorrect.Text  = i.ToString();
                lblWrong.Text    = y.ToString();
                lblTotalQus.Text = dt.Rows.Count.ToString();
            }
        }
Exemplo n.º 7
0
    protected void GrdCategory_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Cancel")
            {
                GrdCategory.FooterRow.Visible = false;
                lnkBtnAdd.Visible             = true;
            }
            else if (e.CommandName == "Insert")
            {
                if (!Page.IsValid)
                {
                    foreach (IValidator validator in Page.Validators)
                    {
                        if (!validator.IsValid)
                        {
                            //errDisp.AddItem(validator.ErrorMessage, DisplayIcons.Error, true);
                        }
                    }
                }
                else
                {
                    BusinessLogic objBus = new BusinessLogic();

                    string Username = Request.Cookies["LoggedUserName"].Value;

                    int    nextSeq = objBus.GetNextSequence(GetConnectionString(), "Select Max(CategoryID) from tblCategories");
                    string cateDes = ((TextBox)GrdCategory.FooterRow.FindControl("txtAddDescr")).Text;
                    string catelvl = ((TextBox)GrdCategory.FooterRow.FindControl("txtAddLvl")).Text;

                    if (nextSeq == -1)
                    {
                        return;
                    }
                    string sQl = string.Format("Insert Into tblCategories Values({0},'{1}',{2})", nextSeq + 1, cateDes, catelvl);
                    srcGridView.InsertParameters.Add("sQl", TypeCode.String, sQl);
                    srcGridView.InsertParameters.Add("connection", TypeCode.String, GetConnectionString());
                    srcGridView.InsertParameters.Add("Usernam", TypeCode.String, Username);
                    srcGridView.InsertParameters.Add("CategoryName", TypeCode.String, cateDes);
                    try
                    {
                        srcGridView.Insert();
                        System.Threading.Thread.Sleep(1000);
                        GrdCategory.DataBind();
                        //}
                        //catch (Exception ex)
                        //{
                        //    if (ex.InnerException != null)
                        //    {
                        //        StringBuilder script = new StringBuilder();
                        //        script.Append("alert('Category with this name already exists, Please try with a different name.');");

                        //        if (ex.InnerException.Message.IndexOf("duplicate values in the index") > -1)
                        //            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);

                        //        return;
                        //    }
                        //}
                    }
                    catch (Exception ex)
                    {
                        TroyLiteExceptionManager.HandleException(ex);
                        return;
                    }
                    lnkBtnAdd.Visible = true;
                }
            }
            else if (e.CommandName == "Update")
            {
                if (!Page.IsValid)
                {
                    foreach (IValidator validator in Page.Validators)
                    {
                        if (!validator.IsValid)
                        {
                            //errDisp.AddItem(validator.ErrorMessage, DisplayIcons.Error, true);
                        }
                    }
                    return;
                }
                //else
                //{
                //    string catDescr = ((TextBox)GrdCategory.HeaderRow.FindControl("txtCatDescr")).Text;
                //    //string catDescr = ((TextBox)GrdCategory.Rows[e.RowIndex].FindControl("txtCatDescr")).Text;

                //    string Username = Request.Cookies["LoggedUserName"].Value;
                //    string catId = GrdCategory.SelectedValue.ToString();
                //    string catlevel = ((TextBox)GrdCategory.HeaderRow.FindControl("txtCatLvl")).Text;

                //    //string catId = GrdCategory.DataKeys[e.RowIndex].Value.ToString();
                //    //string catlevel = ((TextBox)GrdCategory.Rows[e.RowIndex].FindControl("txtCatLvl")).Text;

                //    //srcGridView.UpdateMethod = "UpdateCategory";
                //    srcGridView.UpdateParameters.Add("connection", TypeCode.String, GetConnectionString());
                //    srcGridView.UpdateParameters.Add("CategoryName", TypeCode.String, catDescr);
                //    srcGridView.UpdateParameters.Add("CategoryID", TypeCode.Int32, catId);
                //    srcGridView.UpdateParameters.Add("CategoryLevel", TypeCode.String, catlevel);
                //    srcGridView.UpdateParameters.Add("Usernam", TypeCode.String, Username);

                //    try
                //    {
                //        srcGridView.Update();
                //        System.Threading.Thread.Sleep(1000);
                //        GrdCategory.DataBind();
                //    }
                //    catch (Exception ex)
                //    {
                //        if (ex.InnerException != null)
                //        {
                //            StringBuilder script = new StringBuilder();
                //            script.Append("alert('Category with this name already exists, Please try with a different name.');");

                //            if (ex.InnerException.Message.IndexOf("duplicate values in the index") > -1)
                //                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);

                //            return;
                //        }
                //    }


                lnkBtnAdd.Visible = true;
            }
            else if (e.CommandName == "Edit")
            {
                lnkBtnAdd.Visible = false;
            }
            else if (e.CommandName == "Page")
            {
                lnkBtnAdd.Visible = true;



                int    intCurIndex = GrdCategory.PageIndex;
                string Comm        = e.CommandArgument.ToString();

                switch (Comm)
                {
                case "First":
                    GrdCategory.PageIndex = 0;
                    break;

                case "Prev":
                    GrdCategory.PageIndex = intCurIndex - 1;
                    break;

                case "Next":
                    GrdCategory.PageIndex = intCurIndex + 1;
                    break;

                case "Last":
                    GrdCategory.PageIndex = GrdCategory.PageCount;
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 8
0
        protected void Search(object sender, EventArgs e)
        {
            try
            {
                if (ddlExamName.SelectedValue == "Select Exam")
                {
                    throw new Exception("Select Exam Name");
                }
                DataTable dt = new DataTable();
                objML_StudentProfile.StudentName = Session["UserName"].ToString();
                objML_StudentProfile.ID          = txtSearch.Text != "" ? txtSearch.Text : null;
                if (objML_StudentProfile.ID == null)
                {
                    objML_StudentProfile.ID = "";
                }
                objML_StudentProfile.ExamName = ddlExamName.SelectedItem.Value != "" ? ddlExamName.SelectedItem.Value : null;

                if (rbtnMultiple.Checked == true)
                {
                    objML_StudentProfile.doctype = rbtnMultiple.Text;
                }
                else
                {
                    objML_StudentProfile.doctype = rbtnIndividual.Text;
                }
                dt = objBL_StudentProfile.BL_SerachQuestionInfo(objML_StudentProfile);
                if (dt.Rows.Count > 0)
                {
                    GrdCategory.DataSource = dt;
                    GrdCategory.DataBind();
                    int i = 0;
                    int y = 0;
                    foreach (GridViewRow row in GrdCategory.Rows)
                    {
                        Label lblTick       = (Label)row.FindControl("lbl");
                        Label lblStudentAns = (Label)row.FindControl("StudentAns");
                        Label lblCorrctAns  = (Label)row.FindControl("CorrectAns");
                        if (lblCorrctAns.Text == lblStudentAns.Text)
                        {
                            lblTick.Text = "✔";
                            i            = i + 1;
                        }
                        else
                        {
                            lblTick.Text = "❌";
                            y            = y + 1;
                        }
                    }
                    lblCorrect.Text     = i.ToString();
                    lblWrong.Text       = y.ToString();
                    lblTotalQus.Text    = dt.Rows.Count.ToString();
                    GrdCategory.Visible = true;
                }
                else
                {
                    GrdCategory.DataSource = dt;
                    GrdCategory.Visible    = false;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('No Data Found')", true);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + ex.Message.ToString() + "');", true);
            }
        }