Exemplo n.º 1
0
        protected void ddlTransact_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySQLDatabase db     = new MySQLDatabase();
            var           yearId = new YearTable(db).GetYearId(DateTime.Now.Year);
            var           YCSId  = new YearClassSectionTable(db).GetYearClassSectionId(yearId, Convert.ToInt32(ddlClass.SelectedValue), Convert.ToInt32(ddlSection.SelectedValue));

            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;
            }
        }
Exemplo n.º 2
0
        public void CreateUser()
        {
            var newUser = new IdentityUser()
            {
                Id              = "TestUser",
                Email           = "*****@*****.**",
                UserName        = "******",
                PasswordHash    = "Test",
                FirstName       = "Test",
                LastName        = "McTest",
                DefaultLanguage = 1
            };

            // Hard clean this test user from db if it is there.
            var db = new MySQLDatabase("LanguagePaceDB");

            db.Execute("delete from languagepace.user where Id = 'TestUser';", null);

            var userStore = new UserStore <IdentityUser>();

            // Call creat user
            userStore.CreateAsync(newUser);

            // See if user is in DB
            var user = userStore.FindByEmailAsync("*****@*****.**").Result;

            // Hard clean user from DB
            db.Execute("delete from languagepace.user where Id = 'TestUser';", null);

            // See if a user came back from DB
            Assert.IsNotNull(user);
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Deletes all claims from a user given a userId
        /// </summary>
        /// <param name="userId">The user's id</param>
        /// <returns></returns>
        public int Delete(string userId)
        {
            string commandText = "Delete from UserClaims where UserId = @userId";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("userId", userId);

            return(_database.Execute(commandText, parameters));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Deltes a role from the Roles table
        /// </summary>
        /// <param name="roleId">The role Id</param>
        /// <returns></returns>
        public int Delete(string roleId)
        {
            string commandText = "Delete from Roles where Id = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@id", roleId);

            return(_database.Execute(commandText, parameters));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Sets the user's password hash
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="passwordHash"></param>
        /// <returns></returns>
        public int SetPasswordHash(string userId, string passwordHash)
        {
            string commandText = "Update Users set PasswordHash = @pwdHash where Id = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@pwdHash", passwordHash);
            parameters.Add("@id", userId);

            return(_database.Execute(commandText, parameters));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Deletes a login from a user in the UserLogins table
        /// </summary>
        /// <param name="user">User to have login deleted</param>
        /// <param name="login">Login to be deleted from user</param>
        /// <returns></returns>
        public int Delete(IdentityUser user, UserLoginInfo login)
        {
            string commandText = "Delete from UserLogins where UserId = @userId and LoginProvider = @loginProvider and ProviderKey = @providerKey";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("UserId", user.Id);
            parameters.Add("loginProvider", login.LoginProvider);
            parameters.Add("providerKey", login.ProviderKey);

            return(_database.Execute(commandText, parameters));
        }
Exemplo n.º 9
0
        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 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;
            }
        }
Exemplo n.º 11
0
        protected void btnAssign_Click(object sender, EventArgs e)
        {
            var YCSId = new YearClassSectionTable(db).GetYearClassSectionId(ddlYear.SelectedValue, ddlClass.SelectedValue, ddlSection.SelectedValue);

            TeacherSubjectTable TSTable = new TeacherSubjectTable(db);

            TSTable.RemoveTeacherSubject(ddlTeacher.SelectedValue, ddlSubject.SelectedValue, YCSId);
            var teacherSubjectId = TSTable.AddTeacherSubject(ddlTeacher.SelectedValue, ddlSubject.SelectedValue, YCSId);

            foreach (GridViewRow row in gvMarkPortions.Rows)
            {
                if ((row.FindControl("cbInclude") as CheckBox).Checked)
                {
                    string strPerrcent;
                    if (string.IsNullOrEmpty(strPerrcent = (row.FindControl("txtPercentage") as TextBox).Text))
                    {
                        continue;
                    }
                    var portionId  = Convert.ToInt32((row.FindControl("hfPortionId") as HiddenField).Value);
                    var percentage = Convert.ToInt32(strPerrcent);

                    db.Execute("addMarkPortion", new Dictionary <string, object>()
                    {
                        { "@TSId", teacherSubjectId },
                        { "@PId", portionId },
                        { "@Percentage", percentage }
                    }, true);
                }
            }

            LoadGVDDLExistingSubject(null, null);
        }
