当前位置: 首页>>代码示例>>C#>>正文


C# DBFunctions.getsubmittedassignments方法代码示例

本文整理汇总了C#中DBFunctions.getsubmittedassignments方法的典型用法代码示例。如果您正苦于以下问题:C# DBFunctions.getsubmittedassignments方法的具体用法?C# DBFunctions.getsubmittedassignments怎么用?C# DBFunctions.getsubmittedassignments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBFunctions的用法示例。


在下文中一共展示了DBFunctions.getsubmittedassignments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Downloadzip_Click

    protected void Downloadzip_Click(object sender, EventArgs e)
    {
        DBFunctions db = new DBFunctions();
        int aid = int.Parse(Request.QueryString["Asid"]);
        List<SubmittedAssignments_tbl> AssList = db.getsubmittedassignments(aid, 0, db.SubmittedAssignmentsCount(aid));
     


      //  string sPath = Server.MapPath("~") + "DownloadFolder";

        string sPath = Server.MapPath("~/LMS/SubmittedAssignments/") + "";
        string zipfile=DateTime.Now.Ticks +"_Assignment.zip";
        string zipFullPath = Server.MapPath("~/LMS/DownloadedAssingments/") +zipfile;

        ZipOutputStream zipOut = new ZipOutputStream(File.Create(zipFullPath));

        foreach (var asg in AssList)
        {
            string fName = sPath + asg.AssginmentFile;
            FileInfo fi = new FileInfo(fName);

            ZipEntry entry = new ZipEntry(fi.Name);

            FileStream sReader = File.OpenRead(fName);

            byte[] buff = new byte[Convert.ToInt32(sReader.Length)];

            sReader.Read(buff, 0, (int)sReader.Length);

            entry.DateTime = fi.LastWriteTime;

            entry.Size = sReader.Length;

            sReader.Close();

            zipOut.PutNextEntry(entry);

            zipOut.Write(buff, 0, buff.Length);

        }

        zipOut.Finish();

        zipOut.Close();
   
         Response.Redirect("Download.ashx?file=" + zipfile + "&location=DownloadedAssingments", false);
    }
开发者ID:EezeSolutions,项目名称:Higher_Erp,代码行数:47,代码来源:ViewSubmittedAssignment.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack) { 
        if (Request.QueryString["Asid"] != null)
        {
            int aid = int.Parse(Request.QueryString["Asid"]);
            DBFunctions db = new DBFunctions();



            int pageStart = 1;
            int pageEnd = 10;
            if (Request.QueryString.ToString().Contains("page"))
            {
                page = Convert.ToInt32(Request.QueryString["page"].ToString());
                pageEnd = pageSize * page;
                pageStart = (pageEnd - pageSize) + 1;
            }

            List<SubmittedAssignments_tbl> AssList = db.getsubmittedassignments(aid, page - 1, pageSize);
            // ds = db.getwardenlist(page-1, pageSize);


            literalStart.Text = pageStart.ToString();
            literalEnd.Text = pageEnd.ToString();

            int tmpPageEnd = 0;
            tmpPageEnd = pageEnd;

            pageEnd = db.SubmittedAssignmentsCount(aid);



            if (pageEnd > 10)
            {
                literalTotal.Text = pageEnd.ToString();

                int pagett = 0;
                pagett = Convert.ToInt16(literalEnd.Text);

                if (pagett > pageEnd)
                {
                    literalEnd.Text = pageEnd.ToString();
                }

            }
            else
            {
                if (pageEnd == 0)
                {
                    literalStart.Text = "";
                }
                literalTotal.Text = pageEnd.ToString();
                literalEnd.Text = pageEnd.ToString();
            }


            string tmpUrl = string.Empty;
            tmpUrl = "ViewSubmittedAssignment.aspx?" + Request.QueryString.ToString();
            if (tmpUrl.Contains("&page"))
            {
                tmpUrl = tmpUrl.Remove(tmpUrl.IndexOf("&page"));
            }

            //*************************


            //*********

            StringBuilder listingString = new StringBuilder();

            if (AssList != null)
            {

                if (AssList != null)
                {
                    foreach (var subassgn in AssList)
                    {

                        submittedAsstbl.Text += "<tr><td>" + subassgn.Assignments_tbl.Courses_tbl.Course + "</td><td>" + subassgn.Assignments_tbl.Assignment_Title + "</td><td>" + subassgn.Assignments_tbl.marks + "</td><td>" + subassgn.Candidate_tbl.Name + "</td><td>";
                        submittedAsstbl.Text +="<a href='#'>"  + subassgn.AssginmentFile + "</a></td>";

                    }
                }

            }


            if (pageEnd > 10)
            {
                StringBuilder paging = new StringBuilder();
                int counterPage = 1;
                int totalPages = 1;

                totalPages = (pageEnd / 10) + 1;
                string urlMain = string.Empty;
                urlMain = Request.Url.ToString();
                if (urlMain.Contains("&page"))
                {
//.........这里部分代码省略.........
开发者ID:EezeSolutions,项目名称:Higher_Erp,代码行数:101,代码来源:ViewSubmittedAssignment.aspx.cs


注:本文中的DBFunctions.getsubmittedassignments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。