Esempio n. 1
0
        protected void btnDisapprove_Click(object sender, EventArgs e)
        {
            foreach (ListItem a in cblApprovedStudent.Items)
            {
                if (a.Selected)
                {
                    MySQLDatabase data = new MySQLDatabase();
                    data.Execute("UpdateIsConfirmFalseByStudentCourseID",
                                 new Dictionary <string, object> {
                        { "@scid", a.Value }
                    }, true);

                    var marksection = data.QueryValue("GetMarkSectionIdForAttendenceByTCID",
                                                      new Dictionary <string, object>
                    {
                        { "@tcid", ddlCourseTitle.SelectedValue }
                    }, true);

                    var studentid = data.QueryValue("GetStudentTableIdByScid",
                                                    new Dictionary <string, object>
                    {
                        { "@scid", a.Value }
                    }, true);

                    data.Execute("DeleteMarkByMsidSid",
                                 new Dictionary <string, object>
                    {
                        { "@msid", marksection },
                        { "@sid", studentid }
                    }, true);
                }
            }
            loadNotApprovedStudent();
            loadApprovedStudent();
        }
Esempio n. 2
0
        //protected void LoadCBL(object o, EventArgs e) {
        //	MySQLDatabase db = new MySQLDatabase();
        //	var yid = db.QueryValue("getYearId", new Dictionary<string, object>() { { "@pyear", DateTime.Now.Year } }, true);
        //	var ycsId = db.QueryValue("getYearClassSectionId",
        //		new Dictionary<string, object>() {
        //			{"@pyearid", yid },
        //			{"@pclassid", ddlClass.SelectedValue },
        //			{"@psectionid", ddlSection.SelectedValue }
        //		}, true);
        //	cblDue.DataSource = db.Query("getStudentByTUNYCSId",
        //		new Dictionary<string, object>() {
        //			{"@TUN", User.Identity.Name},
        //			{"@YCSId", ycsId },
        //			{"@pdue", Convert.ToInt32(txtDueGreaterThen.Text.Length==0?"0":txtDueGreaterThen.Text) }
        //		}, true).Select(x => new TextValuePair {
        //			Text = x["student"],
        //			Value = x["studentid"]
        //		}).ToList();
        //	cblDue.DataBind();
        //}

        private List <TextValuePair> getStudents()
        {
            MySQLDatabase db  = new MySQLDatabase();
            var           yid = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var ycsId = db.QueryValue("getYearClassSectionId",
                                      new Dictionary <string, object>()
            {
                { "@pyearid", yid },
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue }
            }, true);

            return(db.Query("getStudentByTUNYCSId",
                            new Dictionary <string, object>()
            {
                { "@TUN", User.Identity.Name },
                { "@YCSId", ycsId }
            }, true).Select(x => new TextValuePair {
                Text = x["student"],
                Value = x["studentid"]
            }).ToList());
        }
Esempio n. 3
0
        protected void LoadCBAdd(object obj, EventArgs e)
        {
            //TODO remove students who are already in the group
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var YCSId = db.QueryValue("getYearClassSectionId",
                                      new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue }
            }, true);

            cbAdd.DataSource = db.Query("getStudentByTUNYCSId",
                                        new Dictionary <string, object>()
            {
                { "@TUN", User.Identity.Name },
                { "@YCSId", YCSId }
            }, true).Select(x => new {
                Text  = x["firstname"] + x["lastname"],
                Value = x["studentid"]
            }).ToList();
            cbAdd.DataBind();
        }
Esempio n. 4
0
        protected void btnApply_Click(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var YCSId = db.QueryValue("getYearClassSectionId",
                                      new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", Convert.ToInt32(txtClass.Text) },
                { "@psectionid", Convert.ToInt32(txtSection.Text) }
            }, true);

            if (YCSId == null)
            {
                info.Attributes["class"] = "text-danger";
            }
            else
            {
                db.Execute("changeStudent",
                           new Dictionary <string, object>()
                {
                    { "@SId", ddlStudent.SelectedValue },
                    { "@YCSId", YCSId },
                    { "@proll", Convert.ToInt32(txtRoll.Text) }
                }, true);
            }
        }
