//绑定数据 private void BindData() { //TODO: bind Dropdownlist,change accordingly txtCustOwnerID.BindDropDownListAndSelect(svr.GetUserByDep(), "UserName", "UserID"); //bind entity var entity = (vw_BillTicket)svr.LoadById(typeof(vw_BillTicket), "ID", hidID.Value); if (entity != null) { if (entity.Status == 'A') { btnCANX.Text = GetREMes("lblCancel"); } else { btnCANX.Text = GetREMes("lblRestore"); } hidID.Value = entity.ID.ToString(); hidDepId.Value = entity.DepId.ToString(); ddlDept.SelectedByText(entity.DepName); //根据德国/荷兰,决定有些选项是显示德文还是英文 BindInfoByDep(ddlDept.SelectedItem.Text); txtDepAddress.Text = entity.DepAddress; txtInnerReferenceID.Text = entity.InnerReferenceID; if (txtInnerReferenceID.Text.EndsWith("GS")) { ddlBillType.Text = "1"; } else if (txtInnerReferenceID.Text.EndsWith("REB")) { ddlBillType.Text = "2"; } HideFieldsWhenRefund(); txtBookingDate.Text = entity.BookingDate.ToString(DateFormatString); hidCustID.Text = entity.CustID.ToString(); txtCustName.Text = IsNull(entity.CustName); txtCustTel.Text = IsNull(entity.CustTel); txtCustFax.Text = IsNull(entity.CustFax); txtCustEmail.Text = IsNull(entity.CustEmail); txtCustAddress.Text = IsNull(entity.CustAddress); txtParentCompany.Text = IsNull(entity.ParentCompany); txtAirline.Items.Insert(0, entity.ProdProvider); txtAirline.Text = entity.ProdProvider; txtBankAccount.Text = entity.BankAccount; txtAccessory.Text = entity.Accessory; txtMaxLuggage.Text = entity.MaxLuggage; txtCancellationFee.Items.Insert(0, entity.CancellationFee); txtCancellationFee.Text = entity.CancellationFee; txtChangeFee.Items.Insert(0, entity.ChangeFee); txtChangeFee.Text = entity.ChangeFee; txtPaymentDate.Text = entity.PaymentDate; ddlDestination.Text = entity.DestinationRegion; txtCustCDate.Text = IsNull(entity.CreateDate); txtCustModifyDate.Text = IsNull(entity.ModifyDate); txtCustCUserID.Value = entity.CreateUserID.ToString(); txtCustModifyUserID.Value = entity.ModifyUserID.ToString(); txtCustCUserName.Text = entity.CreateUserName; txtCustModifyUserName.Text = entity.ModifyUserName; txtCustOwnerID.Text = entity.CustOwnerID.ToString(); lblTotalAmount.Text = IsNull(entity.TotalAmount); //取得乘客名单 gvData.DataSource = svr.getTicketPerson(entity.ID); gvData.DataBind(); //行程的乘客名单是一样的 rptTour.DataSource = gvData.DataSource; rptTour.DataBind(); //get audit log gvAuditLog.DataSource = svr.GetAuditLog(entity.ID, txtCustCDate.Text, txtCustCUserName.Text, txtCustCUserID.Value); gvAuditLog.DataBind(); } else { txtCustCDate.Text = DateTime.Now.ToString(DateTimeFormatString); txtCustCUserID.Value = base.LoginUserID.ToString(); txtCustCUserName.Text = base.LoginUserName.ToLower(); txtCustModifyDate.Text = DateTime.Now.ToString(DateTimeFormatString); txtCustModifyUserID.Value = base.LoginUserID.ToString(); txtCustModifyUserName.Text = base.LoginUserName.ToLower(); //录入人不一定是销售人员本人.所以取消默认值 //txtCustOwnerID.Text = base.LoginUserID.ToString(); txtBookingDate.Text = DateTime.Now.ToString(DateFormatString); //从客户信息那里过来 if (string.IsNullOrEmpty(Request["CustID"]) == false) { var Customer = (vw_CRMCustomer)svr.LoadById(typeof(vw_CRMCustomer), "CustID", Request["CustID"]); if (Customer != null) { hidCustID.Text = Request["CustID"]; txtCustName.Text = IsNull(Customer.CustFullName); txtCustTel.Text = IsNull(Customer.CustTel); txtCustFax.Text = IsNull(Customer.CustFax); txtCustEmail.Text = IsNull(Customer.CustEmail); txtCustAddress.Text = IsNull(Customer.CustAddress); txtParentCompany.Text = IsNull(Customer.ParentCompany); } } } }