public void DeleteDzfp(string billcode) { //删除bill_main表 List <string> list = new System.Collections.Generic.List <string>(); list.Add("delete bill_main where billcode='" + billcode + "'"); list.Add("delete bill_fpfj where billcode='" + billcode + "'"); list.Add("delete bill_fpfjs where billcode='" + billcode + "'"); server.ExecuteNonQuerysArray(list); }
protected void btnSave_Click(object sender, EventArgs e) { //beg发布时间 string sj = ""; if (this.txt_sj.Text.Trim() != "") { DateTime date = DateTime.MinValue; bool flag = DateTime.TryParse(this.txt_sj.Text.ToString(), out date); if (flag) { sj = date.ToString(); } else { Response.Write("<script>alert('日期格式错误!');</script>"); return; } } else { Response.Write("<script>alert('请填写发布日期!');</script>"); return; } //end发布时间 string str_stepid = "-1"; string str_billuser = Session["userCode"].ToString().Trim(); string str_billdate = sj; string str_billdept = server.GetCellValue("select userdept from bill_users where usercode='" + str_billuser + "'"); string bm = txt_dept.Text.Trim(); bm = bm.Substring(1, bm.IndexOf("]") - 1); string type = Request["type"]; List <string> list = new List <string>(); if (type == "add") { DataSet temp = server.GetDataSet("select cgbh from bill_lscg where cgbh='" + txt_cgbh.Text.Trim() + "'"); if (temp.Tables[0].Rows.Count != 0) { this.CreateLscgCode(); ClientScript.RegisterStartupScript(this.GetType(), "", "alert('该编号的报告申请申请已存在,系统已重新生成,请保存!');", true); return; } list.Add("insert into bill_lscg(cgbh,sj,cgdept,cglb,zynr,sm,cbr,spyj01,spyj02,spyj03,spyj04,spyj05,spyj06,spyj07,spyj08,yjfy) values('" + txt_cgbh.Text.Trim() + "','" + str_billdate + "','" + bm + "','" + ddlType.SelectedValue + "','" + txt_content.Text.Trim() + "','" + txt_sm.Text.Trim() + "','" + Session["userCode"].ToString().Trim() + "','','','','','','','','','" + txt_yjfy.Text.Trim() + "') "); //申明主表添加 list.Add("insert into bill_main(looptimes,billType,billcode,billname,flowid,stepid,billuser,billdate,billdept,billje) values(1,'1','" + txt_cgbh.Text.Trim() + "','','lscg','" + str_stepid + "','" + str_billuser + "','" + str_billdate + "','" + str_billdept + "','" + txt_yjfy.Text.Trim() + "')"); } else //编辑 { //修改单据时 list.Add("update bill_lscg set sj='" + str_billdate + "',cgdept='" + bm + "',cglb='" + ddlType.SelectedValue + "',zynr='" + txt_content.Text + "',sm='" + txt_sm.Text.Trim() + "',cbr='" + Session["userCode"].ToString().Trim() + "',yjfy='" + txt_yjfy.Text.Trim() + "' WHERE cgbh='" + Request.QueryString["billCode"].ToString() + "'"); list.Add("update bill_main set billname='' , billuser='******',billdate='" + str_billdate + "',billdept='" + str_billdept + "',billje='" + txt_yjfy.Text.Trim() + "',stepid='" + str_stepid + "' where flowid='lscg' and billcode='" + Request.QueryString["billCode"].ToString() + "'"); } if (server.ExecuteNonQuerysArray(list) == -1) { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存失败!');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存成功!');window.location.href='bgsqList.aspx';", true); } }