Esempio n. 5
0
        protected void Page_Load(object o, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlAs.Items.Add(new ListItem("Student", "student"));
                if (User.IsInRole("Admin"))
                {
                    ddlAs.Items.Add(new ListItem("Teacher", "teacher"));
                    ddlAs.Items.Add(new ListItem("Admin", "admin"));
                }
                ddlDesignation.DataSource = db.Query("getAllDesignation", null, true).
                                            Select(x => new TextValuePair {
                    Text  = x["designation"],
                    Value = x["id"]
                }).ToList();
                ddlDesignation.DataBind();

                ddlClass.DataSource = db.Query("getClassByYId",
                                               new Dictionary <string, object>()
                {
                    { "@YId", db.QueryValue("getYearId", new Dictionary <string, object>()
                        {
                            { "@pyear", DateTime.Now.Year }
                        }, true) }
                }, true).Select(x => new TextValuePair {
                    Text  = x["class"],
                    Value = x["classid"]
                }).ToList();
                ddlClass.DataBind();
            }
        }
        protected void btnIssue_Click(object sender, EventArgs e)
        {
            var data = new MySQLDatabase();
            var mId  = data.QueryValue("GetMemberIdByMemberNum",
                                       new Dictionary <string, object>
            {
                { "@mNum", txtMemberNumber.Text }
            }, true);
            var bId = data.QueryValue("GetBookIdByBookNum",
                                      new Dictionary <string, object>
            {
                { "@bNum", txtBookNumber.Text }
            }, true);
            var returnDate = DateTime.Now;

            if (ddlWeek.SelectedValue == "1")
            {
                returnDate = returnDate.AddDays(7);
            }
            else
            {
                returnDate = returnDate.AddDays(14);
            }

            data.Execute("AddNewBookRecord",
                         new Dictionary <string, object>
            {
                { "@mid", mId },
                { "@bid", bId },
                { "@tDate", DateTime.Now },
                { "@rDate", returnDate },
            }, true);
            h3Success.Visible = true;
            LoadGvBooks();
        }
        protected void btnAssign_Click(object sender, EventArgs e)
        {
            //Checks if a YearClassSection entry with null Section exists
            int?nullSectionId = (int?)db.QueryValue("hasNullSection",
                                                    new Dictionary <string, object>()
            {
                { "@YId", ddlYear.SelectedValue },
                { "@CId", ddlClass.SelectedValue }
            }, true);

            foreach (ListItem item in cbSection.Items)
            {
                if (item.Selected)
                {
                    int count = Convert.ToInt32(db.QueryValue("countSectionInClassYear",
                                                              new Dictionary <string, object>()
                    {
                        { "@YId", ddlYear.SelectedValue },
                        { "@CId", ddlClass.SelectedValue },
                        { "@SId", item.Value }
                    }, true));
                    if (count > 0)
                    {
                        continue;
                    }

                    if (nullSectionId == null)
                    {
                        //If no entry with null Section found, add a new entry normally
                        db.Execute("addYearClassSection", new Dictionary <string, object>()
                        {
                            { "@YId", ddlYear.SelectedValue },
                            { "@CId", ddlClass.SelectedValue },
                            { "@SId", item.Value }
                        }, true);
                    }
                    else
                    {
                        //If a entry with null section exists, replace that with a section id
                        db.Execute("changeSectionId", new Dictionary <string, object>()
                        {
                            { "@YCSId", nullSectionId },
                            { "@Sid", item.Value }
                        }, true);
                        //Next sections will be added normally
                        nullSectionId = null;
                    }
                }
            }
            LoadGVSection(null, null);
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);

            if (!IsPostBack)
            {
                LoadDDLClass(null, null);
                LoadDDLType(null, null);
                hSuccess.Visible = false;
            }
        }
Esempio n. 9
0
        protected void ddlClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var teacherId = db.QueryValue("getTIdByTUN", new Dictionary <string, object>()
            {
                { "@TUN", User.Identity.Name }
            }, true);

            ReloadDDLSection(teacherId, yearId);
            LoadCBAdd(sender, e);
        }
Esempio n. 10
0
        public void DBConnect()
        {
            IMySqlDatabase iMySqlDatabase = new MySQLDatabase("DefaultConnection");

            //var result= iMySqlDatabase.QueryValue("", null);
            Assert.ThrowsException <ArgumentException>(() => { iMySqlDatabase.QueryValue("", null); }, "Command text cannot be null or empty.");
        }
Esempio n. 11
0
        private void LoadStudentClass()
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);

            ddlClass.DataSource = db.Query(
                "getClassByYId",
                new Dictionary <string, object>()
            {
                { "@YId", yearId }
            },
                true)
                                  .Select(x => new {
                Text  = x["class"],
                Value = x["classid"]
            }).ToList();
            ddlClass.DataBind();

            if (ddlClass.Items.Count > 0)
            {
                ReloadDDLSection(yearId);
            }
            else
            {
                ddlSection.Items.Clear();
            }
        }
        protected void btnPush_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                MySQLDatabase db   = new MySQLDatabase();
                var           TUId = Context.GetOwinContext().GetUserManager <ApplicationUserManager>().FindByName(User.Identity.Name).Id;
                var           res1 = db.Query("GetStudentIdByGId",
                                              new Dictionary <string, object>()
                {
                    { "@GId", ddlTo.SelectedValue }
                }, true);

                var id = db.QueryValue("addNotification",
                                       new Dictionary <string, object>()
                {
                    { "@TUId", TUId },
                    { "@ptitle", txtSubject.Text },
                    { "@pbody", txtDetail.Text }
                }, true);

                foreach (var item in res1)
                {
                    db.Execute("addStudentNotification",
                               new Dictionary <string, object>()
                    {
                        { "@SId", item["studentId"] },
                        { "@NId", id }
                    }, true);
                }
                notificatinName.InnerText = txtSubject.Text;
                groupName.InnerText       = ddlTo.SelectedItem.Text;
                divSuccessful.Visible     = true;
            }
        }
Esempio n. 13
0
        private void BindDLL()
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var teacherId = Context.GetOwinContext().GetUserManager <ApplicationUserManager>().FindByName(User.Identity.Name).Id;

            ReloadDDLGroup();

            ddlClass.DataSource = db.Query(
                "getClassByTUIdYId",
                new Dictionary <string, object>()
            {
                { "@TUId", teacherId },
                { "@YId", yearId }
            },
                true)
                                  .Select(x => new {
                Text  = x["class"],
                Value = x["classid"]
            }).ToList();
            ddlClass.DataBind();

            ReloadDDLSection(teacherId, yearId);
        }
Esempio n. 14
0
        private void ReloadDDLStudent(object yearId)
        {
            MySQLDatabase db    = new MySQLDatabase();
            var           YCSId = db.QueryValue("getYearClassSectionId",
                                                new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue }
            }, true);

            ddlStudent.DataSource = db.Query("getStudentByYCSId",
                                             new Dictionary <string, object>()
            {
                { "@YCSId", YCSId }
            }, true).Select(x => new {
                Text  = x["student"],
                Value = x["studentid"]
            }).ToList();
            ddlStudent.DataBind();
            //Reload Textboxes according to new ddl selection
            if (ddlStudent.Items.Count > 0)
            {
                ReloadTextBox(Convert.ToInt32(ddlStudent.SelectedValue), (int)YCSId);
            }
            else
            {
                txtClass.Text   = string.Empty;
                txtSection.Text = string.Empty;
                txtRoll.Text    = string.Empty;
            }
        }
        protected void BtnAuthorFinish_Click(object sender, EventArgs e)
        {
            var data = new MySQLDatabase();

            data.Execute("AddNewBook",
                         new Dictionary <string, object>
            {
                { "@bNum", txtBookNumber.Text },
                { "@bTitle", txtBookTitle.Text },
                { "@bPrice", txtBookPrice.Text },
                { "@bLan", txtBookLanguage.Text },
                { "@bEdi", txtBookEdition.Text }
            }, true);
            var lastBoookId = data.QueryValue("GetLastInsertedBookId", new Dictionary <string, object> {
            }, true);

            data.Execute("AddBookCatagory",
                         new Dictionary <string, object>
            {
                { "@bid", lastBoookId },
                { "@cid", ddlCategory.SelectedValue }
            }, true);
            data.Execute("AddBookAuthor",
                         new Dictionary <string, object>
            {
                { "@bid", lastBoookId },
                { "@aid", ddlAuthor.SelectedValue }
            }, true);
            multiView1.ActiveViewIndex = 3;
        }
