Example #1
0
        protected void QueryOne(string operate, string orderBy)
        {
            string whereEx = string.Empty;

            if (string.IsNullOrEmpty(_where))
            {
                whereEx = " 1=1 ";
            }
            else
            {
                whereEx = _where;
            }

            if (_fish != null)
            {
                whereEx += " and code " + operate + _fish.code;
            }

            List <FishEntity.ProductEntity> list = _bll.GetModelList(whereEx + orderBy);

            if (list == null || list.Count < 1)
            {
                MessageBox.Show("已经没有记录了!");
                return;
            }

            _fish = list[0];
            //
            _fishex = _bllex.GetModel(_fish.id);

            SetFish();
        }
Example #2
0
        protected bool Check()
        {
            errorProvider1.Clear();
            bool    isok     = true;
            int     tempInt1 = 0;
            int     tempInt2 = 0;
            decimal temp2    = 0;

            if (int.TryParse(txtNumber.Text, out tempInt1) == false)
            {
                errorProvider1.SetError(txtNumber, "请输入正确数字。");
                isok = false;
            }
            else
            {
                if (tempInt1 < 1)
                {
                    isok = false;
                    errorProvider1.SetError(txtNumber, "请输入大于零的件数。");
                }
            }

            if (int.TryParse(txtActualNum.Text, out tempInt2) == false)
            {
                errorProvider1.SetError(txtActualNum, "请输入正确数字。");
                isok = false;
            }
            else
            {
                if (tempInt2 < 1)
                {
                    isok = false;
                    errorProvider1.SetError(txtActualNum, "请输入大于零的件数。");
                }
            }

            if (tempInt1 < tempInt2)
            {
                errorProvider1.SetError(txtActualNum, "实际件数必须小于等于件数。");
                isok = false;
            }

            if (decimal.TryParse(txtTon.Text, out temp2) == false)
            {
                errorProvider1.SetError(txtTon, "请输入正确的数字。");
                isok = false;
            }
            else
            {
                if (temp2 <= 0)
                {
                    isok = false;
                    errorProvider1.SetError(txtTon, "请输入大于零的吨数。");
                }
            }

            if (true == string.IsNullOrEmpty(txtCompanyCode.Text))
            {
                errorProvider1.SetError(txtCompanyName, "请选择委托单位。");
                isok = false;
            }
            if (true == string.IsNullOrEmpty(txtFishCode.Text))
            {
                errorProvider1.SetError(txtFishName, "请选择鱼粉。");
                isok = false;
            }

            int productid = 0;

            if (txtFishCode.Tag != null && int.TryParse(txtFishCode.Tag.ToString(), out productid))
            {
                productid = int.Parse(txtFishCode.Tag.ToString());
                //FishBll.Bll.ProductBll productBll = new FishBll.Bll.ProductBll();
                //FishEntity.ProductEntity model = productBll.GetModel(productid);
                //if (model != null && (model.price == null || model.price.Value <= 0))
                //{
                //    isok = false;
                //    MessageBox.Show("鱼粉的购买单价必须大于零,请修改鱼粉资料中的购买单价。");
                //}
                FishBll.Bll.ProductExBll   productexBll = new FishBll.Bll.ProductExBll();
                FishEntity.ProductExEntity model        = productexBll.GetModel(productid);
                if (model != null && (model.confirmrmb.HasValue == false || model.confirmrmb.Value <= 0))
                {
                    isok = false;
                    MessageBox.Show("鱼粉的确盘人民币购买价格必须大于零,请修改鱼粉资料中的确盘人民币购买价格。");
                }
            }

            return(isok);
        }