Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.Signin> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.Signin> modelList = new List <LearnSite.Model.Signin>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.Signin model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.Signin();
                    if (dt.Rows[n]["Qid"].ToString() != "")
                    {
                        model.Qid = int.Parse(dt.Rows[n]["Qid"].ToString());
                    }
                    model.Qnum = dt.Rows[n]["Qnum"].ToString();
                    if (dt.Rows[n]["Qattitude"].ToString() != "")
                    {
                        model.Qattitude = int.Parse(dt.Rows[n]["Qattitude"].ToString());
                    }
                    if (dt.Rows[n]["Qdate"].ToString() != "")
                    {
                        model.Qdate = DateTime.Parse(dt.Rows[n]["Qdate"].ToString());
                    }
                    if (dt.Rows[n]["Qyear"].ToString() != "")
                    {
                        model.Qyear = int.Parse(dt.Rows[n]["Qyear"].ToString());
                    }
                    if (dt.Rows[n]["Qmonth"].ToString() != "")
                    {
                        model.Qmonth = int.Parse(dt.Rows[n]["Qmonth"].ToString());
                    }
                    if (dt.Rows[n]["Qday"].ToString() != "")
                    {
                        model.Qday = int.Parse(dt.Rows[n]["Qday"].ToString());
                    }
                    model.Qweek    = dt.Rows[n]["Qweek"].ToString();
                    model.Qip      = dt.Rows[n]["Qip"].ToString();
                    model.Qmachine = dt.Rows[n]["Qmachine"].ToString();
                    model.Qnote    = dt.Rows[n]["Qnote"].ToString();
                    if (dt.Rows[n]["Qwork"].ToString() != "")
                    {
                        model.Qwork = int.Parse(dt.Rows[n]["Qwork"].ToString());
                    }
                    if (dt.Rows[n]["Qgrade"].ToString() != "")
                    {
                        model.Qgrade = int.Parse(dt.Rows[n]["Qgrade"].ToString());
                    }
                    if (dt.Rows[n]["Qterm"].ToString() != "")
                    {
                        model.Qterm = int.Parse(dt.Rows[n]["Qterm"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 private void showAttitude()
 {
     if (Request.QueryString["Sg"] != null && Request.QueryString["Ld"] != null && Request.QueryString["Qd"] != null)
     {
         Labelname.Text = Server.UrlDecode(Request.QueryString["Ld"].ToString());
         int Qid = Int32.Parse(Request.QueryString["Qd"].ToString());
         LearnSite.BLL.Signin   sgbll   = new LearnSite.BLL.Signin();
         LearnSite.Model.Signin sgmodel = new LearnSite.Model.Signin();
         sgmodel              = sgbll.GetModel(Qid);
         TextBox2.Text        = sgmodel.Qgroup;
         DDLatt.SelectedValue = sgmodel.Qgscore.ToString();
     }
 }
Exemple #3
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LearnSite.Model.Signin> DataTableToList(DataTable dt)
 {
     List<LearnSite.Model.Signin> modelList = new List<LearnSite.Model.Signin>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         LearnSite.Model.Signin model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LearnSite.Model.Signin();
             if (dt.Rows[n]["Qid"].ToString() != "")
             {
                 model.Qid = int.Parse(dt.Rows[n]["Qid"].ToString());
             }
             model.Qnum = dt.Rows[n]["Qnum"].ToString();
             if (dt.Rows[n]["Qattitude"].ToString() != "")
             {
                 model.Qattitude = int.Parse(dt.Rows[n]["Qattitude"].ToString());
             }
             if (dt.Rows[n]["Qdate"].ToString() != "")
             {
                 model.Qdate = DateTime.Parse(dt.Rows[n]["Qdate"].ToString());
             }
             if (dt.Rows[n]["Qyear"].ToString() != "")
             {
                 model.Qyear = int.Parse(dt.Rows[n]["Qyear"].ToString());
             }
             if (dt.Rows[n]["Qmonth"].ToString() != "")
             {
                 model.Qmonth = int.Parse(dt.Rows[n]["Qmonth"].ToString());
             }
             if (dt.Rows[n]["Qday"].ToString() != "")
             {
                 model.Qday = int.Parse(dt.Rows[n]["Qday"].ToString());
             }
             model.Qweek = dt.Rows[n]["Qweek"].ToString();
             model.Qip = dt.Rows[n]["Qip"].ToString();
             model.Qnote = dt.Rows[n]["Qnote"].ToString();
             if (dt.Rows[n]["Qwork"].ToString() != "")
             {
                 model.Qwork = int.Parse(dt.Rows[n]["Qwork"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemple #4
0
    private void showAttitude()
    {
        if (Request.QueryString["Qid"] != null)
        {
            if (Request.QueryString["Qname"] != null)
            {
                Labelname.Text = Server.UrlDecode(Request.QueryString["Qname"].ToString());
            }

            int Qid = Int32.Parse(Request.QueryString["Qid"].ToString());
            LearnSite.BLL.Signin   sgbll   = new LearnSite.BLL.Signin();
            LearnSite.Model.Signin sgmodel = new LearnSite.Model.Signin();
            sgmodel = sgbll.GetModel(Qid);
            int att = sgmodel.Qattitude.Value;
            if (att != 0 && att > -5 && att < 3)
            {
                RBLattitude.SelectedValue = att.ToString();
            }
            TextBox2.Text        = sgmodel.Qnote;
            DDLatt.SelectedValue = att.ToString();
        }
    }
    private void uploadgroupwork()
    {
        if (Request.Files["Filedata"] != null)
        {
            try
            {
                // Get the data
                HttpPostedFile group_upload = Request.Files["Filedata"];
                string         Gtype        = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower();
                string         Gmid         = Request.QueryString["mid"].ToString();
                string         Gnum         = Request.QueryString["num"].ToString();
                string         info         = HttpUtility.UrlDecode(Request.QueryString["info"].ToString());

                LearnSite.BLL.Mission   mbll   = new LearnSite.BLL.Mission();
                LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission();
                mmodel = mbll.GetModel(Int32.Parse(Gmid));

                // string Gextention = mmodel.Mfiletype;
                string Gcid = mmodel.Mcid.ToString();

                //Syear | Sgrade | Sclass | Sid | Sname | Wip | Sterm | LoginTime
                string[] infoarray = info.Split('|');
                string   Ggroup    = infoarray[3];//取组长
                string   Gyear     = infoarray[0];
                string   Ggrade    = infoarray[1];
                string   Gclass    = infoarray[2];
                string   Gip       = infoarray[5];
                string   LoginTime = infoarray[7];
                string   Gterm     = infoarray[6];

                LearnSite.BLL.Signin   sn     = new LearnSite.BLL.Signin();
                LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum);
                if (qmodel != null)
                {
                    Gyear     = qmodel.Qsyear.ToString();
                    Ggrade    = qmodel.Qgrade.ToString();
                    Gclass    = qmodel.Qclass.ToString();
                    Gip       = qmodel.Qip;
                    LoginTime = qmodel.Qdate.ToString();
                    Gterm     = qmodel.Qterm.ToString();
                }


                int      Glengh = group_upload.ContentLength;
                DateTime Gdate  = DateTime.Now;


                LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork();
                bool   gdone      = gbll.DoneGroupWork(Gnum, Int32.Parse(Gmid));
                string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Gyear, Ggrade, Gclass, Gcid, Gmid);//获得作品保存路径(如果不存在,自动创建)

                string NewFileName  = "g" + Gnum + Gcid + "_" + Gmid + "." + Gtype;
                string Gurl         = MySavePath + "/" + NewFileName;
                string saveFilename = Server.MapPath(Gurl);

                //如果作品未提交,提交作品
                if (!gdone)
                {
                    int Gtime = LearnSite.Common.Computer.TimePassed();
                    LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork();
                    gmodel.Gcheck    = false;
                    gmodel.Gcid      = Int32.Parse(Gcid);
                    gmodel.Gclass    = Int32.Parse(Gclass);
                    gmodel.Gdate     = DateTime.Now;
                    gmodel.Gfilename = NewFileName;
                    gmodel.Ggrade    = Int32.Parse(Ggrade);
                    gmodel.Ghit      = 0;
                    gmodel.Gip       = Gip;
                    gmodel.Glengh    = Glengh;
                    gmodel.Gmid      = Int32.Parse(Gmid);
                    gmodel.Gnote     = "";
                    gmodel.Gnum      = Gnum;
                    gmodel.Grank     = -1;
                    gmodel.Gscore    = 0;
                    LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                    gmodel.Gstudents = sbll.GroupSnum(Gnum);
                    gmodel.Gterm     = Int32.Parse(Gterm);
                    gmodel.Gtime     = Gtime;
                    gmodel.Gtype     = Gtype;
                    gmodel.Gurl      = Gurl;
                    gmodel.Gvote     = 0;
                    gmodel.Ggroup    = Int32.Parse(Ggroup);
                    gbll.Add(gmodel);//添加小组作品提交记录
                }
                else
                {
                    //已交则不更新记录
                }
                try
                {
                    group_upload.SaveAs(saveFilename);//保存提交作品
                    Response.StatusCode = 200;
                    Response.Write(NewFileName);
                }
                catch (Exception ex)
                {
                    Response.StatusCode = 200;
                    Response.Write(ex);
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = 200;
                Response.Write(ex);
            }
            finally
            {
                Response.End();
            }
        }
    }
    private void uploadgroupwork()
    {
        HttpPostedFile group_upload = Request.Files["imgFilegroup"];
        int            maxSize      = 104857600;//定义上传最大值为100MB

        if (group_upload != null)
        {
            // Get the data
            string Gtype = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower();
            string Gmid  = Request.QueryString["mid"].ToString();
            string Gnum  = Request.QueryString["num"].ToString();
            LearnSite.BLL.Mission   mbll   = new LearnSite.BLL.Mission();
            LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission();
            mmodel = mbll.GetModel(Int32.Parse(Gmid));
            string Gextention = mmodel.Mfiletype;
            string Gcid       = mmodel.Mcid.ToString();
            string limitext   = Gextention;//初始化,随意
            switch (Gextention)
            {
            case "doc":
                limitext = "*.doc;*.docx";
                break;

            case "ppt":
                limitext = "*.ppt;*.pptx";
                break;

            case "xls":
                limitext = "*.xls;*.xlsx";
                break;

            case "office":
                limitext = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx";
                break;

            case "sb":
                limitext = "*.sb;*.sb2";
                break;

            default:
                limitext = "*." + Gextention;
                break;
            }
            if (Gtype == Gextention || limitext.Contains(Gtype))
            {
                if (group_upload.InputStream != null || group_upload.InputStream.Length < maxSize)
                {
                    LearnSite.BLL.Signin   sn     = new LearnSite.BLL.Signin();
                    LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum);

                    LearnSite.Model.Cook cook = new LearnSite.Model.Cook();

                    string Ggroup    = cook.Sid.ToString();//取组长
                    string Gyear     = cook.Syear.ToString();
                    string Ggrade    = cook.Sgrade.ToString();
                    string Gclass    = cook.Sclass.ToString();
                    string Gip       = cook.LoginIp;
                    string LoginTime = cook.LoginTime;
                    string Gterm     = cook.ThisTerm.ToString();

                    if (qmodel != null)
                    {
                        Gyear     = qmodel.Qsyear.ToString();
                        Ggrade    = qmodel.Qgrade.ToString();
                        Gclass    = qmodel.Qclass.ToString();
                        Gip       = qmodel.Qip;
                        LoginTime = qmodel.Qdate.ToString();
                        Gterm     = qmodel.Qterm.ToString();
                    }


                    int      Glengh = group_upload.ContentLength;
                    DateTime Gdate  = DateTime.Now;


                    LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork();
                    bool   gdone      = gbll.DoneGroupWork(Gnum, Int32.Parse(Gmid));
                    string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Gyear, Ggrade, Gclass, Gcid, Gmid);//获得作品保存路径(如果不存在,自动创建)

                    string NewFileName  = "g" + Gnum + Gcid + "_" + Gmid + "." + Gtype;
                    string Gurl         = MySavePath + "/" + NewFileName;
                    string saveFilename = Server.MapPath(Gurl);

                    //如果作品未提交,提交作品
                    if (!gdone)
                    {
                        int Gtime = LearnSite.Common.Computer.TimePassed();
                        LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork();
                        gmodel.Gcheck    = false;
                        gmodel.Gcid      = Int32.Parse(Gcid);
                        gmodel.Gclass    = Int32.Parse(Gclass);
                        gmodel.Gdate     = DateTime.Now;
                        gmodel.Gfilename = NewFileName;
                        gmodel.Ggrade    = Int32.Parse(Ggrade);
                        gmodel.Ghit      = 0;
                        gmodel.Gip       = Gip;
                        gmodel.Glengh    = Glengh;
                        gmodel.Gmid      = Int32.Parse(Gmid);
                        gmodel.Gnote     = "";
                        gmodel.Gnum      = Gnum;
                        gmodel.Grank     = -1;
                        gmodel.Gscore    = 0;
                        LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                        gmodel.Gstudents = sbll.GroupSnum(Gnum);
                        gmodel.Gterm     = Int32.Parse(Gterm);
                        gmodel.Gtime     = Gtime;
                        gmodel.Gtype     = Gtype;
                        gmodel.Gurl      = Gurl;
                        gmodel.Gvote     = 0;
                        gmodel.Ggroup    = Int32.Parse(Ggroup);
                        gbll.Add(gmodel);//添加小组作品提交记录
                    }
                    else
                    {
                        //已交则不更新记录
                    }
                    group_upload.SaveAs(saveFilename);//保存或更新提交作品
                    Hashtable hash = new Hashtable();
                    hash["error"] = 0;
                    Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                    Response.Write(JsonMapper.ToJson(hash));
                    Response.End();
                }
                else
                {
                    showError("选择的文件大小超过限制!(最大为10MB)");
                }
            }
            else
            {
                showError("选择的文件类型错误!");
            }
        }
        else
        {
            showError("请选择文件!");
        }
    }
Exemple #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LearnSite.Model.Signin model)
 {
     dal.Update(model);
 }
Exemple #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.Signin model)
 {
     return(dal.Add(model));
 }