protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null || Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) < 0 || Convert.ToInt32(Session["UserType"]) > 5) { Response.Write("<script>alert(\"请登录\");location.href = location.origin+\"/forms/publicforms/Login/Login.aspx\";</script>"); Response.End(); } if (Request["action"] != null && Request["action"] == "invoiceInfoSubmit") { Model.InvoiceInfo invoiceInfo = new Model.InvoiceInfo(); invoiceInfo.UserName = Session["UserName"].ToString(); invoiceInfo.Invoice = Request.Form["invoice_header"].ToString(); if (Request.Form["user_type"].ToString() == "2") { invoiceInfo.AccountNum = Request.Form["bank_account"].ToString(); invoiceInfo.Bank = Request.Form["bank_name"].ToString(); invoiceInfo.TaxNum = Request.Form["registration_certification"].ToString(); invoiceInfo.Tel = Request.Form["tel"].ToString(); invoiceInfo.UnitAddress = Request.Form["address"].ToString(); } try { DAL.InvoiceInfo.Add(invoiceInfo); } catch { return; } string json = "{\"code\":200}"; Response.Write(json); Response.End(); } }
/// <summary> /// 更新一条数据,根据ID /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Update(Model.InvoiceInfo model) { string strSql = "update InvoiceInfo set Invoice=@Invoice, TaxNum=@TaxNum, UnitAddress=@UnitAddress, Tel=@Tel, Bank=@Bank, AccountNum=@AccountNum, UserName=@UserName where ID = " + model.ID.ToString(); SqlParameter Invoice = new SqlParameter("Invoice", SqlDbType.NVarChar); Invoice.Value = model.Invoice; SqlParameter TaxNum = new SqlParameter("TaxNum", SqlDbType.NVarChar); TaxNum.Value = model.TaxNum; SqlParameter UnitAddress = new SqlParameter("UnitAddress", SqlDbType.NVarChar); UnitAddress.Value = model.UnitAddress; SqlParameter Tel = new SqlParameter("Tel", SqlDbType.NVarChar); Tel.Value = model.Tel; SqlParameter Bank = new SqlParameter("Bank", SqlDbType.NVarChar); Bank.Value = model.Bank; SqlParameter AccountNum = new SqlParameter("AccountNum", SqlDbType.NVarChar); AccountNum.Value = model.AccountNum; SqlParameter UserName = new SqlParameter("UserName", SqlDbType.NVarChar); UserName.Value = model.UserName; return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { Invoice, TaxNum, UnitAddress, Tel, Bank, AccountNum, UserName }, connectionString) == 1 ? true : false); }
/// <summary> /// 增加一个用户信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Add(Model.InvoiceInfo model) { string strSql = "insert into InvoiceInfo(Invoice, TaxNum, UnitAddress, Tel, Bank, AccountNum, UserName) values(@Invoice, @TaxNum, @UnitAddress, @Tel, @Bank, @AccountNum, @UserName)"; SqlParameter Invoice = new SqlParameter("Invoice", SqlDbType.NVarChar); Invoice.Value = model.Invoice; SqlParameter TaxNum = new SqlParameter("TaxNum", SqlDbType.NVarChar); TaxNum.Value = model.TaxNum; SqlParameter UnitAddress = new SqlParameter("UnitAddress", SqlDbType.NVarChar); UnitAddress.Value = model.UnitAddress; SqlParameter Tel = new SqlParameter("Tel", SqlDbType.NVarChar); Tel.Value = model.Tel; SqlParameter Bank = new SqlParameter("Bank", SqlDbType.NVarChar); Bank.Value = model.Bank; SqlParameter AccountNum = new SqlParameter("AccountNum", SqlDbType.NVarChar); AccountNum.Value = model.AccountNum; SqlParameter UserName = new SqlParameter("UserName", SqlDbType.NVarChar); UserName.Value = model.UserName; return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { Invoice, TaxNum, UnitAddress, Tel, Bank, AccountNum, UserName }, connectionString) == 1 ? true : false); }
/// <summary> /// 得到一个实体对象 /// </summary> /// <param name="Id"></param> /// <returns></returns> public static Model.InvoiceInfo GetModel(string Invoice) { string strSql = "select * from InvoiceInfo where Invoice = '" + Invoice + "'"; Model.InvoiceInfo model = new Model.InvoiceInfo(); DataSet ds = DBHelperSQL.GetDataSet(strSql, connectionString); model.Invoice = Invoice; if (ds.Tables[0].Rows.Count > 0) { model.ID = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"]); model.TaxNum = Convert.ToString(ds.Tables[0].Rows[0]["TaxNum"]); model.UnitAddress = Convert.ToString(ds.Tables[0].Rows[0]["UnitAddress"]); model.Tel = Convert.ToString(ds.Tables[0].Rows[0]["Tel"]); model.Bank = Convert.ToString(ds.Tables[0].Rows[0]["Bank"]); model.AccountNum = Convert.ToString(ds.Tables[0].Rows[0]["AccountNum"]); model.UserName = Convert.ToString(ds.Tables[0].Rows[0]["UserName"]); return(model); } else { return(null); } }
private bool Get_invoice() { string sort = "SubmitTime"; string order = "DESC"; string search = ""; int offset = 0; int limit = 10; if (Request["offset"] != null) { offset = Convert.ToInt32(Request["offset"]); limit = Convert.ToInt32(Request["limit"]); } if (Request["search"] != null) { search = Request["search"].ToString(); } string strwhere = "1=1"; if (Request["dataType"] != null && Request["cityType"] != null) { //int dataTypenum = int.Parse(Request["dataType"].ToString()); if (Request["cityType"].ToString() != "全部") { strwhere = "Status ='" + Request["cityType"].ToString() + "'"; } else { } } //else //{ // if (belongArea != "") // strwhere = "BelongArea ='" + belongArea + "'"; //} if (Request["sort"] != null) { if (Request["sort"].ToString() == "verify") { sort = "Status"; } else if (Request["sort"].ToString() == "reSubmitTime") { sort = "SubmitTime"; } else if (Request["sort"].ToString() == "ReInvoiceType") { sort = "InvoiceType"; } else { sort = Request["sort"].ToString(); } order = Request["order"].ToString(); } //strwhere =strwhere+ "and UserName='******'"; strwhere = strwhere + "and (Status= 2 or Status=3 or Status=4 or Status=-1) "; int totalCount = DAL.InvoiceList.GetRecordCount(search, strwhere); if (offset + limit > totalCount) { limit = totalCount - offset; } DataSet ds = DAL.InvoiceList.GetBriefList1(offset, limit, sort, order, search, strwhere); ds.Tables[0].Columns.Add("button", typeof(string)); ds.Tables[0].Columns.Add("uploadfile", typeof(string)); ds.Tables[0].Columns.Add("reSubmitTime", typeof(string)); ds.Tables[0].Columns.Add("verify", typeof(string)); ds.Tables[0].Columns.Add("Invoice", typeof(string)); ds.Tables[0].Columns.Add("TaxNum", typeof(string)); ds.Tables[0].Columns.Add("ReInvoiceType", typeof(string)); ds.Tables[0].Columns.Add("invoiceStatus", typeof(string)); foreach (DataRow dr in ds.Tables[0].Rows) { Model.InvoiceInfo invoiceInfo = DAL.InvoiceInfo.GetModel(Convert.ToInt32(dr["InvoiceInfoIndex"])); dr["Invoice"] = invoiceInfo.Invoice; dr["TaxNum"] = invoiceInfo.TaxNum; if (Convert.ToInt32(dr["InvoiceType"]) == 0) { dr["ReInvoiceType"] = "普通发票"; } else { dr["ReInvoiceType"] = "增值税发票"; } // string temp_time=((DateTime)dr["SubmitTime"]).ToString("yyyy-MM-dd"); dr["reSubmitTime"] = dr["SubmitTime"].ToString(); dr["uploadfile"] = "<a id='" + dr["ID"] + "' onclick= uploadfile(this.id) >查看详情</a>"; if (dr["Status"].ToString() == "2") { dr["verify"] = "<a style='color:red;' id='" + dr["ID"] + "' onclick= verify(this.id) >待审核</a>"; } else if (dr["Status"].ToString() == "3") { dr["verify"] = "<a style='color:red;' id='" + dr["ID"] + "'>待上传发票</a>"; } else if (dr["Status"].ToString() == "4") { dr["verify"] = "<a id='" + dr["ID"] + "'>已上传发票</a>"; } //为-1的情况下则是已经驳回 else if (dr["Status"].ToString() == "-1") { dr["verify"] = "<a style='color:black;' id='" + dr["ID"] + "'>已驳回</a>"; } } string result = ""; if (ds.Tables[0].Rows.Count > 0) { string jsonComs = CORSV2.cs.JSONHelper.DataTableToJSON(ds.Tables[0]); result = "{\"total\":" + totalCount.ToString() + ",\"rows\":" + jsonComs + "}"; Response.ContentType = "application/Json"; Response.Write(result); Response.End(); return(true); } else { string jsonComs = CORSV2.cs.JSONHelper.DataTableToJSON(ds.Tables[0]); result = "{\"total\":" + totalCount.ToString() + ",\"rows\":" + jsonComs + "}"; Response.ContentType = "application/Json"; Response.Write(result); Response.End(); return(false); } }