Beispiel #1
0
        public int Add(FishEntity.EnterWarehouseReceipts model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_enterwarehousereceipts(");
            strSql.Append("code,Requester,Shipname,tonnage,tName,Billnumber,NumberOfPieces,Unpackingdate,actualnumber,StorageLocation,position,Remarks,createtime,createman,modifytime,modifyman,TO1,TEL1,ANTI1,FAX1,ContractNo,Zhuangjiao)");
            strSql.Append("values(");
            strSql.Append("@code,@Requester,@Shipname,@tonnage,@tName,@Billnumber,@NumberOfPieces,@Unpackingdate,@actualnumber,@StorageLocation,@position,@Remarks,@createtime,@createman,@modifytime,@modifyman,@TO1,@TEL1,@ANTI1,@FAX1,@ContractNo,@Zhuangjiao);");
            strSql.Append("select last_insert_id();");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@Requester",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@Shipname",        MySqlDbType.VarChar,     45),
                new MySqlParameter("@tonnage",         MySqlDbType.Decimal,     45),
                new MySqlParameter("@tName",           MySqlDbType.VarChar,     45),
                new MySqlParameter("@Billnumber",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@NumberOfPieces",  MySqlDbType.Decimal,     45),
                new MySqlParameter("@Unpackingdate",   MySqlDbType.DateTime),
                new MySqlParameter("@actualnumber",    MySqlDbType.Decimal,     45),
                new MySqlParameter("@StorageLocation", MySqlDbType.VarChar,     45),
                new MySqlParameter("@position",        MySqlDbType.VarChar,    200),
                new MySqlParameter("@Remarks",         MySqlDbType.VarChar,    100),
                new MySqlParameter("@createtime",      MySqlDbType.Timestamp),
                new MySqlParameter("@createman",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@modifytime",      MySqlDbType.Timestamp),
                new MySqlParameter("@modifyman",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@TO1",             MySqlDbType.VarChar,     45),
                new MySqlParameter("@TEL1",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@ANTI1",           MySqlDbType.VarChar,     45),
                new MySqlParameter("@FAX1",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@ContractNo",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@Zhuangjiao",      MySqlDbType.VarChar, 45)
            };
            parameters[0].Value  = model.Code;
            parameters[1].Value  = model.Requester;
            parameters[2].Value  = model.Shipname;
            parameters[3].Value  = model.Tonnage;
            parameters[4].Value  = model.TName;
            parameters[5].Value  = model.Billnumber;
            parameters[6].Value  = model.NumberOfPieces;
            parameters[7].Value  = model.Unpackingdate;
            parameters[8].Value  = model.Actualnumber;
            parameters[9].Value  = model.StorageLocation;
            parameters[10].Value = model.Position;
            parameters[11].Value = model.Remarks;
            parameters[12].Value = model.Createtime;
            parameters[13].Value = model.Createman;
            parameters[14].Value = model.Modifytime;
            parameters[15].Value = model.Modifyman;
            parameters[16].Value = model.TO;
            parameters[17].Value = model.TEL;
            parameters[18].Value = model.ANTI;
            parameters[19].Value = model.FAX;
            parameters[20].Value = model.ContractNo;
            parameters[21].Value = model.Zhuangjiao;
            int id = MySqlHelper.ExecuteSqlReturnId(strSql.ToString(), parameters); //MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            return(id);
        }
Beispiel #2
0
        public override int Query()
        {
            panel1.Enabled = true;
            if (_Form == null)
            {
                _Form = new UIForms.FormEnterWarehouseReceiptsCodition();
                _Form.StartPosition = FormStartPosition.CenterParent;
                _Form.ShowInTaskbar = false;
            }
            if (_Form.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(0);
            }
            _where = _Form.GetWhereCondition;
            List <FishEntity.EnterWarehouseReceipts> list = _bll.GetModelListVo(_where + _rolewhere + _orderBy);

            if (list == null || list.Count < 1)
            {
                _fish = null;
                return(1);
            }
            else
            {
                _fish = list[0];
                SetOnepound();
            }
            return(1);
        }
Beispiel #3
0
        public override void Save()
        {
            FishEntity.EnterWarehouseReceipts _fish = new FishEntity.EnterWarehouseReceipts();
            _fish.Code = FishBll.Bll.SequenceUtil.GetEnterWarehouseReceipts();
            decimal temp = 0;

            _fish.Requester = txtRequester.Text.Trim();
            _fish.Shipname  = txtShipname.Text.Trim();
            decimal.TryParse(txttonnage.Text, out temp);
            _fish.Tonnage    = temp;
            _fish.TName      = cmbtName.SelectedValue == null ? string.Empty : cmbtName.SelectedValue.ToString().Trim();
            _fish.Billnumber = txtBillnumber.Text;
            decimal.TryParse(txtNumberOfPieces.Text, out temp);
            _fish.NumberOfPieces = temp;
            _fish.Unpackingdate  = dtpUnpackingdate.Value;
            decimal.TryParse(txtactualnumber.Text, out temp);
            _fish.Actualnumber    = temp;
            _fish.StorageLocation = txtStorageLocation.Text.Trim();
            _fish.Position        = txtposition.Text.Trim();
            _fish.Remarks         = txtRemarks.Text.Trim();
            _fish.Createtime      = DateTime.Now;
            _fish.Createman       = FishEntity.Variable.User.username;
            _fish.Modifytime      = DateTime.Now;
            _fish.Modifyman       = FishEntity.Variable.User.username;
            _fish.TO         = txtTO.Text.Trim();
            _fish.Zhuangjiao = txtZhuangjiao.Text;
            _fish.ContractNo = txtContractNo.Text;
            _fish.TEL        = txtTEL.Text.Trim();
            _fish.ANTI       = txtANTI.Text.Trim();
            _fish.FAX        = txtFAX.Text.Trim();

            FishBll.Bll.EnterWarehouseReceiptsBll bll = new FishBll.Bll.EnterWarehouseReceiptsBll();

            bool isok = bll.Exists(_fish.Code);

            while (isok)
            {
                _fish.Code = FishBll.Bll.SequenceUtil.GetEnterWarehouseReceipts();
                isok       = bll.Exists(_fish.Code);
            }
            int id = bll.Add(_fish);

            if (id > 0)
            {
                _fish.Id          = id;
                tmiQuery.Visible  = false;
                tmiDelete.Visible = false;
                tmiModify.Visible = false;
                tmiAdd.Visible    = false;
                tmiSave.Visible   = true;
                tmiCancel.Visible = true;
                MessageBox.Show("添加成功。");
                txtcode.Text = _fish.Code.ToString();
            }
            else
            {
                // txtCode.Text = _fish.Code;
                MessageBox.Show("添加失败。");
            }
        }
        protected void QueryOne(string operate, string orderBy)
        {
            string whereEx = string.Empty;

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

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

            List <FishEntity.EnterWarehouseReceipts> list = _bll.GetModelListVo(whereEx + orderBy);

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

            _entity = list [0];

            SetOnepound( );
        }
        public int Add(FishEntity.EnterWarehouseReceipts model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("insert into t_enterwarehousereceipts(");
            strSql.Append("code,fishId,codeNum,codeNumContract,deliverybills,proName,numOfPack,qualitySpe,TVN,sand,TEL,TO,enUntil,country,number,location,protein,fat,water,fax,anti,shipno,brand,downDate,locationDis,za,hf,shy,remark,createtime,createman,modifyman,modifytime,height))");
            strSql.Append(" values (");
            strSql.Append("@code,@fishId,@codeNum,@codeNumContract,@deliverybills,@proName,@numOfPack,@qualitySpe,@TVN,@sand,@TEL,@TO,@enUntil,@country,@number,@location,@protein,@fat,@water,@fax,@anti,@shipno,@brand,@downDate,@locationDis,@za,@hf,@shy,@remark,@createtime,@createman,@modifyman,@modifytime,@height);");
            strSql.Append("select LAST_INSERT_ID();");
            MySqlParameter [] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@fishId",          MySqlDbType.VarChar,     45),
                new MySqlParameter("@codeNum",         MySqlDbType.VarChar,     50),
                new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,     45),
                new MySqlParameter("@deliverybills",   MySqlDbType.VarChar,     45),
                new MySqlParameter("@proName",         MySqlDbType.VarChar,    100),
                new MySqlParameter("@numOfPack",       MySqlDbType.Int32,       11),
                new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@TVN",             MySqlDbType.VarChar,     50),
                new MySqlParameter("@sand",            MySqlDbType.VarChar,     50),
                new MySqlParameter("@TEL",             MySqlDbType.VarChar,     50),
                new MySqlParameter("@TO",              MySqlDbType.VarChar,     50),
                new MySqlParameter("@enUntil",         MySqlDbType.VarChar,     50),
                new MySqlParameter("@country",         MySqlDbType.VarChar,     50),
                new MySqlParameter("@number",          MySqlDbType.Int32,       11),
                new MySqlParameter("@location",        MySqlDbType.VarChar,    200),
                new MySqlParameter("@protein",         MySqlDbType.VarChar,     50),
                new MySqlParameter("@fat",             MySqlDbType.VarChar,     50),
                new MySqlParameter("@water",           MySqlDbType.VarChar,     50),
                new MySqlParameter("@fax",             MySqlDbType.VarChar,     50),
                new MySqlParameter("@anti",            MySqlDbType.VarChar,     50),
                new MySqlParameter("@shipno",          MySqlDbType.VarChar,     45),
                new MySqlParameter("@brand",           MySqlDbType.VarChar,     50),
                new MySqlParameter("@downDate",        MySqlDbType.Date),
                new MySqlParameter("@locationDis",     MySqlDbType.VarChar,     50),
                new MySqlParameter("@za",              MySqlDbType.VarChar,     50),
                new MySqlParameter("@hf",              MySqlDbType.VarChar,     50),
                new MySqlParameter("@shy",             MySqlDbType.VarChar,     50),
                new MySqlParameter("@remark",          MySqlDbType.VarChar,     50),
                new MySqlParameter("@createtime",      MySqlDbType.Timestamp),
                new MySqlParameter("@createman",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@modifyman",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@modifytime",      MySqlDbType.Timestamp),
                new MySqlParameter("@height",          MySqlDbType.Decimal)
            };
            parameters [0].Value  = model.code;
            parameters [1].Value  = model.fishId;
            parameters [2].Value  = model.codeNum;
            parameters [3].Value  = model.codeNumContract;
            parameters [4].Value  = model.deliverybills;
            parameters [5].Value  = model.proName;
            parameters [6].Value  = model.numOfPack;
            parameters [7].Value  = model.qualitySpe;
            parameters [8].Value  = model.TVN;
            parameters [9].Value  = model.sand;
            parameters [10].Value = model.TEL;
            parameters [11].Value = model.TO;
            parameters [12].Value = model.enUntil;
            parameters [13].Value = model.country;
            parameters [14].Value = model.number;
            parameters [15].Value = model.location;
            parameters [16].Value = model.protein;
            parameters [17].Value = model.fat;
            parameters [18].Value = model.water;
            parameters [19].Value = model.fax;
            parameters [20].Value = model.anti;
            parameters [21].Value = model.shipno;
            parameters [22].Value = model.brand;
            parameters [23].Value = model.downDate;
            parameters [24].Value = model.locationDis;
            parameters [25].Value = model.za;
            parameters [26].Value = model.hf;
            parameters [27].Value = model.shy;
            parameters [28].Value = model.remark;
            parameters [29].Value = model.createtime;
            parameters [30].Value = model.createman;
            parameters [31].Value = model.modifyman;
            parameters [32].Value = model.modifytime;
            parameters [33].Value = model.height;

            int id = MySqlHelper.ExecuteSqlReturnId(strSql.ToString( ), parameters);

            return(id);
        }
        public List <FishEntity.EnterWarehouseReceipts> GetModelListVo(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from t_enterwarehousereceipts ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet ds = MySqlHelper.Query(strSql.ToString());
            List <FishEntity.EnterWarehouseReceipts> modelList = new List <FishEntity.EnterWarehouseReceipts>();
            int rowsCount = ds.Tables[0].Rows.Count;

            FishEntity.EnterWarehouseReceipts model;
            for (int n = 0; n < rowsCount; n++)
            {
                DataRow row = ds.Tables[0].Rows[n];
                model = new FishEntity.EnterWarehouseReceipts();
                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 ["codeNum"] != null)
                {
                    model.codeNum = row ["codeNum"].ToString( );
                }
                if (row ["codeNumContract"] != null)
                {
                    model.codeNumContract = row ["codeNumContract"].ToString( );
                }
                if (row ["deliverybills"] != null)
                {
                    model.deliverybills = row ["deliverybills"].ToString( );
                }
                if (row ["proName"] != null)
                {
                    model.proName = row ["proName"].ToString( );
                }
                if (row ["numOfPack"] != null && row ["numOfPack"].ToString( ) != "")
                {
                    model.numOfPack = int.Parse(row ["numOfPack"].ToString( ));
                }
                if (row ["qualitySpe"] != null)
                {
                    model.qualitySpe = row ["qualitySpe"].ToString( );
                }
                if (row ["TVN"] != null)
                {
                    model.TVN = row ["TVN"].ToString( );
                }
                if (row ["sand"] != null)
                {
                    model.sand = row ["sand"].ToString( );
                }
                if (row ["TEL"] != null)
                {
                    model.TEL = row ["TEL"].ToString( );
                }
                if (row ["TO"] != null)
                {
                    model.TO = row ["TO"].ToString( );
                }
                if (row ["enUntil"] != null)
                {
                    model.enUntil = row ["enUntil"].ToString( );
                }
                if (row ["country"] != null)
                {
                    model.country = row ["country"].ToString( );
                }
                if (row ["number"] != null && row ["number"].ToString( ) != "")
                {
                    model.number = int.Parse(row ["number"].ToString( ));
                }
                if (row ["height"] != null && row ["height"].ToString( ) != "")
                {
                    model.height = decimal.Parse(row ["height"].ToString( ));
                }
                if (row ["location"] != null)
                {
                    model.location = row ["location"].ToString( );
                }
                if (row ["protein"] != null)
                {
                    model.protein = row ["protein"].ToString( );
                }
                if (row ["fat"] != null)
                {
                    model.fat = row ["fat"].ToString( );
                }
                if (row ["water"] != null)
                {
                    model.water = row ["water"].ToString( );
                }
                if (row ["fax"] != null)
                {
                    model.fax = row ["fax"].ToString( );
                }
                if (row ["anti"] != null)
                {
                    model.anti = row ["anti"].ToString( );
                }
                if (row ["shipno"] != null)
                {
                    model.shipno = row ["shipno"].ToString( );
                }
                if (row ["brand"] != null)
                {
                    model.brand = row ["brand"].ToString( );
                }
                if (row ["downDate"] != null && row ["downDate"].ToString( ) != "")
                {
                    model.downDate = DateTime.Parse(row ["downDate"].ToString( ));
                }
                if (row ["locationDis"] != null)
                {
                    model.locationDis = row ["locationDis"].ToString( );
                }
                if (row ["za"] != null)
                {
                    model.za = row ["za"].ToString( );
                }
                if (row ["hf"] != null)
                {
                    model.hf = row ["hf"].ToString( );
                }
                if (row ["shy"] != null)
                {
                    model.shy = row ["shy"].ToString( );
                }
                if (row ["remark"] != null)
                {
                    model.remark = row ["remark"].ToString( );
                }
                if (row ["createtime"] != null && row ["createtime"].ToString( ) != "")
                {
                    model.createtime = DateTime.Parse(row ["createtime"].ToString( ));
                }
                if (row ["createman"] != null)
                {
                    model.createman = row ["createman"].ToString( );
                }
                if (row ["modifyman"] != null)
                {
                    model.modifyman = row ["modifyman"].ToString( );
                }
                if (row ["modifytime"] != null && row ["modifytime"].ToString( ) != "")
                {
                    model.modifytime = DateTime.Parse(row ["modifytime"].ToString( ));
                }
                if (row ["isdelete"] != null && row ["isdelete"].ToString( ) != "")
                {
                    model.isdelete = int.Parse(row ["isdelete"].ToString( ));
                }
                modelList.Add(model);
            }
            return(modelList);
        }
        public bool Update(FishEntity.EnterWarehouseReceipts model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("update t_enterwarehousereceipts set ");
            strSql.Append("code=@code,");
            strSql.Append("fishId=@fishId,");
            strSql.Append("codeNum=@codeNum,");
            strSql.Append("codeNumContract=@codeNumContract,");
            strSql.Append("deliverybills=@deliverybills,");
            strSql.Append("proName=@proName,");
            strSql.Append("numOfPack=@numOfPack,");
            strSql.Append("qualitySpe=@qualitySpe,");
            strSql.Append("TVN=@TVN,");
            strSql.Append("sand=@sand,");
            strSql.Append("TEL=@TEL,");
            strSql.Append("TO=@TO,");
            strSql.Append("enUntil=@enUntil,");
            strSql.Append("country=@country,");
            strSql.Append("number=@number,");
            strSql.Append("location=@location,");
            strSql.Append("protein=@protein,");
            strSql.Append("fat=@fat,");
            strSql.Append("water=@water,");
            strSql.Append("fax=@fax,");
            strSql.Append("anti=@anti,");
            strSql.Append("shipno=@shipno,");
            strSql.Append("brand=@brand,");
            strSql.Append("downDate=@downDate,");
            strSql.Append("locationDis=@locationDis,");
            strSql.Append("za=@za,");
            strSql.Append("hf=@hf,");
            strSql.Append("shy=@shy,");
            strSql.Append("remark=@remark,");
            strSql.Append("height=@height,");
            strSql.Append("createman=@createman,");
            strSql.Append("modifyman=@modifyman ");
            strSql.Append(" where id=@id");
            MySqlParameter [] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,  45),
                new MySqlParameter("@fishId",          MySqlDbType.VarChar,  45),
                new MySqlParameter("@codeNum",         MySqlDbType.VarChar,  50),
                new MySqlParameter("@codeNumContract", MySqlDbType.VarChar,  45),
                new MySqlParameter("@deliverybills",   MySqlDbType.VarChar,  45),
                new MySqlParameter("@proName",         MySqlDbType.VarChar, 100),
                new MySqlParameter("@numOfPack",       MySqlDbType.Int32,    11),
                new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar,  45),
                new MySqlParameter("@TVN",             MySqlDbType.VarChar,  50),
                new MySqlParameter("@sand",            MySqlDbType.VarChar,  50),
                new MySqlParameter("@TEL",             MySqlDbType.VarChar,  50),
                new MySqlParameter("@TO",              MySqlDbType.VarChar,  50),
                new MySqlParameter("@enUntil",         MySqlDbType.VarChar,  50),
                new MySqlParameter("@country",         MySqlDbType.VarChar,  50),
                new MySqlParameter("@number",          MySqlDbType.Int32,    11),
                new MySqlParameter("@location",        MySqlDbType.VarChar, 200),
                new MySqlParameter("@protein",         MySqlDbType.VarChar,  50),
                new MySqlParameter("@fat",             MySqlDbType.VarChar,  50),
                new MySqlParameter("@water",           MySqlDbType.VarChar,  50),
                new MySqlParameter("@fax",             MySqlDbType.VarChar,  50),
                new MySqlParameter("@anti",            MySqlDbType.VarChar,  50),
                new MySqlParameter("@shipno",          MySqlDbType.VarChar,  45),
                new MySqlParameter("@brand",           MySqlDbType.VarChar,  50),
                new MySqlParameter("@downDate",        MySqlDbType.Date),
                new MySqlParameter("@locationDis",     MySqlDbType.VarChar,  50),
                new MySqlParameter("@za",              MySqlDbType.VarChar,  50),
                new MySqlParameter("@hf",              MySqlDbType.VarChar,  50),
                new MySqlParameter("@shy",             MySqlDbType.VarChar,  50),
                new MySqlParameter("@remark",          MySqlDbType.VarChar,  50),
                new MySqlParameter("@createman",       MySqlDbType.VarChar,  45),
                new MySqlParameter("@modifyman",       MySqlDbType.VarChar,  45),
                new MySqlParameter("@height",          MySqlDbType.Decimal,  45),
                new MySqlParameter("@id",              MySqlDbType.Int32, 11)
            };
            parameters [0].Value  = model.code;
            parameters [1].Value  = model.fishId;
            parameters [2].Value  = model.codeNum;
            parameters [3].Value  = model.codeNumContract;
            parameters [4].Value  = model.deliverybills;
            parameters [5].Value  = model.proName;
            parameters [6].Value  = model.numOfPack;
            parameters [7].Value  = model.qualitySpe;
            parameters [8].Value  = model.TVN;
            parameters [9].Value  = model.sand;
            parameters [10].Value = model.TEL;
            parameters [11].Value = model.TO;
            parameters [12].Value = model.enUntil;
            parameters [13].Value = model.country;
            parameters [14].Value = model.number;
            parameters [15].Value = model.location;
            parameters [16].Value = model.protein;
            parameters [17].Value = model.fat;
            parameters [18].Value = model.water;
            parameters [19].Value = model.fax;
            parameters [20].Value = model.anti;
            parameters [21].Value = model.shipno;
            parameters [22].Value = model.brand;
            parameters [23].Value = model.downDate;
            parameters [24].Value = model.locationDis;
            parameters [25].Value = model.za;
            parameters [26].Value = model.hf;
            parameters [27].Value = model.shy;
            parameters [28].Value = model.remark;
            parameters [29].Value = model.createman;
            parameters [30].Value = model.modifyman;
            parameters [31].Value = model.height;
            parameters [32].Value = model.id;

            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #8
