예제 #1
0
        public override int Query( )
        {
            UIForms.PurchaseApplicationCondition form = new UIForms.PurchaseApplicationCondition(this.Text + "查询");
            if (form.ShowDialog( ) == DialogResult.OK)
            {
                strWhere = form.getStrWhere;
                _model   = _bll.getModel(strWhere);
                if (_model == null)
                {
                    MessageBox.Show("请重新查询");
                    return(0);
                }
                panel1.Enabled = true;
                setValue(_model);
                dicPic = _bll.getImages(_model.id, this.Name);
                if (dicPic != null && dicPic.Count > 0)
                {
                    _pic      = dicPic [0];
                    pic.Image = PictureOpreation.ReadPicture(_pic.picInfo);
                    pic.Tag   = 0;
                    num++;
                }
                //FishBll . Bll . PurchaseApplicationBll bll = new FishBll . Bll . PurchaseApplicationBll ( );
                //List<FishEntity . PurchaseOtherInfo> listOtherInfo = bll . getOtherInfoList ( _model . codeNum );
                //if ( listOtherInfo != null && listOtherInfo . Count > 0 )
                //    setValue ( listOtherInfo );
                //List<FishEntity . PurchaseContractFishInfo> listFishInfo = _bll . getFishInfoList ( _model . codeNum );
                //if ( listFishInfo != null && listFishInfo . Count > 0 )
                //    setValue ( listFishInfo );
            }

            return(base.Query( ));
        }
