コード例 #1
0
    protected void Del_Btn(object obj, EventArgs e)
    {
        LinkButton        linkButton        = obj as LinkButton;
        RepeaterItem      repeaterItem      = linkButton.Parent as RepeaterItem;
        HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
        int num = Convert.ToInt32(htmlInputCheckBox.Value);

        try
        {
            IList all = Docs_Doc.Init().GetAll("doctypeid=" + num, null);
            if (all != null && all.Count > 0)
            {
                foreach (object current in all)
                {
                    Docs_DocInfo docs_DocInfo = current as Docs_DocInfo;
                    Help.DeleteFiles(docs_DocInfo.FilePath);
                }
            }
        }
        catch
        {
        }
        string cmdText = "delete from Docs_Doc where doctypeid=" + num;

        MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText, new SqlParameter[0]);
        Docs_DocType.Init().Delete(num);
        this.Show();
    }
コード例 #2
0
 private void Show(string did)
 {
     if (!string.IsNullOrEmpty(did))
     {
         Docs_DocInfo byId = Docs_Doc.Init().GetById(Convert.ToInt32(did));
         this.ViewState["di"] = byId;
         this.DocTitle.Value  = byId.DocTitle;
         this.Notes.Value     = byId.Notes;
         try
         {
             this.doctype.SelectedValue = string.Concat(byId.DocTypeID);
         }
         catch
         {
             this.doctype.SelectedValue = "0";
         }
         if (byId.IsShare == 1)
         {
             this.IsShare.SelectedIndex  = 1;
             this.tr.Attributes["style"] = "";
             this.userlist.Value         = byId.ShareUsers;
             this.namelist.Value         = byId.namelist;
         }
         if (!string.IsNullOrEmpty(byId.FilePath) && byId.FilePath.Contains("|"))
         {
             this.Attachword.Visible = true;
             List <TmpInfo> list  = new List <TmpInfo>();
             string[]       array = byId.FilePath.Split(new char[]
             {
                 '|'
             });
             for (int i = 0; i < array.Length; i++)
             {
                 if (array[i].Trim() != "")
                 {
                     TmpInfo tmpInfo = new TmpInfo();
                     int     num     = array[i].LastIndexOf('/') + 1;
                     string  tmp     = array[i].Substring(num, array[i].Length - num);
                     string  tmp2    = array[i].Replace("~", "");
                     tmpInfo.Tmp1 = array[i];
                     tmpInfo.Tmp2 = tmp;
                     tmpInfo.Tmp3 = tmp2;
                     list.Add(tmpInfo);
                 }
             }
             this.rpt.DataSource = list;
             this.rpt.DataBind();
         }
     }
 }
コード例 #3
0
    protected void Del_Btn(object obj, EventArgs e)
    {
        LinkButton   linkButton   = obj as LinkButton;
        RepeaterItem repeaterItem = linkButton.Parent.Parent as RepeaterItem;
        Panel        panel        = repeaterItem.FindControl("d") as Panel;

        if (panel.Visible)
        {
            HtmlInputCheckBox htmlInputCheckBox = repeaterItem.FindControl("chk") as HtmlInputCheckBox;
            int          id   = Convert.ToInt32(htmlInputCheckBox.Value);
            Docs_DocInfo byId = Docs_Doc.Init().GetById(id);
            Help.DeleteFiles(byId.FilePath);
            Docs_Doc.Init().Delete(id);
            this.Show();
        }
    }
