public void Fillddls()
    {
        obj_SYS_Role     = new SYS_Role();
        obj_BAL_SYS_Role = new SYS_Role_BLogic();

        DataSet dsSelect = new DataSet();

        dsSelect = obj_BAL_SYS_Role.BAL_Select_BMSList();

        if (dsSelect.Tables.Count > ((int)EnumFile.AssignValue.Zero))
        {
            ddlBoard.DataSource     = dsSelect.Tables[0];
            ddlBoard.DataTextField  = "BMS";
            ddlBoard.DataValueField = "BMSID";
            ddlBoard.DataBind();
            ddlBoard.Items.Insert(((int)EnumFile.AssignValue.Zero), new ListItem("-- Select --"));

            ddlSubject.DataSource     = dsSelect.Tables[1];
            ddlSubject.DataTextField  = "Subject";
            ddlSubject.DataValueField = "SubjectID";
            ddlSubject.DataBind();
            ddlSubject.Items.Insert(((int)EnumFile.AssignValue.Zero), new ListItem("-- Select --"));
        }
    }
Ejemplo n.º 2
0
 protected string IsFreePackage()
 {
     try
     {
         string strresult = string.Empty;
         obj_BAL_SYS_Role = new SYS_Role_BLogic();
         DataSet dtPackageDetails = new DataSet();
         dtPackageDetails = obj_BAL_SYS_Role.BAL_SYS_Select_IsFreePackage(Convert.ToInt32(AppSessions.StudentID));
         double packageprice = Convert.ToDouble(dtPackageDetails.Tables[0].Rows[0]["Price"].ToString());
         if (packageprice > 0)
         {
             strresult = "paid";
         }
         else
         {
             strresult = "free";
         }
         return(strresult);
     }
     catch (Exception)
     {
         return(string.Empty);
     }
 }