Esempio n. 16
0
        protected void btnCtSave_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                MySQLDatabase data = new MySQLDatabase();
                data.Execute("AddSectionName",
                             new Dictionary <string, object>
                {
                    { "@name", txtName.Text }
                }, true);

                var lastSecId = data.QueryValue("GetLastInsertIdOfSectionName",
                                                new Dictionary <string, object> {
                }, true);

                data.Execute("AddMarksectionForCt",
                             new Dictionary <string, object>
                {
                    { "@tcid", ddlSelectCourse.SelectedValue },
                    { "@snid", lastSecId },
                    { "@msmark", Convert.ToInt32(txtMarks.Text) }
                }, true);


                var LastMarkSectionIdForCt = data.QueryValue("GetLastInsertIdOfMarkSection4CtAssByTcid",
                                                             new Dictionary <string, object> {
                    { "@tcid", ddlSelectCourse.SelectedValue }
                }, true);

                var studentTableIdlist = data.Query("GetStudentTableIdByTcid",
                                                    new Dictionary <string, object> {
                    { "@tcid", ddlSelectCourse.SelectedValue }
                }, true);

                foreach (var a in studentTableIdlist)
                {
                    var val = a["studentid"];
                    data.Execute("AddMark4CtAssByMsidSid",
                                 new Dictionary <string, object>
                    {
                        { "@msid", LastMarkSectionIdForCt },
                        { "@sid", val }
                    }, true);
                }
                LoadGvCtAss();
            }
        }
Esempio n. 17
0
        protected void ddlStudent_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var YCSId = db.QueryValue("getYearClassSectionId",
                                      new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue }
            }, true);

            ReloadTextBox(Convert.ToInt32(ddlStudent.SelectedValue), (int)YCSId);
        }
Esempio n. 18
0
        /// <summary>
        /// Click Event Handler for btnApply. Creates a new response.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>(13);
                dict.Add("applicationid", Convert.ToInt32(Request.QueryString["appid"]));
                dict.Add("firstname", txtFirstName.Text);
                dict.Add("lastname", txtFirstName.Text);
                dict.Add("fathersname", txtFathersName.Text);
                dict.Add("mothersname", txtMothersName.Text);
                dict.Add("email", txtEmail.Text);
                dict.Add("gender", ddlGender.SelectedValue);
                dict.Add("birthdate", txtBirthDate.Text);
                dict.Add("phoneNumber", txtBirthDate.Text);
                dict.Add("address", txtAddress.Text);

                if (Convert.ToInt32(Request.QueryString["type"]) == 2)
                {
                    dict.Add("designationId", ViewState["id"]);
                    dict.Add("qualification", txtQualification.Text);
                    dict.Add("class", null);
                    dict.Add("GaurdianOccupation", null);
                    dict.Add("GaurdianOccupationDetail", null);
                }
                else
                {
                    dict.Add("designationId", null);
                    dict.Add("qualification", null);
                    dict.Add("class", ViewState["id"]);
                    dict.Add("GaurdianOccupation", txtGuardianOccupation.Text);
                    dict.Add("GaurdianOccupationDetail", txtGuardianOccupationDetail.Text);
                }

                MySQLDatabase db = new MySQLDatabase();
                long?         id = Convert.ToInt64(db.QueryValue("addResponse", dict, true));
                if (id == null)
                {
                    Server.Transfer(Statics.Error, true);
                }
                divSuccessful.Visible = true;
                appId.InnerText       = id.ToString();
                // TODO Send Email with response id

                string dirstr = Server.MapPath(Statics.ResponseFolder + id.ToString());
                if (!Directory.Exists(dirstr))
                {
                    Directory.CreateDirectory(dirstr);
                }
                if (fuImage.HasFile)
                {
                    fuImage.SaveAs(dirstr + "/" + fuImage.FileName);
                }
                if (fuCertificate.HasFile)
                {
                    fuCertificate.SaveAs(dirstr + "/" + fuCertificate.FileName);
                }
            }
        }
