Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tamrinid = Session["TamrinIDForHomeWorkDetails"].ToString().ToInt();
            Session.Add("stuID", 93124345);//
            OzviatRepository r = new OzviatRepository();

            ozviatid = r.OzviatIDByLGIDAndStudentCode(Session["LGIDForHomeWork"].ToString().ToInt(), Session["stuID"].ToString());
            vJavabeTamrinRepository vr = new vJavabeTamrinRepository();

            dtable = vr.getJavabeTamrinInfoByTamrinID_OzviatID(tamrinid, ozviatid);

            if (!IsPostBack)
            {
                // ozviatid = -2;
                // dtable = new DataTable();
                setLabels();
                setDataTable();
            }
        }
Ejemplo n.º 2
0
        private bool saveChanges()
        {
            bool result           = true;
            TransactionOptions op = new TransactionOptions();

            op.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, op))
            {
                try
                {
                    if (Session["LGIDforSessionHistory"] != null)
                    {
                        id = Convert.ToInt32(Session["LGIDforSessionHistory"].ToString());
                        ///////////////// Save session ////////////////
                        Sessoin newSes = new Sessoin();
                        newSes.Date = tbxSessionDate.Text;
                        newSes.LGID = id;
                        SessionRepository sRep = new SessionRepository();
                        newSes.SessionNum = sRep.CountSessionsByLGID(id).ToInt();
                        sRep.SaveSession(newSes);

                        ////////////////// Save Score ///////////////////////
                        foreach (GridViewRow row in gvStudents.Rows)
                        {
                            string           stuCode = row.Cells[1].Text.ToString();
                            Nomarat          nomre   = new Nomarat();
                            OzviatRepository oRep    = new OzviatRepository();
                            int ozviatid             = oRep.OzviatIDByLGIDAndStudentCode(id, stuCode);
                            nomre.OzviatID = ozviatid;
                            int lastSession = sRep.FindLastSessionID();
                            nomre.SessionID = lastSession;
                            nomre.Date      = tbxSessionDate.Text;
                            nomre.Nomre     = (row.FindControl("Score") as TextBox).Text;
                            vNomratRepository nomreRep = new vNomratRepository();
                            nomreRep.SaveNomre(nomre);
                            ///////////////////Save Present///////////////////
                            Presence presence = new Presence();
                            presence.OzviatID    = ozviatid;
                            presence.SessionID   = sRep.FindLastSessionID();
                            presence.Date        = tbxSessionDate.Text;
                            presence.Status      = (row.FindControl("RowChB") as CheckBox).Checked;
                            presence.isMovajjah  = (row.FindControl("RowChB2") as CheckBox).Checked;
                            presence.Description = (row.FindControl("DescriptionTbx") as TextBox).Text.ToString();
                            vPresenceRepository PRep = new vPresenceRepository();
                            PRep.SavePresenc(presence);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Teacher/News.aspx'", true);
                    }
                    scope.Complete();
                }
                catch (Exception e)
                {
                    string s = e.Message;
                    result = false;
                }
                return(result);
            }
        }