Ejemplo n.º 3
0
    private void BindFeedbackQuestion()
    {
        try
        {
            ActivityFeedbackRaing obj_Activity_Feedback_Rating = new ActivityFeedbackRaing();


            SYS_Role_BLogic obj_SYS_Role_BLogic = new SYS_Role_BLogic();
            int             BMSID = obj_SYS_Role_BLogic.BAL_Select_BMS(Convert.ToInt16(ddlBoard.SelectedValue), Convert.ToInt16(ddlMedium.SelectedValue), Convert.ToInt16(ddlStandard.SelectedValue));


            Teacher_Dashboard        obj_Teacher_Dashboard;
            Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard;

            obj_Teacher_Dashboard     = new Teacher_Dashboard();
            obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic();


            obj_Teacher_Dashboard.BMSID     = Convert.ToInt64(BMSID);
            obj_Teacher_Dashboard.SubjectID = Convert.ToInt16(ddlsubject.SelectedValue.ToString());

            obj_Teacher_Dashboard.ChapterID = Convert.ToInt64(ddlchapter.SelectedValue.ToString());
            obj_Teacher_Dashboard.TopicID   = Convert.ToInt64(ddltopic.SelectedValue.ToString());


            bmssctid = obj_BAL_Teacher_Dashboard.BAL_Select_BMS_SCTID(obj_Teacher_Dashboard);

            // ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid));


            double[] totalavg;
            int[]    star;

            int rowcount  = ds_ActivityFeedback.Tables[3].Rows.Count + ds_ActivityFeedback.Tables[4].Rows.Count;
            int row_count = 0;

            totalavg = new double[rowcount];
            //star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2];
            star = new int[6];

            if (ds_ActivityFeedback.Tables[3].Rows.Count > 0)
            {
                QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[0]["QuestionCount"].ToString());
                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[3].Rows.Count; cnt++)
                {
                    TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString());
                    if (TotalRating1 != 0)
                    {
                        totalavg[row_count] = (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString()));
                        row_count           = row_count + 1;
                    }
                }
            }

            if (ds_ActivityFeedback.Tables[4].Rows.Count > 0)
            {
                QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[0]["QuestionCount"].ToString());

                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[4].Rows.Count; cnt++)
                {
                    TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[cnt]["Rating"].ToString());
                    if (TotalRating1 != 0)
                    {
                        totalavg[row_count] += (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[4].Rows[cnt]["QuestionCount"].ToString()));
                        row_count            = row_count + 1;
                    }
                }
            }

            for (int avgcnt = 0; avgcnt < totalavg.Length; avgcnt++)
            {
                int roundavg = Convert.ToInt32(Math.Round(totalavg[avgcnt]));
                if (roundavg == 1)
                {
                    OneStar       += 1.0;
                    star[roundavg] = Convert.ToInt32(Math.Round((OneStar * 100 / row_count)));
                    lbl1star.Text  = star[roundavg].ToString() + "%";
                }
                else if (roundavg == 2)
                {
                    Twostar       += 1;
                    star[roundavg] = Convert.ToInt32(Math.Round((Twostar * 100 / row_count)));
                    lbl2star.Text  = star[roundavg].ToString() + "%";
                }
                else if (roundavg == 3)
                {
                    Threestar     += 1;
                    star[roundavg] = Convert.ToInt32(Math.Round((Threestar * 100 / row_count)));
                    lbl3star.Text  = star[roundavg].ToString() + "%";
                }
                else if (roundavg == 4)
                {
                    Fourstar      += 1;
                    star[roundavg] = Convert.ToInt32(Math.Round((Fourstar * 100 / row_count)));
                    lbl4star.Text  = star[roundavg].ToString() + "%";
                }
                else if (roundavg == 5)
                {
                    Fivestar      += 1;
                    star[roundavg] = Convert.ToInt32(Math.Round((Fivestar * 100 / row_count)));
                    lbl5star.Text  = star[roundavg].ToString() + "%";
                }
            }

            pnlreport.Visible = true;
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 4
0
    //public void ShowMessage(string message)
    //{
    //    this.lblMessage.Text = message;
    //    ModalMessageExtender.Show();
    //}

    protected void RedirectToDashboard()
    {
        try
        {
            // 0 Indicates Student

            StudentDash    = new StudentDash();
            BLogic_Student = new Student_DashBoard_BLogic();

            DataSet   dtLogin   = new DataSet();
            DataTable LoginInfo = new DataTable();
            DataTable UserInfo  = new DataTable();

            obj_SYS_Role          = new SYS_Role();
            obj_BAL_SYS_Role      = new SYS_Role_BLogic();
            obj_SYS_Role.Username = txtEmail.Text;
            obj_SYS_Role.Password = ViewState["strpassword"].ToString();

            //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue);
            //if (uctxtEmail.Text != "" && uctxtpass.Text != "")
            //{

            dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role);
            LoginInfo = dtLogin.Tables[0];
            //}
            if (LoginInfo.Rows.Count > 0 && LoginInfo != null)
            {
                AppSessions.AppUserType = "Student";

                AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString());
                AppSessions.UserName  = LoginInfo.Rows[0]["FirstName"].ToString();

                AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString());
                AppSessions.BMS   = LoginInfo.Rows[0]["BMS"].ToString();

                AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString());
                AppSessions.Board   = LoginInfo.Rows[0]["Board"].ToString();

                AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString());
                AppSessions.Medium   = LoginInfo.Rows[0]["Medium"].ToString();

                AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString());
                AppSessions.Standard   = LoginInfo.Rows[0]["Standard"].ToString();

                AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString());
                //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString();

                AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString());
                //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString();

                AppSessions.Role   = LoginInfo.Rows[0]["Role"].ToString();
                AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString());

                AppSessions.IsFreePackage = IsFreePackage();


                //AppSessions.EmailID = Convert.ToString(LoginInfo.Rows[0]["EmailID"]);

                //yourLoginMethodStudent(LoginInfo);
                bool AllowMultipleSession = false;
                AllowMultipleSession = Convert.ToBoolean(LoginInfo.Rows[0]["AllowMultipleSession"].ToString());


                //Hashtable sessions1 = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                //HttpSessionState existingUserSession1 = (HttpSessionState)sessions1[Session["StudentID"].ToString()];
                //if (existingUserSession1 != null)
                //{
                //    Response.Redirect("../Dashboard/StudentDashboard.aspx");
                //}

                if (AllowMultipleSession == false)
                {
                    Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                    if (sessions == null)
                    {
                        sessions = new Hashtable();
                    }

                    HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["StudentID"].ToString()];
                    if (existingUserSession != null)
                    {
                        ////existingUserSession[Session["EmpolyeeID"].ToString()] = null;
                        //logout current logged in user
                        WebMsg.Show("you are already logged in.");
                        return;
                    }
                }

                ////////getting the pointer to the Session of the current logged in user
                yourLoginMethodStudent(LoginInfo);
                //ProceedToRedirectPage(LoginInfo);

                bool    AllowPayment  = false;
                DataSet dsPaymentInfo = new DataSet();
                dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment");
                if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0)
                {
                    if (dsPaymentInfo.Tables[0].Rows.Count > 0)
                    {
                        string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString();
                        if (a == "0")
                        {
                            AllowPayment = false;
                        }
                        else
                        {
                            AllowPayment = true;
                        }
                    }
                }

                DataSet ds = new DataSet();
                StudentDash.StudentID = AppSessions.StudentID;
                //ds = BLogic_Student.BAL_Validate_Student(StudentDash);
                ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash);
                TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtEmail.Text, 0);


                if (AllowPayment == true)
                {
                    //Session["ShowPaymentPages"] = "yes";
                    if (ds != null && dtLogin.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Session["CheckValidity"] = "Yes";
                            ProceedToRedirect();
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('We have sent your Login details on your registered Email Address, kindly check your Email to get your Password.  ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true);
                            //Response.Redirect("~/DashBoard/StudentDashboard.aspx", false);
                            //ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Congratulation! You got free trial for 30 days. \\n We have sent your Login details on your registered Email Address.  ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true);
                            TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + txtEmail.Text, 0);
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('We have sent your Login details on your registered Email Address, kindly check your Email to get your Password.  ');window.open('../DashBoard/StudentDashboard.aspx','_self');", true);
                        //Response.Redirect("~/DashBoard/StudentDashboard.aspx", false);
                        TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + txtEmail.Text, 0);
                    }
                }
                else
                {
                    Session["CheckValidity"]    = "Yes";
                    Session["ShowPaymentPages"] = "No";
                    ProceedToRedirect();
                }
            }
        }
        catch (Exception)
        {
        }
    }
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            StoreCookie();
            int status = CheckLogin();
            //if (ddlUserType.SelectedValue == "0")
            if (status == 2)
            {
                WebMsg.Show("invalid username or password");
                return;
            }
            else if (status == 0)
            {
                // 0 Indicates Student

                StudentDash    = new StudentDash();
                BLogic_Student = new Student_DashBoard_BLogic();

                DataSet   dtLogin   = new DataSet();
                DataTable LoginInfo = new DataTable();
                DataTable UserInfo  = new DataTable();

                obj_SYS_Role          = new SYS_Role();
                obj_BAL_SYS_Role      = new SYS_Role_BLogic();
                obj_SYS_Role.Username = txtUserName.Text;
                obj_SYS_Role.Password = txtUserPassword.Text;
                //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue);

                dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role);
                LoginInfo = dtLogin.Tables[0];
                if (LoginInfo.Rows.Count > 0 && LoginInfo != null)
                {
                    AppSessions.AppUserType = "Student";

                    AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString());
                    AppSessions.UserName  = LoginInfo.Rows[0]["FirstName"].ToString();

                    AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString());
                    AppSessions.BMS   = LoginInfo.Rows[0]["BMS"].ToString();

                    AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString());
                    AppSessions.Board   = LoginInfo.Rows[0]["Board"].ToString();

                    AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString());
                    AppSessions.Medium   = LoginInfo.Rows[0]["Medium"].ToString();

                    AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString());
                    AppSessions.Standard   = LoginInfo.Rows[0]["Standard"].ToString();

                    AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString());
                    //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString();

                    AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString());
                    //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString();

                    AppSessions.Role   = LoginInfo.Rows[0]["Role"].ToString();
                    AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString());

                    yourLoginMethodStudent(LoginInfo);

                    bool    AllowPayment  = false;
                    DataSet dsPaymentInfo = new DataSet();
                    dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment");
                    if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0)
                    {
                        if (dsPaymentInfo.Tables[0].Rows.Count > 0)
                        {
                            string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString();
                            if (a == "0")
                            {
                                AllowPayment = false;
                            }
                            else
                            {
                                AllowPayment = true;
                            }
                        }
                    }


                    DataSet ds = new DataSet();
                    StudentDash.StudentID = AppSessions.StudentID;
                    // ds = BLogic_Student.BAL_Validate_Student(StudentDash);
                    ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash);


                    if (AllowPayment == true)
                    {
                        if (ds != null && dtLogin.Tables.Count > 0)
                        {
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                Session["CheckValidity"] = "Yes";
                                ProceedToRedirect();
                            }
                            else
                            {
                                Response.Redirect("~/DashBoard/SelectPackage.aspx");
                            }
                        }
                        else
                        {
                            Response.Redirect("~/DashBoard/SelectPackage.aspx");
                        }
                    }
                    else
                    {
                        Session["CheckValidity"]    = "Yes";
                        Session["ShowPaymentPages"] = "No";
                        ProceedToRedirect();
                    }
                }
            }
            else if (status == 1)
            {
                // 1 Indicates Teacher
                DataSet   dtLogin   = new DataSet();
                DataTable LoginInfo = new DataTable();
                DataTable UserInfo  = new DataTable();

                obj_SYS_Role          = new SYS_Role();
                obj_BAL_SYS_Role      = new SYS_Role_BLogic();
                obj_SYS_Role.Username = txtUserName.Text;
                obj_SYS_Role.Password = txtUserPassword.Text;
                //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue);

                dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Active_Login(obj_SYS_Role);
                LoginInfo = dtLogin.Tables[0];

                if (LoginInfo.Rows.Count > 0 && LoginInfo != null && LoginInfo.Rows[0]["Status"].ToString().Equals("1"))
                {
                    if (dtLogin.Tables[1].Rows[0]["RoleID"].ToString() != "3")
                    {
                        bool AllowMultipleSession = false;
                        UserInfo = dtLogin.Tables[1];
                        if (UserInfo.Rows.Count > 0 && UserInfo != null)
                        {
                            AppSessions.AppUserType = "School";
                            AppSessions.EmpolyeeID  = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString());
                            AppSessions.RoleID      = int.Parse(UserInfo.Rows[0]["RoleID"].ToString());
                            AppSessions.SchoolID    = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString());
                            AppSessions.UserName    = UserInfo.Rows[0]["FirstName"].ToString();
                            AppSessions.SchoolName  = UserInfo.Rows[0]["Name"].ToString();
                            AppSessions.Role        = UserInfo.Rows[0]["Role"].ToString();

                            AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString());
                            TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtUserName.Text, 0);
                        }

                        if (AllowMultipleSession == false)
                        {
                            Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                            if (sessions == null)
                            {
                                sessions = new Hashtable();
                            }

                            ////////getting the pointer to the Session of the current logged in user
                            HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()];
                            if (existingUserSession != null)
                            {
                                ////existingUserSession[Session["EmpolyeeID"].ToString()] = null;
                                //logout current logged in user
                                lblError1.Visible = true;
                            }
                            else
                            {
                                yourLoginMethod(UserInfo);
                                ProceedToRedirectPage(UserInfo);
                            }
                        }
                        else
                        {
                            yourLoginMethod(UserInfo);

                            ProceedToRedirectPage(UserInfo);
                        }
                    }
                    else
                    {
                        // For Teacher Redirection

                        bool AllowMultipleSession = false;
                        UserInfo = dtLogin.Tables[1];
                        if (UserInfo.Rows.Count > 0 && UserInfo != null)
                        {
                            Session["UserInfoTable"] = UserInfo;

                            ViewState["AppUserType"] = "School";
                            ViewState["EmpolyeeID"]  = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString());
                            ViewState["RoleID"]      = int.Parse(UserInfo.Rows[0]["RoleID"].ToString());
                            ViewState["SchoolID"]    = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString());
                            ViewState["UserName"]    = UserInfo.Rows[0]["FirstName"].ToString();
                            ViewState["SchoolName"]  = UserInfo.Rows[0]["Name"].ToString();
                            ViewState["Role"]        = UserInfo.Rows[0]["Role"].ToString();

                            AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString());
                            TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + txtUserName.Text, 0);
                        }

                        if (AllowMultipleSession == false)
                        {
                            Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                            if (sessions == null)
                            {
                                sessions = new Hashtable();
                            }
                            ////////getting the pointer to the Session of the current logged in user
                            // HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()];
                            HttpSessionState existingUserSession = (HttpSessionState)sessions[ViewState["EmpolyeeID"].ToString()];
                            if (existingUserSession != null)
                            {
                                ////existingUserSession[Session["EmpolyeeID"].ToString()] = null;
                                //logout current logged in user
                                lblError1.Visible = true;
                            }
                            else
                            {
                                yourLoginMethod(UserInfo);
                                ProceedToRedirectPage(UserInfo);
                            }
                        }
                        else
                        {
                            yourLoginMethod(UserInfo);

                            ProceedToRedirectPage(UserInfo);
                        }
                    }
                }
                else
                {
                    TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginFailed), "LoginId: " + txtUserName.Text + " , Password: "******"Authentication Failed,unable to login");
                }
            }
        }
        catch (Exception ex)
        {
            WebMsg.Show(ex.Message);
        }
    }
