void QueryOne(string operate, string orderBy)
        {
            string whereEx = string.Empty;

            if (string.IsNullOrEmpty(strWhere))
            {
                whereEx = "1=1";
            }
            else
            {
                whereEx = strWhere;
            }
            if (_model != null)
            {
                whereEx = whereEx + " AND code " + operate + orderBy;
            }

            _model = _bll.getModel(whereEx);
            if (_model == null)
            {
                MessageBox.Show("已经没有记录了");
                return;
            }
            setValue();
        }
 private void FormStorageOfRequisition_Load(object sender, EventArgs e)
 {
     if (Megres.oddNum != "")
     {
         MenuCode = "M450"; ControlButtomRoles();
         strWhere = "1=1";
         strWhere = strWhere + " and code='" + Megres.oddNum + "'";
         if (Megres.fishId != "")
         {
             strWhere = strWhere + " and fishId='" + Megres.fishId + "'";
         }
         _model = _bll.getModel(strWhere);
         if (_model == null)
         {
             MessageBox.Show("查无记录");
             return;
         }
         setValue();
     }
     else
     {
         strWhere = "";
     }
     Megres.oddNum = Megres.fishId = string.Empty;
 }
        public FormStorageOfRequisition()
        {
            InitializeComponent();

            _model = new FishEntity.StorageOfRequisitionEntity();
            _bll   = new FishBll.Bll.StorageOfRequisitionBll();
        }
        private void txtsupply_Click(object sender, EventArgs e)
        {
            FormCompanyList form = new FormCompanyList();

            if (form.ShowDialog() == DialogResult.OK)
            {
                FishEntity.PurchaseApplicationEntity _model = new FishEntity.PurchaseApplicationEntity();
                _model         = form.getModel;
                txtsupply.Text = _model.buyer;
            }
        }
 public FormStorageOfRequisition(string codenum)
 {
     InitializeComponent();
     getname = codenum;
     _model  = new FishEntity.StorageOfRequisitionEntity();
     _bll    = new FishBll.Bll.StorageOfRequisitionBll();
     InitDataUtil.BindComboBoxData(txtcountry, FishEntity.Constant.CountryType, true);
     InitDataUtil.BindComboBoxData(txtbrand, FishEntity.Constant.Brand, true);
     txtcountry.SelectedValueChanged -= country_SelectedValueChanged;
     InitDataUtil.BindComboBoxData(txtcountry, FishEntity.Constant.CountryType, true);
     txtcountry.SelectedValueChanged += country_SelectedValueChanged;
 }
        public override int Query()
        {
            FormStorageOfRequisitionQuery form = new FormStorageOfRequisitionQuery(this.Text + "查询");

            if (form.ShowDialog() == DialogResult.OK)
            {
                strWhere = form.getWhere;
                _model   = _bll.getModel(strWhere);
                if (_model == null)
                {
                    MessageBox.Show("没有记录了");
                    return(0);
                }
                setValue();
            }

            return(base.Query());
        }
 /// <summary>
 /// 编辑数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit(FishEntity.StorageOfRequisitionEntity model)
 {
     return(dal.Edit(model));
 }
 /// <summary>
 /// 新增数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Add(FishEntity.StorageOfRequisitionEntity model, string name)
 {
     return(dal.Add(model, name));
 }
        bool getValue()
        {
            if (_model == null)
            {
                _model = new FishEntity.StorageOfRequisitionEntity();
            }
            errorProvider1.Clear();

            if (string.IsNullOrEmpty(txtcode.Text))
            {
                errorProvider1.SetError(txtcode, "不可为空");
                return(false);
            }
            if (string.IsNullOrEmpty(txtfishId.Text))
            {
                errorProvider1.SetError(txtfishId, "不可为空");
                return(false);
            }

            outResult = 0M;
            if (!string.IsNullOrEmpty(txtthCodeNum.Text) && decimal.TryParse(txtthCodeNum.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtthCodeNum, "请重新输入");
                return(false);
            }
            outResult = 0M;
            if (!string.IsNullOrEmpty(txtliWeight.Text) && decimal.TryParse(txtliWeight.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtliWeight, "请重新输入");
                return(false);
            }
            outResult = 0M;
            if (!string.IsNullOrEmpty(txtliNumber.Text) && decimal.TryParse(txtliNumber.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtliNumber, "请重新输入");
                return(false);
            }
            outResult = 0M;
            if (!string.IsNullOrEmpty(txtprice.Text) && decimal.TryParse(txtprice.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtprice, "请重新输入");
                return(false);
            }
            outResult = 0M;
            if (!string.IsNullOrEmpty(txtsaWeight.Text) && decimal.TryParse(txtsaWeight.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtsaWeight, "请重新输入");
                return(false);
            }

            if (txtcode.Tag == null)
            {
                _model.id = 0;
            }
            else
            {
                _model.id = Convert.ToInt32(txtcode.Tag);
            }

            _model.code            = txtcode.Text;
            _model.fishId          = txtfishId.Text;
            _model.liWeight        = string.IsNullOrEmpty(txtliWeight.Text) == true ? 0 : Convert.ToDecimal(txtliWeight.Text);
            _model.LiNumber        = string.IsNullOrEmpty(txtliNumber.Text) == true ? 0 : Convert.ToDecimal(txtliNumber.Text);
            _model.price           = string.IsNullOrEmpty(txtprice.Text) == true ? 0 : Convert.ToDecimal(txtprice.Text);
            _model.shipName        = txtshipName.Text;
            _model.country         = txtcountry.Text;
            _model.billName        = txtbillName.Text;
            _model.proName         = txtproName.Text;
            _model.za              = txtza.Text;
            _model.zf              = txtzf.Text;
            _model.sand            = txtsand.Text;
            _model.db              = txtdb.Text;
            _model.applyDate       = txtapplyDate.Value;
            _model.thCodeNum       = txtthCodeNum.Text;
            _model.supply          = txtsupply.Text;
            _model.saWeight        = string.IsNullOrEmpty(txtsaWeight.Text) == true ? 0 : Convert.ToDecimal(txtsaWeight.Text);
            _model.brand           = txtbrand.Text;
            _model.pileNum         = txtpileNum.Text;
            _model.qualitySpe      = txtqualitySpe.Text;
            _model.tvn             = txttvn.Text;
            _model.hf              = txthf.Text;
            _model.sf              = txtsf.Text;
            _model.shy             = txtshy.Text;
            _model.remark          = txtremark.Text;
            _model.codeNum         = txtcodeNum.Text;
            _model.codeNumContract = txtcodeNumContract.Text;
            _model.jcCode          = txtjcCode.Text;

            return(true);
        }
