private void SetControlData() { if (Request["id"] != null) { string id = Request["id"]; DA_JieYuanBU jyue1 = new DA_JieYuanBU(); DataSet ds = jyue1.GetDetailByID(id); jyue1.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]]); } if (ds.Tables[0].Rows[0]["paytime1"].ToString() == "") { //this.paytime.Text = ""; this.paytime1.Text = ""; } else { this.paytime1.Text = DateTime.Parse(ds.Tables[0].Rows[0]["paytime1"].ToString()).ToString("yyyy-MM-dd"); } this.paytime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["paytime"].ToString()).ToString("yyyy-MM-dd"); this.billtime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["billtime"].ToString()).ToString("yyyy-MM-dd"); } ds.Dispose(); } }
//返回到借阅单 protected void Button2_Click(object sender, EventArgs e) { DA_JieYuanBU jyue1 = new DA_JieYuanBU(); string id = jyue1.GetIdBybill(Request.QueryString["bill"]); jyue1.Close(); Response.Redirect("EditJieyueInfo.aspx?id=" + id, true); }
//删除一条数据 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); DA_JieYuanBU jyue3 = new DA_JieYuanBU(); string bill = jyue3.GetbillById(id); jyue3.DeleteData(bill, id); this.BindData2(jyue3); jyue3.Close(); }
private void BindData1(string zeren) { DA_JieYuanBU jyue1 = new DA_JieYuanBU(); DataSet ds = jyue1.GetJieyueList1(zeren); //DataSet ds = jyue1.GetJieyueList(); this.GridView1.DataSource = ds; this.GridView1.DataBind(); jyue1.Close(); }
//确定文件的借阅 protected void Button1_Click(object sender, EventArgs e) { string Files = ""; Hashtable ht = new Hashtable(); for (int i = 1; i < 6; i++) { string temp = Util.GetControlValue(this.title1.Parent.FindControl("title" + i)); string temp1 = Util.GetControlValue(this.title1.Parent.FindControl("ajnum" + i)); if (temp.Trim() != "") { ht[temp.Trim()] = temp.Trim() + "_" + temp1.Trim(); } if (temp != "" && temp1 == "") { if (Files == "") { Files = i.ToString(); } else { Files = Files + "," + i; } } } if (ht.Count == 0) { Util.alert(this.Page, "错误提示:你至少需要输入一个文件名称"); } else { if (Files != "") { Util.alert(this.Page, "错误提示:请检查文件" + Files + "是否输入档案编号!"); } else { DA_JieYuanBU jyue1 = new DA_JieYuanBU(); string result = jyue1.AddJyueFileData(Request.QueryString["bill"], ht); string id = jyue1.GetIdBybill(Request.QueryString["bill"]); jyue1.Close(); if (result == null) { PubComm.ShowInfo("提示:增加文件成功!", Application["root"] + "/DangAn/EditJieyueInfo.aspx?id=" + id); } else { Util.alert(this.Page, result); } } } }
protected void BindData() { if (Request.QueryString["id"] != null) { DA_JieYuanBU jyue1 = new DA_JieYuanBU(); DataSet ds = jyue1.GetDetailByID(Request.QueryString["id"]); jyue1.Close(); this.bill.Text = ds.Tables[0].Rows[0]["bill"].ToString(); this.paytime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["paytime"].ToString()).ToString("yyyy-MM-dd"); this.paytim1.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); } }
private void BindFiles(DA_JieYuanBU jyue) { bool flag = false; if (jyue == null) { jyue = new DA_JieYuanBU(); flag = true; } DA_JieYuanBU jyue2 = new DA_JieYuanBU(); DataSet ds1 = jyue2.GetFileList(this.bill.Text.ToString()); Repeater1.DataSource = ds1; Repeater1.DataBind(); if (flag) { jyue2.Close(); } }
//删除Repeater里面的一条数据 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_JieYuanBU jyue3 = new DA_JieYuanBU(); jyue3.DeleteFile(id); this.BindFiles(jyue3); jyue3.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,paytime,remark }; object[] obj1 = new object[] { bill, billtime, billmen, zeren, paytime}; 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); //ht.Add("status", "0"); DA_JieYuanBU jyue1=new DA_JieYuanBU(); jyue1.TabCommand.InsertData(ht); jyue1.Close(); Util.alert(this.Page,"增加借阅单成功!"); DA_JieYuanBU jyue2 = new DA_JieYuanBU(); string id= jyue2.GetIdBybill(this.bill.Text.ToString()); Response.Redirect("EditJieYueInfo.aspx?id="+id); } catch { Util.alert(this.Page, "错误提示:增加资产数据失败,可能的原因是数据类型有错误,请检查后重新输入!"); } } }