Ejemplo n.º 6
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            if (uctxtUserName.Text == string.Empty || uctxtUserPassword.Text == string.Empty)
            {
                WebMsg.Show("Please enter User ID and Password");
            }
            else
            {
                StoreCookie();

                int status = CheckLogin();
                //if (ddlUserType.SelectedValue == "0")
                if (status == 2)
                {
                    //WebMsg.Show("invalid username or password");
                    uctxtUserName.Text       = string.Empty;
                    uctxtUserPassword.Text   = string.Empty;
                    ucinvalididpassword.Text = "Invalid User ID or Password";

                    //Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('FiveDot File uploaded successfully'); ", true);

                    //Response.Write("<script>alert('my message');</script> ");
                    //ScriptManager.RegisterClientScriptBlock(ucbtnGo, this.GetType(), "Alert Message", "<script> alert('invalid username or password');</script>", true);

                    return;
                }
                else if (status == 0)
                {
                    // 0 Indicates Student

                    StudentDash    = new StudentDash();
                    BLogic_Student = new Student_DashBoard_BLogic();

                    DataSet   dtLogin   = new DataSet();
                    DataTable LoginInfo = new DataTable();
                    DataTable UserInfo  = new DataTable();

                    obj_SYS_Role          = new SYS_Role();
                    obj_BAL_SYS_Role      = new SYS_Role_BLogic();
                    obj_SYS_Role.Username = uctxtUserName.Text;
                    obj_SYS_Role.Password = uctxtUserPassword.Text;
                    //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue);
                    //if (uctxtEmail.Text != "" && uctxtpass.Text != "")
                    //{

                    dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role);
                    LoginInfo = dtLogin.Tables[0];
                    //}
                    if (LoginInfo.Rows.Count > 0 && LoginInfo != null)
                    {
                        AppSessions.AppUserType = "Student";

                        AppSessions.StudentID = Convert.ToInt32(LoginInfo.Rows[0]["StudentID"].ToString());
                        AppSessions.UserName  = LoginInfo.Rows[0]["FirstName"].ToString();

                        AppSessions.LoginID = LoginInfo.Rows[0]["LoginID"].ToString();

                        AppSessions.BMSID = Convert.ToInt32(LoginInfo.Rows[0]["BMSID"].ToString());
                        AppSessions.BMS   = LoginInfo.Rows[0]["BMS"].ToString();

                        AppSessions.BoardID = Convert.ToInt32(LoginInfo.Rows[0]["BoardID"].ToString());
                        AppSessions.Board   = LoginInfo.Rows[0]["Board"].ToString();

                        AppSessions.MediumID = Convert.ToInt32(LoginInfo.Rows[0]["MediumID"].ToString());
                        AppSessions.Medium   = LoginInfo.Rows[0]["Medium"].ToString();

                        AppSessions.StandardID = Convert.ToInt32(LoginInfo.Rows[0]["StandardID"].ToString());
                        AppSessions.Standard   = LoginInfo.Rows[0]["Standard"].ToString();

                        AppSessions.DivisionID = Convert.ToInt32(LoginInfo.Rows[0]["DivisionID"].ToString());
                        //AppSessions.Division = LoginInfo.Rows[0]["Division"].ToString();

                        AppSessions.SchoolID = Convert.ToInt32(LoginInfo.Rows[0]["SchoolID"].ToString());
                        //AppSessions.SchoolName = LoginInfo.Rows[0]["SchoolName"].ToString();

                        AppSessions.Role   = LoginInfo.Rows[0]["Role"].ToString();
                        AppSessions.RoleID = Convert.ToInt32(LoginInfo.Rows[0]["RoleID"].ToString());

                        AppSessions.IsFreePackage = IsFreePackage();


                        //AppSessions.EmailID = Convert.ToString(LoginInfo.Rows[0]["EmailID"]);

                        //yourLoginMethodStudent(LoginInfo);
                        bool AllowMultipleSession = false;
                        AllowMultipleSession = Convert.ToBoolean(LoginInfo.Rows[0]["AllowMultipleSession"].ToString());


                        //Hashtable sessions1 = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                        //HttpSessionState existingUserSession1 = (HttpSessionState)sessions1[Session["StudentID"].ToString()];
                        //if (existingUserSession1 != null)
                        //{
                        //    Response.Redirect("../Dashboard/StudentDashboard.aspx");
                        //}

                        if (AllowMultipleSession == false)
                        {
                            Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                            if (sessions == null)
                            {
                                sessions = new Hashtable();
                            }

                            HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["StudentID"].ToString()];
                            if (existingUserSession != null)
                            {
                                ////existingUserSession[Session["EmpolyeeID"].ToString()] = null;
                                //logout current logged in user
                                Session["StudentID"] = null;
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", "<script>alert('You are already Logged In.')</script>", false);
                                return;
                            }
                        }

                        ////////getting the pointer to the Session of the current logged in user
                        yourLoginMethodStudent(LoginInfo);
                        ProceedToRedirectPage(LoginInfo);

                        bool    AllowPayment  = false;
                        DataSet dsPaymentInfo = new DataSet();
                        dsPaymentInfo = BLogic_Student.BAL_Select_PaymentPagesInfo("Payment");
                        if (dsPaymentInfo != null & dsPaymentInfo.Tables.Count > 0)
                        {
                            if (dsPaymentInfo.Tables[0].Rows.Count > 0)
                            {
                                string a = dsPaymentInfo.Tables[0].Rows[0]["value"].ToString();
                                if (a == "0")
                                {
                                    AllowPayment = false;
                                }
                                else
                                {
                                    AllowPayment = true;
                                }
                            }
                        }

                        DataSet ds = new DataSet();
                        StudentDash.StudentID = AppSessions.StudentID;
                        //ds = BLogic_Student.BAL_Validate_Student(StudentDash);
                        ds = BLogic_Student.BAL_Validate_Student_Package(StudentDash);
                        TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + uctxtUserName.Text, 0);


                        if (AllowPayment == true)
                        {
                            //Session["ShowPaymentPages"] = "yes";
                            if (ds != null && dtLogin.Tables.Count > 0)
                            {
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    Session["CheckValidity"] = "Yes";
                                    ProceedToRedirect();
                                }
                                else
                                {
                                    Response.Redirect("~/DashBoard/SelectPackage.aspx", false);
                                    TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + uctxtUserName.Text, 0);
                                }
                            }
                            else
                            {
                                Response.Redirect("~/DashBoard/SelectPackage.aspx", false);
                                TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmployeeOrStudentID), Convert.ToInt16(AppSessions.DivisionID), "Login", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.PackageSelection), "LoginId: " + uctxtUserName.Text, 0);
                            }
                        }
                        else
                        {
                            Session["CheckValidity"]    = "Yes";
                            Session["ShowPaymentPages"] = "No";
                            ProceedToRedirect();
                        }
                    }
                }

                //else if (ddlUserType.SelectedValue == "1")
                else if (status == 1)
                {
                    // 1 Indicates Teacher
                    DataSet   dtLogin   = new DataSet();
                    DataTable LoginInfo = new DataTable();
                    DataTable UserInfo  = new DataTable();

                    obj_SYS_Role          = new SYS_Role();
                    obj_BAL_SYS_Role      = new SYS_Role_BLogic();
                    obj_SYS_Role.Username = uctxtUserName.Text;
                    obj_SYS_Role.Password = uctxtUserPassword.Text;
                    //obj_SYS_Role.roleid = Convert.ToInt16(DdlRole.SelectedValue);

                    dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Active_Login(obj_SYS_Role);
                    LoginInfo = dtLogin.Tables[0];

                    if (LoginInfo.Rows.Count > 0 && LoginInfo != null && LoginInfo.Rows[0]["Status"].ToString().Equals("1"))
                    {
                        if (dtLogin.Tables[1].Rows[0]["RoleID"].ToString() != "3")
                        {
                            bool AllowMultipleSession = false;
                            UserInfo = dtLogin.Tables[1];
                            if (UserInfo.Rows.Count > 0 && UserInfo != null)
                            {
                                AppSessions.AppUserType = "School";
                                AppSessions.EmpolyeeID  = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString());
                                AppSessions.RoleID      = int.Parse(UserInfo.Rows[0]["RoleID"].ToString());
                                AppSessions.SchoolID    = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString());
                                AppSessions.UserName    = UserInfo.Rows[0]["FirstName"].ToString();
                                AppSessions.SchoolName  = UserInfo.Rows[0]["Name"].ToString();
                                AppSessions.Role        = UserInfo.Rows[0]["Role"].ToString();

                                AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString());
                                TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), "LoginId: " + uctxtUserName.Text, 0);
                            }

                            if (AllowMultipleSession == false)
                            {
                                Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                                if (sessions == null)
                                {
                                    sessions = new Hashtable();
                                }

                                ////////getting the pointer to the Session of the current logged in user
                                HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()];
                                if (existingUserSession != null)
                                {
                                    ////existingUserSession[Session["EmpolyeeID"].ToString()] = null;
                                    //logout current logged in user
                                }
                                else
                                {
                                    yourLoginMethod(UserInfo);
                                    ProceedToRedirectPage(UserInfo);
                                }
                            }
                            else
                            {
                                yourLoginMethod(UserInfo);
                                ProceedToRedirectPage(UserInfo);
                            }
                        }
                        else
                        {
                            // For Teacher Redirection

                            bool AllowMultipleSession = false;
                            UserInfo = dtLogin.Tables[1];
                            if (UserInfo.Rows.Count > 0 && UserInfo != null)
                            {
                                Session["UserInfoTable"] = UserInfo;

                                ViewState["AppUserType"] = "School";
                                ViewState["EmpolyeeID"]  = int.Parse(UserInfo.Rows[0]["EmployeeID"].ToString());
                                ViewState["RoleID"]      = int.Parse(UserInfo.Rows[0]["RoleID"].ToString());
                                ViewState["SchoolID"]    = int.Parse(UserInfo.Rows[0]["SchoolID"].ToString());
                                ViewState["UserName"]    = UserInfo.Rows[0]["FirstName"].ToString();
                                ViewState["SchoolName"]  = UserInfo.Rows[0]["Name"].ToString();
                                ViewState["Role"]        = UserInfo.Rows[0]["Role"].ToString();

                                AllowMultipleSession = Convert.ToBoolean(UserInfo.Rows[0]["AllowMultipleSession"].ToString());
                                TrackLog_Utils.Log(Convert.ToInt32(ViewState["SchoolID"]), Convert.ToInt32(ViewState["EmpolyeeID"]), Convert.ToInt16(AppSessions.DivisionID), "LoginMasterPage.master", "ucbtnGo", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginSuccess), ViewState["UserName"] + " (" + uctxtUserName.Text + ") From " + ViewState["SchoolName"] + " school Logged in.", 0);
                            }

                            if (AllowMultipleSession == false)
                            {
                                Hashtable sessions = (Hashtable)Application["WEB_SESSIONS_OBJECT"];
                                if (sessions == null)
                                {
                                    sessions = new Hashtable();
                                }
                                ////////getting the pointer to the Session of the current logged in user
                                // HttpSessionState existingUserSession = (HttpSessionState)sessions[Session["EmpolyeeID"].ToString()];
                                HttpSessionState existingUserSession = (HttpSessionState)sessions[ViewState["EmpolyeeID"].ToString()];
                                if (existingUserSession != null)
                                {
                                    WebMsg.Show("This user is already logged in");
                                }
                                else
                                {
                                    yourLoginMethod(UserInfo);
                                    ProceedToRedirectPage(UserInfo);
                                }
                            }
                            else
                            {
                                yourLoginMethod(UserInfo);
                                ProceedToRedirectPage(UserInfo);
                            }
                        }
                    }
                    else
                    {
                        TrackLog_Utils.Log(Convert.ToInt32(AppSessions.SchoolID), Convert.ToInt32(AppSessions.EmpolyeeID), Convert.ToInt16(AppSessions.DivisionID), "LoginPage", "btnLogin", "Click", Convert.ToDateTime(System.DateTime.Now), HttpContext.Current.Session.SessionID, StringEnum.stringValueOf(EnumFile.Activity.LoginFailed), "LoginId: " + uctxtUserName.Text + " , Password: "******"Authentication Failed,unable to login");
                    }
                }

                uctxtUserName.Text     = string.Empty;
                uctxtUserPassword.Text = string.Empty;
            }
        }
        catch (Exception ex)
        {
            WebMsg.Show(ex.Message);
        }
    }
    private void BindFeedbackQuestion()
    {
        try
        {
            ActivityFeedbackRaing obj_Activity_Feedback_Rating = new ActivityFeedbackRaing();


            SYS_Role_BLogic obj_SYS_Role_BLogic = new SYS_Role_BLogic();
            int             BMSID = obj_SYS_Role_BLogic.BAL_Select_BMS(Convert.ToInt16(ddlBoard.SelectedValue), Convert.ToInt16(ddlMedium.SelectedValue), Convert.ToInt16(ddlStandard.SelectedValue));


            Teacher_Dashboard        obj_Teacher_Dashboard;
            Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard;

            obj_Teacher_Dashboard     = new Teacher_Dashboard();
            obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic();


            obj_Teacher_Dashboard.BMSID     = Convert.ToInt64(BMSID);
            obj_Teacher_Dashboard.SubjectID = Convert.ToInt16(ddlsubject.SelectedValue.ToString());

            obj_Teacher_Dashboard.ChapterID = Convert.ToInt64(ddlchapter.SelectedValue.ToString());
            obj_Teacher_Dashboard.TopicID   = Convert.ToInt64(ddltopic.SelectedValue.ToString());


            bmssctid = obj_BAL_Teacher_Dashboard.BAL_Select_BMS_SCTID(obj_Teacher_Dashboard);
            ViewState["BMSSCTID"] = bmssctid.ToString();

            if (ddlDivision.SelectedIndex != 0)
            {
                ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue), 2);
                ds_QuestionAverage  = obj_Activity_Feedback_Rating.GetQuestionRatingAverage(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue));
            }
            else
            {
                ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), 0, 1);
                ds_QuestionAverage  = obj_Activity_Feedback_Rating.GetQuestionRatingAverage(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue));
            }



            //DataSet teacher = new DataSet();
            //teacher = obj_Activity_Feedback_Rating.GetActivityFeedbackTeacher(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid),Convert.ToInt32(ddlDivision.SelectedValue));

            //ds_ActivityFeedback.Merge(teacher);

            double[] totalavg;
            int[]    star;
            star = new int[6];

            DataTable dt_teacherRating = new DataTable();
            dt_teacherRating = ds_QuestionAverage.Tables[0];

            DataTable dt_studentRating = new DataTable();
            dt_studentRating = ds_QuestionAverage.Tables[1];



            //DataRow dr;

            //for (int i = 0; i < dt_studentRating.Rows.Count; i++)
            //{


            //    dr = dt_teacherRating.NewRow();
            //    dr["ActivityFeedbackID"] = dt_studentRating.Rows[i]["ActivityFeedbackID"].ToString();
            //    dr["SchoolID"] = dt_studentRating.Rows[i]["SchoolID"].ToString();
            //    dr["BMSSCTID"] = dt_studentRating.Rows[i]["BMSSCTID"].ToString();
            //    dr["ID"] = dt_studentRating.Rows[i]["ID"].ToString();
            //    dr["DivisionID"] = dt_studentRating.Rows[i]["DivisionID"].ToString();
            //    dr["Rating"] = dt_studentRating.Rows[i]["Rating"].ToString();

            //    dt_teacherRating.Rows.Add(dr);
            //}


            int total = 0;



            if (ds_ActivityFeedback.Tables[0].Rows.Count > 0)
            {
                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[0].Rows.Count; cnt++)
                {
                    if (ds_ActivityFeedback.Tables[0].Rows[cnt]["Rating"].ToString() != "0")
                    {
                        //total += ds_ActivityFeedback.Tables[0].Rows.Count;
                        total += 1;
                    }
                }
            }
            if (ds_ActivityFeedback.Tables[1].Rows.Count > 0)
            {
                //total += ds_ActivityFeedback.Tables[1].Rows.Count;

                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[1].Rows.Count; cnt++)
                {
                    if (ds_ActivityFeedback.Tables[1].Rows[cnt]["Rating"].ToString() != "0")
                    {
                        //total += ds_ActivityFeedback.Tables[0].Rows.Count;
                        total += 1;
                    }
                }
            }

            for (int q_avg = 0; q_avg < ds_ActivityFeedback.Tables[0].Rows.Count; q_avg++)
            {
                if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "1")
                {
                    OneStar      += 1.0;
                    star[1]       = Convert.ToInt32(Math.Round((OneStar * 100) / total));
                    lbl1star.Text = star[1].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "2")
                {
                    Twostar      += 1.0;
                    star[2]       = Convert.ToInt32(Math.Round((Twostar * 100) / total));
                    lbl2star.Text = star[2].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "3")
                {
                    Threestar    += 1.0;
                    star[3]       = Convert.ToInt32(Math.Round((Threestar * 100) / total));
                    lbl3star.Text = star[3].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "4")
                {
                    Fourstar     += 1.0;
                    star[4]       = Convert.ToInt32(Math.Round((Fourstar * 100) / total));;
                    lbl4star.Text = star[4].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "5")
                {
                    Fivestar     += 1.0;
                    star[5]       = Convert.ToInt32(Math.Round((Fivestar * 100) / total));
                    lbl5star.Text = star[5].ToString() + "%";
                }
            }


            for (int q_avg = 0; q_avg < ds_ActivityFeedback.Tables[1].Rows.Count; q_avg++)
            {
                if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "1")
                {
                    OneStar      += 1.0;
                    star[1]       = Convert.ToInt32((OneStar * 100) / total);
                    lbl1star.Text = star[1].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "2")
                {
                    Twostar      += 1.0;
                    star[2]       = Convert.ToInt32(Math.Round(Twostar * 100) / total);
                    lbl2star.Text = star[2].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "3")
                {
                    Threestar    += 1.0;
                    star[3]       = Convert.ToInt32((Threestar * 100) / total);
                    lbl3star.Text = star[3].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "4")
                {
                    Fourstar     += 1.0;
                    star[4]       = Convert.ToInt32((Fourstar * 100) / total);
                    lbl4star.Text = star[4].ToString() + "%";
                }
                if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "5")
                {
                    Fivestar     += 1.0;
                    star[5]       = Convert.ToInt32((Fivestar * 100) / total);
                    lbl5star.Text = star[5].ToString() + "%";
                }
            }

            #region commnet


            //for (int i = 0; i < dt_student.Rows.Count; i++)
            //{
            //    dt_teacher.ImportRow(dt_student.Rows[i]);
            //}


            //for (int q_avg = 0; q_avg < ds_QuestionAverage.Tables[0].Rows.Count; q_avg++)
            //{

            //    if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "1")
            //    {
            //        OneStar += 1.0;
            //        star[1] = Convert.ToInt32(Math.Round((OneStar * 100) / ds_QuestionAverage.Tables[0].Rows.Count));
            //        lbl1star.Text = star[1].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "2")
            //    {
            //        Twostar += 1.0;
            //        star[2] = Convert.ToInt32(Convert.ToDouble(Math.Round((Twostar * 100) / ds_QuestionAverage.Tables[0].Rows.Count)));
            //        lbl2star.Text = star[2].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "3")
            //    {
            //        Threestar += 1.0;
            //        star[3] = Convert.ToInt32(Math.Round((Threestar * 100) / ds_QuestionAverage.Tables[0].Rows.Count));
            //        lbl3star.Text = star[3].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "4")
            //    {
            //        Fourstar += 1.0;
            //        star[4] = Convert.ToInt32(Math.Round((Fourstar * 100) / ds_QuestionAverage.Tables[0].Rows.Count));
            //        lbl4star.Text = star[4].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "5")

            //    {
            //        Fivestar += 1.0;
            //        star[5] = Convert.ToInt32(Math.Round((Fivestar * 100) / ds_QuestionAverage.Tables[0].Rows.Count));
            //        lbl5star.Text = star[5].ToString() + "%";
            //    }
            //}


            //for (int q_avg = 0; q_avg < ds_QuestionAverage.Tables[0].Rows.Count; q_avg++)
            //{

            //    if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "1")
            //    {
            //        OneStar += 1.0;
            //        star[1] = Convert.ToInt32(Math.Round((OneStar * 100) / ds_QuestionAverage.Tables[1].Rows.Count));
            //        lbl1star.Text = star[1].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "2")
            //    {
            //        Twostar += 1.0;
            //        star[2] = Convert.ToInt32(Convert.ToDouble(Math.Round((Twostar * 100) / ds_QuestionAverage.Tables[1].Rows.Count)));
            //        lbl2star.Text = star[2].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "3")
            //    {
            //        Threestar += 1.0;
            //        star[3] = Convert.ToInt32(Math.Round((Threestar * 100) / ds_QuestionAverage.Tables[1].Rows.Count));
            //        lbl3star.Text = star[3].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "4")
            //    {
            //        Fourstar += 1.0;
            //        star[4] = Convert.ToInt32(Math.Round((Fourstar * 100) / ds_QuestionAverage.Tables[1].Rows.Count));
            //        lbl4star.Text = star[4].ToString() + "%";
            //    }
            //    if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "5")
            //    {
            //        Fivestar += 1.0;
            //        star[5] = Convert.ToInt32(Math.Round((Fivestar * 100) / ds_QuestionAverage.Tables[1].Rows.Count));
            //        lbl5star.Text = star[5].ToString() + "%";
            //    }
            //}

            //int rowcount = ds_ActivityFeedback.Tables[3].Rows.Count + ds_ActivityFeedback.Tables[4].Rows.Count;
            //int row_count = 0;

            // totalavg = new double[rowcount];
            ////star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2];
            //star = new int[6];

            #endregion
            int rowcount  = ds_ActivityFeedback.Tables[0].Rows.Count + ds_ActivityFeedback.Tables[1].Rows.Count;
            int row_count = 0;

            totalavg = new double[rowcount];
            //star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2];
            star = new int[6];


            if (ds_ActivityFeedback.Tables[0].Rows.Count > 0)
            {
                QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[0].Rows[0]["count"].ToString());
                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[0].Rows.Count; cnt++)
                {
                    TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[0].Rows[cnt]["Rating"].ToString());
                    if (TotalRating1 != 0)
                    {
                        totalavg[row_count] = (TotalRating1 / Convert.ToDouble(QuestionCount));
                        row_count           = row_count + 1;
                    }
                }
            }

            if (ds_ActivityFeedback.Tables[1].Rows.Count > 0)
            {
                //QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[1]["count"].ToString());
                QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[0]["count"].ToString());

                for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[1].Rows.Count; cnt++)
                {
                    TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[cnt]["Rating"].ToString());
                    if (TotalRating1 != 0)
                    {
                        totalavg[row_count] += (TotalRating1 / Convert.ToDouble(QuestionCount));
                        row_count            = row_count + 1;
                    }
                }
            }
            //if (ds_ActivityFeedback.Tables[3].Rows.Count > 0)
            //{
            //    QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[0]["QuestionCount"].ToString());
            //    for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[3].Rows.Count; cnt++)
            //    {
            //        TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString());
            //        if (TotalRating1 != 0)
            //        {
            //            totalavg[row_count] = (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["QuestionCount"].ToString()));
            //            row_count = row_count + 1;
            //        }
            //    }
            //}

            //if (ds_ActivityFeedback.Tables[4].Rows.Count > 0)
            //{
            //    QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[0]["QuestionCount"].ToString());

            //    for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[4].Rows.Count; cnt++)
            //    {

            //        TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[cnt]["Rating"].ToString());
            //        if (TotalRating1 != 0)
            //        {
            //            totalavg[row_count] += (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["QuestionCount"].ToString()));
            //            row_count = row_count + 1;
            //        }
            //    }
            //}

            //for (int avgcnt = 0; avgcnt < totalavg.Length; avgcnt++)
            //{
            //    int roundavg = Convert.ToInt32(Math.Round(totalavg[avgcnt]));
            //    if (roundavg == 1)
            //    {
            //        OneStar += 1.0;
            //        star[roundavg] = Convert.ToInt32(Math.Round((OneStar * 100 / row_count)));
            //       // lbl1star.Text = star[roundavg].ToString() + "%";

            //    }
            //    else if (roundavg == 2)
            //    {
            //        Twostar += 1;
            //        star[roundavg] = Convert.ToInt32(Math.Round((Twostar * 100 / row_count)));
            //       // lbl2star.Text = star[roundavg].ToString() + "%";

            //    }
            //    else if (roundavg == 3)
            //    {
            //        Threestar += 1;
            //        star[roundavg] = Convert.ToInt32(Math.Round((Threestar * 100 / row_count)));
            //       // lbl3star.Text = star[roundavg].ToString() + "%";


            //    }
            //    else if (roundavg == 4)
            //    {
            //        Fourstar += 1;
            //        star[roundavg] = Convert.ToInt32(Math.Round((Fourstar * 100 / row_count)));
            //        //lbl4star.Text = star[roundavg].ToString() + "%";


            //    }
            //    else if (roundavg == 5)
            //    {
            //        Fivestar += 1;
            //        star[roundavg] = Convert.ToInt32(Math.Round((Fivestar * 100 / row_count)));
            //        //lbl5star.Text = star[roundavg].ToString() + "%";

            //    }
            //}

            pnlreport.Visible = true;
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Page.Title = "Manage User";

            string          IFormat          = "dd-MMM-yyyy";
            SYS_Role_BLogic obj_BAL_SYS_Role = new SYS_Role_BLogic();
            DataSet         dsSelect         = new DataSet();
            dsSelect = obj_BAL_SYS_Role.BAL_SYS_Role_SelectAll();

            if (Session["RoleID"].ToString() == Convert.ToString((int)EnumFile.Role.E_Admin))
            {
                //EAdmin
                foreach (DataRow dr in dsSelect.Tables[0].Rows)
                {
                    if ((Convert.ToString(dr["RoleID"]) == "2") || Convert.ToString(dr["RoleID"]) == "3")
                    {
                        ListItem oList = new ListItem(Convert.ToString(dr["Role"]), Convert.ToString(dr["RoleID"]));
                        ddlRole.Items.Add(oList);
                    }
                }
            }
            else if (Session["RoleID"].ToString() == Convert.ToString((int)EnumFile.Role.S_Admin))
            {
                //SAdmin
                foreach (DataRow dr in dsSelect.Tables[0].Rows)
                {
                    if (Convert.ToString(dr["RoleID"]) == "3")
                    {
                        ListItem oList = new ListItem(Convert.ToString(dr["Role"]), Convert.ToString(dr["RoleID"]));
                        ddlRole.Items.Add(oList);
                    }
                }
            }
            //ddlRole.DataSource = dsSelect.Tables[0];
            //ddlRole.DataTextField = "Role";
            //ddlRole.DataValueField = "RoleID";
            //ddlRole.DataBind();

            ddlRole.Items.Insert(((int)EnumFile.AssignValue.Zero), new ListItem("-- Select --", "0"));

            if (Request.QueryString["Employeeid"] != "0" & Request.QueryString["Employeeid"] != null)
            {
                this.ViewState["Employeeid"] = Request.QueryString["Employeeid"];

                ArrayList AlistEmailID = new ArrayList();
                DataSet   dsEmail      = new DataSet();
                BAL_Employee = new Employee_BLogic();
                try
                {
                    dsEmail = BAL_Employee.SelectEmployeeDetailByEmployeeID(Convert.ToInt64(this.ViewState["Employeeid"]));
                    if (dsEmail != null & dsEmail.Tables.Count > 0)
                    {
                        if (dsEmail.Tables[0].Rows.Count > 0)
                        {
                            //EmployeeID, Code, RoleID, SchoolID, FirstName, MiddleName, LastName, Gender, DateOfBirth, BloodGroup, Address, EmailID, ContactNo, Qualification,
                            // Designation, SecurityQuestion, SecurityAnswer, LoginID, Password, Image, LastLoginDate, AttemptCount, IsActive, CreatedOn, CreatedBy, ModifiedOn,
                            // ModifiedBy, AllowMultipleSession
                            ddlRole.SelectedValue       = Convert.ToString(dsEmail.Tables[0].Rows[0]["RoleID"]);
                            txtAddFirstName.Text        = Convert.ToString(dsEmail.Tables[0].Rows[0]["FirstName"]);
                            txtAddMiddleName.Text       = Convert.ToString(dsEmail.Tables[0].Rows[0]["MiddleName"]);
                            txtAddLastName.Text         = Convert.ToString(dsEmail.Tables[0].Rows[0]["LastName"]);
                            rlstAddGender.SelectedValue = Convert.ToString(dsEmail.Tables[0].Rows[0]["Gender"]);
                            DateTime dt;
                            if (DateTime.TryParse(Convert.ToString(dsEmail.Tables[0].Rows[0]["DateOfBirth"]), out dt))
                            {
                                txtAddDOB.Text = dt.ToString(IFormat);
                            }
                            txtAddBloodGroup.Text       = Convert.ToString(dsEmail.Tables[0].Rows[0]["BloodGroup"]);
                            txtAddPermanentAddress.Text = Convert.ToString(dsEmail.Tables[0].Rows[0]["Address"]);
                            txtAddEmail.Text            = Convert.ToString(dsEmail.Tables[0].Rows[0]["EmailID"]);
                            txtAddContactNumber.Text    = Convert.ToString(dsEmail.Tables[0].Rows[0]["ContactNo"]);
                            txtAddQualification.Text    = Convert.ToString(dsEmail.Tables[0].Rows[0]["Qualification"]);
                            txtAddDesignation.Text      = Convert.ToString(dsEmail.Tables[0].Rows[0]["Designation"]);
                            tLoginId.Text    = Convert.ToString(dsEmail.Tables[0].Rows[0]["LoginID"]);
                            hdnLoginid.Value = Convert.ToString(dsEmail.Tables[0].Rows[0]["LoginID"]);
                            lblAddTitle.Text = "Update User: " + txtAddFirstName.Text;
                        }
                    }
                }
                catch (Exception ex)
                {
                    WebMsg.Show(ex.Message);
                }
            }
        }
    }
    public string GetStudentInformation(int studentID, string ValueField)
    {
        SYS_Role_BLogic obj_BAL_SYS_Role = new SYS_Role_BLogic();
        DataSet         dtLogin          = new DataSet();
        DataTable       LoginInfo        = new DataTable();

        dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Student_Information(2);
        LoginInfo = dtLogin.Tables[0];
        string returnValue = "";

        if (LoginInfo.Rows.Count > 0 && LoginInfo != null)
        {
            if (ValueField == "StudentID")
            {
                returnValue = LoginInfo.Rows[0]["StudentID"].ToString();
            }
            else if (ValueField == "StudentName")
            {
                returnValue = LoginInfo.Rows[0]["FirstName"].ToString();
            }
            else if (ValueField == "BMSID")
            {
                returnValue = LoginInfo.Rows[0]["BMSID"].ToString();
            }
            else if (ValueField == "BMS")
            {
                returnValue = LoginInfo.Rows[0]["BMS"].ToString();
            }
            else if (ValueField == "BoardID")
            {
                returnValue = LoginInfo.Rows[0]["BoardID"].ToString();
            }
            else if (ValueField == "Board")
            {
                returnValue = LoginInfo.Rows[0]["Board"].ToString();
            }
            else if (ValueField == "MediumID")
            {
                returnValue = LoginInfo.Rows[0]["MediumID"].ToString();
            }
            else if (ValueField == "Medium")
            {
                returnValue = LoginInfo.Rows[0]["Medium"].ToString();
            }
            else if (ValueField == "StandardID")
            {
                returnValue = LoginInfo.Rows[0]["StandardID"].ToString();
            }
            else if (ValueField == "Standard")
            {
                returnValue = LoginInfo.Rows[0]["Standard"].ToString();
            }
            else if (ValueField == "DivisionID")
            {
                returnValue = LoginInfo.Rows[0]["DivisionID"].ToString();
            }
            else if (ValueField == "SchoolID")
            {
                returnValue = LoginInfo.Rows[0]["SchoolID"].ToString();
            }
            else if (ValueField == "Role")
            {
                returnValue = LoginInfo.Rows[0]["Role"].ToString();
            }
            else if (ValueField == "RoleID")
            {
                returnValue = LoginInfo.Rows[0]["RoleID"].ToString();
            }
            else
            {
            }
        }
        return(returnValue);
    }
Ejemplo n.º 10
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            if (AppSessions.RoleID == 4)//student
            {
                DataSet   dtLogin   = new DataSet();
                DataTable LoginInfo = new DataTable();
                DataTable UserInfo  = new DataTable();

                SYS_Role        obj_SYS_Role     = new SYS_Role();
                SYS_Role_BLogic obj_BAL_SYS_Role = new SYS_Role_BLogic();
                obj_SYS_Role.Username = AppSessions.LoginID;
                // obj_SYS_Role.Password = TxtOldPassword.Text;
                if (!string.IsNullOrEmpty(TxtOldPassword.Text))
                {
                    dtLogin   = obj_BAL_SYS_Role.BAL_SYS_Student_Login(obj_SYS_Role);
                    LoginInfo = dtLogin.Tables[0];

                    if (LoginInfo.Rows.Count > 0 && LoginInfo != null)
                    {
                        oStudent.password = TxtNewPassword.Text;
                    }
                    else
                    {
                        WebMsg.Show("Please enter valid old password.");
                    }
                }
            }
            else if (AppSessions.RoleID == 3 || AppSessions.RoleID == 2 || AppSessions.RoleID == 1) //3-teacher,2-sadmin,1-epath-admin
            {
                Employee_BLogic BEmployee = new Employee_BLogic();
                Employee        PEmployee = new Employee();
                PEmployee.roleid      = AppSessions.RoleID;
                PEmployee.userid      = Convert.ToString(AppSessions.EmpolyeeID);
                PEmployee.Studentlist = "";
                PEmployee.password    = TxtNewPassword.Text;
                PEmployee.modifiedby  = AppSessions.EmpolyeeID;
                BEmployee.BAL_Employee_Password_Update(PEmployee);
            }
            oStudent    = new Student();
            BAL_Student = new Student_BLogic();

            string IFormat = "dd-MMM-yyyy";
            oStudent.studentid = AppSessions.StudentID;
            oStudent.firstname = txtAddFirstName.Text;
            //  oStudent.middlename = txtAddMiddleName.Text;
            oStudent.lastname = txtAddLastName.Text;
            if (rlstAddGender.SelectedIndex == (int)EnumFile.AssignValue.Zero)
            {
                oStudent.gender = 'M';
            }
            else if (rlstAddGender.SelectedIndex == (int)EnumFile.AssignValue.One)
            {
                oStudent.gender = 'F';
            }
            if (!string.IsNullOrEmpty(txtAddDOB.Text))

            {
                oStudent.dateofbirth = Convert.ToDateTime(DateTime.Parse(txtAddDOB.Text).ToString(IFormat));
            }
            //else
            //{

            //    oStudent.dateofbirth = null;


            //}
            //oStudent.bloodgroup = ""; //txtAddBloodGroup.Text;
            if (!string.IsNullOrEmpty(txtAddPermanentAddress.Text))
            {
                oStudent.Address = txtAddPermanentAddress.Text;
            }
            if (!string.IsNullOrEmpty(txtAddEmail.Text))
            {
                oStudent.emailid = txtAddEmail.Text;
            }
            if (!string.IsNullOrEmpty(txtAddContactNumber.Text))
            {
                oStudent.contactno = Convert.ToInt64(txtAddContactNumber.Text);
            }
            if (!string.IsNullOrEmpty(txtAddMobileNumber.Text))
            {
                oStudent.mobileno = Convert.ToInt64(txtAddMobileNumber.Text);
            }

            bool Status = this.BAL_Student.BAL_Student_UpdateProfile(oStudent);

            if (Status)
            {
                ResetControl();
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Update profile sucessfully');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Update profile Failed');", true);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
        }
    }