private void btnOk_Click(object sender, EventArgs e)
        {
            bool isValidated = true;

            if (string.IsNullOrEmpty(lkuProduct.Text))
            {
                errorProvider.SetError(lkuProduct, "产品不能为空!");
                isValidated = false;
            }
            else
            {
                errorProvider.SetError(lkuProduct, "");
            }
            if (!isValidated)
            {
                return;
            }

            try
            {
                string         tutorName     = Thread.CurrentPrincipal.Identity.Name;
                Guid           productId     = Guid.Parse(lkuProduct.EditValue.ToString());
                IStudioService studioService = new ContainerBootstrapper().ChildContainer.Resolve <IStudioService>();
                studioService.Sell(tutorName, productId);
                XtraMessageBox.Show("成功!");
                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("购买时出现错误:" + ex.Message, "错误",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void FrmTimesCardPurchase_Load(object sender, EventArgs e)
        {
            IMediumMgr mediumMgr = new ContainerBootstrapper().ChildContainer.Resolve <IMediumMgr>();

            bindingSourceMediums.DataSource = mediumMgr.GetAll().ToList();

            IProductMgr productMgr = new ContainerBootstrapper().ChildContainer.Resolve <IProductMgr>();

            bindingSourceProducts.DataSource = productMgr.GetAll().OfType <OneTimeExperience>();
        }
示例#3
0
        private void FrmTimesCard_Load(object sender, EventArgs e)
        {
            var mediums = new ContainerBootstrapper().ChildContainer.Resolve <IMediumMgr>().GetAll();

            bindingSourceMediums.DataSource = mediums;
            bindingSourceProduct.DataSource = _product;

            txtName.Validated   += ValidatedHandler;
            lkuMedium.Validated += ValidatedHandler;
            txtPrice.Validated  += ValidatedHandler;
        }
        private void lkuProduct_EditValueChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(lkuProduct.Text))
            {
                return;
            }

            IProductMgr productMgr = new ContainerBootstrapper().ChildContainer.Resolve <IProductMgr>();
            var         product    = productMgr.GetById(Guid.Parse(lkuProduct.EditValue.ToString()));

            if (product != null)
            {
                lkuMedium.EditValue = product.MediumId;
                txtPrice.Text       = product.Price.ToString("0.00");
            }
        }
        private void btnPhoneNumber_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtPhoneNumber.Text))
            {
                XtraMessageBox.Show("请先输入顾客的手机号码!");
                return;
            }

            IMemberMgr memberMgr = new ContainerBootstrapper().ChildContainer.Resolve <IMemberMgr>();
            var        member    = memberMgr.GetByPhoneNumber(txtPhoneNumber.Text);

            if (member != null)
            {
                txtName.Text = member.Name;
            }
            else
            {
                XtraMessageBox.Show("根据该手机号码未能找到顾客!", "提示");
            }
        }
示例#6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                XtraMessageBox.Show("请先输入用户名!");
                txtUserName.Focus();
                return;
            }

            IAuthenticator userMgr = new ContainerBootstrapper().ChildContainer.Resolve <IAuthenticator>();

            if (userMgr.Authenticate(txtUserName.Text, txtPassword.Text))
            {
                DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show("用户名或密码不正确!请重新输入!", "提示");
                txtPassword.Focus();
            }
        }