Example #1
0
        private void BindUserDetails()
        {
            string         userName       = string.Empty;
            string         email          = string.Empty;
            string         strUserName    = string.Empty;
            DataSet        dsUserDetails  = new DataSet();
            DataTable      dtUserDetails  = new DataTable();
            UserManagement objUserListDTO = new UserManagement();
            UserManagement userBAL        = new UserManagement();

            List <UserManagement> lstUserDetails = new List <UserManagement>();

            objUserListDTO = new UserManagement();
            userBAL        = new UserManagement();
            dsUserDetails  = new DataSet();


            if (Session["userEmail"] != null && Session["userEmail"].ToString().Length > 0)
            {
                lstUserDetails           = new List <UserManagement>();
                objUserListDTO.UserName  = userName;
                objUserListDTO.UserEmail = Session["userEmail"].ToString();

                //Label lblExamUserID = (Label)Page.Master.FindControl("lblExamUserID");
                //if (lblExamUserID != null)
                //{
                //    lblExamUserID.Text = Session["userEmail"].ToString();
                //}
                lstUserDetails = userBAL.GetUserDetailsDBByEmail(objUserListDTO);
                if (lstUserDetails != null && lstUserDetails.Count > 0)
                {
                    this.Session["UserEmail"]   = lstUserDetails[0].UserEmail.ToString();
                    this.Session["ApplyingFor"] = lstUserDetails[0].ApplyingFor.ToString();

                    if (lstUserDetails[0].FirstName != null && lstUserDetails[0].FirstName.ToString() != null && lstUserDetails[0].FirstName.ToString().Length > 0)
                    {
                        lblFirstName.Text = lstUserDetails[0].FirstName.ToString();
                    }
                    if (lstUserDetails[0].LastName != null && lstUserDetails[0].LastName.ToString() != null && lstUserDetails[0].LastName.ToString().Length > 0)
                    {
                        lblLastName.Text = lstUserDetails[0].LastName.ToString();
                    }
                    if (lstUserDetails[0].FatherName != null && lstUserDetails[0].FatherName.ToString() != null && lstUserDetails[0].FatherName.ToString().Length > 0)
                    {
                        lblFatherName.Text = lstUserDetails[0].FatherName.ToString();
                    }
                    if (lstUserDetails[0].Gender != null && lstUserDetails[0].Gender.ToString() != null && lstUserDetails[0].Gender.ToString().Length > 0)
                    {
                        lblGender.Text = lstUserDetails[0].Gender.ToString();
                    }
                    if (lstUserDetails[0].PreferredName != null && lstUserDetails[0].PreferredName.ToString() != null && lstUserDetails[0].PreferredName.ToString().Length > 0)
                    {
                        lblPreferredName.Text = lstUserDetails[0].PreferredName.ToString();
                    }
                    if (lstUserDetails[0].PassportNumber != null && lstUserDetails[0].PassportNumber.ToString() != null && lstUserDetails[0].PassportNumber.ToString().Length > 0)
                    {
                        lblPassport.Text = lstUserDetails[0].PassportNumber.ToString();
                    }
                    if (lstUserDetails[0].State != null && lstUserDetails[0].State.ToString() != null && lstUserDetails[0].State.ToString().Length > 0)
                    {
                        lblState.Text = lstUserDetails[0].State.ToString();
                    }
                    if (lstUserDetails[0].City != null && lstUserDetails[0].City.ToString() != null && lstUserDetails[0].City.ToString().Length > 0)
                    {
                        lblCity.Text = lstUserDetails[0].City.ToString();
                    }
                    if (lstUserDetails[0].PinCode != null && lstUserDetails[0].PinCode.ToString() != null && lstUserDetails[0].PinCode.ToString().Length > 0)
                    {
                        lblPincode.Text = lstUserDetails[0].PinCode.ToString();
                    }
                    if (lstUserDetails[0].UserEmail != null && lstUserDetails[0].UserEmail.ToString() != null && lstUserDetails[0].UserEmail.ToString().Length > 0)
                    {
                        lblEmail.Text = lstUserDetails[0].UserEmail.ToString();
                    }
                    if (lstUserDetails[0].ApplyingFor != null && lstUserDetails[0].ApplyingFor.ToString() != null && lstUserDetails[0].ApplyingFor.ToString().Length > 0)
                    {
                        lblApplyingfor.Text = lstUserDetails[0].ApplyingFor.ToString();
                    }
                    if (lstUserDetails[0].DOB != null && lstUserDetails[0].DOB.ToString() != null && lstUserDetails[0].DOB.ToString().Length > 0)
                    {
                        lblDOB.Text = lstUserDetails[0].DOB.ToString();
                    }
                    if (lstUserDetails[0].HomePhone != null && lstUserDetails[0].HomePhone.ToString() != null && lstUserDetails[0].HomePhone.ToString().Length > 0)
                    {
                        lblHomePhone.Text = lstUserDetails[0].HomePhone.ToString();
                    }
                    if (lstUserDetails[0].WorkPhone != null && lstUserDetails[0].WorkPhone.ToString() != null && lstUserDetails[0].WorkPhone.ToString().Length > 0)
                    {
                        lblWorkPhone.Text = lstUserDetails[0].WorkPhone.ToString();
                    }
                    if (lstUserDetails[0].MobileNumber != null && lstUserDetails[0].MobileNumber.ToString() != null && lstUserDetails[0].MobileNumber.ToString().Length > 0)
                    {
                        lblMobileNumber.Text = lstUserDetails[0].MobileNumber.ToString();
                    }
                    if (lstUserDetails[0].LanguagesKnown != null && lstUserDetails[0].LanguagesKnown.ToString() != null && lstUserDetails[0].LanguagesKnown.ToString().Length > 0)
                    {
                        lblLanguagesKnown.Text = lstUserDetails[0].LanguagesKnown.ToString();
                    }
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "alert('Invalid username and password')", true);
                }
            }
        }
        protected void BtnLogin_Click(object sender, EventArgs e)
        {
            if (chkUserLogin.Checked)
            {
                if (txtUserEmail.Text.Trim().Length > 0)
                {
                    bool usrstatus = Check_Candidate_Registration(txtUserEmail.Text.Trim());

                    if (!usrstatus)
                    {
                        lblerrorMessage.Text      = txtUserEmail.Text.Trim() + "  Your resume is not available in the NES website.  please post your resume @ www.nes.co.in and Try Again!! ";
                        lblerrorMessage.ForeColor = System.Drawing.Color.Red;
                        Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "alert('Your resume is not available in the NES website.  please post your resume @ www.nes.co.in and Try Again!!')", true);

                        return;
                    }
                }
                else
                {
                    lblerrorMessage.Text      = " Enter email address as user name ";
                    lblerrorMessage.ForeColor = System.Drawing.Color.Red;
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "alert('Enter email address as user name')", true);
                    return;
                }
            }

            if (Session["exammoduleid"] != null && Session["exammoduleid"].ToString() == "44")
            {
                if (!chkUserLogin.Checked)
                {
                    txtUserEmail.Text = Session["ExaminerName"].ToString();
                }
            }



            string         userName       = string.Empty;
            string         passWord       = string.Empty;
            string         strUserName    = string.Empty;
            DataSet        dsUserDetails  = new DataSet();
            DataTable      dtUserDetails  = new DataTable();
            DataTable      dtexamdetails  = new DataTable();
            UserManagement objUserListDTO = new UserManagement();
            UserManagement userBAL        = new UserManagement();

            try
            {
                objUserListDTO = new UserManagement();
                userBAL        = new UserManagement();
                dsUserDetails  = new DataSet();

                userName = txtUserEmail.Text.ToString();
                objUserListDTO.UserName = userName;

                bool   isStatus  = false;
                string strStatus = string.Empty;

                strUserName          = userName;
                Session["userEmail"] = userName;
                int result = 0;
                if (Session["exammoduleid"] != null)
                {
                    int exammoduleid = 0;
                    int.TryParse(Session["exammoduleid"].ToString(), out exammoduleid);
                    switch (exammoduleid)
                    {
                    case 36:     //EMP - Enhance Metadata Project EMP
                    {
                        dtexamdetails = userBAL.VerifyUserExamByUserEmail(objUserListDTO);
                        if (dtexamdetails != null && dtexamdetails.Rows.Count > 0)
                        {
                            lblerrorMessage.Text      = strUserName + "  You have already appeared for the test! ";
                            lblerrorMessage.ForeColor = System.Drawing.Color.Red;
                            Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "alert('You have already appeared for the test!')", true);
                        }
                        else
                        {
                            if (strUserName.Length > 0)
                            {
                                Page.Session["userEmail"] = strUserName;
                                result = ExamUserInsert();

                                if (result > 0)
                                {
                                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                                }
                            }
                        }
                        break;
                    }

                    case 18:
                    case 21:
                    case 22:
                    case 23:
                    case 24:
                    case 25:
                    case 26:
                    case 29:
                    case 30:
                    case 31:
                    case 32:
                    case 35:
                    case 39:
                    case 45:
                    {
                        // Session["exammoduleid"].ToString() == "18"
                        // //|| Session["exammoduleid"].ToString() == "19"
                        // || Session["exammoduleid"].ToString() == "21"
                        // || Session["exammoduleid"].ToString() == "22"
                        // || Session["exammoduleid"].ToString() == "23" //ADPNET
                        // || Session["exammoduleid"].ToString() == "24"
                        // || Session["exammoduleid"].ToString() == "25" //python
                        // || Session["exammoduleid"].ToString() == "26"
                        // || Session["exammoduleid"].ToString() == "29"
                        // || Session["exammoduleid"].ToString() == "30"
                        // || Session["exammoduleid"].ToString() == "31"
                        // || Session["exammoduleid"].ToString() == "32"
                        // || Session["exammoduleid"].ToString() == "35"
                        // || Session["exammoduleid"].ToString() == "39" //PSP
                        /// || Session["exammoduleid"].ToString() == "41" //PCM
                        // || Session["exammoduleid"].ToString() == "45"
                        // ))

                        long UserId = InsertObj_UserDetails();
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 19:     // HelpDesk - Level: 2 desc
                    case 20:     //HelpDesk - Level: 3 desc
                    case 33:     //HelpDesk - Level: 3 desc
                    case 38:     // Content Specialist - Descriptive Test -2
                    case 41:     //Product Management Team -desc
                    {
                        int roleid = 3;
                        if (!chkUserLogin.Checked)
                        {
                            Session["UserId"] = 0;
                            UserDetails umbl = new UserDetails();

                            string UserType = umbl.GetUserRole(userName);
                            umbl = null;
                            Session["UserType"] = UserType;

                            if (UserType == "Administrator")
                            {
                                roleid = 1;
                            }
                            else if (UserType == "Evaluator")
                            {
                                roleid = 2;
                            }
                        }

                        long UserId = Des_Insert_UserDetails(roleid);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 44:     //Cataloguing Online Test CAT
                    {
                        if (!chkUserLogin.Checked)
                        {
                            Session["UserId"]    = 0;
                            Session["LoginName"] = userName;
                            Session["userEmail"] = userName;

                            UserDetails umbl = new UserDetails();

                            string UserType = umbl.GetUserRole(userName);
                            umbl = null;

                            Session["UserType"] = UserType;
                            int roleid = 1;
                            if (UserType == "Administrator")
                            {
                                roleid = 1;
                            }
                            else if (UserType == "Evaluator")
                            {
                                roleid = 2;
                            }

                            long UserId = InsertCat_UserDetails(roleid);
                            Session["EvaluatorId"] = 0;
                            Session["UserId"]      = 0;
                            if (UserType == "Administrator")
                            {
                                Session["UserType"]        = "Administrator";
                                Session["AdministratorId"] = UserId;
                            }
                            else if (UserType == "Evaluator")
                            {
                                Session["UserType"]    = "Evaluator";
                                Session["EvaluatorId"] = UserId;
                            }
                            if (UserId > 0)
                            {
                                Session["UserId"]   = UserId;
                                Session["ModuleId"] = Session["exammoduleid"].ToString();
                                Response.Redirect("http://10.68.98.83/CataloguingTest/models/AdminHome.aspx?UserType=" + Session["UserType"].ToString() + "&UserId=" + Session["UserId"].ToString() + "&LoginName=" + Session["userEmail"].ToString() + "", false);

                                //ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                            }
                        }
                        else
                        {
                            Session["userEmail"] = userName;
                            Session["UserType"]  = "User";
                            Session["UserId"]    = 0;

                            long UserId = InsertCat_UserDetails(3);
                            if (UserId > 0)
                            {
                                Session["UserId"]   = UserId;
                                Session["ModuleId"] = Session["exammoduleid"].ToString();
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                            }
                        }
                        break;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        /// <summary>
        /// To insert the user test deatails
        /// </summary>
        protected void CreateTest(long CanId, string username)
        {
            string userName    = string.Empty;
            string passWord    = string.Empty;
            string strUserName = string.Empty;

            DataTable      dtUserDetails  = new DataTable();
            DataTable      dtexamdetails  = new DataTable();
            UserManagement objUserListDTO = new UserManagement();
            UserManagement userBAL        = new UserManagement();

            try
            {
                objUserListDTO          = new UserManagement();
                userBAL                 = new UserManagement();
                userName                = username;
                objUserListDTO.UserName = userName;

                bool   isStatus  = false;
                string strStatus = string.Empty;

                strUserName          = userName;
                Session["userEmail"] = userName;
                int result = 0;
                if (Session["exammoduleid"] != null)
                {
                    int exammoduleid = 0;
                    int.TryParse(Session["exammoduleid"].ToString(), out exammoduleid);
                    switch (exammoduleid)
                    {
                    case 36:     //EMP - Enhance Metadata Project EMP
                    case 40:     // Book Processing & AI
                    {
                        int  roleid = 3;
                        long UserId = InsertOther_UserDetails(CanId, roleid);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 18:
                    case 21:
                    case 22:
                    case 23:
                    case 24:
                    case 25:
                    case 26:
                    case 29:
                    case 30:
                    case 31:
                    case 32:
                    case 34:
                    case 35:
                    case 39:
                    case 45:
                    {
                        long UserId = InsertObj_UserDetails(CanId);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 19:     // HelpDesk - Level: 2 desc
                    case 20:     //HelpDesk - Level: 3 desc
                    case 28:     // TS Test
                    case 33:     //lib  - Level: 3 desc
                    case 38:     // Content Specialist - Descriptive Test -2
                    case 41:     //Product Management Team -desc
                    {
                        int roleid = 3;

                        long UserId = Des_Insert_UserDetails(CanId, roleid);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 44:     //Cataloguing Online Test CAT
                    {
                        Session["userEmail"] = userName;
                        Session["UserType"]  = "User";
                        Session["UserId"]    = 0;

                        long UserId = InsertCat_UserDetails(CanId, 3);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            // ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }

                        break;
                    }

                    case 47:     //PIR Test
                    {
                        Session["userEmail"] = userName;
                        Session["UserType"]  = "User";
                        Session["UserId"]    = 0;

                        long UserId = InsertCat_UserDetails(CanId, 3);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            // ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }

                        break;
                    }

                    case 49:     //JP Test
                    case 46:     //PIR Test
                    {
                        Session["userEmail"] = userName;
                        Session["UserType"]  = "User";
                        Session["UserId"]    = 0;

                        long UserId = InsertOther_UserDetails(CanId, 3);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            // ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }

                        break;
                    }

                    case 50:    //Product Management Team -desc
                    case 52:    //Insurance
                    {
                        int roleid = 3;

                        long UserId = DAO_Insert_UserDetails(CanId, roleid);
                        if (UserId > 0)
                        {
                            Session["UserId"]   = UserId;
                            Session["ModuleId"] = Session["exammoduleid"].ToString();
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "window.open('UserDashboard.aspx','_parent');", true);
                        }
                        break;
                    }

                    case 54:     //Analytical Test
                    {
                        goto case 52;
                    }

                    case 56:     //EBK XML
                    {
                        goto case 52;
                    }

                    case 57:     //EBK EPUB
                    {
                        goto case 52;
                    }

                    case 59:     //EDT
                    {
                        goto case 52;
                    }

                    case 61:     //CINAHL Indexing Test 20200723 Anil
                    {
                        goto case 52;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }