public override int Add()
 {
     controlClear();
     txtcode.Text = _bll.getCode();
     FishEntity.PriWarehouseEntity addmodel = new FishEntity.PriWarehouseEntity();
     if (getname != null && getname != "")
     {
         addmodel = _bll.addRK(" where a.codeNum = '" + getname + "' ");
         if (addmodel != null)
         {
             txtfishId.Text          = addmodel.FishId;
             txtcodeNum.Text         = addmodel.CodeNum;
             txtcodeNumContract.Text = addmodel.CodeNumContract;
             txtsaWeight.Text        = addmodel.Confirmsgsweight;
             txtprice.Text           = addmodel.Confirmrmb;
             txtshipName.Text        = addmodel.ShipName;
             txtcountry.Text         = addmodel.Conutry;
             txtsupply.Text          = addmodel.gongfang;
             txtbrand.Text           = addmodel.Brand;
             txtbillName.Text        = addmodel.BillName;
             txtpileNum.Text         = addmodel.Cornerno;
             txtproName.Text         = addmodel.Name;
             txtqualitySpe.Text      = addmodel.QuaSpe;
             txtza.Text   = addmodel.Sgs_amine;
             txttvn.Text  = addmodel.Sgs_tvn;
             txtzf.Text   = addmodel.Sgs_fat;
             txthf.Text   = addmodel.Sgs_graypart;
             txtsand.Text = addmodel.Sgs_sand;
             txtsf.Text   = addmodel.Sgs_water;
             txtdb.Text   = addmodel.Sgs_protein;
             txtshy.Text  = addmodel.Sgs_sandsalt;
         }
     }
     return(base.Add());
 }
        public FishEntity.PriWarehouseEntity addRK(string name)
        {
            StringBuilder strsql = new StringBuilder();

            strsql.Append("SELECT a.fishId,a.codeNum,a.codeNumContract,b.supplier,billofgoods,UnitPrice,confirmagent,confirmlinkman,confirmdate,confirmrmb,a.country, d.brand, a.brands,a.weight,b.varieties,sgs_protein,sgs_tvn,sgs_fat,sgs_water,sgs_amine,sgs_ffa,sgs_sandsalt,sgs_graypart,sgs_sand,domestic_protein,domestic_amine,domestic_tvn,domestic_sandsalt,domestic_graypart,domestic_sour,domestic_fat,domestic_lysine,domestic_methionine,domestic_aminototal,d.remark,d.shipno,spotdate,warehouse,cornerno,samplingtime,spotproductdate,CASE WHEN d.state = TRUE THEN	'报盘'WHEN d.state1 = TRUE THEN	'确盘'WHEN d.state2 = TRUE THEN	'现货'WHEN d.state3 = TRUE THEN	'自营'WHEN d.state4 = TRUE THEN	'自制'WHEN d.state5 THEN	'成品'END 状态, d.type 港口 FROM 	t_purchaseapplication a LEFT JOIN t_purchaseFishInfo e ON a.codeNum = e. CODE LEFT JOIN t_purchasecontract b ON a.codeNum = b.codeNum  LEFT JOIN t_product d ON a.fishId = d. CODE LEFT JOIN t_productex f ON d.id = f.id ");
            strsql.Append(name);
            DataSet ds = MySqlHelper.Query(strsql.ToString());

            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                FishEntity.PriWarehouseEntity model = new FishEntity.PriWarehouseEntity();
                DataRow row = ds.Tables[0].Rows[0];
                if (row != null)
                {
                    if (row["fishId"] != null)
                    {
                        model.FishId = row["fishId"].ToString();
                    }
                    if (row["codeNum"] != null)
                    {
                        model.CodeNum = row["codeNum"].ToString();
                    }
                    if (row["codeNumContract"] != null)
                    {
                        model.CodeNumContract = row["codeNumContract"].ToString();
                    }
                    if (row["supplier"] != null)
                    {
                        model.gongfang = row["supplier"].ToString();
                    }
                    //gongfang
                    if (row["billofgoods"] != null)
                    {
                        model.BillName = row["billofgoods"].ToString();
                    }
                    if (row["confirmagent"] != null)
                    {
                        model.Confirmagent = row["confirmagent"].ToString();
                    }
                    if (row["confirmlinkman"] != null)
                    {
                        model.Confirmlinkman = row["confirmlinkman"].ToString();
                    }
                    if (row["confirmdate"] != null)
                    {
                        model.Confirmdate = row["confirmdate"].ToString();
                    }
                    if (row["UnitPrice"] != null)
                    {
                        model.Confirmrmb = row["UnitPrice"].ToString();
                    }
                    if (row["country"] != null)
                    {
                        model.Conutry = row["country"].ToString();
                    }
                    if (row["brand"] != null)
                    {
                        model.Brand = row["brand"].ToString();
                    }
                    if (row["brands"] != null)
                    {
                        model.QuaSpe = row["brands"].ToString();
                    }
                    if (row["weight"] != null)
                    {
                        model.Confirmsgsweight = row["weight"].ToString();
                    }
                    //if (row["height"] != null)
                    //{
                    //    model.Height = row["height"].ToString();
                    //}
                    if (row["varieties"] != null)
                    {
                        model.Name = row["varieties"].ToString();
                    }
                    if (row["sgs_protein"] != null)
                    {
                        model.Sgs_protein = row["sgs_protein"].ToString();
                    }
                    if (row["sgs_tvn"] != null)
                    {
                        model.Sgs_tvn = row["sgs_tvn"].ToString();
                    }
                    if (row["sgs_fat"] != null)
                    {
                        model.Sgs_fat = row["sgs_fat"].ToString();
                    }
                    if (row["sgs_water"] != null)
                    {
                        model.Sgs_water = row["sgs_water"].ToString();
                    }
                    if (row["sgs_amine"] != null)
                    {
                        model.Sgs_amine = row["sgs_amine"].ToString();
                    }
                    if (row["sgs_ffa"] != null)
                    {
                        model.Sgs_ffa = row["sgs_ffa"].ToString();
                    }
                    if (row["sgs_sandsalt"] != null)
                    {
                        model.Sgs_sandsalt = row["sgs_sandsalt"].ToString();
                    }
                    if (row["sgs_graypart"] != null)
                    {
                        model.Sgs_graypart = row["sgs_graypart"].ToString();
                    }
                    if (row["sgs_sand"] != null)
                    {
                        model.Sgs_sand = row["sgs_sand"].ToString();
                    }

                    if (row["domestic_protein"] != null)
                    {
                        model.Domestic_protein = row["domestic_protein"].ToString();
                    }
                    if (row["domestic_amine"] != null)
                    {
                        model.Domestic_amine = row["domestic_amine"].ToString();
                    }
                    if (row["domestic_tvn"] != null)
                    {
                        model.Domestic_tvn = row["domestic_tvn"].ToString();
                    }
                    if (row["domestic_sandsalt"] != null)
                    {
                        model.Domestic_sandsalt = row["domestic_sandsalt"].ToString();
                    }
                    if (row["domestic_graypart"] != null)
                    {
                        model.Domestic_graypart = row["domestic_graypart"].ToString();
                    }
                    if (row["domestic_sour"] != null)
                    {
                        model.Domestic_sour = row["domestic_sour"].ToString();
                    }
                    if (row["domestic_fat"] != null)
                    {
                        model.Domestic_fat = row["domestic_fat"].ToString();
                    }

                    if (row["domestic_lysine"] != null)
                    {
                        model.Domestic_lysine = row["domestic_lysine"].ToString();
                    }
                    if (row["domestic_methionine"] != null)
                    {
                        model.Domestic_methionine = row["domestic_methionine"].ToString();
                    }
                    if (row["domestic_aminototal"] != null)
                    {
                        model.Domestic_aminototal = row["domestic_aminototal"].ToString();
                    }
                    if (row["remark"] != null)
                    {
                        model.Remark = row["remark"].ToString();
                    }
                    if (row["shipno"] != null)
                    {
                        model.ShipName = row["shipno"].ToString();
                    }
                    if (row["spotdate"] != null)
                    {
                        model.Spotdate = row["spotdate"].ToString();
                    }
                    if (row["warehouse"] != null)
                    {
                        model.Warehouse = row["warehouse"].ToString();
                    }

                    if (row["cornerno"] != null)
                    {
                        model.Cornerno = row["cornerno"].ToString();
                    }
                    if (row["samplingtime"] != null)
                    {
                        model.Samplingtime = row["samplingtime"].ToString();
                    }
                    if (row["spotproductdate"] != null)
                    {
                        model.Spotproductdate = row["spotproductdate"].ToString();
                    }
                    //if (row["type"] != null)
                    //{
                    //    model.Type = row["type"].ToString();
                    //}
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }