//添加复印文件 protected void Button1_Click(object sender, EventArgs e) { object[] obj0 = new object[] { title, copycount }; string[] info = new string[] { "文件名称", "复印份数" }; bool check = true; for (int i = 0; i < info.Length; i++) { if (Util.GetControlValue((Control)obj0[i]) == null || Util.GetControlValue((Control)obj0[i]) == "") { check = false; Util.alert(this.Page, "错误提示:【" + info[i] + "】栏目不能为空!"); break; } } if (check) { Hashtable ht = new Hashtable(); ht.Add("bill", this.bill.Text);//加入复印单编号 DA_CopyBU copy1 = new DA_CopyBU(); DA_JieYuanBU jyue1 = new DA_JieYuanBU(); //通过文号获取文件ID string fileId = copy1.GetFileIdByTitle(this.title.Text.ToString().Trim()); if (fileId == null) { Util.alert(this.Page, "文件【" + this.title.Text.ToString() + "】不存在!"); } else { //判断文件是否已经被借阅 DA_FilesBU file1 = new DA_FilesBU(); bool jyuestatus = file1.IsOrNotJieYue(fileId); if (jyuestatus)// { ht.Add("fileid", fileId); ht.Add("copycount", this.copycount.Text.ToString()); bool result = copy1.AddCopyFileData(ht); string id = copy1.GetIdBybill(this.bill.Text.ToString()); copy1.Close(); if (result) { Util.alert(this.Page, "新增文件成功!"); Response.Redirect("AddCopyFile.aspx?bill=" + this.bill.Text.Trim()); } else { Util.alert(this.Page, "错误提示:本复印单已存在此文件!"); } } else { Util.alert(this.Page, "错误提示:此文件被借阅,不能复印!"); } } } }
//删除数据 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); DA_CopyBU copy1 = new DA_CopyBU(); copy1.DelCopyData(id); this.BindData2(copy1); copy1.Close(); }
private void BindData1(string zeren) { DA_CopyBU print1 = new DA_CopyBU(); DataSet ds = print1.GetPrintList1(zeren); this.GridView1.DataSource = ds; this.GridView1.DataBind(); print1.Close(); ds.Dispose(); }
private void BindFiles(DA_CopyBU print) { bool flag = false; if (print == null) { print = new DA_CopyBU(); flag = true; } DA_CopyBU print1 = new DA_CopyBU(); DataSet ds1 = print1.GetFileList(this.bill.Text.ToString()); Repeater1.DataSource = ds1; Repeater1.DataBind(); if (flag) { print1.Close(); } }
private void SetControlData() { if (Request["id"] != null) { string id = Request["id"]; DA_CopyBU print1 = new DA_CopyBU(); DataSet ds = print1.GetDetailByID(id); print1.Close(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < arr0.Length; i++) { Util.SetControlValue(this.bill.Parent.FindControl(arr0[i]), ds.Tables[0].Rows[0][arr0[i]]); } this.billtime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["billtime"].ToString()).ToString("yyyy-MM-dd"); } ds.Dispose(); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.Item.FindControl("seldoc") != null) { string id = ((Label)e.Item.FindControl("seldoc")).Text; if (e.CommandName == "delete") { try { DA_CopyBU copy1 = new DA_CopyBU(); copy1.DeleteFile(id); this.BindFiles(copy1); copy1.Close(); } catch (Exception err1) { Util.alert(this.Page, err1.Message); } } } }
protected void Button1_Click(object sender, EventArgs e) { object[] obj0 = new object[] { bill, billtime, billmen, zeren, remark }; object[] obj1 = new object[] { bill, billtime, billmen, zeren }; string[] info = new string[] { "单据编号", "开票时间", "开票员", "复印人" }; bool check = true; for (int i = 0; i < info.Length; i++) { if (Util.GetControlValue((Control)obj1[i]) == null || Util.GetControlValue((Control)obj1[i]) == "") { check = false; Util.alert(this.Page, "错误提示:【" + info[i] + "】栏目不能为空!"); break; } } if (check) { try { Hashtable ht = new Hashtable(); Util.getPageData(obj0, ht); DA_CopyBU copy1 = new DA_CopyBU(); copy1.TabCommand.InsertData(ht); copy1.Close(); Util.alert(this.Page, "增加复印单成功!"); DA_JieYuanBU jyue2 = new DA_JieYuanBU(); string id = copy1.GetIdBybill(this.bill.Text.ToString()); Response.Redirect("EditPrintInfo.aspx?id=" + id); } catch { Util.alert(this.Page, "错误提示:增加资产数据失败,可能的原因是数据类型有错误,请检查后重新输入!"); } } }