Esempio n. 1
0
        //protected void loadDdlDropCoruseName()
        //{
        //    var usr = User.Identity.GetUserId();
        //    var StudentId = new MySQLDatabase().QueryValue("GetStudentTableIdByUserId",
        //        new Dictionary<string, object> {
        //            {"@uid", usr }
        //        }, true);
        //    var courseName = new MySQLDatabase().Query("GetCorseNameByStudentId",
        //        new Dictionary<string, object>
        //        {
        //            {"@sid",StudentId }
        //        }, true);
        //    ddlDropCoruseName.DataSource = courseName.Select(x => new
        //    {
        //        t = x["prefix"] + " " + x["course_no"] + " " + x["course_tittle"] + " " + x["postfix"],
        //        v = x["id"],
        //        a = x["isconfirmed"]
        //    }).ToList();
        //    ddlDropCoruseName.DataValueField = "v";
        //    ddlDropCoruseName.DataTextField = "t";
        //    ddlDropCoruseName.DataBind();

        //}

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                var studentId = new MySQLDatabase().QueryValue("GetStudentTableIdByUserId", new Dictionary <string, object> {
                    { "@uid", User.Identity.GetUserId() }
                }, true);

                var studentcourse = new MySQLDatabase().QueryValue("GetStudentCourseIDbyTeacherCourseIdStudentId",
                                                                   new Dictionary <string, object>
                {
                    { "@tcid", ddlSession.SelectedValue },
                    { "@sid", studentId.ToString() }
                }, true);

                if (studentcourse == null)
                {
                    new MySQLDatabase().Execute("AddStudentUserCourse",
                                                new Dictionary <string, object>
                    {
                        { "@tcid", ddlSession.SelectedValue },
                        { "@sid", studentId.ToString() }
                    }, true);
                    h2Success.Visible = true;
                    //loadDdlDropCoruseName();
                }
                else
                {
                    h2Fail.Visible = true;
                }
            }
        }
 protected void gvTakeAttendence_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (cblCalssNumber.SelectedValue == "1")
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             HiddenField hf1         = e.Row.FindControl("hfMarkId") as HiddenField;
             CheckBox    cb1         = e.Row.FindControl("cbSelected1") as CheckBox;
             var         isDateExist = new MySQLDatabase().QueryValue("GetAttendanceIdByMarkIdDate",
                                                                      new Dictionary <string, object>
             {
                 { "@mrid", Convert.ToInt32(hf1.Value) },
                 { "@dt", txtDate.Text }
             }, true);
             if (isDateExist != null)
             {
                 var present = new MySQLDatabase().QueryValue("GetPresentByAttnId",
                                                              new Dictionary <string, object>
                 {
                     { "@atnid", isDateExist }
                 }, true);
                 if (present.ToString() == "True")
                 {
                     cb1.Checked = true;
                 }
                 else
                 {
                     cb1.Checked = false;
                 }
             }
         }
     }
 }
Esempio n. 3
0
        protected void LoadAttMarks()
        {
            var marks = new MySQLDatabase().QueryValue("GetAttMarkByTCID",
                                                       new Dictionary <string, object>
            {
                { "@tcid", ddlSelectCourse.SelectedValue }
            }, true);

            txtAttmarks.Text = marks.ToString();
        }
Esempio n. 4
0
        protected void LoadTxtAttendenceMark()
        {
            var atmark = new MySQLDatabase().QueryValue("GetAttendancePersentaheByTCID",
                                                        new Dictionary <string, object>
            {
                { "@tcid", ddlSelectCourse.SelectedValue }
            }, true);

            txtAttendenceMark.Text = atmark.ToString();
        }
        private void LoadQuestionDetail(int?postId)
        {
            if (postId == null)
            {
                return;
            }
            var res2 = new MySQLDatabase().QueryValue("getQuestionBodyById", new Dictionary <string, object>()
            {
                { "@pid", postId }
            }, true);

            quesBody.InnerText = res2.ToString();
            quesBody.Visible   = true;
            hAnswered.Visible  = false;
        }
Esempio n. 6
0
        protected void AsStudent()
        {
            if (User.IsInRole("Teacher"))
            {
                divStudent.Visible = !true;
                divTeacher.Visible = true;
                var designation = new MySQLDatabase().Query("GetAllDesignation", new Dictionary <string, object> {
                }, true);

                ddlDesignation.DataSource = designation.Select(x => new
                {
                    t = x["name"],
                    v = x["id"]
                }).ToList();
                ddlDesignation.DataValueField = "v";
                ddlDesignation.DataTextField  = "t";
                var td = new MySQLDatabase().QueryValue("GetDesignationIDByUserId",
                                                        new Dictionary <string, object> {
                    { "@uid", User.Identity.GetUserId() }
                }, true);
                ddlDesignation.SelectedValue = td.ToString();
                ddlDesignation.DataBind();
            }
            else
            {
                var ursId     = User.Identity.GetUserId();
                var studentId = new MySQLDatabase().QueryValue("GetStudentIdByUserId",
                                                               new Dictionary <string, object>
                {
                    { "@uid", ursId }
                }, true);

                lblStudentID.InnerText = studentId.ToString();

                var batch = new MySQLDatabase().QueryValue("GetBatchByUserId",
                                                           new Dictionary <string, object>
                {
                    { "@uid", ursId }
                }, true);
                lblBatch.InnerText = batch.ToString();

                divStudent.Visible = true;
            }
        }
Esempio n. 7
0
        protected void Page_Load()
        {
            AsStudent();
            var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var authenticationManager = HttpContext.Current.GetOwinContext().Authentication;

            if (!IsPostBack)
            {
                var ursId = User.Identity.GetUserId();
                var urs   = manager.FindById(ursId);

                lblFullName.InnerText = urs.FirstName + " " + urs.LastName;
                lblEmail.InnerText    = urs.Email;
                txtMobileNum.Text     = urs.PhoneNumber;
                txtAddress.Text       = urs.Address;
                if (urs.Sex == "Female")
                {
                    ddlSex.SelectedValue = "Female";
                }
                else if (urs.Sex == "Male")
                {
                    ddlSex.SelectedValue = "Male";
                }
                else
                {
                    ddlSex.SelectedValue = "Other";
                }

                var vdid = urs.VersityDepartmentId;
                var dept = new MySQLDatabase().QueryValue("GetDeptByVdId",
                                                          new Dictionary <string, object>
                {
                    { "@vdid", vdid }
                }, true);
                lblDepartment.InnerText = dept.ToString();

                var versity = new MySQLDatabase().QueryValue("GetVersityByVdID",
                                                             new Dictionary <string, object>
                {
                    { "@vdid", vdid }
                }, true);
                lblVersityName.InnerText = versity.ToString();

                if (HasPassword(manager))
                {
                    ChangePassword.Visible = true;
                }
                else
                {
                    ChangePassword.Visible = false;
                }

                // Render success message
                var message = Request.QueryString["m"];
                if (message != null)
                {
                    // Strip the query string from action
                    Form.Action = ResolveUrl("~/Account/Manage");

                    SuccessMessage =
                        message == "ChangePwdSuccess" ? "Your password has been changed."
                        : message == "SetPwdSuccess" ? "Your password has been set."
                        : message == "RemoveLoginSuccess" ? "The account was removed."
                        : message == "AddPhoneNumberSuccess" ? "Phone number has been added"
                        : message == "RemovePhoneNumberSuccess" ? "Phone number was removed"
                        : String.Empty;
                    successMessage.Visible = !String.IsNullOrEmpty(SuccessMessage);
                }
            }
        }