Esempio n. 19
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (ViewState["YCSId"] == null)
            {
                ReloadYCSId(null, null);
            }

            MySQLDatabase db        = new MySQLDatabase();
            var           teacherId = new UserTable <ApplicationUser>(db).GetUserId(User.Identity.Name);

            #region Load Mark
            int teacherSubjectId = Convert.ToInt32(
                db.QueryValue("getTeacherSubjectId",
                              new Dictionary <string, object>()
            {
                { "@TUN", User.Identity.Name },
                { "@ycsid", ViewState["YCSId"] },
                { "@psubjectid", ddlSubject.SelectedValue }
            },
                              true));
            var res2 = db.Query("getMarkPortionIdByTSId", new Dictionary <string, object>()
            {
                { "@TSId", teacherSubjectId }
            }, true);

            marks.Controls.Clear();
            //ViewState["clicks"] = new List<MarkPortion>();
            foreach (var item in res2)
            {
                MarkPortion markPortion = LoadControl("~/User Control/MarkPortion.ascx") as MarkPortion;
                markPortion.PortionName   = item["portionname"];
                markPortion.MarkPortionId = Convert.ToInt32(item["markportionid"]);
                var resMark = db.Query("getMarkByMPIdSIdTid",
                                       new Dictionary <string, object>()
                {
                    { "@MPId", item["markportionid"] },
                    { "@SId", ddlStudent.SelectedValue },
                    { "@Tid", ddlTerm.SelectedValue }
                }, true);
                if (resMark.Count == 0)
                {
                    markPortion.Mark   = null;
                    markPortion.MarkId = null;
                }
                else
                {
                    markPortion.Mark   = Convert.ToInt32(resMark[0]["mark"]);
                    markPortion.MarkId = Convert.ToInt32(resMark[0]["markid"]);
                }
                markPortion.SubmitClick += MarkPortion_SubmitClick;
                //AsyncPostBackTrigger trigger = new AsyncPostBackTrigger() { ControlID = markPortion.ID, EventName = "SubmitClick" };
                //up.Triggers.Add(trigger);
                //(ViewState["clicks"] as List<MarkPortion>).Add(markPortion);
                marks.Controls.Add(markPortion);
            }
            #endregion
        }
Esempio n. 20
0
        protected void ddlClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);

            //var teacherId = Context.GetOwinContext().GetUserManager<ApplicationUserManager>().FindByName(User.Identity.Name).Id;
            ReloadDDLSection(yearId);
        }
Esempio n. 21
0
        protected void ChangeDDLDesignationAsDDLTeacher(object obj, EventArgs e)
        {
            MySQLDatabase db = new MySQLDatabase();

            ddlDesignation.SelectedValue = db.QueryValue(
                "getDesignationIdByTId",
                new Dictionary <string, object>()
            {
                { "TId", ddlTeacher.SelectedValue }
            },
                true).ToString();
        }
Esempio n. 22
0
        protected void ddlTransact_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
            {
                { "@pyear", DateTime.Now.Year }
            }, true);
            var YCSId = db.QueryValue("getYearClassSectionId",
                                      new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue }
            }, true);

            if (ddlTransact.SelectedValue == "1")
            {
                db.Execute("addTransactionAccessibility",
                           new Dictionary <string, object>()
                {
                    { "@Tid", ddlTeacher.SelectedValue },
                    { "@YCSId", YCSId }
                }, true);
                hInfo.InnerText           = ddlTeacher.SelectedItem.Text + " now can access class " + ddlClass.SelectedItem.Text + ", section " + ddlSection.SelectedItem.Text;
                hInfo.Attributes["class"] = "text-success";
                hInfo.Visible             = true;
            }
            else
            {
                db.Execute("removeTransactionAccessibility",
                           new Dictionary <string, object>()
                {
                    { "@TId", ddlTeacher.SelectedValue },
                    { "@YCSId", YCSId }
                }, true);
                hInfo.InnerText           = ddlTeacher.SelectedItem.Text + " now cannot access class " + ddlClass.SelectedItem.Text + ", section " + ddlSection.SelectedItem.Text;
                hInfo.Attributes["class"] = "text-danger";
                hInfo.Visible             = true;
            }
        }
Esempio n. 23
0
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try {
                MySQLDatabase db     = new MySQLDatabase();
                var           yearId = db.QueryValue("getYearId", new Dictionary <string, object>()
                {
                    { "@pyear", DateTime.Now.Year }
                }, true);
                var YCSId = db.QueryValue("getYearClassSectionId",
                                          new Dictionary <string, object>()
                {
                    { "@pyearid", yearId },
                    { "@pclassid", Convert.ToInt32(txtClass.Text) },
                    { "@psectionid", Convert.ToInt32(txtSection.Text) }
                }, true);

                if (YCSId == null)
                {
                    info.Visible     = true;
                    success2.Visible = false;
                }
                else
                {
                    db.Execute("changeStudent",
                               new Dictionary <string, object>()
                    {
                        { "@SId", ddlStudent.SelectedValue },
                        { "@YCSId", YCSId },
                        { "@proll", Convert.ToInt32(txtRoll.Text) }
                    }, true);
                    success2.Visible = true;
                    info.Visible     = false;
                    ReloadDDLStudent(yearId);
                }
            } catch (Exception) {
                info.Visible     = true;
                success2.Visible = false;
            }
        }
