public override void Save() { _model = new FishEntity.SalesRContractEntity(); List <FishEntity.productsituationEntity> modelList = new List <FishEntity.productsituationEntity>(); bll = new FishBll.Bll.SalesRContractBll(); GetSalesRContract(); DataView(modelList); //bool isok = bll.Exists(_model.ContractCode); //if (isok) //{ // MessageBox.Show("合同编号已存在!"); // return; //} bool isok = bll.ExistsNumbering(_model.Numbering); if (isok) { MessageBox.Show("编号已存在!"); return; } _model.Id = bll.Add(_model, modelList); if (_model.Id > 0) { setbool.id = _model.Id; AddImages(_model); MessageBox.Show("保存成功!"); } }
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; txtcode.Text = string.Empty; txtdemand.Text = string.Empty; txtNumbering.Text = string.Empty; txtSignplace.Text = string.Empty; txtsupplier.Text = string.Empty; dtpSigndate.Value = DateTime.Now; _model = null; dataGridView1.Rows.Clear(); dataGridView1.Rows.Insert(0, new DataGridViewRow()); //新增带入 bll = new FishBll.Bll.SalesRContractBll(); DataTable queryTable = bll.getxxsqd(" a.Numbering='" + name + "' "); if (queryTable != null && queryTable.Rows.Count > 0) { dataGridView1.Rows.Clear(); for (int i = 0; i < queryTable.Rows.Count; i++) { int idx = dataGridView1.Rows.Add(); DataGridViewRow row = dataGridView1.Rows[idx]; txtNumbering.Text = queryTable.Rows[i]["Numbering"].ToString(); dtpSigndate.Value = DateTime.Parse(queryTable.Rows[i]["Signdate"].ToString()); txtdemand.Text = queryTable.Rows[i]["demand"].ToString(); txtSignplace.Text = queryTable.Rows[i]["Signplace"].ToString(); txtsupplier.Text = queryTable.Rows[i]["supplier"].ToString(); txtcode.Text = queryTable.Rows[i]["code"].ToString(); row.Cells["product_id"].Value = queryTable.Rows[i]["product_id"].ToString(); row.Cells["productname"].Value = queryTable.Rows[i]["productname"].ToString(); row.Cells["Funit"].Value = queryTable.Rows[i]["Funit"].ToString(); row.Cells["Variety"].Value = queryTable.Rows[i]["Variety"].ToString(); row.Cells["Quantity"].Value = queryTable.Rows[i]["Quantity"].ToString(); row.Cells["unitprice"].Value = queryTable.Rows[i]["unitprice"].ToString(); row.Cells["Amonut"].Value = queryTable.Rows[i]["Amonut"].ToString(); } } return(0); }
void GenerateBody( ) { bll = new FishBll.Bll.SalesRContractBll(); List <FishEntity.productsituationEntity> modelList = bll.modellist(txtNumbering.Text); if (modelList.Count < 1 && modelList == null) { return; } bodySetValue(modelList); }
public override int Modify() { _model = new FishEntity.SalesRContractEntity(); GetSalesRContract(); List <FishEntity.productsituationEntity> modelList = new List <FishEntity.productsituationEntity>(); DataView(modelList); bll = new FishBll.Bll.SalesRContractBll(); bool isok = bll.Update(_model, modelList); if (isok == true) { AddImages(_model); MessageBox.Show("保存成功!"); return(1); } return(1); }
public override int Query( ) { if (QueryForm == null) { QueryForm = new UIForms.FormSalesRContractQuery(); QueryForm.StartPosition = FormStartPosition.CenterParent; QueryForm.ShowInTaskbar = false; } if (QueryForm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return(0); } _where = QueryForm.GetWhereCondition; bll = new FishBll.Bll.SalesRContractBll(); _model = new FishEntity.SalesRContractEntity(); _model = bll.GetList(_where); if (_model != null) { SetSalesRContract(); dataGridView1.Rows.Clear(); GenerateBody(); } else { MessageBox.Show("查无数据!"); } //FormSalesTables form = new FormSalesTables(); //form.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; //if (form.ShowDialog() != System.Windows.Forms.DialogResult.OK) //if (form.fish == null) return 1; //txtcode.Text = string.Empty; //txtcode.Text = form.fish.code; //dataGridView1.Rows.Clear(); //GenerateContect(); //if (result == true) // GenerateBody(); return(base.Query( )); }
//void GenerateContect ( ) //{ // result = _bll . Exist (txtNumbering. Text ); // if ( result == true ) // { // _rolewhere += " Numbering= '" + txtNumbering.Text+"' "; // if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan)) // { // _rolewhere += string.Format(" and createman='{0}' ", FishEntity.Variable.User.username); // } // FishEntity . SalesRequisitionEntity _list = _bll . GetList (_rolewhere); // if ( _list == null ) // return; // headSetValue ( _list ); // } // else // MessageBox . Show ( "编号:" + txtNumbering. Text + "不存在,请核实" ); //} //void GenerateContectCode() //{ // result = _bll.ExistCode(txtNumbering.Text); // if (result == true) // { // _rolewhere += " Numbering= '" + txtcode.Text + "' "; // if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan)) // { // _rolewhere += string.Format(" and createman='{0}' ", FishEntity.Variable.User.username); // } // FishEntity.SalesRequisitionEntity _list = _bll.GetList(_rolewhere); // if (_list == null) // return; // headSetValue(_list); // } // else // MessageBox.Show("销售编号:" + txtcode.Text + "不存在,请核实"); //} void GenerateContectNumbering() { bll = new FishBll.Bll.SalesRContractBll(); result = _bll.ExistCode(txtNumbering.Text); if (result == true) { _rolewhere += " Numbering= '" + txtNumbering.Text + "' "; if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan)) { _rolewhere += string.Format(" and createman='{0}' ", FishEntity.Variable.User.username); } _model = new FishEntity.SalesRContractEntity(); _model = bll.GetList(_rolewhere); if (_model == null) { return; } SetSalesRContract(); } //else //MessageBox.Show("销售编号:" + txtcode.Text + "不存在,请核实"); }