//新增 public override int Add() { tmiSave.Visible = true; tmiCancel.Visible = true; tmiAdd.Visible = false; tmiModify.Visible = false; tmiQuery.Visible = false; tmiDelete.Visible = false; tmiClose.Visible = false; tmiNext.Visible = false; tmiPrevious.Visible = false; tmiExport.Visible = false; tmiReview.Visible = false; _model = null; //_modelOne = null; dataGridView1.Rows.Clear( ); dataGridView2.Rows.Clear( ); dataGridView3.Rows.Clear( ); dataGridView4.Rows.Clear( ); Clear( ); codeNum( ); //panel2 . Enabled = true; dataGridView2.Rows.Insert(0, new DataGridViewRow( )); dataGridView3.Rows.Insert(0, new DataGridViewRow( )); dataGridView4.Rows.Insert(0, new DataGridViewRow( )); state = "add"; return(1); }
void headSetValue ( FishEntity . PresaleRequisitionHeadEntity _list ) { txtsupplier . Text = _list . supplier; txtdemand . Text = _list . demand; dtpSigndate . Value = _list . Signdate; txtSignplace . Text = _list . Signplace; if ( _list . rebateBool == false ) { } else { } if ( _list . PortpriceBool == false ) { labPortpriceBool . Visible = false; texPortprice . Visible = false; } else { labPortpriceBool . Visible = true; texPortprice . Visible = true; texPortprice . Text = _list .Portprice . ToString ( ); } texDeliveryPlace . Text = _list . DeliveryPlace; textransport . Text = _list . ModeOfTransport; texFreight . Text = _list . Freight . ToString ( ); texDeliveryDeadline . Text = _list . DeliveryDeadline . ToString ( ); texBanDan . Text = _list . BanDan; texOpenbank . Text = _list . Openbank; texCollectUnit . Text = _list . CollectUnit; texAcountNum . Text = _list . AcountNum; gnjc = _list . testIndex; }
protected void QueryByWhere( ) { _bll = new FishBll.Bll.PresaleRequisitionBll( ); List <FishEntity.PresaleRequisitionHeadEntity> list = _bll.GetModelList(_where + _rolewhere + _orderBy); if (list == null || list.Count < 1) { MessageBox.Show("查无记录。"); } else { _model = list [0]; dataGridView1.Rows.Clear( ); dataGridView2.Rows.Clear( ); dataGridView3.Rows.Clear( ); dataGridView4.Rows.Clear( ); Clear( ); SetPresaleRequisition( ); Sethappening( ); Setsgsindicators( ); SetIndex( ); Ship( ); tmiModify.Visible = true; tmiDelete.Visible = true; tmiNext.Visible = true; tmiPrevious.Visible = true; tmiReview.Visible = true; } panel1.Enabled = true; }
protected void QueryOne(string operate, string orderBy) { panel1.Enabled = true; _rolewhere = string.Empty; if (string.IsNullOrEmpty(_where)) { _rolewhere = "1=1"; } else { _rolewhere = _where; } if (_model != null) { _rolewhere += " AND code " + operate + "'" + _model.code + "'"; } List <FishEntity.PresaleRequisitionHeadEntity> list = _bll.GetModelList(_rolewhere + _orderBy); if (list == null || list.Count < 1) { //_Pres = null; MessageBox.Show("查无记录。"); } else { _model = list [0]; dataGridView1.Rows.Clear( ); dataGridView2.Rows.Clear( ); dataGridView3.Rows.Clear( ); dataGridView4.Rows.Clear( ); Clear( ); SetPresaleRequisition( ); Sethappening( ); Setsgsindicators( ); SetIndex( ); Ship( ); tmiSave.Visible = false; tmiCancel.Visible = false; tmiAdd.Visible = true; tmiModify.Visible = true; tmiQuery.Visible = true; tmiDelete.Visible = true; tmiClose.Visible = true; tmiNext.Visible = true; tmiPrevious.Visible = true; tmiExport.Visible = true; } }
//保存 public override void Save( ) { _model = new FishEntity.PresaleRequisitionHeadEntity( ); _modelOne = new FishEntity.PresaleRequisitionBodyEntity( ); if (GetPresaleRequisition( ) == false) { return; } _model.createman = FishEntity.Variable.User.username; _model.createtime = _bll.getDate( ); _model.modifyman = _model.createman; _model.modifytime = _model.createtime; List <FishEntity.PresaleRequisitionBodyEntity> modelList = new List <FishEntity.PresaleRequisitionBodyEntity> ( ); DataViewOne(modelList); _bll = new FishBll.Bll.PresaleRequisitionBll( ); if (state == "add") { result = _bll.Add(_model, modelList); } else if (state == "edit") { result = _bll.Edit(_model, modelList); } if (result == true) { MessageBox.Show("保存成功"); tmiSave.Visible = false; tmiCancel.Visible = false; tmiAdd.Visible = true; tmiModify.Visible = true; tmiQuery.Visible = true; tmiDelete.Visible = true; tmiClose.Visible = true; tmiReview.Visible = true; //panel2 . Enabled = false; } else { MessageBox.Show("保存失败,请重试"); } base.Save( ); }
void GenerateContect ( ) { _bll = new FishBll . Bll . PresaleRequisitionBll ( ); result = _bll . Exists ( txtcode . Text ); if ( result == true ) { FishEntity . PresaleRequisitionHeadEntity _list = _bll . GetHeadList ( txtcode . Text ); if ( _list == null ) return; headSetValue ( _list ); } else MessageBox . Show ( "合同编号:" + txtcode . Text + "不存在,请核实" ); }
//删除 public override int Delete( ) { if (string.IsNullOrEmpty(txtcode.Tag.ToString( ))) { MessageBox.Show("请选择删除的内容"); return(0); } if (string.IsNullOrEmpty(txtcode.Text.ToString( ))) { MessageBox.Show("请选择删除的内容"); return(0); } if (MessageBox.Show("确定删除此单内容?", "询问", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return(0); } _model.id = ( int )txtcode.Tag; _model.code = txtcode.Text; result = _bll.Delete(_model.id, _model.code); if (result == true) { MessageBox.Show("删除成功"); _model = null; dataGridView1.Rows.Clear( ); dataGridView2.Rows.Clear( ); dataGridView3.Rows.Clear( ); dataGridView4.Rows.Clear( ); Clear( ); //panel2 . Enabled = false; Next( ); } else { MessageBox.Show("删除失败"); } return(0); }
//生成合同号 protected void codeNum( ) { _model = new FishEntity.PresaleRequisitionHeadEntity( ); _bll = new FishBll.Bll.PresaleRequisitionBll( ); DateTime dt = _bll.getDate( ); _model.code = _bll.codeNum( ); if (_model.code == string.Empty) { _model.code = "ZD" + dt.ToString("MMdd") + "0001"; } else { if (_model.code.Substring(2, 4) == dt.ToString("MMdd")) { _model.code = "ZD" + (Convert.ToInt64(_model.code.Substring(2, 8)) + 1).ToString( ).PadLeft(8, '0'); } else { _model.code = "ZD" + dt.ToString("MMdd") + "0001"; } } txtcode.Text = _model.code; }
/// <summary> /// 编辑数据 /// </summary> /// <param name="_model"></param> /// <param name="modelList"></param> /// <returns></returns> public bool Edit(FishEntity.PresaleRequisitionHeadEntity _model, List <FishEntity.PresaleRequisitionBodyEntity> modelList) { return(dal.Edit(_model, modelList)); }