コード例 #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbDel_Click(object sender, CommandEventArgs e)
        {
            int pwid = Convert.ToInt32(e.CommandArgument);

            Daiv_OA.Entity.PlanEntity model = new Daiv_OA.Entity.PlanEntity();
            model = new Daiv_OA.BLL.PlanBLL().GetEntity(pwid);
            string islock = model.Locked;

            if (islock == "未锁定")
            {
                new Daiv_OA.BLL.PlanBLL().Delete(Convert.ToInt32(e.CommandArgument));
                string dirpath = Server.MapPath("~/Worddoc");
                if (Directory.Exists(dirpath) == false)
                {
                    Directory.CreateDirectory(dirpath);
                }
                string FileName = Path.GetFileName(model.Pwpath);
                string lastpath = dirpath + @"\" + FileName;
                File.Delete(lastpath);
                Selectinfo(" and uid = " + UserId + "");
            }
            else
            {
                System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('该文件已锁定!');</script>");
            }
        }
コード例 #2
0
        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbDown_Click(object sender, CommandEventArgs e)
        {
            string path = "";

            Daiv_OA.Entity.PlanEntity model = new Daiv_OA.Entity.PlanEntity();
            model = new Daiv_OA.BLL.PlanBLL().GetEntity(Convert.ToInt32(e.CommandArgument));
            path  = model.Pwpath;
            DownloadFile(path);
        }
コード例 #3
0
        /// <summary>
        /// 获取信息
        /// </summary>
        public void Selectinfo(string str)
        {
            int count;

            Daiv_OA.BLL.PlanBLL bll = new Daiv_OA.BLL.PlanBLL();
            this.Plan_repeater.DataSource = bll.getpage(AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, out count, str);
            this.Plan_repeater.DataBind();
            AspNetPager1.RecordCount = count;
        }
コード例 #4
0
        //插入信息
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            string dirpath = Server.MapPath("~/Worddoc");

            if (Directory.Exists(dirpath) == false)
            {
                Directory.CreateDirectory(dirpath);
            }
            Random ro            = new Random();
            int    name          = 1;
            string FileName      = "";
            string FileExtention = "";

            FileName = Path.GetFileName(this.fuFile.FileName);
            string stro    = ro.Next(100, 100000000).ToString() + name.ToString();//产生一个随机数用于新命名的文件
            string NewName = DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + stro;

            if (FileName.Length > 0)//有文件才执行上传操作再保存到数据库
            {
                FileExtention = Path.GetExtension(this.fuFile.FileName);
                string ppath = dirpath + @"\" + NewName + FileExtention;
                this.fuFile.SaveAs(ppath);
                Daiv_OA.Entity.PlanEntity model = new Daiv_OA.Entity.PlanEntity();
                model.Uid     = UserId;
                model.Pwtitle = this.txtTitle.Text;
                model.Pwdate  = DateTime.Now;
                model.Manager = this.ddlManager.SelectedValue;
                model.Pwpath  = "Worddoc/" + NewName + FileExtention;
                model.Locked  = "未锁定";
                int i = new Daiv_OA.BLL.PlanBLL().Add(model);
                if (i > 0)
                {
                    FinalMessage("操作成功", "My_Plan_List.aspx", 0);
                }
                else
                {
                    System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
                    page.ClientScript.RegisterStartupScript(page.GetType(), "clientScript", "<script language='javascript'>alert('对不起,操作失败!');</script>");
                }
            }
        }