protected bool flg = true;//标识是否有印章
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["userName"] == null || Session["userName"].ToString() == "" || Session["userPw"] == null || Session["userPw"].ToString() == "")
     {
         Response.Redirect("login.aspx");
     }
     lblUserName.Text = Session["userName"].ToString();
     //lblNowTime.Text = DateTime.Now.ToString("yyyy/MM/dd");
     if (!IsPostBack)
     {
         PageOffice.ZoomSeal.SealManager sealMg = new PageOffice.ZoomSeal.SealManager(Server.MapPath("."));
         sealMg.DBConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=|DataDirectory|seal.mdb";
         //显示印章列表
         if (sealMg.GetQueryCollection("").Count > 0)
         {
             flg = true;
             ShowList(sealMg);
         }
         else
         {
             flg = false;
             ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>ShowDelAll();</script>");
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 显示印章列表
        /// </summary>
        /// <param name="sealMg"></param>
        private void ShowList(PageOffice.ZoomSeal.SealManager sealMg)
        {
            GridView1.AutoGenerateColumns = false;
            GridView1.DataSource          = sealMg.GetQueryCollection(" order by ID desc");



            //GridView1.DataSource.ToString;
            //项
            System.Diagnostics.Debug.WriteLine(sealMg.GetQueryCollection(" order by ID desc")[0].SealImage.Length);
            byte[] dt     = sealMg.GetQueryCollection(" order by ID desc")[0].SealImage;
            string sValue = Convert.ToBase64String(dt);

            System.Diagnostics.Debug.WriteLine("sss");

            sValue = "data:" + sealMg.GetQueryCollection(" order by ID desc")[0].SealImageType + ";base64," + sValue;
            System.Diagnostics.Debug.WriteLine(sValue);



            GridView1.DataBind();
        }
        /// <summary>
        /// 删除印章
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                if (GridView1.Rows[e.RowIndex].Cells[0].Text != null && GridView1.Rows[e.RowIndex].Cells[0].Text.Trim().Length > 0)
                {
                    string id = GridView1.Rows[e.RowIndex].Cells[0].Text.Trim();

                    PageOffice.ZoomSeal.SealManager sealMg = new PageOffice.ZoomSeal.SealManager(Server.MapPath("."));
                    sealMg.DBConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=|DataDirectory|seal.mdb";

                    if (string.IsNullOrEmpty(id) || !sealMg.Exists(int.Parse(id)))
                    {
                        // Literal_JS.Text = "<script type='text/javascript'>alert('为获得印章的ID号,删除失败!');</script>";
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('未获得印章的ID号,删除失败!');</script>");
                        return;
                    }

                    if (sealMg.Delete(int.Parse(id)))
                    {
                        ShowList(sealMg);
                        //Literal_JS.Text = "<script type='text/javascript'>alert('删除成功!');</script>";
                        if (sealMg.GetQueryCollection("").Count == 0)
                        {
                            flg = false;
                            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>ShowDelAll();alert('删除成功!');</script>");
                            Response.Redirect("seal.aspx");
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除成功!');</script>");
                            Response.Redirect("seal.aspx");
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除失败!');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                // Literal_JS.Text = "<script type='text/javascript'>alert('删除失败!失败原因:" + ex.Message + "');</script>";
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除失败!失败原因:" + ex.Message + "');</script>");
                return;
            }
        }
 /// <summary>
 /// 显示印章列表
 /// </summary>
 /// <param name="sealMg"></param>
 private void ShowList(PageOffice.ZoomSeal.SealManager sealMg)
 {
     GridView1.AutoGenerateColumns = false;
     GridView1.DataSource          = sealMg.GetQueryCollection(" order by ID desc");
     GridView1.DataBind();
 }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userName"] == null || Session["userName"].ToString() == "" || Session["userPw"] == null || Session["userPw"].ToString() == "")
            {
                Response.Redirect("login.aspx");
            }
            lblUserName.Text = Session["userName"].ToString();
            lblNowTime.Text = DateTime.Now.ToString("yyyy/MM/dd");
            if (!IsPostBack)
            {
                PageOffice.ZoomSeal.SealManager sealMg = new PageOffice.ZoomSeal.SealManager(Server.MapPath("."));
                sealMg.DBConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=|DataDirectory|seal.mdb";
                //显示印章列表
                if (sealMg.GetQueryCollection("").Count > 0)
                {
                    flg = true;
                    ShowList(sealMg);
                }
                else
                {
                    flg = false;
                    ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>ShowDelAll();</script>");
                }

            }
        }
Exemple #6
0
        /// <summary>
        /// 删除印章
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {

                if (GridView1.Rows[e.RowIndex].Cells[0].Text != null && GridView1.Rows[e.RowIndex].Cells[0].Text.Trim().Length > 0)
                {
                    string id = GridView1.Rows[e.RowIndex].Cells[0].Text.Trim();

                    PageOffice.ZoomSeal.SealManager sealMg = new PageOffice.ZoomSeal.SealManager(Server.MapPath("."));
                    sealMg.DBConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=|DataDirectory|seal.mdb";

                    if (string.IsNullOrEmpty(id) || !sealMg.Exists(int.Parse(id)))
                    {
                        // Literal_JS.Text = "<script type='text/javascript'>alert('为获得印章的ID号,删除失败!');</script>";
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('未获得印章的ID号,删除失败!');</script>");
                        return;
                    }

                    if (sealMg.Delete(int.Parse(id)))
                    {
                        ShowList(sealMg);
                        //Literal_JS.Text = "<script type='text/javascript'>alert('删除成功!');</script>";
                        if (sealMg.GetQueryCollection("").Count == 0)
                        {
                            flg = false;
                            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>ShowDelAll();alert('删除成功!');</script>");
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除成功!');</script>");
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除失败!');</script>");
                    }

                }
            }
            catch (Exception ex)
            {
                // Literal_JS.Text = "<script type='text/javascript'>alert('删除失败!失败原因:" + ex.Message + "');</script>";
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('删除失败!失败原因:" + ex.Message + "');</script>");
                return;
            }
        }