Пример #1
0
        protected void Upload_Click(object sender, EventArgs e)
        {
            FileUpload fileUpload = (FileUpload)Page.FindControlRecursive("fileUpload");

            if (fileUpload.HasFile)
            {
                string fileName = Path.GetFileName(fileUpload.FileName);
                string path     = "Subjects/" + subjectID + "/Tasks/" + id + "/";
                fileUpload.SaveAs(Server.MapPath(path) + User.Identity.GetUserId() + fileName);
                AddJoinUserMark join = new AddJoinUserMark();
                if (alredySent)
                {
                    bool updateSuccess = join.UpdateJoinUserMarks(id, User.Identity.GetUserId(), User.Identity.GetUserId() + fileName);
                    if (updateSuccess)
                    {
                        Response.Redirect(Request.RawUrl);
                    }
                }
                else
                {
                    bool addSuccess = join.AddJoinUserMarks(id, User.Identity.GetUserId(), User.Identity.GetUserId() + fileName,
                                                            User.Identity.GetName() + " " + User.Identity.GetSurname1() + " " + User.Identity.GetSurname2(), subjectID);
                    if (addSuccess)
                    {
                        Response.Redirect(Request.RawUrl);
                    }
                }
            }
        }
Пример #2
0
        public static string SaveScore(string a)
        {
            AddJoinUserMark addMark = new AddJoinUserMark();

            addMark.AddJoinUserMarkTest(id, userID, userName, subID, float.Parse(a) / 10);
            return(a);
        }
Пример #3
0
        public void SaveMarks(object sender, EventArgs e)
        {
            GridView list = (GridView)Page.FindControlRecursive("fileList");

            for (int i = 0; i < list.Rows.Count; i++)
            {
                GridViewRow     row        = list.Rows[i];
                TextBox         mark       = (TextBox)row.FindControlRecursive("mark");
                HiddenField     userid     = (HiddenField)row.FindControlRecursive("userid");
                HiddenField     resourceid = (HiddenField)row.FindControlRecursive("resourceid");
                AddJoinUserMark join       = new AddJoinUserMark();
                bool            addSuccess = join.UpdateMark(int.Parse(resourceid.Value), userid.Value, float.Parse(mark.Text));
                if (addSuccess)
                {
                    Response.Redirect(Request.RawUrl);
                }
            }
        }