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( )); }
private void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } selectIdx = e.RowIndex; txtLeiBie.Text = dataGridView1.Rows[e.RowIndex].Cells["categroy"].Value.ToString(); pic.Image = PictureOpreation.ReadPicture(dataGridView1.Rows[e.RowIndex].Cells["picInfo"].Value == null ? null : (byte[])dataGridView1.Rows[e.RowIndex].Cells["picInfo"].Value); }
private void btnPrevious_Click(object sender, EventArgs e) { if (dicPic.Count > 0) { for (int i = 1; i <= dicPic.Count; i++) { if (dicPic.ContainsKey(Convert.ToInt32(this.pic.Tag) - i)) { _pic = dicPic[Convert.ToInt32(this.pic.Tag) - i]; this.pic.Image = PictureOpreation.ReadPicture(_pic.picInfo); this.pic.Tag = Convert.ToInt32(this.pic.Tag) - i; break; } } } }
private void btnPreview_Click(object sender, EventArgs e) { if (dicPic == null) { dicPic = new Dictionary <int, FishEntity.PicInfoAll> ( ); } num++; _pic = new FishEntity.PicInfoAll( ); _pic.picInfo = PictureOpreation.ReadPicture(pic); if (_pic.picInfo.Length == 0)//是否有图片 { return; } _pic.tableName = this.Name; dicPic.Add(num, _pic); pic.Tag = num; }
//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; }
private void btnDel_Click(object sender, EventArgs e) { PictureOpreation.ClearPicture(pic); dicPic.Remove(Convert.ToInt32(pic.Tag)); if (dicPic.Count > 0) { for (int i = 1; i <= dicPic.Count; i++) { if (dicPic.ContainsKey(Convert.ToInt32(this.pic.Tag) + i)) { _pic = dicPic[Convert.ToInt32(this.pic.Tag) + i]; this.pic.Image = PictureOpreation.ReadPicture(_pic.picInfo); this.pic.Tag = Convert.ToInt32(this.pic.Tag) + i; break; } } } }
private void btnEdit_Click(object sender, EventArgs e) { errorProvider1.Clear(); if (string.IsNullOrEmpty(txtLeiBie.Text)) { errorProvider1.SetError(txtLeiBie, "请选择类别"); return; } _pic = new FishEntity.PicInfoAll(); _pic.tableId = txtcode.Tag == null ? 0 : Convert.ToInt32(txtcode.Tag); _pic.picInfo = PictureOpreation.ReadPictureToByte(pic); _pic.tableName = this.Name; _pic.categroy = txtLeiBie.Text; //_pic.remark = txtBeiZhu.Text; dataGridView1.Rows[selectIdx].Cells["picInfo"].Value = _pic.picInfo; dataGridView1.Rows[selectIdx].Cells["categroy"].Value = _pic.categroy; //dataGridView1.Rows[selectIdx].Cells["remark"].Value = _pic.remark; }