因为要做一个OA的练习项目,所以想询问一下相关问题,希望能给一些答案,或者推荐一些教程文章:
1、日程管理应该去做呢? 就是一个日历一样的东西,日程就在与相对日期对应的地方。
2、请推荐一些关于文档上传下载,分类别上传下载,限制大小等等的文章,或者告之大概应该如何去做,谢谢了。
3、如何把数据导出Excel,.txt等格式。 那如果导入?请推荐一些文章,或者给个大概思想。
4、关于角色方面的知识然后,如果做OA需要什么注意的地方,或者需要明晓的知识点,希望能指点,指明。
谢谢。

解决方案 »

  1.   

    OA最重要的有2点,第一组织结构、第二工作流
    其他都是扯
    1.可以以日期和用户名为传入条件,在数据库中搜索对应日程
    2..Net上传下载很简单,百度一下
    3.同上,真的很简单
    4.角色就是群组,没有OA把角色直接赋给用户的
      

  2.   

    1、日程管理应该去做呢? 就是一个日历一样的东西,日程就在与相对日期对应的地方。
       在数据库建一个日程管理表,表中有一个字段为用户编号.用于与用户表关联.
    在为人员添加日程计划时,向日程表中添加相应信息,如日程安排的人员编号,内
    容,日期等等.可以通过人员编号查询人员的日程安排.也可以在系统中为用户提示
    近3天内的日程安排(几天根据用户定.) 
    2、请推荐一些关于文档上传下载,分类别上传下载,限制大小等等的文章,或者告之大概应该如何去做,谢谢了。
    这有一个图片上传下载的例子,供参考,文件和图片一样.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>院内展示</title>
        <script language="javascript">
       function PreviewPhotoatwidth(photo_file,img_object,imgwidth)
       {
            var fileext=photo_file.value.substring(photo_file.value.lastIndexOf("."),photo_file.value.length);
            fileext=fileext.toLowerCase();
            if ((fileext!='.jpg')&&(fileext!='.gif')&&(fileext!='.jpeg')&&(fileext!='.png')&&(fileext!='.bmp'))
            {
                  alert("对不起,系统仅支持标准格式的照片,请您调整格式后重新上传,谢谢 !");
                  photo_file.focus();
            }
            else
            {
                img_object.src=photo_file.value;
                if (img_object.width>imgwidth)
                 {img_object.width=imgwidth;  }
            }
        }
        </script>
    </head>
    <body >
        <form id="form1" runat="server" enctype="multipart/form-data" method="post" action="">
            <table width="100%">
                <tr>
                    <td style="font-size: 11px;">
                        上传图片:
                    </td>
                    <td class="contenttext">
                        <input id="ImageFile" type="file" name="ImageFile" runat="server" onchange="javascript:PreviewPhotoatwidth(this,picpreview,260)"
                            style="width: 308px" />
                        <asp:Label ID="ImageFileLabel" runat="server" ForeColor="Red"></asp:Label>
                    </td>
                    <td>
                        <td style="font-size: 11px;">
                            图片预览:
                        </td>
                        <td>
                            <img id="picpreview" alt="预览"  width="126" height="76" />
                        </td>
                        <td>
                            <asp:Button ID="Button2" runat="server" Text="下载" OnClick="Button2_Click" />
                        </td>
                    </td>
                </tr>
            </table>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
            <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Button" />
        </form>
    </body>
    </html>
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.IO;
    public partial class myPage : System.Web.UI.Page
    {
        private void DownloadFile()
        {
            string path = Server.MapPath("UploadFiles/07de2121-c906-45e1-8aff-2ce320c12404.jpg");
            //string path = this.ApplicationRootPath + objNetDisk_Resource.ResURL;        if (!File.Exists(path))
            {
                // 文件没有找到
                //Page.Response.Write ("文件不存在") ; 
                //       return; 
            }
            else
            {
                System.IO.FileInfo file = new System.IO.FileInfo(path);
                // clear the current output content from the buffer
                Response.Clear();
                // add the header that specifies the default filename for the Download/SaveAs dialog
                Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8));
                // add the header that specifies the file size, so that the browser
                // can show the download progress
                Response.AddHeader("Content-Length", file.Length.ToString());
                // specify that the response is a stream that cannot be read by the
                // client and must be downloaded
                Response.ContentType = "application/octet-stream";
                // send the file stream to the client
                Response.WriteFile(file.FullName);
                // stop the execution of this page
                Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {  }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime CreateDate = DateTime.Now;
            string TrueName = "";
            string RandomName = "";
            if (ImageFile.PostedFile.FileName.Length > 0 )
            {
                if (ImageFile.PostedFile.FileName != "")
                {
                    string RandomString = Convert.ToString(Guid.NewGuid());
                    TrueName = Path.GetFileName(ImageFile.PostedFile.FileName);
                    int i = TrueName.LastIndexOf(".");
                    string ExtendName = TrueName.Substring(i);
                    RandomName = RandomString + ExtendName;
                    string filepath = Server.MapPath("~/UploadFiles/" + RandomName);
                    //string FileType = UploadFile.PostedFile.ContentType.ToString();
                    //UploadFileName.EndsWith(".exe")
                    if (ExtendName != ".jpg" && ExtendName != ".gif" && ExtendName != ".bmp" && ExtendName != ".JPG" && ExtendName != ".GIF" && ExtendName != ".BMP")
                    {
                        //Response.Write("<script language=\"javascript\">alert('只能上传jpg,gif,bmp格式的图片!');</script>");
                        ImageFileLabel.Visible = true;
                        ImageFileLabel.Text = "只能上传jpg,gif,bmp格式的图片!";
                        return;
                    }
                    if (ImageFile.PostedFile.ContentLength > 202800)
                    {
                        //Response.Write("<script language=\"javascript\">alert('上传图片不能超过200k!');</script>");
                        ImageFileLabel.Visible = true;
                        ImageFileLabel.Text = "上传图片不能超过200k";
                        return;
                    }
                    else
                    {
                        ImageFile.PostedFile.SaveAs(filepath);
                    }
                }
                else
                {
                    ImageFileLabel.Visible = true;
                    ImageFileLabel.Text = "必须选择图片";
                    return;
                }
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            this.DownloadFile();
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            Page.Response.Clear();
            string path = Server.MapPath("UploadFiles/07de2121-c906-45e1-8aff-2ce320c12404.jpg");
            bool success = Class1.ResponseFile(Page.Request, Page.Response, "理解你", path, 1024000);
            if (!success)
                Response.Write("下载文件出错!");
            Page.Response.End();
        }
    }
     
      

  3.   

    3、如何把数据导出Excel,.txt等格式。 那如果导入?请推荐一些文章,或者给个大概思想。 
    读取Excel到dataset中,就可以导入到数据库中..string excelFilePath=@"D:\Book1.xls";
       Excel.Application myExcel=new Excel.ApplicationClass( ) ;
       object oMissing = System.Reflection.Missing.Value ;
       myExcel.Application.Workbooks.Open(excelFilePath,oMissing,oMissing,oMissing,oMissing,oMissing,    oMissing,oMissing,oMissing,oMissing,oMissing,oMissing,oMissing,oMissing,oMissing) ;
       Excel.Workbook myBook = myExcel.Workbooks[1] ;
       Excel.Worksheet mySheet = (Excel.Worksheet)myBook.Worksheets[1] ;
       System.Data.DataTable dt=new System.Data.DataTable("mytable");
       dt.Columns.Add("F1", System.Type.GetType("System.String"));
       dt.Columns.Add("F2", System.Type.GetType("System.String"));
       dt.Columns.Add("F3", System.Type.GetType("System.String"));
       dt.Columns.Add("F4", System.Type.GetType("System.String"));
       dt.Columns.Add("F5", System.Type.GetType("System.String"));
       DataSet myDs = new DataSet();
       myDs.Tables.Add(dt);
       DataRow myRow;
       myDs.Clear();
       for( int i = 2 ; i <= 4 ; i ++ ) //第一行为标题,不读取
       {
        myRow = myDs.Tables["mytable"].NewRow();
        for( int j = 1 ; j <= 5 ; j ++ )
        {
         Excel.Range r=(Excel.Range)mySheet.Cells[i,j];
         string strValue=r.Text.ToString();
         string aa=strValue;
         string columnname="F"+j.ToString();
         myRow[columnname]=strValue;
        }
        myDs.Tables["mytable"].Rows.Add(myRow);
       }  
      }读写.txt       //程序得引用命名空间using System.IO;
           //先从数据中把要写入.txt文件中的数据读到datatable中.要向.txt文件写时,用WriteLine或Write把datatable中的数据写入.txt文件中去.
           //向文件中写入数据,并清空以前文件中的数据。
            //StreamWriter sw = new StreamWriter(@"D:\file.txt");
           //向文件中写入数据,不清空以前文件中的数据。
            StreamWriter sw = File.AppendText(Server.MapPath(".") + "\\file.txt");
            sw.WriteLine("一行一行写");
            sw.Write("接着写");
            sw.Flush();
            sw.Close();
     
            也可以从.txt文件中把数据读出来,可以将读出来的数据插入数据库中..
            //StreamReader sr = new StreamReader(@"D:\file.txt");
            StreamReader sr = new StreamReader(Server.MapPath(".") + "\\file.txt");
            string str = "";
            string content = "";
            do
            {
                str = sr.ReadLine();
                content += str + "<br>";
            }
      

  4.   

    角色是具有某些共性的用户组成的集合(这个集合允许为空)。权限是规定了的一系列的访问规则。权限的本质是规则。是规定哪些用户可以做哪些事情,哪些用户不可以做哪些事情的规则。
    比如说,只有拥有经理的角色才能查看报表。我们解析的时候是这样的:有这么一批人可以查看报表,这批人有个共同的特征,那就是他们拥有经理的角色。经理的角色特征是,在现实的业务逻辑中是经理或者拥有经理一样高的权利。
    在权限中定义的是用户和事情之间的关系,并没有涉及到角色。所以,如果不使用角色也可以实现成员资格管理。但是,角色作为某些用户的集合,这样对制定规格是更为方便、合理,也更符合业务逻辑的客观存在形式。用户和角色的优先级:
    在同一个功能操作的访问权限下,一个用户被拒绝/允许,但这个用户的角色却被允许/拒绝,那这个用户到底能不能执行这个功能操作?我们给出的答案的否定的。也是就如果有明确用户可以做或不能做则按照这个规定!为什么呢,因为角色只是为了更好的组织用户,它代表了一类的用户。但是这类人中必然存在差异性,直接明确用户访问规则就是为了承认或者实现这种差异性。用户具有原子性,但是角色是由用户组成的,所以它不具备原子性。只有原子性的对象才能够保证这个访问规则的正确性。拒绝和允许的优先级:
    allow 和 deny 的优先级,到底哪个高呢?由于用户可以有多个角色,但这些角色中有些角色被一访问规则允许,有些则被禁止,有些未定义。这时,我们是让这个用户通过还是拒绝通过。我们认为应该拒绝用户的通过。正是用户角色的复杂性,所以在没有足够证据证明“里面的有些角色被拒绝但实际上这个用户不应该拒绝”的情况下,应该先把这个用户拒绝掉。这也是出于安全性的考虑。关于企业单位中的部门设置与角色的关系:
    我认为部门是一个角色,是一个和现实有密切联系的特殊角色。这个角色中包含了一系列的用户(这个部门的员工,这个部门的计算机(虚拟用户)等等)