Esempio n. 24
0
        protected void btnCreateGroup_Click(object sender, EventArgs e)
        {
            MySQLDatabase db        = new MySQLDatabase();
            var           teacherId = db.QueryValue("getTIdByTUN", new Dictionary <string, object>()
            {
                { "@TUN", User.Identity.Name }
            }, true);

            //string query = "INSERT INTO `group` VALUES(null, '" + teacherId + "', '" + txtGroupName.Text + "';";
            db.Execute("addGroup", new Dictionary <string, object>()
            {
                { "@TId", teacherId },
                { "@name", txtGroupName.Text }
            }, true);
            BindDLL();
        }
Esempio n. 25
0
 protected void Year_ServerValidate(object source, ServerValidateEventArgs args)
 {
     args.IsValid = Convert.ToInt32(db.QueryValue("countYear", new Dictionary <string, object>()
     {
         { "@pyear", txtYear.Text.Trim() }
     }, true)) == 0;
     if (!args.IsValid)
     {
         hSuccess.Visible = false;
     }
 }
Esempio n. 26
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            MySQLDatabase db = new MySQLDatabase();

            db.Execute("addTransaction",
                       new Dictionary <string, object>()
            {
                { "@SId", ddlStudent.SelectedValue },
                { "@TeaId", db.QueryValue("getTIdByTUN", new Dictionary <string, object>()
                    {
                        { "@TUN", User.Identity.Name }
                    }, true) },
                { "@TypeId", ddlType.SelectedValue },
                { "@ammount", Convert.ToInt32(txtAmount.Text) }
            }, true);
            LoadDue(null, null);
        }
Esempio n. 27
0
        /// <summary>
        /// Returns the role Id given a role name
        /// </summary>
        /// <param name="roleName">Role's name</param>
        /// <returns>Role's Id</returns>
        public string GetRoleId(string roleName)
        {
            string roleId      = null;
            string commandText = "Select Id from Roles where Name = @name";
            Dictionary <string, object> parameters = new Dictionary <string, object>()
            {
                { "@name", roleName }
            };

            var result = _database.QueryValue(commandText, parameters);

            if (result != null)
            {
                return(Convert.ToString(result));
            }

            return(roleId);
        }
Esempio n. 28
0
        private void ReloadDDLCanTransact(object yearId)
        {
            MySQLDatabase db    = new MySQLDatabase();
            var           YCSId = db.QueryValue("getYearClassSectionId",
                                                new Dictionary <string, object>()
            {
                { "@pyearid", yearId },
                { "@pclassid", Convert.ToInt32(ddlClass.SelectedValue) },
                { "@psectionid", Convert.ToInt32(ddlSection.SelectedValue) }
            }, true);

            ddlTransact.SelectedValue = db.Execute(
                "canTransact",
                new Dictionary <string, object>()
            {
                { "@Tid", Convert.ToInt32(ddlTeacher.SelectedValue) },
                { "@YCSId", YCSId }
            }, true).ToString();
        }
        protected void btnBookDetailNext_Click(object sender, EventArgs e)
        {
            var data       = new MySQLDatabase();
            var bookNumber = data.QueryValue("GetBookNumber",
                                             new Dictionary <string, object>
            {
                { "@bNum", txtBookNumber.Text }
            }, true);

            if (bookNumber == null)
            {
                multiView1.ActiveViewIndex = 2;
                LoadViewAuthor();
            }
            else
            {
                lblWarnnig.Visible = true;
            }
        }
Esempio n. 30
0
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["postid"] == null)
            {
                return;
            }
            MySQLDatabase db        = new MySQLDatabase();
            int           id        = Convert.ToInt32(Request.QueryString["postid"]);
            var           studentId = new UserTable <ApplicationUser>(db).GetUserId(User.Identity.Name);

            db.Execute("removeNotificationByNidSId",
                       new Dictionary <string, object>()
            {
                { "@Nid", id },
                { "@SId", Convert.ToInt32(db.QueryValue(
                                              "SELECT id FROM student WHERE userid = '" + studentId + "' LIMIT 1",
                                              null)) }
            }, true);
            Response.Redirect(Request.Url.AbsolutePath);
        }