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.cheque { public partial class ChequeBooksInfo : System.Web.UI.Page { private string strHandle; private string strChequeBookID;//支票册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; } else { Server.Transfer("~/Error/FriendError.aspx"); return; //strUserID = ""; } if (Session["SHOWNAME"] != null) { strShowName = Session["SHOWNAME"].ToString(); } if (Request.QueryString["handle"] != null) { strHandle = Request.QueryString["handle"].ToString(); } if (Request.QueryString["id"] != null) { strChequeBookID = Request.QueryString["id"].ToString(); this.h_bookid.Value = strChequeBookID; } 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)); } // DataSet ds = new CurrencyDA().GetCurrencyList(); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataTable myTable in ds.Tables) { foreach (DataRow myRow in myTable.Rows)//遍历表 { sel_CURRENCY.Items.Add(new ListItem(myRow["CODENAME"].ToString().Trim(), myRow["CODENAME"].ToString().Trim())); } } } else { sel_CURRENCY.Items.Add(new ListItem("", "")); } } else { sel_CURRENCY.Items.Add(new ListItem("", "")); } } if (strHandle == "edit" && strChequeBookID != null) { this.txt_startnum.Disabled = true;//支票起始号码不可编辑" this.txt_endnum.Disabled = true;//支票结束号码不可编辑 this.btn_create.Disabled = true;//生成按钮不可编辑 ChequeBooksDA ChequeBooksDA = new ChequeBooksDA(); ChequeBooksEntity ChequeBooksEntity = new ChequeBooksEntity(); ChequeBooksEntity = ChequeBooksDA.GetChequeBookByGID(strChequeBookID); if (ChequeBooksEntity.GID != null) { this.txt_name.Value = ChequeBooksEntity.Name; this.txt_description.Value = ChequeBooksEntity.Description; this.sel_type.Value = ChequeBooksEntity.Type.ToString(); this.txt_code.Value = ChequeBooksEntity.CHEQUECODE; this.txt_startnum.Value = ChequeBooksEntity.CHEQUENUMSTART; this.txt_endnum.Value = ChequeBooksEntity.CHEQUENUMEND; CompanyEntity companyEntity = new CompanyDA().GetCompanyByUserID(strUserID); if (companyEntity.GID != null) { sel_company.Items.Add(new ListItem(companyEntity.NAME, companyEntity.GID)); } this.txt_total.Value = ChequeBooksEntity.CHEQUETOTAL.ToString(); this.ck_lock.Value = ChequeBooksEntity.IsLock ? "1" : "0"; this.ck_delete.Value = ChequeBooksEntity.IsDelete ? "1" : "0"; // this.sel_CURRENCY.Value = ChequeBooksEntity.CURRENCY.ToString(); // } } } } } }