protected void FinishData()
        {
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            if (Session["UserType"] != null && Session["UserType"].ToString() == "User")
            {
                Catalog_DAC dac = new Catalog_DAC();
                int         res = dac.UpdateUserDetails(UserId);
                if (res > 0)
                {
                    Session["UserId"]   = null;
                    Session["UserType"] = null;
                    Response.Redirect("~/Login.aspx");
                }
                dac = null;
            }
            if (Session["UserType"] != null && Session["UserType"].ToString() == "Evaluator")
            {
                long EvaluatorId = 0;
                long.TryParse(Session["EvaluatorId"].ToString(), out EvaluatorId);

                Catalog_DAC dac = new Catalog_DAC();
                int         res = dac.UpdateEvaluatorDetails(UserId, EvaluatorId);
                dac = null;
                Session["UserId"] = null;
                Response.Redirect("AdminHome.aspx");
            }
            if (Session["UserType"] != null && Session["UserType"].ToString() == "Administrator")
            {
                Session["UserId"] = null;
                Response.Redirect("AdminHome.aspx");
            }
        }
        private void GetCatalogOptions()
        {
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getCatalogOptions();

            dac = null;
            ViewState["dtCtlgOpts"] = dt;
        }
Ejemplo n.º 3
0
        private void GetTagValues()
        {
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getTagValues();

            if (dt != null && dt.Rows.Count > 0)
            {
                ViewState["TagValues"] = dt;
            }
        }
        private void GetUserTestDetails()
        {
            DateTime StartDate = DateTime.Now.Date;
            DateTime EndDate   = DateTime.Now.Date;

            StartDate = Convert.ToDateTime(txtFromDate.Text);
            EndDate   = Convert.ToDateTime(txtToDate.Text);
            gvUserTestDtls.DataSource = null;
            Catalog_DAC dac = new Catalog_DAC();

            {
                DataTable dt = dac.GetUserTestDetails(StartDate, EndDate);
                gvUserTestDtls.DataSource = dt;
            }
            gvUserTestDtls.DataBind();
        }
        private void GetImgPaths()
        {
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getImagePaths();

            ViewState["dtImgPaths"] = dt;

            DataTable dt1 = dac.getImageAnswers(UserId);

            ViewState["dtImgAns"] = dt1;

            dac = null;
        }
        private void SaveCataloguingData(bool IsSubmit)
        {
            string Cat_Answer = string.Empty;
            int    CatalogId  = 0;

            int.TryParse(hdfQn.Value, out CatalogId);

            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            long EvaluatorId   = 0;
            bool CheckedResult = false;

            if (Session["UserType"].ToString() == "User")
            {
                if (rbtnCtlgOpts.SelectedIndex >= 0)
                {
                    Cat_Answer = rbtnCtlgOpts.SelectedItem.Text;
                }
                Catalog_DAC dac = new Catalog_DAC();
                int         res = dac.InsertCataloguingDetails(CatalogId, Cat_Answer, UserId);
                if (res > 0)
                {
                    if (IsSubmit)
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                }
                dac = null;
            }
            if (Session["UserType"].ToString() == "Evaluator")
            {
                bool.TryParse(chkResult.Checked.ToString(), out CheckedResult);

                Catalog_DAC dac = new Catalog_DAC();
                int         res = dac.UpdateEvaluatorCataloguingDetails(CatalogId, UserId, EvaluatorId, CheckedResult);
                if (res > 0)
                {
                    if (IsSubmit)
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                }
                dac = null;
            }
        }