예제 #2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="_model"></param>
        /// <param name="dicPic"></param>
        /// <returns></returns>
        public int Save(FishEntity.PurcurementContractEntity _model, Dictionary <int, FishEntity.PicInfoAll> dicPic)
        {
            Hashtable     SQLSing = new Hashtable( );
            StringBuilder strSql  = new StringBuilder( );
            int           idx     = add(strSql, _model);

            if (idx > 0)
            {
                strSql = new StringBuilder( );
                strSql.AppendFormat("UPDATE t_purchaseApplication SET codeNumContract='{0}' WHERE codeNum='{1}'", _model.codeNumContract, _model.codeNum);
                SQLSing.Add(strSql, null);
                foreach (FishEntity.PicInfoAll model in dicPic.Values)
                {
                    model.tableId = idx;
                    addImage(SQLSing, strSql, model);
                }
                if (MySqlHelper.ExecuteSqlTran(SQLSing))
                {
                    return(idx);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                return(0);
            }
        }
예제 #3
0
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        public bool Exists(FishEntity.PurcurementContractEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.AppendFormat("SELECT COUNT(1) FROM t_purchasecontract WHERE codeNum='{0}'", _model.codeNum);

            return(MySqlHelper.Exists(strSql.ToString( )));
        }
예제 #4
0
        public FishEntity.PurcurementContractEntity getCGSQD(string code)
        {
            StringBuilder strsql = new StringBuilder();

            //strsql.AppendFormat("SELECT codeNum,codeNumContract,bondPro,height,supplier,account,Bank FROM t_purchasecontract a left JOIN t_purchaseapplication b on a.codeNum=b.codeNum "+ code);
            strsql.AppendFormat("SELECT a.codeNum,a.codeNumContract,a.bondPro,a.height,a.supplier,b.account,b.Bank FROM t_purchasecontract a left JOIN t_purchaseapplication b on a.codeNum = b.codeNum " + code);
            DataSet   ds = MySqlHelper.Query(strsql.ToString());
            DataTable dt = ds.Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                FishEntity.PurcurementContractEntity model = new FishEntity.PurcurementContractEntity();
                if (row != null)
                {
                    if (row["codeNumContract"] != null)
                    {
                        model.codeNumContract = row["codeNumContract"].ToString();
                    }
                    if (row["codeNum"] != null)
                    {
                        model.codeNum = row["codeNum"].ToString();
                    }
                    if (row["supplier"] != null)
                    {
                        model.supplier = row["supplier"].ToString();
                    }
                    if (row["bondPro"] != null && row["bondPro"].ToString() != "")
                    {
                        model.bondPro = decimal.Parse(row["bondPro"].ToString());
                    }
                    if (row["height"] != null && row["height"].ToString() != "")
                    {
                        model.height = decimal.Parse(row["height"].ToString());
                    }
                    if (row["Account"] != null)
                    {
                        model.Account = row["Account"].ToString();
                    }
                    if (row["Bank"] != null)
                    {
                        model.Bank = row["Bank"].ToString();
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
        void setValue(FishEntity.PurcurementContractEntity _model)
        {
            txtcodeNumContract.Text = _model.codeNumContract;
            txtCodeNum.Tag          = _model.id;
            txtbondPro.Text         = Convert.ToDecimal(_model.bondPro).ToString("f3");
            txtproName.Text         = _model.ProName;
            txtbuyer.Text           = _model.buyer;
            txtbuyerUser.Text       = _model.buyerUser;
            txtCodeNum.Text         = _model.codeNum;
            txtconDAS.Text          = _model.conDAS;
            txtconFFA.Text          = _model.conFFA;
            txtconHF.Text           = _model.conHF;
            txtconLAS.Text          = _model.conLAS;
            txtconProtein.Text      = _model.conProtein;
            txtconS.Text            = _model.conS;
            txtconSF.Text           = _model.conSF;
            txtconSHY.Text          = _model.conSHY;
            txtconSJ.Text           = _model.conSJ;
            txtconTVN.Text          = _model.conTVN;
            txtconZA.Text           = _model.conZA;
            txtconZF.Text           = _model.conZF;
            txtdeliveryAdd.Text     = _model.deliveryAdd;
            jincang                  = _model.Choise;
            txtheight.Text           = Convert.ToDecimal(_model.height).ToString("f2");
            txtMoney.Text            = Convert.ToDecimal(_model.price).ToString("f2");
            txtMoneyMJ.Text          = Convert.ToDecimal(_model.priceMY).ToString("f2");
            txtUnitPrice.Text        = _model.UnitPrice;
            txtDollar.Text           = _model.Dollar;
            txtsignAdd.Text          = _model.signAdd;
            txtsigndate.Text         = _model.signDate.ToString( );
            txtsupplier.Text         = _model.supplier;
            txtsupplierUser.Text     = _model.supplierUser;
            txtvarieties.Text        = _model.varieties;
            txtdateshipDate.Text     = _model.shipdate.ToString( );
            txtdatedeliveryDate.Text = _model.deliveryDate.ToString( );
            txtdeliveryLast.Text     = _model.quaSpe;
            txtdeliveryLastUse.Text  = _model.conutry;
            txtpurchase.Text         = _model.purchase;
            txtpurchaseUser.Text     = _model.purchaseUser;
            if (_model.gongfang == "供方")
            {
                rabgongfang.Checked = true;
            }
            else if (_model.xufang == "需方")
            {
                rabxufang.Checked = true;
            }
            else
            {
                rabgongfang.Checked = rabxufang.Checked = false;
            }

            panel1.Enabled = true;
            yincang(_model.Choise);
        }
예제 #6
0
        public FormPurcurementContract( )
        {
            InitializeComponent( );

            //InitDataUtil.BindComboBoxData(txtproName, FishEntity.Constant.Goods, true);
            _model = new FishEntity.PurcurementContractEntity( );
            _bll   = new FishBll.Bll.PurcurementContractBll( );
            _pic   = new FishEntity.PicInfoAll( );
            dicPic = new Dictionary <int, FishEntity.PicInfoAll> ( );
            AddShuiYin.SetWatermark(txtconProtein, "请选取指标或者填写");
        }
        private void txtcodeNumContract_DoubleClick(object sender, EventArgs e)
        {
            FormPurcurementContract form = new FormPurcurementContract( );

            if (form.ShowDialog( ) == DialogResult.OK)
            {
                FishEntity.PurcurementContractEntity _model = form.getModel;
                txtTVN.Text     = _model.conTVN;
                txtsand.Text    = _model.conS;
                txtprotein.Text = _model.conProtein;
                txtfat.Text     = _model.conZF;
                txtwater.Text   = _model.conSF;
                txtza.Text      = _model.conZA;
                txthf.Text      = _model.conHF;
                txtshy.Text     = _model.conSHY;
            }
        }
예제 #8
0
        //void saveFishOtherInfo ( )
        //{
        //    dataGridView1 . EndEdit ( );
        //    List<FishEntity . PurchaseContractFishInfo> listFishInfo = new List<FishEntity . PurchaseContractFishInfo> ( );
        //    foreach ( DataGridViewRow row in dataGridView1 . Rows )
        //    {
        //        if ( row . IsNewRow )
        //            continue;
        //        _fishInfo = new FishEntity . PurchaseContractFishInfo ( );
        //        _fishInfo . code = _model . codeNum;
        //        _fishInfo . fishId = row . Cells [ "fishId" ] . Value . ToString ( );
        //        decimal outResult = 0;
        //        if ( row . Cells [ "price" ] . Value != null )
        //        {
        //            decimal . TryParse ( row . Cells [ "price" ] . Value . ToString ( ) ,out outResult );
        //        }
        //        _fishInfo . price = outResult;
        //        outResult = 0;
        //        if ( row . Cells [ "weight" ] . Value != null )
        //        {
        //            decimal . TryParse ( row . Cells [ "weight" ] . Value . ToString ( ) ,out outResult );
        //        }
        //        _fishInfo . weight = outResult;
        //        outResult = 0;
        //        if ( row . Cells [ "priceUSA" ] . Value != null )
        //        {
        //            decimal . TryParse ( row . Cells [ "priceUSA" ] . Value . ToString ( ) ,out outResult );
        //        }
        //        _fishInfo . priceUSA = outResult;
        //        _fishInfo . specifications = row . Cells [ "specifications" ] . Value . ToString ( );
        //        _fishInfo . brand = row . Cells [ "brand" ] . Value . ToString ( );
        //        _fishInfo . country = row . Cells [ "country" ] . Value . ToString ( );
        //        _fishInfo . shipName = row . Cells [ "shipName" ] . Value . ToString ( );
        //        _fishInfo . billName = row . Cells [ "billName" ] . Value . ToString ( );
        //        listFishInfo . Add ( _fishInfo );
        //    }

        //    bool result = false;
        //    if ( listFishInfo != null && listFishInfo . Count > 0 )
        //    {
        //        result = _bll . SaveFishInfo ( listFishInfo );
        //        if ( result == false )
        //            MessageBox . Show ( "鱼粉资料保存失败,请重试" );
        //    }
        //}
        void QueryOne(string operate, string orderBy)
        {
            string whereEx = string.Empty;

            if (string.IsNullOrEmpty(strWhere))
            {
                whereEx = "1=1";
            }
            else
            {
                whereEx = strWhere;
            }
            if (_model != null)
            {
                if (operate != null && operate != "" && orderBy != "" && orderBy != null)
                {
                    whereEx = whereEx + " AND codeNum " + operate + orderBy;
                }
            }
            _model = _bll.getModel(whereEx);
            if (_model == null)
            {
                //MessageBox . Show ( "已经没有记录了" );
                return;
            }
            setValue(_model);
            panel1.Enabled = true;
            dicPic         = new Dictionary <int, FishEntity.PicInfoAll>();
            dicPic         = _bll.getImages(_model.id, this.Name);
            if (dicPic != null)//dicPic.Count
            {
                _pic      = dicPic [0];
                pic.Image = PictureOpreation.ReadPicture(_pic.picInfo);
                pic.Tag   = 0;
            }
            //FishBll . Bll . PurchaseApplicationBll bll = new FishBll . Bll . PurchaseApplicationBll ( );
            //List<FishEntity . PurchaseOtherInfo> listOtherInfo = bll . getOtherInfoList ( _model . codeNum );
            //if ( listOtherInfo != null && listOtherInfo . Count > 0 )
            //    setValue ( listOtherInfo );
            //List<FishEntity.PurchaseContractFishInfo> listFishInfo = _bll.getFishInfoList(_model.codeNum);
            //if (listFishInfo != null && listFishInfo.Count > 0)
            //    setValue(listFishInfo);

            panel1.Enabled = true;
        }
예제 #9
0
        private void txtpurchasecode_Click(object sender, EventArgs e)
        {
            //FormPurchaseRequisition from = new FormPurchaseRequisition ( );
            //from . StartPosition = FormStartPosition . CenterParent;
            //if ( from . ShowDialog ( ) != DialogResult . OK )
            //    return;
            //txtpurchasecode . Text = from . fish . ContractNo;
            //txtPurchasingUnit . Text = from . fish . Supplier;
            //txtbackDeposit . Text = from . fish . Openbank;
            //txtPayAcount . Text = from . fish . Accountnumber;
            FormPurcurementContract form = new FormPurcurementContract( );

            if (form.ShowDialog( ) != DialogResult.OK)
            {
                return;
            }
            FishEntity.PurcurementContractEntity model = form.getModel;
            if (model == null)
            {
                return;
            }
            txtpurchasecode.Text = model.codeNumContract;
            txtCNumbering.Text   = model.codeNum;
        }
예제 #10
0
 FishEntity.PurcurementContractEntity getModel(DataRow row)
 {
     FishEntity.PurcurementContractEntity model = new FishEntity.PurcurementContractEntity( );
     if (row != null)
     {
         if (row["gongfang"] != null)
         {
             model.gongfang = row["gongfang"].ToString();
         }
         if (row["xufang"] != null)
         {
             model.xufang = row["xufang"].ToString();
         }
         if (row ["id"] != null && row ["id"].ToString( ) != "")
         {
             model.id = int.Parse(row ["id"].ToString( ));
         }
         if (row ["codeNum"] != null)
         {
             model.codeNum = row ["codeNum"].ToString( );
         }
         if (row ["codeNumContract"] != null)
         {
             model.codeNumContract = row ["codeNumContract"].ToString( );
         }
         if (row["UnitPrice"] != null)
         {
             model.UnitPrice = row["UnitPrice"].ToString();
         }
         if (row["Dollar"] != null)
         {
             model.Dollar = row["Dollar"].ToString();
         }
         if (row ["supplier"] != null)
         {
             model.supplier = row ["supplier"].ToString( );
         }
         if (row ["supplierUser"] != null)
         {
             model.supplierUser = row ["supplierUser"].ToString( );
         }
         if (row ["buyer"] != null)
         {
             model.buyer = row ["buyer"].ToString( );
         }
         if (row ["buyerUser"] != null)
         {
             model.buyerUser = row ["buyerUser"].ToString( );
         }
         if (row ["signDate"] != null && row ["signDate"].ToString( ) != "")
         {
             model.signDate = DateTime.Parse(row ["signDate"].ToString( ));
         }
         if (row ["signAdd"] != null)
         {
             model.signAdd = row ["signAdd"].ToString( );
         }
         if (row ["bondPro"] != null && row ["bondPro"].ToString( ) != "")
         {
             model.bondPro = decimal.Parse(row ["bondPro"].ToString( ));
         }
         if (row["proName"] != null)
         {
             model.ProName = row["proName"].ToString();
         }
         if (row["choise"] != null)
         {
             model.Choise = row["choise"].ToString();
         }
         if (row ["varieties"] != null)
         {
             model.varieties = row ["varieties"].ToString( );
         }
         if (row ["quaSpe"] != null)
         {
             model.quaSpe = row ["quaSpe"].ToString( );
         }
         if (row ["height"] != null && row ["height"].ToString( ) != "")
         {
             model.height = decimal.Parse(row ["height"].ToString( ));
         }
         if (row ["price"] != null && row ["price"].ToString( ) != "")
         {
             model.price = decimal.Parse(row ["price"].ToString( ));
         }
         if (row ["priceMY"] != null && row ["priceMY"].ToString( ) != "")
         {
             model.priceMY = decimal.Parse(row ["priceMY"].ToString( ));
         }
         if (row ["conutry"] != null)
         {
             model.conutry = row ["conutry"].ToString( );
         }
         if (row ["shipDate"] != null && row ["shipDate"].ToString( ) != "")
         {
             model.shipdate = DateTime.Parse(row ["shipDate"].ToString( ));
         }
         if (row ["deliveryDate"] != null && row ["deliveryDate"].ToString( ) != "")
         {
             model.deliveryDate = DateTime.Parse(row ["deliveryDate"].ToString( ));
         }
         if (row ["deliveryAdd"] != null)
         {
             model.deliveryAdd = row ["deliveryAdd"].ToString( );
         }
         if (row ["conProtein"] != null)
         {
             model.conProtein = row ["conProtein"].ToString( );
         }
         if (row ["conTVN"] != null)
         {
             model.conTVN = row ["conTVN"].ToString( );
         }
         if (row ["conZA"] != null)
         {
             model.conZA = row ["conZA"].ToString( );
         }
         if (row ["conFFA"] != null)
         {
             model.conFFA = row ["conFFA"].ToString( );
         }
         if (row ["conZF"] != null)
         {
             model.conZF = row ["conZF"].ToString( );
         }
         if (row ["conSF"] != null)
         {
             model.conSF = row ["conSF"].ToString( );
         }
         if (row ["conSHY"] != null)
         {
             model.conSHY = row ["conSHY"].ToString( );
         }
         if (row ["conS"] != null)
         {
             model.conS = row ["conS"].ToString( );
         }
         if (row ["conSJ"] != null)
         {
             model.conSJ = row ["conSJ"].ToString( );
         }
         if (row ["conHF"] != null)
         {
             model.conHF = row ["conHF"].ToString( );
         }
         if (row ["conLAS"] != null)
         {
             model.conLAS = row ["conLAS"].ToString( );
         }
         if (row ["conDAS"] != null)
         {
             model.conDAS = row ["conDAS"].ToString( );
         }
         if (row ["purchase"] != null)
         {
             model.purchase = row ["purchase"].ToString( );
         }
         if (row ["purchaseUser"] != null)
         {
             model.purchaseUser = row ["purchaseUser"].ToString( );
         }
     }
     return(model);
 }
예제 #11
0
 void edit(Hashtable SQLString, StringBuilder strSql, FishEntity.PurcurementContractEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("update t_purchasecontract set ");
     strSql.Append("codeNum=@codeNum,");
     strSql.Append("codeNumContract=@codeNumContract,");
     strSql.Append("supplier=@supplier,");
     strSql.Append("supplierUser=@supplierUser,");
     strSql.Append("buyer=@buyer,");
     strSql.Append("buyerUser=@buyerUser,");
     strSql.Append("signDate=@signDate,");
     strSql.Append("signAdd=@signAdd,");
     strSql.Append("bondPro=@bondPro,");
     strSql.Append("varieties=@varieties,");
     strSql.Append("quaSpe=@quaSpe,");
     strSql.Append("height=@height,");
     strSql.Append("price=@price,");
     strSql.Append("priceMY=@priceMY,");
     strSql.Append("conutry=@conutry,");
     strSql.Append("shipDate=@shipDate,");
     strSql.Append("deliveryDate=@deliveryDate,");
     strSql.Append("deliveryAdd=@deliveryAdd,");
     strSql.Append("conProtein=@conProtein,");
     strSql.Append("conTVN=@conTVN,");
     strSql.Append("conZA=@conZA,");
     strSql.Append("conFFA=@conFFA,");
     strSql.Append("conZF=@conZF,");
     strSql.Append("conSF=@conSF,");
     strSql.Append("conSHY=@conSHY,");
     strSql.Append("conS=@conS,");
     strSql.Append("conSJ=@conSJ,");
     strSql.Append("conHF=@conHF,");
     strSql.Append("conLAS=@conLAS,");
     strSql.Append("conDAS=@conDAS,");
     strSql.Append("purchase=@purchase,");
     strSql.Append("purchaseUser=@purchaseUser,");
     strSql.Append("modifyUser=@modifyUser,");
     strSql.Append("UnitPrice=@UnitPrice,");
     strSql.Append("Dollar=@Dollar,");
     strSql.Append("proName=@proName,");
     strSql.Append("choise=@choise,");
     strSql.Append("gongfang=@gongfang,");
     strSql.Append("xufang=@xufang,");
     strSql.Append("modifyDate=@modifyDate");
     strSql.Append(" where id=@id");
     MySqlParameter [] parameters =
     {
         new MySqlParameter("@codeNum",         MySqlDbType.VarChar,    30),
         new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,    30),
         new MySqlParameter("@supplier",        MySqlDbType.VarChar,    50),
         new MySqlParameter("@supplierUser",    MySqlDbType.VarChar,    50),
         new MySqlParameter("@buyer",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@buyerUser",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@signDate",        MySqlDbType.DateTime),
         new MySqlParameter("@signAdd",         MySqlDbType.VarChar,   100),
         new MySqlParameter("@bondPro",         MySqlDbType.Decimal,    18),
         new MySqlParameter("@varieties",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@quaSpe",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@height",          MySqlDbType.Decimal,    18),
         new MySqlParameter("@price",           MySqlDbType.Decimal,    18),
         new MySqlParameter("@priceMY",         MySqlDbType.Decimal,    18),
         new MySqlParameter("@conutry",         MySqlDbType.VarChar,    30),
         new MySqlParameter("@shipDate",        MySqlDbType.DateTime),
         new MySqlParameter("@deliveryDate",    MySqlDbType.DateTime),
         new MySqlParameter("@deliveryAdd",     MySqlDbType.VarChar,    50),
         new MySqlParameter("@conProtein",      MySqlDbType.VarChar,    50),
         new MySqlParameter("@conTVN",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conZA",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conFFA",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conZF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSHY",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conS",            MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSJ",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conHF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conLAS",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conDAS",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@modifyUser",      MySqlDbType.VarChar,    50),
         new MySqlParameter("@modifyDate",      MySqlDbType.DateTime),
         new MySqlParameter("@id",              MySqlDbType.Int32,      11),
         new MySqlParameter("@purchase",        MySqlDbType.VarChar,    50),
         new MySqlParameter("@purchaseUser",    MySqlDbType.VarChar,    50),
         new MySqlParameter("@UnitPrice",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@Dollar",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@proName",         MySqlDbType.VarChar,    45),
         new MySqlParameter("@choise",          MySqlDbType.VarChar,    45),
         new MySqlParameter("@gongfang",        MySqlDbType.VarChar,    45),
         new MySqlParameter("@xufang",          MySqlDbType.VarChar, 45)
     };
     parameters [0].Value  = model.codeNum;
     parameters [1].Value  = model.codeNumContract;
     parameters [2].Value  = model.supplier;
     parameters [3].Value  = model.supplierUser;
     parameters [4].Value  = model.buyer;
     parameters [5].Value  = model.buyerUser;
     parameters [6].Value  = model.signDate;
     parameters [7].Value  = model.signAdd;
     parameters [8].Value  = model.bondPro;
     parameters [9].Value  = model.varieties;
     parameters [10].Value = model.quaSpe;
     parameters [11].Value = model.height;
     parameters [12].Value = model.price;
     parameters [13].Value = model.priceMY;
     parameters [14].Value = model.conutry;
     parameters [15].Value = model.shipdate;
     parameters [16].Value = model.deliveryDate;
     parameters [17].Value = model.deliveryAdd;
     parameters [18].Value = model.conProtein;
     parameters [19].Value = model.conTVN;
     parameters [20].Value = model.conZA;
     parameters [21].Value = model.conFFA;
     parameters [22].Value = model.conZF;
     parameters [23].Value = model.conSF;
     parameters [24].Value = model.conSHY;
     parameters [25].Value = model.conS;
     parameters [26].Value = model.conSJ;
     parameters [27].Value = model.conHF;
     parameters [28].Value = model.conLAS;
     parameters [29].Value = model.conDAS;
     parameters [30].Value = model.modifyUser;
     parameters [31].Value = model.modifyDate;
     parameters [32].Value = model.id;
     parameters [33].Value = model.purchase;
     parameters [34].Value = model.purchaseUser;
     parameters[35].Value  = model.UnitPrice;
     parameters[36].Value  = model.Dollar;
     parameters[37].Value  = model.ProName;
     parameters[38].Value  = model.Choise;
     parameters[39].Value  = model.gongfang;
     parameters[40].Value  = model.xufang;
     SQLString.Add(strSql, parameters);
 }
예제 #12
0
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="_model"></param>
        /// <param name="dicPic"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public int Edit(FishEntity.PurcurementContractEntity _model, Dictionary <int, FishEntity.PicInfoAll> dicPic, string tableName)
        {
            int           result    = 0;
            StringBuilder strSql    = new StringBuilder( );
            Hashtable     SQLString = new Hashtable( );

            edit(SQLString, strSql, _model);
            if (dicPic != null)
            {
                if (MySqlHelper.ExecuteSqlTran(SQLString))
                {
                    SQLString.Clear();
                    strSql = new StringBuilder();
                    strSql.AppendFormat("SELECT COUNT(1) FROM t_picinfoall WHERE tableId={0}", _model.id);

                    if (MySqlHelper.Exists(strSql.ToString()))
                    {
                        result = 1;
                        SQLString.Clear();
                        strSql = new StringBuilder();
                        strSql.AppendFormat("UPDATE t_purchaseApplication SET codeNumContract='{0}' WHERE codeNum='{1}'", _model.codeNumContract, _model.codeNum);
                        SQLString.Add(strSql, null);
                        strSql = new StringBuilder();
                        strSql.AppendFormat("DELETE FROM t_picinfoall WHERE tableId={0} and tableName='{1}'", _model.id, tableName);
                        if (MySqlHelper.ExecuteSql(strSql.ToString()) > 0)
                        {
                            foreach (FishEntity.PicInfoAll model in dicPic.Values)
                            {
                                model.id = _model.id;
                                addImage(SQLString, strSql, model);
                            }
                        }
                        else
                        {
                            result = -1;
                        }
                    }
                    else
                    {
                        foreach (FishEntity.PicInfoAll model in dicPic.Values)
                        {
                            model.id = _model.id;
                            addImage(SQLString, strSql, model);
                        }
                    }

                    if (MySqlHelper.ExecuteSqlTran(SQLString))
                    {
                        result = 1;
                    }
                    else
                    {
                        result = -1;
                    }
                }
                else
                {
                    result = 0;
                }

                return(result);
            }
            else
            {
                if (MySqlHelper.ExecuteSqlTran(SQLString))
                {
                    return(result = 1);
                }
                else
                {
                    return(result = -1);
                }
            }
        }
예제 #13
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="_model"></param>
 /// <param name="dicPic"></param>
 /// <returns></returns>
 public int Save(FishEntity.PurcurementContractEntity _model, Dictionary <int, FishEntity.PicInfoAll> dicPic)
 {
     return(dal.Save(_model, dicPic));
 }
예제 #14
0
        //void setValue ( List<FishEntity . PurchaseOtherInfo> listOtherInfo )
        //{
        //    dataGridView2 . Rows . Clear ( );
        //    foreach ( FishEntity . PurchaseOtherInfo otherInfo in listOtherInfo )
        //    {
        //        int idx = dataGridView2 . Rows . Add ( );
        //        DataGridViewRow row = dataGridView2 . Rows [ idx ];
        //        row . Cells [ "idx" ] . Value = otherInfo . id;
        //        row . Cells [ "brands" ] . Value = otherInfo . brand;
        //        row . Cells [ "moneys" ] . Value = otherInfo . money;
        //        row . Cells [ "nums" ] . Value = otherInfo . num;
        //    }
        //}
        //void setValue ( List<FishEntity . PurchaseContractFishInfo> listFishInfo )
        //{
        //    dataGridView1 . Rows . Clear ( );
        //    foreach ( FishEntity . PurchaseContractFishInfo fishInfo in listFishInfo )
        //    {
        //        int idx = dataGridView1 . Rows . Add ( );
        //        DataGridViewRow row = dataGridView1 . Rows [ idx ];
        //        row . Cells [ "id" ] . Value = fishInfo . id;
        //        row . Cells [ "fishId" ] . Value = fishInfo . fishId;
        //        row . Cells [ "price" ] . Value = fishInfo . price;
        //        row . Cells [ "weight" ] . Value = fishInfo . weight;
        //        row . Cells [ "priceUSA" ] . Value = fishInfo . priceUSA;
        //        row . Cells [ "specifications" ] . Value = fishInfo . specifications;
        //        row . Cells [ "brand" ] . Value = fishInfo . brand;
        //        row . Cells [ "country" ] . Value = fishInfo . country;
        //        row . Cells [ "shipName" ] . Value = fishInfo . shipName;
        //        row . Cells [ "billName" ] . Value = fishInfo . billName;
        //        row . Cells [ "money" ] . Value = fishInfo . price * fishInfo . weight;
        //        row . Cells [ "moneyUSA" ] . Value = fishInfo . priceUSA * fishInfo . weight;
        //    }

        //    int index = dataGridView1 . Rows . Add ( );
        //    dataGridView1 . Rows [ index ] . Cells [ "fishId" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "price" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "weight" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "priceUSA" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "specifications" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "brand" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "country" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "shipName" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "billName" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "money" ] . Value = string . Empty;
        //    dataGridView1 . Rows [ index ] . Cells [ "moneyUSA" ] . Value = string . Empty;
        //}
        bool getValue( )
        {
            if (_model == null)
            {
                _model = new FishEntity.PurcurementContractEntity( );
            }
            errorProvider1.Clear( );
            if (string.IsNullOrEmpty(txtCodeNum.Text))
            {
                errorProvider1.SetError(txtCodeNum, "不可为空");
                return(false);
            }
            if (string.IsNullOrEmpty(txtcodeNumContract.Text))
            {
                errorProvider1.SetError(txtcodeNumContract, "不可为空");
                return(false);
            }
            outResult = 0M;
            if (!string.IsNullOrEmpty(txtbondPro.Text) && decimal.TryParse(txtbondPro.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtbondPro, "请重新输入");
                return(false);
            }
            if (txtproName.Text == null || txtproName.Text == "")
            {
                errorProvider1.SetError(txtproName, "请选择");
                return(false);
            }
            if (rabxufang.Checked == true)
            {
                _model.xufang = "需方";
            }
            else if (rabgongfang.Checked == true)
            {
                _model.gongfang = "供方";
            }
            else
            {
                _model.gongfang = _model.xufang = string.Empty;
            }
            _model.ProName         = txtproName.Text;
            _model.bondPro         = outResult;
            _model.id              = txtCodeNum.Tag == null ? 0 : Convert.ToInt32(txtCodeNum.Tag.ToString( ));
            _model.codeNumContract = txtcodeNumContract.Text;
            _model.buyer           = txtbuyer.Text;
            _model.buyerUser       = txtbuyerUser.Text;
            _model.codeNum         = txtCodeNum.Text;
            _model.conDAS          = txtconDAS.Text;
            _model.conFFA          = txtconFFA.Text;
            _model.conHF           = txtconHF.Text;
            _model.conLAS          = txtconLAS.Text;
            _model.conProtein      = txtconProtein.Text;
            _model.conS            = txtconS.Text;
            _model.conSF           = txtconSF.Text;
            _model.conSHY          = txtconSHY.Text;
            _model.conSJ           = txtconSJ.Text;
            _model.conTVN          = txtconTVN.Text;
            _model.conZA           = txtconZA.Text;
            _model.conZF           = txtconZF.Text;
            _model.deliveryAdd     = txtdeliveryAdd.Text;
            _model.Choise          = jincang;
            outResult              = 0M;
            if (!string.IsNullOrEmpty(txtheight.Text) && decimal.TryParse(txtheight.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtheight, "请重新输入");
                return(false);
            }
            _model.height = outResult;
            outResult     = 0M;
            if (!string.IsNullOrEmpty(txtMoney.Text) && decimal.TryParse(txtMoney.Text, out outResult) == false)
            {
                errorProvider1.SetError(txtMoney, "请重新输入");
                return(false);
            }
            _model.price = outResult;
            outResult    = 0M;
            if (jincang == "报盘")
            {
                if (!string.IsNullOrEmpty(txtMoneyMJ.Text) && decimal.TryParse(txtMoneyMJ.Text, out outResult) == false)
                {
                    errorProvider1.SetError(txtMoneyMJ, "请重新输入");
                    return(false);
                }
            }
            if (jincang == "报盘")
            {
                if (!string.IsNullOrEmpty(txtDollar.Text) && decimal.TryParse(txtDollar.Text, out outResult) == false)
                {
                    errorProvider1.SetError(txtDollar, "请重新输入");
                    return(false);
                }
            }
            _model.UnitPrice    = txtUnitPrice.Text;
            _model.Dollar       = txtDollar.Text;
            _model.priceMY      = outResult;
            _model.signAdd      = txtsignAdd.Text;
            _model.supplier     = txtsupplier.Text;
            _model.supplierUser = txtsupplierUser.Text;
            if (string.IsNullOrEmpty(txtsigndate.Text))
            {
                _model.signDate = null;
            }
            else
            {
                _model.signDate = Convert.ToDateTime(txtsigndate.Text);
            }
            _model.varieties = txtvarieties.Text;
            if (string.IsNullOrEmpty(txtdateshipDate.Text))
            {
                _model.shipdate = null;
            }
            else
            {
                _model.shipdate = Convert.ToDateTime(txtdateshipDate.Text);
            }
            if (string.IsNullOrEmpty(txtdatedeliveryDate.Text))
            {
                _model.deliveryDate = null;
            }
            else
            {
                _model.deliveryDate = Convert.ToDateTime(txtdatedeliveryDate.Text);
            }
            _model.quaSpe       = txtdeliveryLast.Text;
            _model.conutry      = txtdeliveryLastUse.Text;
            _model.purchase     = txtpurchase.Text;
            _model.purchaseUser = txtpurchaseUser.Text;
            _model.createUser   = _model.modifyUser = FishEntity.Variable.User.username;
            _model.createDate   = _model.modifyDate = DateTime.Now;


            return(true);
        }
예제 #15
0
 /// <summary>
 /// 编辑数据
 /// </summary>
 /// <param name="_model"></param>
 /// <param name="dicPic"></param>
 /// <param name="tableName"></param>
 /// <returns></returns>
 public int Edit(FishEntity.PurcurementContractEntity _model, Dictionary <int, FishEntity.PicInfoAll> dicPic, string tableName)
 {
     return(dal.Edit(_model, dicPic, tableName));
 }
예제 #16
0
        public override int Add( )
        {
            panel1.Enabled = true;
            txtOddNum.Text = _bll.getCode( );
            txtDepartMent.SelectedValue = false;
            txtPayCode.Text             = string.Empty;
            txtNumbering.Text           = string.Empty;
            dtpPayment.Value            = DateTime.Now;
            txtPayAcount.Text           = string.Empty;
            txtPayUnit.Text             = string.Empty;
            txtPayUnit.Tag         = string.Empty;
            txtcontacts.Text       = string.Empty;
            txtcontacts.Tag        = string.Empty;
            txtbackDeposit.Text    = string.Empty;
            txtprice.Text          = string.Empty;
            txtweight.Text         = string.Empty;
            txtFishMealId.Text     = string.Empty;
            txtPurchasingUnit.Text = string.Empty;
            txtPurchasingUnit.Tag  = string.Empty;
            txtapplyMoney.Text     = string.Empty;
            inputRMB.Text          = string.Empty;
            dtpDate.Value          = DateTime.Now;
            txtRemark.Text         = string.Empty;
            texOther.Text          = string.Empty;
            txtpurchasecode.Text   = string.Empty;
            txtCNumbering.Text     = string.Empty;
            txtBond.Text           = string.Empty;
            rabBaoZheng.Checked    = rabHuoKuan.Checked = rabYuFu.Checked = rabQuanKuan.Checked = rabWeiKuan.Checked = rabGongZhang.Checked = rabSiZhang.Checked = rabChengDui.Checked = rabXianJin.Checked = rabQiTa.Checked = rabZZSFP.Checked = rabPTFP.Checked = rabSJ.Checked = false;

            tmiQuery.Visible    = false;
            tmiAdd.Visible      = false;
            tmiModify.Visible   = false;
            tmiDelete.Visible   = false;
            tmiClose.Visible    = false;
            tmiSave.Visible     = true;
            tmiCancel.Visible   = true;
            tmiExport.Visible   = false;
            tmiNext.Visible     = false;
            tmiPrevious.Visible = false;

            state = "add";
            if (XCNumbering == "X")
            {
                _model = _bll.getXSSQD(_getname);
                if (_model != null)
                {
                    txtPayCode.Text        = _model.code;
                    txtFishMealId.Text     = _model.Product_id;
                    txtNumbering.Text      = _model.Numbering;
                    txtPayUnit.Text        = _model.demand;
                    txtPayUnit.Tag         = _model.demandId;
                    txtcontacts.Text       = _model.DemandContact;
                    txtcontacts.Tag        = _model.DemandContactId;
                    txtpurchasecode.Text   = _model.Purchasecontractnumber;
                    txtPurchasingUnit.Text = _model.Purchasingunits;
                    txtPurchasingUnit.Tag  = _model.PurchasingunitsId;
                    txtPayAcount.Text      = _model.accountnumber.ToString();
                    txtbackDeposit.Text    = _model.Bank;
                    txtCNumbering.Text     = _model.CNumbering;
                }
            }
            else if (XCNumbering == "C")
            {
                FishEntity.PurcurementContractEntity getmodel = new FishEntity.PurcurementContractEntity();
                FishBll.Bll.PurchaseApplicationBll   getbll   = new FishBll.Bll.PurchaseApplicationBll();
                getmodel = getbll.getCGSQD(" where a.codenum='" + _getname + "' ");
                if (getmodel != null)
                {
                    //txtFishMealId.Text=getmodel.
                    txtBond.Text           = getmodel.bondPro.ToString();
                    txtpurchasecode.Text   = getmodel.codeNumContract;
                    txtPurchasingUnit.Text = getmodel.supplier;
                    txtCNumbering.Text     = getmodel.codeNum;
                    txtPayAcount.Text      = getmodel.Account;
                    txtbackDeposit.Text    = getmodel.Bank;
                }
            }
            return(base.Add( ));
        }
예제 #17
0
 int add(StringBuilder strSql, FishEntity.PurcurementContractEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("insert into t_purchasecontract(");
     strSql.Append("codeNum,codeNumContract,supplier,supplierUser,buyer,buyerUser,signDate,signAdd,bondPro,varieties,quaSpe,height,price,priceMY,conutry,shipDate,deliveryDate,deliveryAdd,conProtein,conTVN,conZA,conFFA,conZF,conSF,conSHY,conS,conSJ,conHF,conLAS,conDAS,createUser,createDate,modifyUser,modifyDate,purchase,purchaseUser,UnitPrice,Dollar,proName,choise,gongfang,xufang)");
     strSql.Append(" values (");
     strSql.Append("@codeNum,@codeNumContract,@supplier,@supplierUser,@buyer,@buyerUser,@signDate,@signAdd,@bondPro,@varieties,@quaSpe,@height,@price,@priceMY,@conutry,@shipDate,@deliveryDate,@deliveryAdd,@conProtein,@conTVN,@conZA,@conFFA,@conZF,@conSF,@conSHY,@conS,@conSJ,@conHF,@conLAS,@conDAS,@createUser,@createDate,@modifyUser,@modifyDate,@purchase,@purchaseUser,@UnitPrice,@Dollar,@proName,@choise,@gongfang,@xufang);select LAST_INSERT_ID();");
     MySqlParameter [] parameters =
     {
         new MySqlParameter("@codeNum",         MySqlDbType.VarChar,    30),
         new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,    30),
         new MySqlParameter("@supplier",        MySqlDbType.VarChar,    50),
         new MySqlParameter("@supplierUser",    MySqlDbType.VarChar,    50),
         new MySqlParameter("@buyer",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@buyerUser",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@signDate",        MySqlDbType.DateTime),
         new MySqlParameter("@signAdd",         MySqlDbType.VarChar,   100),
         new MySqlParameter("@bondPro",         MySqlDbType.Decimal,    18),
         new MySqlParameter("@varieties",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@quaSpe",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@height",          MySqlDbType.Decimal,    18),
         new MySqlParameter("@price",           MySqlDbType.Decimal,    18),
         new MySqlParameter("@priceMY",         MySqlDbType.Decimal,    18),
         new MySqlParameter("@conutry",         MySqlDbType.VarChar,    30),
         new MySqlParameter("@shipDate",        MySqlDbType.DateTime),
         new MySqlParameter("@deliveryDate",    MySqlDbType.DateTime),
         new MySqlParameter("@deliveryAdd",     MySqlDbType.VarChar,    50),
         new MySqlParameter("@conProtein",      MySqlDbType.VarChar,    50),
         new MySqlParameter("@conTVN",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conZA",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conFFA",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conZF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSHY",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conS",            MySqlDbType.VarChar,    50),
         new MySqlParameter("@conSJ",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conHF",           MySqlDbType.VarChar,    50),
         new MySqlParameter("@conLAS",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@conDAS",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@createUser",      MySqlDbType.VarChar,    50),
         new MySqlParameter("@createDate",      MySqlDbType.DateTime),
         new MySqlParameter("@modifyUser",      MySqlDbType.VarChar,    50),
         new MySqlParameter("@modifyDate",      MySqlDbType.DateTime),
         new MySqlParameter("@purchase",        MySqlDbType.VarChar,    50),
         new MySqlParameter("@purchaseUser",    MySqlDbType.VarChar,    50),
         new MySqlParameter("@UnitPrice",       MySqlDbType.VarChar,    50),
         new MySqlParameter("@Dollar",          MySqlDbType.VarChar,    50),
         new MySqlParameter("@proName",         MySqlDbType.VarChar,    45),
         new MySqlParameter("@choise",          MySqlDbType.VarChar,    45),
         new MySqlParameter("@xufang",          MySqlDbType.VarChar,    45),
         new MySqlParameter("@gongfang",        MySqlDbType.VarChar, 45)
     };
     parameters [0].Value  = model.codeNum;
     parameters [1].Value  = model.codeNumContract;
     parameters [2].Value  = model.supplier;
     parameters [3].Value  = model.supplierUser;
     parameters [4].Value  = model.buyer;
     parameters [5].Value  = model.buyerUser;
     parameters [6].Value  = model.signDate;
     parameters [7].Value  = model.signAdd;
     parameters [8].Value  = model.bondPro;
     parameters [9].Value  = model.varieties;
     parameters [10].Value = model.quaSpe;
     parameters [11].Value = model.height;
     parameters [12].Value = model.price;
     parameters [13].Value = model.priceMY;
     parameters [14].Value = model.conutry;
     parameters [15].Value = model.shipdate;
     parameters [16].Value = model.deliveryDate;
     parameters [17].Value = model.deliveryAdd;
     parameters [18].Value = model.conProtein;
     parameters [19].Value = model.conTVN;
     parameters [20].Value = model.conZA;
     parameters [21].Value = model.conFFA;
     parameters [22].Value = model.conZF;
     parameters [23].Value = model.conSF;
     parameters [24].Value = model.conSHY;
     parameters [25].Value = model.conS;
     parameters [26].Value = model.conSJ;
     parameters [27].Value = model.conHF;
     parameters [28].Value = model.conLAS;
     parameters [29].Value = model.conDAS;
     parameters [30].Value = model.createUser;
     parameters [31].Value = model.createDate;
     parameters [32].Value = model.modifyUser;
     parameters [33].Value = model.modifyDate;
     parameters [34].Value = model.purchase;
     parameters [35].Value = model.purchaseUser;
     parameters[36].Value  = model.UnitPrice;
     parameters[37].Value  = model.Dollar;
     parameters[38].Value  = model.ProName;
     parameters[39].Value  = model.Choise;
     parameters[40].Value  = model.xufang;
     parameters[41].Value  = model.gongfang;
     return(MySqlHelper.ExecuteSqlReturnId(strSql.ToString( ), parameters));
 }
예제 #18
0
 /// <summary>
 /// 是否存在
 /// </summary>
 /// <param name="_model"></param>
 /// <returns></returns>
 public bool Exists(FishEntity.PurcurementContractEntity _model)
 {
     return(dal.Exists(_model));
 }