Exemplo n.º 12
0
        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();
        }
Exemplo n.º 13
0
        protected void btnCauseFee_Click(object sender, EventArgs e)
        {
            var YCSId = db.QueryValue("getYearClassSectionId", new Dictionary <string, object>()
            {
                { "@pclassid", ddlClass.SelectedValue },
                { "@psectionid", ddlSection.SelectedValue },
                { "@pyearid", yearId }
            }, true);

            var studentIds = db.Query("getStudentByYCSId", new Dictionary <string, object>()
            {
                { "@YCSId", YCSId }
            }, true).
                             Select(x => new SingleValue {
                Value = x["studentid"]
            }).ToList();
            var userId = User.Identity.GetUserId();

            foreach (var studentId in studentIds)
            {
                db.Execute("causeFee", new Dictionary <string, object>()
                {
                    { "@SId", studentId.Value },
                    { "@doneBy", userId },
                    { "@TId", ddlType.SelectedValue },
                    { "@amount", txtAmount.Text }
                }, true);
            }

            hSuccess.InnerText = "Tk " + txtAmount.Text + " is caused to Class " + ddlClass.SelectedItem.Text + ", Section " + ddlSection.SelectedItem.Text + " for " + ddlType.SelectedItem.Text + ".";
            hSuccess.Visible   = true;
        }
Exemplo n.º 14
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);
            }
        }
Exemplo n.º 15
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();
            }
        }
Exemplo n.º 16
0
        private void ReloadDDLCanTransact(int yearId)
        {
            var YCSId = new YearClassSectionTable(db).GetYearClassSectionId(yearId, Convert.ToInt32(ddlClass.SelectedValue), Convert.ToInt32(ddlSection.SelectedValue));

            ddlTransact.SelectedValue = db.Execute(
                "canTransact",
                new Dictionary <string, object>()
            {
                { "@Tid", Convert.ToInt32(ddlTeacher.SelectedValue) },
                { "@YCSId", YCSId }
            }, true).ToString();
        }
Exemplo n.º 17
0
        private void MarkPortion_SubmitClick(object sender, EventArgs e)
        {
            MySQLDatabase db        = new MySQLDatabase();
            var           teacherId = new UserTable <ApplicationUser>(db).GetUserId(User.Identity.Name);
            int           mark;
            MarkPortion   mp = (sender as MarkPortion);

            if (mp.MarkId == null)
            {
                if (int.TryParse(mp.Mark.ToString(), out mark))
                {
                    int SYCSRId = Convert.ToInt32(db.QueryValue("getSYCSRIdByYCSIdSId",
                                                                new Dictionary <string, object>()
                    {
                        { "@YCSId", ViewState["YCSId"] },
                        { "@SId", ddlStudent.SelectedValue }
                    },
                                                                true));

                    db.Execute("addMark", new Dictionary <string, object>()
                    {
                        { "@MPId", mp.MarkPortionId },
                        { "@SYCSRId", SYCSRId },
                        { "@termid", ddlTerm.SelectedValue },
                        { "@mark", mark },
                        { "@TUId", teacherId }
                    }, true);
                }
            }
            else
            {
                db.Execute("updateMark",
                           new Dictionary <string, object>()
                {
                    { "@pid", mp.MarkId },
                    { "@mark", mp.Mark }
                }, true);
            }
        }
Exemplo n.º 18
0
        protected void ddlDesignation_SelectedIndexChanged(object sender, EventArgs e)
        {
            //changeDesignation
            MySQLDatabase db = new MySQLDatabase();

            db.Execute("changeDesignation",
                       new Dictionary <string, object>()
            {
                { "@designationId", ddlDesignation.SelectedValue },
                { "@TId", ddlTeacher.SelectedValue }
            }, true);
            success1.Visible = true;
        }
Exemplo n.º 19
0
        public void RegisterAction()
        {
            // Arrange
            AccountController controller = new AccountController();

            RegisterViewModel model = new RegisterViewModel()
            {
                Email           = "*****@*****.**",
                Username        = "******",
                Password        = "******",
                ConfirmPassword = "******",
                DefaultLanguage = 1,
                FirstName       = "Test",
                LastName        = "McTest"
            };

            // Act

            MySQLDatabase db = new MySQLDatabase("LanguagePaceDB");

            db.Execute("delete from languagepace.user where email='*****@*****.**'", null);

            try
            {
                ViewResult result = controller.Register(model).Result as ViewResult;

                UserStore <IdentityUser> userStore = new UserStore <IdentityUser>(new MySQLDatabase("LanguagePaceDB"));
                IdentityUser             user      = userStore.FindByEmailAsync("*****@*****.**").Result;

                // Assert
                Assert.IsNotNull(result);
                Assert.IsNotNull(user);
            }
            finally
            {
                db.Execute("delete from languagepace.user where email='*****@*****.**'", null);
            }
        }
Exemplo n.º 20
0
 protected void btnAddYear_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         db.Execute("INSERT INTO year VALUES(null, '" + txtYear.Text.Trim() + "');", null);
         hSuccess.InnerText = "Year " + txtYear.Text + " successfully added.";
         hSuccess.Visible   = true;
     }
 }
Exemplo n.º 21
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();
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            MySQLDatabase db = new MySQLDatabase();

            foreach (ListItem item in cbAdd.Items)
            {
                if (item.Selected)
                {
                    db.Execute("addGroupMember", new Dictionary <string, object>()
                    {
                        { "@groupid", ddlGroup.SelectedValue },
                        { "@studentId", item.Value }
                    }, true);
                }
            }
            LoadCBRemove(sender, e);
            LoadCBAdd(sender, e);
        }
Exemplo n.º 24
0
        public static void LogError(Exception ex)
        {
            MySQLDatabase db = new MySQLDatabase();

            while (ex != null)
            {
                db.Execute("logError",
                           new Dictionary <string, object>()
                {
                    { "type", ex.GetType() },
                    { "source", ex.Source },
                    { "message", ex.Message },
                    { "StackTrace", ex.StackTrace }
                },
                           true);
                ex = ex.InnerException;
            }
        }
Exemplo n.º 25
0
        void Application_Error(object sender, EventArgs e)
        {
            Exception     ex = Server.GetLastError();
            MySQLDatabase db = new MySQLDatabase();

            while (ex != null)
            {
                db.Execute("logError",
                           new Dictionary <string, object>()
                {
                    { "type", ex.GetType() },
                    { "source", ex.Source },
                    { "message", ex.Message },
                    { "StackTrace", ex.StackTrace }
                },
                           true);
                ex = ex.InnerException;
            }
        }
Exemplo n.º 26
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();
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
0
        protected void Ask_Click(object sender, EventArgs e)
        {
            MySQLDatabase db = new MySQLDatabase();

            var userid    = User.Identity.GetUserId();
            int studentId = Convert.ToInt32(db.QueryValue(
                                                "SELECT id FROM student WHERE userid = '" + userid + "' LIMIT 1", null));

            db.Execute("addQuestion",
                       new Dictionary <string, object>()
            {
                { "@askedby", ddlTo.SelectedValue },
                { "@askedto", studentId },
                { "@title", txtSubject.Text },
                { "@body", txtQuestion.Text }
            },
                       true);
            divSuccess.Visible     = true;
            spanQuestion.InnerText = txtSubject.Text;
            spanTo.InnerText       = ddlTo.SelectedItem.Text;
        }
Exemplo n.º 29
0
        protected void btnSubmint_Click(object obj, EventArgs ea)
        {
            //TODO Not checked
            //TODO add trigger
            var YCSID         = new YearClassSectionTable(db).GetYearClassSectionId(new YearTable(db).GetYearId(DateTime.Now.Year), ddlClass.SelectedValue, ddlSection.SelectedValue);
            var markPortionId = db.QueryValue("getMarkPortionIdByYCSIdPId",
                                              new Dictionary <string, object>()
            {
                { "@YCSId", Convert.ToInt32(ViewState["YCSId"]) },
                { "@PId", -1 }
            }, true);

            foreach (ListItem item in cbAttendance.Items)
            {
                db.Execute("addAttendance", new Dictionary <string, object>()
                {
                    { "@MPId", markPortionId },
                    { "@SId", item.Value },
                    { "@isPresent", item.Selected }
                }, true);
            }
        }
Exemplo n.º 30
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;
            }
        }