Ejemplo n.º 7
0
        private void GetMarcTags()
        {
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            gvMarcTags.DataSource = null;
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getMarcQuesctions(1, UserId);

            dac = null;
            if (dt != null && dt.Rows.Count > 0)
            {
                gvMarcTags.DataSource = dt;
            }
            gvMarcTags.DataBind();
        }
        private void GetCatalogs()
        {
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getCataloguingQuesctions(4);

            dac = null;
            ViewState["dtCtlgQns"] = dt;
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 1; i <= dt.Rows.Count; i++)
                {
                    ListItem li = new ListItem();
                    li.Text  = i.ToString();
                    li.Value = dt.Rows[i - 1]["CatalogId"].ToString();
                    BulletedList1.Items.Add(li);
                }
                hdfQn.Value = BulletedList1.Items[0].Value;
            }
        }
        private void GeImgQuestions()
        {
            BulletedList1.Items.Clear();
            Catalog_DAC dac = new Catalog_DAC();
            DataTable   dt  = dac.getImagePartsQuesctions(3);

            dac = null;
            ViewState["dtImgQns"] = dt;
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 1; i <= dt.Rows.Count; i++)
                {
                    ListItem li = new ListItem();
                    li.Text  = i.ToString();
                    li.Value = dt.Rows[i - 1]["ImgMastId"].ToString();
                    BulletedList1.Items.Add(li);
                }
                hdfQn.Value = BulletedList1.Items[0].Value;
            }
        }
        protected void FillUserCatalogs()
        {
            lblUsrAns.Text    = string.Empty;
            chkResult.Checked = false;

            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            int CatalogId = 0;

            if (hdfQn.Value.Length > 0)
            {
                int.TryParse(hdfQn.Value, out CatalogId);
            }
            if (CatalogId > 0)
            {
                rbtnCtlgOpts.ClearSelection();

                Catalog_DAC dac = new Catalog_DAC();
                DataTable   dt  = dac.getUserCatalogs(CatalogId, UserId);
                dac = null;

                if (dt != null && dt.Rows.Count > 0)
                {
                    if (Session["UserType"].ToString() == "User")
                    {
                        rbtnCtlgOpts.SelectedIndex = rbtnCtlgOpts.Items.IndexOf(rbtnCtlgOpts.Items.FindByText(dt.Rows[0]["Cat_Answer"].ToString()));
                    }
                    if (Session["UserType"].ToString() == "Evaluator" || Session["UserType"].ToString() == "Administrator")
                    {
                        rbtnCtlgOpts.Visible = false;
                        divEval.Visible      = true;
                        lblUsrAns.Text       = dt.Rows[0]["Cat_Answer"].ToString();
                        bool chkres = false;
                        bool.TryParse(dt.Rows[0]["Result"].ToString(), out chkres);
                        chkResult.Checked = chkres;
                    }
                }
            }
        }
        protected void btnTimeOut_Click(object sender, EventArgs e)
        {
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            if (Session["UserType"] != null && Session["UserType"].ToString() == "User")
            {
                SaveCitationsData();

                if (Session["UserType"] != null && Session["UserType"].ToString() == "User")
                {
                    Catalog_DAC dac = new Catalog_DAC();
                    int         res = dac.UpdateUserDetails(UserId);
                    if (res > 0)
                    {
                        Session["UserId"]   = null;
                        Session["UserType"] = null;
                        Response.Redirect("~/Login.aspx");
                    }
                    dac = null;
                }
            }
        }
        private void SaveCitationsData()
        {
            int CitationId = 0;

            int.TryParse(hdfQn.Value, out CitationId);

            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            DataTable dtCitations = ViewState["dtCitations"] as DataTable;

            if (Session["UserType"].ToString() == "User")
            {
                Dictionary <string, string> diCitations = new Dictionary <string, string>();

                foreach (DetailsViewRow dvr in dvCitation.Rows)
                {
                    foreach (DataColumn dc in dtCitations.Columns)
                    {
                        if (dc.ColumnName != "Citation")
                        {
                            TextBox txt = dvr.FindControl("txt" + dc.ColumnName) as TextBox;
                            if (txt != null)
                            {
                                diCitations.Add(dc.ColumnName, txt.Text.Trim());
                            }
                        }
                    }
                    break;
                }

                if (CitationId > 0 && diCitations.Count > 0)
                {
                    Catalog_DAC dac = new Catalog_DAC();
                    int         res = dac.InsertCitationDetails(CitationId, diCitations, UserId);
                    if (res > 0)
                    {
                        // Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                    dac = null;
                    //BindCitation();
                }
            }
            if (Session["UserType"].ToString() == "Evaluator")
            {
                long    EvaluatorId = 0;
                decimal Marks       = 0;
                string  Comments    = string.Empty;

                long.TryParse(Session["EvaluatorId"].ToString(), out EvaluatorId);

                foreach (DetailsViewRow dvr in dvCitation.Rows)
                {
                    TextBox txtComments = dvr.Cells[1].FindControl("txtComments") as TextBox;
                    if (txtComments != null)
                    {
                        Comments = txtComments.Text.Trim();
                    }
                    TextBox txtResult = dvr.Cells[1].FindControl("txtResult") as TextBox;
                    if (txtResult != null)
                    {
                        decimal.TryParse(txtResult.Text.Trim(), out Marks);
                    }
                }

                if (CitationId > 0 && EvaluatorId > 0)
                {
                    Catalog_DAC dac = new Catalog_DAC();
                    int         res = dac.UpdateEevaluatorCitationDetails(CitationId, UserId, EvaluatorId, Comments, Marks);
                    if (res > 0)
                    {
                        //Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                    dac = null;
                }
            }
        }
        private void SaveImagePartsData()
        {
            BindCatalogs();
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);
            int ImgMastId = 0;

            if (hdfQn.Value.Length > 0)
            {
                int.TryParse(hdfQn.Value, out ImgMastId);
            }
            if (ImgMastId > 0)
            {
                string ImgAnsIds = string.Empty;
                string ImgAns    = string.Empty;

                DataTable dtImgAns = ViewState["dtImgAns"] as DataTable;
                if (Session["UserType"].ToString() == "User")
                {
                    DataRow[] drImgAns = dtImgAns.Select("ImgMastId=" + ImgMastId + "");
                    if (drImgAns != null && drImgAns.Length > 0 && drImgAns[0]["QueType"].ToString() == "CheckBox")
                    {
                        if (rbtnImgOpts.SelectedIndex > 0)
                        {
                            if (ImgAnsIds == string.Empty)
                            {
                                ImgAnsIds = rbtnImgOpts.ToolTip;
                            }
                            else
                            {
                                ImgAnsIds = ImgAnsIds + "~" + rbtnImgOpts.ToolTip;
                            }

                            if (ImgAns == string.Empty)
                            {
                                ImgAns = rbtnImgOpts.SelectedItem.Value;
                            }
                            else
                            {
                                ImgAns = ImgAns + "~" + rbtnImgOpts.SelectedItem.Value;
                            }
                        }
                    }
                    else if (drImgAns != null && drImgAns.Length > 0 && drImgAns[0]["QueType"].ToString() == "TextBox")
                    {
                        foreach (GridViewRow gvr in gvImagesAns.Rows)
                        {
                            TextBox txtImgAns = gvr.FindControl("txtImgAns") as TextBox;
                            if (txtImgAns != null)
                            {
                                if (ImgAnsIds == string.Empty)
                                {
                                    ImgAnsIds = gvr.Cells[1].Text;
                                }
                                else
                                {
                                    ImgAnsIds = ImgAnsIds + "~" + gvr.Cells[1].Text;
                                }

                                string strtxt = (txtImgAns.Text.Length == 0 ? null : txtImgAns.Text);

                                if (ImgAns == string.Empty)
                                {
                                    ImgAns = strtxt;
                                }
                                else
                                {
                                    ImgAns = ImgAns + "~" + strtxt;
                                }
                            }
                        }
                    }

                    if (ImgAnsIds != string.Empty)
                    {
                        Catalog_DAC dac = new Catalog_DAC();
                        int         res = dac.InsertimageDetails(ImgAnsIds, ImgAns, UserId);
                        if (res > 0)
                        {
                            // Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                        }
                        dac = null;
                    }
                }
                if (Session["UserType"].ToString() == "Evaluator")
                {
                    long    EvaluatorId = 0;
                    decimal Marks       = 0;
                    string  Comments    = string.Empty;

                    long.TryParse(Session["EvaluatorId"].ToString(), out EvaluatorId);
                    if (EvaluatorId > 0)
                    {
                        decimal.TryParse(txtMarks.Text, out Marks);
                        Comments = txtComments.Text.Trim();

                        Catalog_DAC dac = new Catalog_DAC();
                        int         res = dac.InsertEvaluatorImageDetails(ImgMastId, UserId, EvaluatorId, Marks, Comments);
                        if (res > 0)
                        {
                            // Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                        }
                        dac = null;
                    }
                }
            }
        }
        private void BindImgAnswers()
        {
            dvImgEvl.Visible = false;
            txtMarks.Text    = string.Empty;
            txtComments.Text = string.Empty;

            rbtnImgOpts.Visible = true;
            divEval.Visible     = false;

            lblImgAns.Text = string.Empty;
            lblUsrAns.Text = string.Empty;


            int ImgMastId = 0;

            if (hdfQn.Value.Length > 0)
            {
                int.TryParse(hdfQn.Value, out ImgMastId);
            }
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            if (ImgMastId > 0)
            {
                DataTable dtImgAns = ViewState["dtImgAns"] as DataTable;
                DataRow[] drImgAns = dtImgAns.Select("ImgMastId=" + ImgMastId + "");
                gvImagesAns.DataSource = null;
                if (drImgAns != null && drImgAns.Length > 0 && drImgAns[0]["QueType"].ToString() == "TextBox")
                {
                    gvImagesAns.DataSource = drImgAns.CopyToDataTable();
                }
                gvImagesAns.DataBind();

                rbtnImgOpts.Items.Clear();
                if (drImgAns != null && drImgAns.Length > 0 && drImgAns[0]["QueType"].ToString() == "CheckBox")
                {
                    DataTable dtImgPaths = ViewState["dtImgPaths"] as DataTable;
                    DataRow[] drImgPaths = dtImgPaths.Select("ImgMastId=" + ImgMastId + "");
                    DataTable dtTemp     = drImgPaths.CopyToDataTable();
                    int       r          = 1;
                    rbtnImgOpts.ToolTip = drImgAns[0]["ImgAnsId"].ToString();

                    foreach (DataRow dr in dtTemp.Rows)
                    {
                        ListItem li = new ListItem();
                        li.Text  = "Page(" + r.ToString() + ")";
                        li.Value = dr["PathId"].ToString();
                        rbtnImgOpts.Items.Add(li);
                        r++;
                    }
                    rbtnImgOpts.SelectedIndex = rbtnImgOpts.Items.IndexOf(rbtnImgOpts.Items.FindByValue(drImgAns[0]["UsrAnswer"].ToString()));
                    if (Session["UserType"].ToString() == "Evaluator")
                    {
                        rbtnImgOpts.Visible = false;
                        divEval.Visible     = true;

                        lblImgAns.Text = drImgAns[0]["ImgAnswer"].ToString();

                        lblUsrAns.Text = (rbtnImgOpts.SelectedIndex > -1 ? rbtnImgOpts.SelectedItem.Text : "");
                    }
                }
                if (Session["UserType"].ToString() == "Evaluator" || Session["UserType"].ToString() == "Administrator")
                {
                    dvImgEvl.Visible = true;
                    Catalog_DAC dac = new Catalog_DAC();
                    DataTable   dt  = dac.getEvaluatorImageDetails(ImgMastId, UserId);
                    dac = null;
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        txtMarks.Text    = dt.Rows[0]["Marks"].ToString();
                        txtComments.Text = dt.Rows[0]["Comments"].ToString();
                    }
                }
            }
        }
Ejemplo n.º 15
0
        private void SaveMarcData()
        {
            string MarcIds  = string.Empty;
            string MarcAns  = string.Empty;
            string Comments = string.Empty;

            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            long EvaluatorId = 0;

            if (Session["UserType"].ToString() == "User")
            {
                foreach (GridViewRow gvr in gvMarcTags.Rows)
                {
                    if (MarcIds == string.Empty)
                    {
                        MarcIds = gvr.Cells[1].Text;
                    }
                    else
                    {
                        MarcIds = MarcIds + "~" + gvr.Cells[1].Text;
                    }

                    DropDownList ddlTV = gvr.FindControl("ddlTagValues") as DropDownList;
                    if (MarcAns == string.Empty)
                    {
                        MarcAns = ddlTV.SelectedItem.Text;
                    }
                    else
                    {
                        MarcAns = MarcAns + "~" + ddlTV.SelectedItem.Text;
                    }
                }
                if (MarcIds != string.Empty)
                {
                    Catalog_DAC dac = new Catalog_DAC();
                    int         res = dac.InsertMarcDetails(MarcIds, MarcAns, UserId, EvaluatorId, Comments);
                    if (res > 0)
                    {
                        Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                    dac = null;
                    GetMarcTags();
                }
            }

            int chkres = 0;

            if (Session["UserType"].ToString() == "Evaluator")
            {
                long.TryParse(Session["EvaluatorId"].ToString(), out EvaluatorId);

                foreach (GridViewRow gvr in gvMarcTags.Rows)
                {
                    chkres = 0;
                    if (MarcIds == string.Empty)
                    {
                        MarcIds = gvr.Cells[1].Text;
                    }
                    else
                    {
                        MarcIds = MarcIds + "~" + gvr.Cells[1].Text;
                    }

                    CheckBox chkReselt = gvr.FindControl("chkReselt") as CheckBox;
                    chkres = (chkReselt.Checked ? 1 : 0);

                    if (MarcAns == string.Empty)
                    {
                        MarcAns = chkres.ToString();
                    }
                    else
                    {
                        MarcAns = MarcAns + "~" + chkres.ToString();
                    }

                    TextBox txtComments = gvr.FindControl("txtComments") as TextBox;
                    string  tempcmt     = (txtComments.Text.Trim().Length > 0 ? txtComments.Text : null);

                    if (Comments == string.Empty)
                    {
                        Comments = tempcmt;
                    }
                    else
                    {
                        Comments = Comments + "~" + tempcmt;
                    }
                }
                if (MarcIds != string.Empty)
                {
                    Catalog_DAC dac = new Catalog_DAC();
                    int         res = dac.InsertMarcDetails(MarcIds, MarcAns, UserId, EvaluatorId, Comments);
                    if (res > 0)
                    {
                        //Page.ClientScript.RegisterStartupScript(typeof(Page), "marin", "alert('Recard saved.')", true);
                    }
                    dac = null;
                    GetMarcTags();
                }
            }
        }
        private void FillUserCitations()
        {
            foreach (DetailsViewRow dvr in dvCitation.Rows)
            {
                if (dvr.Cells[1].HasControls() == true && dvr.Cells[1].Controls.Count > 0)
                {
                    TextBox txt = dvr.Cells[1].Controls[1] as TextBox;
                    if (txt != null)
                    {
                        txt.Text = string.Empty;
                        if (txt.ID == "txtComments" || txt.ID == "txtResult")
                        {
                            if (Session["UserType"].ToString() == "User")
                            {
                                dvr.Visible = false;
                            }
                            else
                            {
                                dvr.Visible = true;
                            }

                            if (Session["UserType"].ToString() == "Evaluator")
                            {
                                dvr.Visible = true;
                                txt.Enabled = true;
                                txt.Visible = true;
                            }
                            else if (Session["UserType"].ToString() == "Administrator")
                            {
                                txt.Visible = true;
                                txt.Enabled = false;
                            }
                        }
                    }
                }
            }
            long UserId = 0;

            long.TryParse(Session["UserId"].ToString(), out UserId);

            int CitationId = 0;

            if (hdfQn.Value.Length > 0)
            {
                int.TryParse(hdfQn.Value, out CitationId);
            }
            if (CitationId > 0)
            {
                Catalog_DAC dac = new Catalog_DAC();
                DataTable   dt  = dac.getUserCitations(CitationId, UserId);
                dac = null;

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    if (dvCitation.Rows.Count > 0)
                    {
                        foreach (DetailsViewRow dvr in dvCitation.Rows)
                        {
                            foreach (DataColumn dc in dt.Columns)
                            {
                                if (dc.ColumnName != "Citation")
                                {
                                    if (dvr.Cells[0].Text == dc.ColumnName)
                                    {
                                        TextBox txt = dvr.Cells[1].FindControl("txt" + dc.ColumnName) as TextBox;
                                        Label   lbl = dvr.Cells[1].FindControl("lbl" + dc.ColumnName) as Label;
                                        if (txt != null)
                                        {
                                            txt.Text = dr[dc.ColumnName].ToString();
                                        }

                                        if (Session["UserType"].ToString() == "Evaluator" || Session["UserType"].ToString() == "Administrator")
                                        {
                                            if (lbl != null && lbl.Visible == false)
                                            {
                                                lbl.Visible = true;
                                            }
                                        }

                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserType"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            if (!IsPostBack)
            {
                if (Session["crnttime"] != null)
                {
                    hdfTimer.Value  = Session["crnttime"].ToString();
                    hdfRoleId.Value = Session["RoleId"].ToString();
                }


                //HttpCookie cookiename = Request.Cookies.Get("cookiename");

                //// Check if cookie exists in the current request.
                //if (cookiename != null)
                //{
                //    hdfTimer.Value = cookiename.Value;
                //}

                if (Request.QueryString["UserType"] != null)
                {
                    //hdfStartTime.Value = string.Empty;
                    Session["StartTime"] = "";

                    Session["UserType"]    = null;
                    Session["EvaluatorId"] = null;
                    Session["LoginName"]   = null;
                    Session["StartTime"]   = null;

                    Session["UserType"] = Request.QueryString["UserType"];

                    if (Request.QueryString["UserType"] == "User")
                    {
                        if (Request.QueryString["UserId"] != null)
                        {
                            Session["UserId"]      = Request.QueryString["UserId"];
                            Session["EvaluatorId"] = 0;
                        }
                    }
                }
                if (Request.QueryString["LoginName"] != null)
                {
                    Session["LoginName"] = Request.QueryString["LoginName"];
                }

                Catalog_DAC dac = new Catalog_DAC();
                {
                    DataTable dt = dac.getIndex();

                    gvIndex.DataSource = dt;
                    gvIndex.DataBind();
                }

                if (Session["UserType"] != null)
                {
                    if (Session["UserType"].ToString() == "User")
                    {
                        lnkHome.Visible = false;
                    }
                }

                if (Session["UserName"] != null)
                {
                    lblUserName.Text = Session["UserName"].ToString();
                }
            }
        }