Esempio n. 10
0
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(FishEntity.StorageOfRequisitionEntity model, string name)
        {
            Hashtable SQLString = new Hashtable();

            SQLString = ReviewInfo.getSQLString(name, model.code, string.Empty, SQLString);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_storageofrequisition(");
            strSql.Append("code,fishId,liWeight,LiNumber,price,shipName,country,billName,proName,za,zf,sand,db,applyDate,thCodeNum,supply,saWeight,brand,pileNum,qualitySpe,tvn,hf,sf,shy,remark,codeNum,codeNumContract,jcCode)");
            strSql.Append(" values (");
            strSql.Append("@code,@fishId,@liWeight,@LiNumber,@price,@shipName,@country,@billName,@proName,@za,@zf,@sand,@db,@applyDate,@thCodeNum,@supply,@saWeight,@brand,@pileNum,@qualitySpe,@tvn,@hf,@sf,@shy,@remark,@codeNum,@codeNumContract,@jcCode);");//select LAST_INSERT_ID();
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,    45),
                new MySqlParameter("@fishId",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@liWeight",        MySqlDbType.Decimal,    10),
                new MySqlParameter("@price",           MySqlDbType.Decimal,    10),
                new MySqlParameter("@shipName",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@country",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@billName",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@proName",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@za",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@zf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@sand",            MySqlDbType.VarChar,    45),
                new MySqlParameter("@db",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@applyDate",       MySqlDbType.DateTime),
                new MySqlParameter("@thCodeNum",       MySqlDbType.VarChar,    45),
                new MySqlParameter("@supply",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@saWeight",        MySqlDbType.Decimal,    10),
                new MySqlParameter("@brand",           MySqlDbType.VarChar,    45),
                new MySqlParameter("@pileNum",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar,    45),
                new MySqlParameter("@tvn",             MySqlDbType.VarChar,    45),
                new MySqlParameter("@hf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@sf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@shy",             MySqlDbType.VarChar,    45),
                new MySqlParameter("@remark",          MySqlDbType.VarChar,   255),
                new MySqlParameter("@codeNum",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,    45),
                new MySqlParameter("@jcCode",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@LiNumber",        MySqlDbType.Decimal, 45)
            };
            parameters[0].Value  = model.code;
            parameters[1].Value  = model.fishId;
            parameters[2].Value  = model.liWeight;
            parameters[3].Value  = model.price;
            parameters[4].Value  = model.shipName;
            parameters[5].Value  = model.country;
            parameters[6].Value  = model.billName;
            parameters[7].Value  = model.proName;
            parameters[8].Value  = model.za;
            parameters[9].Value  = model.zf;
            parameters[10].Value = model.sand;
            parameters[11].Value = model.db;
            parameters[12].Value = model.applyDate;
            parameters[13].Value = model.thCodeNum;
            parameters[14].Value = model.supply;
            parameters[15].Value = model.saWeight;
            parameters[16].Value = model.brand;
            parameters[17].Value = model.pileNum;
            parameters[18].Value = model.qualitySpe;
            parameters[19].Value = model.tvn;
            parameters[20].Value = model.hf;
            parameters[21].Value = model.sf;
            parameters[22].Value = model.shy;
            parameters[23].Value = model.remark;
            parameters[24].Value = model.codeNum;
            parameters[25].Value = model.codeNumContract;
            parameters[26].Value = model.jcCode;
            parameters[27].Value = model.LiNumber;
            SQLString.Add(strSql, parameters);
            if (MySqlHelper.ExecuteSqlTran(SQLString))
            {
                strSql = new StringBuilder();
                strSql.AppendFormat("SELECT id FROM t_storageofrequisition WHERE code='{0}'", model.code);

                DataTable dt = MySqlHelper.Query(strSql.ToString()).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    return(string.IsNullOrEmpty(dt.Rows[0]["id"].ToString()) == true ? 0 : Convert.ToInt32(dt.Rows[0]["id"].ToString()));
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
Esempio n. 11
0
 public FishEntity.StorageOfRequisitionEntity getModel(DataRow row)
 {
     FishEntity.StorageOfRequisitionEntity model = new FishEntity.StorageOfRequisitionEntity();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["code"] != null)
         {
             model.code = row["code"].ToString();
         }
         if (row["fishId"] != null)
         {
             model.fishId = row["fishId"].ToString();
         }
         if (row["liWeight"] != null && row["liWeight"].ToString() != "")
         {
             model.liWeight = decimal.Parse(row["liWeight"].ToString());
         }
         if (row["LiNumber"] != null && row["LiNumber"].ToString() != "")
         {
             model.LiNumber = decimal.Parse(row["LiNumber"].ToString());
         }//LiNumber
         if (row["price"] != null && row["price"].ToString() != "")
         {
             model.price = decimal.Parse(row["price"].ToString());
         }
         if (row["shipName"] != null)
         {
             model.shipName = row["shipName"].ToString();
         }
         if (row["country"] != null)
         {
             model.country = row["country"].ToString();
         }
         if (row["billName"] != null)
         {
             model.billName = row["billName"].ToString();
         }
         if (row["proName"] != null)
         {
             model.proName = row["proName"].ToString();
         }
         if (row["za"] != null)
         {
             model.za = row["za"].ToString();
         }
         if (row["zf"] != null)
         {
             model.zf = row["zf"].ToString();
         }
         if (row["sand"] != null)
         {
             model.sand = row["sand"].ToString();
         }
         if (row["db"] != null)
         {
             model.db = row["db"].ToString();
         }
         if (row["applyDate"] != null && row["applyDate"].ToString() != "")
         {
             model.applyDate = DateTime.Parse(row["applyDate"].ToString());
         }
         if (row["thCodeNum"] != null && row["thCodeNum"].ToString() != "")
         {
             model.thCodeNum = row["thCodeNum"].ToString();
         }
         if (row["supply"] != null)
         {
             model.supply = row["supply"].ToString();
         }
         if (row["saWeight"] != null && row["saWeight"].ToString() != "")
         {
             model.saWeight = decimal.Parse(row["saWeight"].ToString());
         }
         if (row["brand"] != null)
         {
             model.brand = row["brand"].ToString();
         }
         if (row["pileNum"] != null)
         {
             model.pileNum = row["pileNum"].ToString();
         }
         if (row["qualitySpe"] != null)
         {
             model.qualitySpe = row["qualitySpe"].ToString();
         }
         if (row["tvn"] != null)
         {
             model.tvn = row["tvn"].ToString();
         }
         if (row["hf"] != null)
         {
             model.hf = row["hf"].ToString();
         }
         if (row["sf"] != null)
         {
             model.sf = row["sf"].ToString();
         }
         if (row["shy"] != null)
         {
             model.shy = row["shy"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["codeNum"] != null)
         {
             model.codeNum = row["codeNum"].ToString();
         }
         if (row["codeNumContract"] != null)
         {
             model.codeNumContract = row["codeNumContract"].ToString();
         }
         if (row["jcCode"] != null)
         {
             model.jcCode = row["jcCode"].ToString();
         }
     }
     return(model);
 }
Esempio n. 12
0
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(FishEntity.StorageOfRequisitionEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_storageofrequisition set ");
            strSql.Append("code=@code,");
            strSql.Append("fishId=@fishId,");
            strSql.Append("liWeight=@liWeight,");
            strSql.Append("LiNumber=@LiNumber,");
            strSql.Append("price=@price,");
            strSql.Append("shipName=@shipName,");
            strSql.Append("country=@country,");
            strSql.Append("billName=@billName,");
            strSql.Append("proName=@proName,");
            strSql.Append("za=@za,");
            strSql.Append("zf=@zf,");
            strSql.Append("sand=@sand,");
            strSql.Append("db=@db,");
            strSql.Append("applyDate=@applyDate,");
            strSql.Append("thCodeNum=@thCodeNum,");
            strSql.Append("supply=@supply,");
            strSql.Append("saWeight=@saWeight,");
            strSql.Append("brand=@brand,");
            strSql.Append("pileNum=@pileNum,");
            strSql.Append("qualitySpe=@qualitySpe,");
            strSql.Append("tvn=@tvn,");
            strSql.Append("hf=@hf,");
            strSql.Append("sf=@sf,");
            strSql.Append("shy=@shy,");
            strSql.Append("remark=@remark,");
            strSql.Append("codeNum=@codeNum,");
            strSql.Append("codeNumContract=@codeNumContract,");
            strSql.Append("jcCode=@jcCode ");
            //strSql . Append ( "createTime=@createTime," );
            //strSql . Append ( "createUser=@createUser," );
            //strSql . Append ( "modifyTime=@modifyTime," );
            //strSql . Append ( "modifyUser=@modifyUser" );
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,    45),
                new MySqlParameter("@fishId",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@liWeight",        MySqlDbType.Decimal,    10),
                new MySqlParameter("@price",           MySqlDbType.Decimal,    10),
                new MySqlParameter("@shipName",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@country",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@billName",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@proName",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@za",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@zf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@sand",            MySqlDbType.VarChar,    45),
                new MySqlParameter("@db",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@applyDate",       MySqlDbType.DateTime),
                new MySqlParameter("@thCodeNum",       MySqlDbType.VarChar,    45),
                new MySqlParameter("@supply",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@saWeight",        MySqlDbType.Decimal,    10),
                new MySqlParameter("@brand",           MySqlDbType.VarChar,    45),
                new MySqlParameter("@pileNum",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar,    45),
                new MySqlParameter("@tvn",             MySqlDbType.VarChar,    45),
                new MySqlParameter("@hf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@sf",              MySqlDbType.VarChar,    45),
                new MySqlParameter("@shy",             MySqlDbType.VarChar,    45),
                new MySqlParameter("@remark",          MySqlDbType.VarChar,   255),
                new MySqlParameter("@codeNum",         MySqlDbType.VarChar,    45),
                new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,    45),
                new MySqlParameter("@jcCode",          MySqlDbType.VarChar,    45),
                new MySqlParameter("@id",              MySqlDbType.Int32,      11),
                new MySqlParameter("@LiNumber",        MySqlDbType.Decimal, 45)
            };
            parameters[0].Value  = model.code;
            parameters[1].Value  = model.fishId;
            parameters[2].Value  = model.liWeight;
            parameters[3].Value  = model.price;
            parameters[4].Value  = model.shipName;
            parameters[5].Value  = model.country;
            parameters[6].Value  = model.billName;
            parameters[7].Value  = model.proName;
            parameters[8].Value  = model.za;
            parameters[9].Value  = model.zf;
            parameters[10].Value = model.sand;
            parameters[11].Value = model.db;
            parameters[12].Value = model.applyDate;
            parameters[13].Value = model.thCodeNum;
            parameters[14].Value = model.supply;
            parameters[15].Value = model.saWeight;
            parameters[16].Value = model.brand;
            parameters[17].Value = model.pileNum;
            parameters[18].Value = model.qualitySpe;
            parameters[19].Value = model.tvn;
            parameters[20].Value = model.hf;
            parameters[21].Value = model.sf;
            parameters[22].Value = model.shy;
            parameters[23].Value = model.remark;
            parameters[24].Value = model.codeNum;
            parameters[25].Value = model.codeNumContract;
            parameters[26].Value = model.jcCode;
            parameters[27].Value = model.id;
            parameters[28].Value = model.LiNumber;
            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }