You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.6 KiB
C#

11 months ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.Models;
using DSWeb.EntityDA;
namespace DSWeb.Invoice
{
public partial class InvoiceBookEdit : OpenPageBase
{
private string strHandle;
private string strInvoiceBookID;//发票册GID
private string strUserID;//用户GID
private string strShowName;//用户显示名称
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
this.h_userid.Value = strUserID;
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString();
}
if (Request.QueryString["id"] != null)
{
strInvoiceBookID = Request.QueryString["id"].ToString();
this.h_bookid.Value = strInvoiceBookID;
}
if (strHandle != null)
{
if (strHandle == "add")
{
txt_createuser.InnerHtml = strShowName;
this.btn_update.Disabled = true;
CompanyEntity companyEntity = new CompanyDA().GetCompanyByUserID(strUserID);
if (companyEntity.GID != null)
{
sel_company.Items.Add(new ListItem(companyEntity.NAME,companyEntity.GID));
}
}
if (strHandle == "edit" && strInvoiceBookID != null)
{
this.txt_startnum.Disabled = true;//发票起始号码不可编辑
this.txt_endnum.Disabled = true;//发票结束号码不可编辑
this.btn_create.Disabled = true;//生成按钮不可编辑
InvoiceBookDA invoiceBookDA = new InvoiceBookDA();
InvoiceBookEntity invoiceBookEntity = new InvoiceBookEntity();
invoiceBookEntity = invoiceBookDA.GetInvoiceBookByGID(strInvoiceBookID);
if (invoiceBookEntity.GID != null)
{
this.txt_name.Value = invoiceBookEntity.Name;
this.txt_description.Value = invoiceBookEntity.Description;
this.sel_type.Value = invoiceBookEntity.Type.ToString();
this.txt_code.Value = invoiceBookEntity.InvoiceCode;
this.txt_startnum.Value = invoiceBookEntity.InvoiceNumStart;
this.txt_endnum.Value = invoiceBookEntity.InvoiceNumEnd;
CompanyEntity companyEntity = new CompanyDA().GetCompanyByUserID(strUserID);
if (companyEntity.GID != null)
{
sel_company.Items.Add(new ListItem(companyEntity.NAME, companyEntity.GID));
}
this.txt_total.Value = invoiceBookEntity.InvoiceTotal.ToString();
this.ck_lock.Value = invoiceBookEntity.IsLock ? "1" : "0";
this.ck_delete.Value = invoiceBookEntity.IsDelete ? "1" : "0";
}
}
}
}
}
}