0
        public bool Update(FishEntity.EnterWarehouseReceipts model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_enterwarehousereceipts set ");
            strSql.Append("code = @code,");
            strSql.Append("Requester = @Requester,");
            strSql.Append("Shipname = @Shipname,");
            strSql.Append("tonnage = @tonnage,");
            strSql.Append("tName = @tName,");
            strSql.Append("Billnumber = @Billnumber,");
            strSql.Append("NumberOfPieces = @NumberOfPieces,");
            strSql.Append("Unpackingdate = @Unpackingdate,");
            strSql.Append("actualnumber = @actualnumber,");
            strSql.Append("StorageLocation = @StorageLocation,");
            strSql.Append("position = @position,");
            strSql.Append("Remarks = @Remarks,");
            strSql.Append("modifytime = @modifytime,");
            strSql.Append("modifyman = @modifyman,");
            strSql.Append("TO1 = @TO1,");
            strSql.Append("TEL1 = @TEL1,");
            strSql.Append("ANTI1 = @ANTI1,");
            strSql.Append("FAX1 = @FAX1, ");
            strSql.Append("ContractNo=@ContractNo, ");
            strSql.Append("Zhuangjiao=@Zhuangjiao ");
            strSql.Append("where id = @id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@Requester",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@Shipname",        MySqlDbType.VarChar,     45),
                new MySqlParameter("@tonnage",         MySqlDbType.Decimal,     45),
                new MySqlParameter("@tName",           MySqlDbType.VarChar,     45),
                new MySqlParameter("@Billnumber",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@NumberOfPieces",  MySqlDbType.Decimal,     45),
                new MySqlParameter("@Unpackingdate",   MySqlDbType.DateTime),
                new MySqlParameter("@actualnumber",    MySqlDbType.Decimal,     45),
                new MySqlParameter("@StorageLocation", MySqlDbType.VarChar,     45),
                new MySqlParameter("@position",        MySqlDbType.VarChar,    200),
                new MySqlParameter("@Remarks",         MySqlDbType.VarChar,    100),
                new MySqlParameter("@modifytime",      MySqlDbType.Timestamp),
                new MySqlParameter("@modifyman",       MySqlDbType.VarChar,     45),
                new MySqlParameter("@TO1",             MySqlDbType.VarChar,     45),
                new MySqlParameter("@TEL1",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@ANTI1",           MySqlDbType.VarChar,     45),
                new MySqlParameter("@FAX1",            MySqlDbType.VarChar,     45),
                new MySqlParameter("@id",              MySqlDbType.VarChar,     11),
                new MySqlParameter("@ContractNo",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@Zhuangjiao",      MySqlDbType.VarChar, 45)
            };
            parameters[0].Value  = model.Code;
            parameters[1].Value  = model.Requester;
            parameters[2].Value  = model.Shipname;
            parameters[3].Value  = model.Tonnage;
            parameters[4].Value  = model.TName;
            parameters[5].Value  = model.Billnumber;
            parameters[6].Value  = model.NumberOfPieces;
            parameters[7].Value  = model.Unpackingdate;
            parameters[8].Value  = model.Actualnumber;
            parameters[9].Value  = model.StorageLocation;
            parameters[10].Value = model.Position;
            parameters[11].Value = model.Remarks;
            parameters[12].Value = model.Modifytime;
            parameters[13].Value = model.Modifyman;
            parameters[14].Value = model.TO;
            parameters[15].Value = model.TEL;
            parameters[16].Value = model.ANTI;
            parameters[17].Value = model.FAX;
            parameters[18].Value = model.Id;
            parameters[19].Value = model.ContractNo;
            parameters[20].Value = model.Zhuangjiao;
            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #9
0
        public List <FishEntity.EnterWarehouseReceipts> GetModelListVo(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from t_enterwarehousereceipts ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet ds = MySqlHelper.Query(strSql.ToString());
            List <FishEntity.EnterWarehouseReceipts> modelList = new List <FishEntity.EnterWarehouseReceipts>();
            int rowsCount = ds.Tables[0].Rows.Count;

            FishEntity.EnterWarehouseReceipts model;
            for (int n = 0; n < rowsCount; n++)
            {
                DataRow row = ds.Tables[0].Rows[n];
                model = new FishEntity.EnterWarehouseReceipts();
                if (row["id"].ToString() != "")
                {
                    model.Id = int.Parse(row["id"].ToString());
                }
                if (row["code"] != null && row["code"].ToString() != "")
                {
                    model.Code = row["code"].ToString();
                }
                if (row["Requester"].ToString() != "" && row["Requester"] != null)
                {
                    model.Requester = row["Requester"].ToString();
                }
                if (row["Shipname"] != null && row["Shipname"].ToString() != "")
                {
                    model.Shipname = row["Shipname"].ToString();
                }
                if (row["tonnage"] != null && row["tonnage"].ToString() != "")
                {
                    model.Tonnage = decimal.Parse(row["tonnage"].ToString());
                }
                if (row["tName"] != null && row["tName"].ToString() != "")
                {
                    model.TName = row["tName"].ToString();
                }
                if (row["Billnumber"] != null && row["Billnumber"].ToString() != "")
                {
                    model.Billnumber = row["Billnumber"].ToString();
                }
                if (row["NumberOfPieces"] != null && row["NumberOfPieces"].ToString() != "")
                {
                    model.NumberOfPieces = decimal.Parse(row["NumberOfPieces"].ToString());
                }
                if (row["Unpackingdate"] != null && row["Unpackingdate"].ToString() != "")
                {
                    model.Unpackingdate = DateTime.Parse(row["Unpackingdate"].ToString());
                }
                if (row["actualnumber"] != null && row["actualnumber"].ToString() != "")
                {
                    model.Actualnumber = decimal.Parse(row["actualnumber"].ToString());
                }
                if (row["StorageLocation"] != null && row["StorageLocation"].ToString() != "")
                {
                    model.StorageLocation = row["StorageLocation"].ToString();
                }
                if (row["position"] != null && row["position"].ToString() != "")
                {
                    model.Position = row["position"].ToString();
                }
                if (row["Remarks"] != null && row["Remarks"].ToString() != "")
                {
                    model.Remarks = row["Remarks"].ToString();
                }
                if (row["TO1"] != null && row["TO1"].ToString() != "")
                {
                    model.TO = row["TO1"].ToString();
                }
                if (row["TEL1"] != null && row["TEL1"].ToString() != "")
                {
                    model.TEL = row["TEL1"].ToString();
                }
                if (row["ANTI1"] != null && row["ANTI1"].ToString() != "")
                {
                    model.ANTI = row["ANTI1"].ToString();
                }
                if (row["FAX1"] != null && row["FAX1"].ToString() != "")
                {
                    model.FAX = row["FAX1"].ToString();
                }
                if (row["ContractNo"] != null)
                {
                    model.ContractNo = row["ContractNo"].ToString();
                }
                if (row["Zhuangjiao"] != null)
                {
                    model.Zhuangjiao = row["Zhuangjiao"].ToString();
                }
                modelList.Add(model);
            }
            return(modelList);
        }
Beispiel #10
0
 public bool Update(FishEntity.EnterWarehouseReceipts model)
 {
     return(dal.Update(model));
 }
Beispiel #11
0
 public int Add(FishEntity.EnterWarehouseReceipts model)
 {
     return(dal.Add(model));
 }
        public override void Save()
        {
            if (Check( ) == false)
            {
                return;
            }

            FishEntity.EnterWarehouseReceipts _fish = new FishEntity.EnterWarehouseReceipts();

            int temp = 0;

            _entity.anti = txtanti.Text;
            //_entity . code = txtCode . Text;
            _entity.codeNum         = txtcodeNum.Text;
            _entity.codeNumContract = txtcodeNumContract.Text;
            _entity.deliverybills   = txtdeliverybills.Text;
            _entity.enUntil         = txtenUntil.Text;
            _entity.fat             = txtfat.Text;
            _entity.fax             = txtfax.Text;
            _entity.fishId          = txtfishId.Text;
            _entity.hf          = txthf.Text;
            _entity.location    = txtlocation.Text;
            _entity.locationDis = txtlocationDis.Text;
            int.TryParse(txtnumber.Text, out temp);
            _entity.number = temp;
            temp           = 0;
            int.TryParse(txtnumOfPack.Text, out temp);
            _entity.numOfPack  = temp;
            _entity.protein    = txtprotein.Text;
            _entity.remark     = txtremark.Text;
            _entity.sand       = txtsand.Text;
            _entity.shipno     = txtshipno.Text;
            _entity.shy        = txtshy.Text;
            _entity.TEL        = txtTEL.Text;
            _entity.TO         = txtTO.Text;
            _entity.TVN        = txtTVN.Text;
            _entity.water      = txtwater.Text;
            _entity.za         = txtza.Text;
            _entity.brand      = cmbbrand.Text;
            _entity.country    = cmbcountry.Text;
            _entity.proName    = cmbproName.Text;
            _entity.qualitySpe = cmbqualitySpe.Text;
            _entity.downDate   = dtdownDate.Value;

            decimal te = 0;

            decimal.TryParse(txtHeight.Text, out te);
            _entity.height = te;

            FishBll.Bll.EnterWarehouseReceiptsBll bll = new FishBll.Bll.EnterWarehouseReceiptsBll();

            bool isok = bll.Exists(_entity.code);

            while (isok)
            {
                _entity.code = FishBll.Bll.SequenceUtil.GetEnterWarehouseReceipts();
                isok         = bll.Exists(_entity.code);
            }
            int id = bll.Add(_fish);

            if (id > 0)
            {
                _entity.id        = id;
                tmiQuery.Visible  = false;
                tmiDelete.Visible = false;
                tmiModify.Visible = false;
                tmiAdd.Visible    = false;
                tmiSave.Visible   = true;
                tmiCancel.Visible = true;
                MessageBox.Show("添加成功。");
                txtCode.Text = _entity.code.ToString();
            }
            else
            {
                // txtCode.Text = _fish.Code;
                MessageBox.Show("添加失败。");
            }
        }