コード例 #4
0
ファイル: FileView.aspx.cs プロジェクト: a532367171/WC
    protected void SaveToMe(object sender, EventArgs e)
    {
        Docs_DocInfo docs_DocInfo  = this.ViewState["di"] as Docs_DocInfo;
        Docs_DocInfo docs_DocInfo2 = new Docs_DocInfo();

        docs_DocInfo2.AddTime         = DateTime.Now;
        docs_DocInfo2.CreatorDepName  = this.DepName;
        docs_DocInfo2.CreatorID       = Convert.ToInt32(this.Uid);
        docs_DocInfo2.CreatorRealName = this.RealName;
        docs_DocInfo2.DocTitle        = "来自:[" + docs_DocInfo.CreatorRealName + "] " + docs_DocInfo.DocTitle;
        docs_DocInfo2.FilePath        = docs_DocInfo.FilePath;
        docs_DocInfo2.Notes           = docs_DocInfo.Notes;
        docs_DocInfo2.ShareUsers      = "";
        docs_DocInfo2.IsShare         = 0;
        Docs_Doc.Init().Add(docs_DocInfo2);
        base.Response.Write("<script>alert('您好!文档已保存成功!');window.location='" + base.Request.Url.AbsoluteUri + "'</script>");
    }
コード例 #5
0
ファイル: FileView.aspx.cs プロジェクト: a532367171/WC
    private void Show(string did)
    {
        Docs_DocInfo byId = Docs_Doc.Init().GetById(Convert.ToInt32(did));

        this.ViewState["di"]     = byId;
        this.DocTitle5.InnerText = byId.DocTitle;
        this.Creator5.InnerText  = byId.CreatorRealName + " (" + byId.CreatorDepName + ")";
        this.AddTime5.InnerText  = Utils.ConvertDate2(byId.AddTime);
        this.Notes5.InnerText    = byId.Notes;
        this.doctype5.InnerText  = this.GetDocType(byId.DocTypeID);
        if (byId.IsShare == 0)
        {
            this.IsShare5.InnerText = "不共享";
        }
        else
        {
            this.IsShare5.InnerText = "已经共享";
        }
        if (!string.IsNullOrEmpty(byId.FilePath))
        {
            string[] array = byId.FilePath.Split(new char[]
            {
                '|'
            });
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].Trim() != "")
                {
                    int    num = array[i].LastIndexOf('/') + 1;
                    string arg = array[i].Substring(num, array[i].Length - num);
                    string s   = array[i].Replace("~", "");
                    this.fjs += string.Format(this.fj, base.Server.UrlEncode(s), arg);
                }
            }
        }
    }
コード例 #6
0
 protected void Save_Btn(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.DocTitle.Value))
     {
         HttpFileCollection files = HttpContext.Current.Request.Files;
         int num = 1;
         for (int i = 0; i < files.Count; i++)
         {
             HttpPostedFile f = files[i];
             if (Config.IsValidFile(f))
             {
                 num++;
             }
         }
         if (!string.IsNullOrEmpty(base.Request.QueryString["did"]))
         {
             Docs_DocInfo docs_DocInfo = this.ViewState["di"] as Docs_DocInfo;
             docs_DocInfo.DocTitle  = this.DocTitle.Value;
             docs_DocInfo.FilePath  = this.UpdateFiles();
             docs_DocInfo.Notes     = this.Notes.Value;
             docs_DocInfo.DocTypeID = Convert.ToInt32(base.Request.Form["doctype"]);
             if (this.userlist.Value.Contains("#"))
             {
                 docs_DocInfo.IsShare    = 1;
                 docs_DocInfo.namelist   = this.namelist.Value;
                 docs_DocInfo.ShareUsers = this.userlist.Value;
             }
             else
             {
                 docs_DocInfo.IsShare    = 0;
                 docs_DocInfo.namelist   = "";
                 docs_DocInfo.ShareUsers = "";
             }
             Docs_Doc.Init().Update(docs_DocInfo);
             MessageBox.ShowAndRedirect(this, "保存成功!", "FileMenu.aspx");
         }
         else
         {
             if (num != 0)
             {
                 Docs_DocInfo docs_DocInfo = new Docs_DocInfo();
                 docs_DocInfo.AddTime         = DateTime.Now;
                 docs_DocInfo.CreatorDepName  = this.DepName;
                 docs_DocInfo.CreatorID       = Convert.ToInt32(this.Uid);
                 docs_DocInfo.CreatorRealName = this.RealName;
                 docs_DocInfo.DocTitle        = this.DocTitle.Value;
                 docs_DocInfo.FilePath        = this.UpdateFiles();
                 docs_DocInfo.Notes           = this.Notes.Value;
                 docs_DocInfo.DocTypeID       = Convert.ToInt32(base.Request.Form["doctype"]);
                 if (this.userlist.Value.Contains("#"))
                 {
                     docs_DocInfo.IsShare    = 1;
                     docs_DocInfo.namelist   = this.namelist.Value;
                     docs_DocInfo.ShareUsers = this.userlist.Value;
                 }
                 else
                 {
                     docs_DocInfo.IsShare    = 0;
                     docs_DocInfo.namelist   = "";
                     docs_DocInfo.ShareUsers = "";
                 }
                 Docs_Doc.Init().Add(docs_DocInfo);
                 MessageBox.ShowAndRedirect(this, "保存成功!", "FileMenu.aspx");
             }
             else
             {
                 MessageBox.ShowAndRedirect(this, "您还没上传任何文件!", base.Request.Url.AbsoluteUri);
             }
         }
     }
     else
     {
         MessageBox.ShowAndRedirect(this, "标题不能为空!", base.Request.Url.AbsoluteUri);
     }
 }
コード例 #7
0
    protected void Save_Btn(object sender, EventArgs e)
    {
        HttpFileCollection files = HttpContext.Current.Request.Files;
        int num = 1;

        for (int i = 0; i < files.Count; i++)
        {
            HttpPostedFile f = files[i];
            if (Config.IsValidFile(f))
            {
                num++;
            }
        }
        if (!string.IsNullOrEmpty(base.Request.QueryString["did"]))
        {
            Docs_DocInfo docs_DocInfo = this.ViewState["di"] as Docs_DocInfo;
            docs_DocInfo.DocTitle  = this.DocTitle.Value;
            docs_DocInfo.FilePath  = this.UpdateFiles();
            docs_DocInfo.Notes     = this.Notes.Value;
            docs_DocInfo.DocTypeID = Convert.ToInt32(base.Request.Form["doctype"]);
            if (this.IsShare.Value == "1")
            {
                docs_DocInfo.IsShare    = 1;
                docs_DocInfo.namelist   = this.namelist.Value;
                docs_DocInfo.ShareUsers = this.userlist.Value;
            }
            else
            {
                docs_DocInfo.IsShare    = 0;
                docs_DocInfo.namelist   = "";
                docs_DocInfo.ShareUsers = "";
            }
            Docs_Doc.Init().Update(docs_DocInfo);
            string str = HttpContext.Current.Server.HtmlEncode("您好!文档已保存成功!");
            base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str);
        }
        else
        {
            if (num != 0)
            {
                Docs_DocInfo docs_DocInfo = new Docs_DocInfo();
                docs_DocInfo.AddTime         = DateTime.Now;
                docs_DocInfo.CreatorDepName  = this.DepName;
                docs_DocInfo.CreatorID       = Convert.ToInt32(this.Uid);
                docs_DocInfo.CreatorRealName = this.RealName;
                docs_DocInfo.DocTitle        = this.DocTitle.Value;
                docs_DocInfo.FilePath        = this.UpdateFiles();
                docs_DocInfo.Notes           = this.Notes.Value;
                docs_DocInfo.DocTypeID       = Convert.ToInt32(base.Request.Form["doctype"]);
                if (this.IsShare.Value == "1")
                {
                    docs_DocInfo.IsShare    = 1;
                    docs_DocInfo.namelist   = this.namelist.Value;
                    docs_DocInfo.ShareUsers = this.userlist.Value;
                }
                else
                {
                    docs_DocInfo.IsShare    = 0;
                    docs_DocInfo.namelist   = "";
                    docs_DocInfo.ShareUsers = "";
                }
                Docs_Doc.Init().Add(docs_DocInfo);
                string str = HttpContext.Current.Server.HtmlEncode("您好!文档已保存成功!");
                base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str);
            }
            else
            {
                base.Response.Write("<script>alert('您还没上传任何文件');window.location='" + base.Request.Url.AbsoluteUri + "'</script>");
            }
        }
    }