public void getCutomerAccounts_Called_When_Given_Valid_CustomerId() { _config.Setup(p => p.Get(1)).Returns(new Customer { }); var result = TokenObj.Get(1); Assert.That(result, Is.Not.Null); }
protected void Page_Load(object sender, EventArgs e) { tblNotes.Visible = String.IsNullOrEmpty(Request["mode"]); if (!this.IsPostBack) { string custBarcode = Request["barcode"]; if (!String.IsNullOrEmpty(custBarcode)) { Customer customer = customerProvider.Get(custBarcode); if (customer != null) { litCustomerName.Text = String.Format("{0} {1} ({2})", customer.FirstName, customer.LastName, customer.Barcode); } } if (!String.IsNullOrEmpty(Request["mode"])) { btnSave.Enabled = txtNotes.Enabled = false; } else { btnSave.Enabled = txtNotes.Enabled = true; } lblDate.Text = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"); } //litCustomerName.Text = }
/// <summary> /// 获取一个客户信息 /// </summary> /// <param name="id">客户id</param> /// <returns></returns> public Customer Get(string id) { //参数验证 if (string.IsNullOrEmpty(id)) { ErrorMsg = ErrorCode.ParameterNull; return(null); } //数据获取 Customer customer = null; DataEntity customerEntity = _customerProvider.Get(id); if (customerEntity != null) { customer = GetCustomerFromEntity(customerEntity); } return(customer); }
private void GetCustomerInfo(string customerCode) { Customer cust = customerProvider.Get(customerCode); if (cust != null) { CustomerStatusHistory customerStatusHistory = customerStatusProvider.GetLatestStatus(customerCode); lblBarcode.Text = cust.Barcode; lblName.Text = String.Format("{0} {1}", cust.FirstName, cust.LastName); // lblStatus.Text = customerStatusHistory == null ? "OK" : customerStatusHistory.CustomerStatus.Description; lblDateOfBirth.Text = cust.DateOfBirth.HasValue ? cust.DateOfBirth.Value.ToString("dddd, dd MMMM yyyy") : String.Empty; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { ddlCreditCardType.DataSource = creditCardTypeProvider.GetAll(); ddlCreditCardType.DataTextField = "Description"; ddlCreditCardType.DataValueField = "ID"; ddlCreditCardType.DataBind(); ddlBank.DataSource = bankProvider.GetActiveBanks(); ddlBank.DataTextField = "Name"; ddlBank.DataValueField = "ID"; ddlBank.DataBind(); ddlBank.Items.Insert(0, String.Empty); var cust = customerProvider.Get(Request["barcode"]); lblCustomer.Text = String.Format("{0} - {1} {2}", cust.Barcode, cust.FirstName.Trim(), cust.LastName.Trim()); } }
protected void btnAdd_Click(object sender, EventArgs e) { Customer customer = customerProvider.Get(txtBarcode.Text); if (customer != null) { try { classProvider.AddParticipant( Convert.ToInt32(ViewState["ClassRunningID"]), customer.ID); gvwData.DataBind(); txtBarcode.Text = String.Empty; CountTotalParticipants(); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage3, ex.Message, LabelStyleNames.ErrorMessage); } } }