protected void ImageButton1_Click(object sender, EventArgs e) { //判断名称是否唯一性 if (ZWL.Common.PublicMethod.IFExists("YinZhangName", "ERPYinZhang", 0, this.TextBox1.Text) == false) { ZWL.Common.MessageBox.Show(this, "该印章名称已经存在!"); return; } string FileNameStr = ZWL.Common.PublicMethod.UploadFileIntoDir(this.FileUpload1, DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)); if (FileNameStr.Trim().Length > 0) { ZWL.BLL.ERPYinZhang MyModel = new ZWL.BLL.ERPYinZhang(); MyModel.ImgPath = FileNameStr; MyModel.TimeStr = DateTime.Now; MyModel.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyModel.YinZhangLeiBie = Request.QueryString["Type"].ToString(); MyModel.YinZhangMiMa = this.TextBox2.Text; MyModel.YinZhangName = this.TextBox1.Text; MyModel.Add(); //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加印章信息(" + this.TextBox1.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); ZWL.Common.MessageBox.ShowAndRedirect(this, "印章信息添加成功!", "PublicSeal.aspx?Type=" + Request.QueryString["Type"].ToString()); } }
protected void Button2_Click(object sender, EventArgs e) { DataSet MYDTDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select UserName from ERPUser"); for (int i = 0; i < MYDTDT.Tables[0].Rows.Count; i++) { string filePath = Server.MapPath("../UpLoadFile/" + MYDTDT.Tables[0].Rows[i]["UserName"].ToString() + "") + ".jpg"; //文件路径 if (System.IO.File.Exists(filePath))//判断文件是否存在 { ZWL.BLL.ERPYinZhang MyModel = new ZWL.BLL.ERPYinZhang(); MyModel.ImgPath = MYDTDT.Tables[0].Rows[i]["UserName"].ToString()+".jpg"; MyModel.TimeStr = DateTime.Now; MyModel.UserName = MYDTDT.Tables[0].Rows[i]["UserName"].ToString(); MyModel.YinZhangLeiBie = "私人印章"; MyModel.YinZhangMiMa = "123456"; MyModel.YinZhangName = MYDTDT.Tables[0].Rows[i]["UserName"].ToString()+"个人签名"; MyModel.Add(); } } }
protected void Button2_Click(object sender, EventArgs e) { DataSet MYDTDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select UserName from ERPUser"); for (int i = 0; i < MYDTDT.Tables[0].Rows.Count; i++) { string filePath = Server.MapPath("../UpLoadFile/" + MYDTDT.Tables[0].Rows[i]["UserName"].ToString() + "") + ".jpg"; //文件路径 if (System.IO.File.Exists(filePath)) //判断文件是否存在 { ZWL.BLL.ERPYinZhang MyModel = new ZWL.BLL.ERPYinZhang(); MyModel.ImgPath = MYDTDT.Tables[0].Rows[i]["UserName"].ToString() + ".jpg"; MyModel.TimeStr = DateTime.Now; MyModel.UserName = MYDTDT.Tables[0].Rows[i]["UserName"].ToString(); MyModel.YinZhangLeiBie = "私人印章"; MyModel.YinZhangMiMa = "123456"; MyModel.YinZhangName = MYDTDT.Tables[0].Rows[i]["UserName"].ToString() + "个人签名"; MyModel.Add(); } } }