public override void Review() { Review(this.Name, txtNumbering.Text, txtCode.Text); if (txtNumbering.Text != "") { _Refreshbll = new FishBll.Bll.ProcessStateBll(); _Refreshbll.GetFormOnepound(txtNumbering.Text); } base.Review(); }
public override void Save() { FishEntity.OnepoundEntity _fish = new FishEntity.OnepoundEntity(); _fish.Buyers = Buyers.Text; if (string.IsNullOrEmpty(Sellers.Text) == false) { FishEntity.CompanyEntity company = Sellers.Tag as FishEntity.CompanyEntity; _fish.Sellers = Sellers.Text.ToString(); } else { MessageBox.Show("请选择销售商。"); return; } if (string.IsNullOrEmpty(txtCodeOdd.Text)) { MessageBox.Show("请选择销售合同号"); return; } if (GetValue() == false) { return; } decimal temp = 0; _fish.Code = FishBll.Bll.SequenceUtil.GerLadingNumber(); _fish.OwnerId = txtOwner.Tag.ToString(); _fish.BuyersId = Buyers.Tag.ToString(); _fish.SellersId = Sellers.Tag.ToString(); _fish.Dateofmanufacture = dtpfactureDate.Value; _fish.IntothefactoryDate = dtpfactoryDate.Value; _fish.Carnumber = txtCarnumber.Text.Trim(); _fish.Goods = cmbspecies.SelectedValue == null ? string.Empty : cmbspecies.SelectedValue.ToString(); _fish.Remarks = txtRemarks.Text; _fish.Shipno = txtshipno.Text; _fish.Grossweight = txtGrossweight.Text; _fish.Tareweight = txtTareweight.Text; _fish.Competition = txtCompetition.Text; _fish.Owner = txtOwner.Text.Trim(); _fish.Quantity = Quantity.Text.Trim(); _fish.Pileangle = Pileangle.Text.Trim(); _fish.BillOfLadingid = BillOfLadingid.Text.Trim(); _fish.PName = cmbName.SelectedValue == null ? string.Empty : cmbName.SelectedValue.ToString(); _fish.Country = cmbCountry.SelectedValue == null ? string.Empty : cmbCountry.SelectedValue.ToString(); _fish.Qualit = txtSpecification.Text; _fish.Serialnumber = Serialnumber.Text.Trim(); _fish.Address = txtAddress.Text.Trim(); _fish.Createtime = DateTime.Now; _fish.Createman = FishEntity.Variable.User.username; _fish.Modifytime = DateTime.Now; _fish.Modifyman = _fish.Createman; _fish.codeContract = txtCodeOdd.Text; _fish.Numbering = txtNumbering.Text; FishBll.Bll.OnepoundBll bll = new FishBll.Bll.OnepoundBll(); bool isok = bll.Exists(_fish.Code); while (isok) { _fish.Code = FishBll.Bll.SequenceUtil.GerLadingNumber(); isok = bll.Exists(_fish.Code); } int id = bll.Add(_fish); if (id > 0) { if (txtNumbering.Text != "") { _Refreshbll = new FishBll.Bll.ProcessStateBll(); _Refreshbll.GetFormOnepound(txtNumbering.Text); } _fish.Id = id; AddImages(_fish); tmiQuery.Visible = false; tmiDelete.Visible = false; tmiModify.Visible = false; tmiAdd.Visible = true; tmiSave.Visible = false; tmiCancel.Visible = true; MessageBox.Show("添加成功。"); txtCode.Text = _fish.Code.ToString(); } else { // txtCode.Text = _fish.Code; MessageBox.Show("添加失败。"); } }
public override int Modify() { if (GetValue() == false) { return(0); } if (txtCode == null && txtCode.Text == "") { MessageBox.Show("请查询需要修改的磅单。"); return(0); } if (string.IsNullOrEmpty(txtCodeOdd.Text)) { MessageBox.Show("请选择销售合同号"); return(0); } _Refreshbll = new FishBll.Bll.ProcessStateBll(); if (_Refreshbll.ExistsNumbering(txtNumbering.Text, "bdExBool") == true) { MessageBox.Show("已审核无法操作!"); return(0); } decimal temp = 0; _fish.Buyers = Buyers.Text.ToString(); _fish.OwnerId = txtOwner.Tag.ToString(); _fish.BuyersId = Buyers.Tag.ToString(); _fish.SellersId = Sellers.Tag.ToString(); _fish.Sellers = Sellers.Text; _fish.Code = txtCode.Text; _fish.Dateofmanufacture = dtpfactureDate.Value;//chu _fish.IntothefactoryDate = dtpfactoryDate.Value; _fish.Carnumber = txtCarnumber.Text.Trim(); _fish.Grossweight = txtGrossweight.Text; _fish.Tareweight = txtTareweight.Text; _fish.Competition = txtCompetition.Text; _fish.Goods = cmbspecies.SelectedValue == null ? string.Empty : cmbspecies.SelectedValue.ToString(); _fish.Remarks = txtRemarks.Text; _fish.Shipno = txtshipno.Text; _fish.Owner = txtOwner.Text.Trim(); _fish.Address = txtAddress.Text.Trim(); _fish.Modifytime = DateTime.Now; _fish.Modifyman = FishEntity.Variable.User.username; _fish.Quantity = Quantity.Text.Trim(); _fish.Pileangle = Pileangle.Text.Trim(); _fish.BillOfLadingid = BillOfLadingid.Text.Trim(); _fish.PName = cmbName.SelectedValue == null ? string.Empty : cmbName.SelectedValue.ToString(); _fish.Country = cmbCountry.SelectedValue == null ? string.Empty : cmbCountry.SelectedValue.ToString(); _fish.Qualit = txtSpecification.Text; _fish.Serialnumber = Serialnumber.Text.Trim(); _fish.codeContract = txtCodeOdd.Text; FishBll.Bll.OnepoundBll bll = new FishBll.Bll.OnepoundBll(); if (bll.ExistsUpdate(_fish.Code, FishEntity.Variable.User.username) != true) { MessageBox.Show("不是所属人无法操作!"); return(0); } bool isOk = bll.Update(_fish); if (isOk) { AddImages(_fish); if (txtNumbering.Text != "") { _Refreshbll = new FishBll.Bll.ProcessStateBll(); _Refreshbll.GetFormOnepound(txtNumbering.Text); } MessageBox.Show("修改成功。"); } else { txtCode.Text = string.Empty; MessageBox.Show("修改失败。"); } return(1); }
public override int Query() { try { if (!string.IsNullOrEmpty(comNumbering.Text)) { _bll.GetFormSalesRequisition(comNumbering.Text); _bll.GetFormSalesRContract(comNumbering.Text); _bll.GetFormPaymentRequisition(comNumbering.Text); _bll.GetFormBilloflading(comNumbering.Text); _bll.GetFormOnepound(comNumbering.Text); _bll.GetFormCargoFeedbackSheet(comNumbering.Text); _bll.GetFormTheproblemsheet(comNumbering.Text); _bll.GetFormReceiptRecord(comNumbering.Text); } } catch (Exception ex) { Utility.LogHelper.WriteLog(ex.StackTrace); Utility.LogHelper.WriteLog(ex.Message); } finally { string strWhere = "1=1"; if (!string.IsNullOrEmpty(comNumbering.Text)) { strWhere = strWhere + " and a.Numbering='" + comNumbering.Text + "'"; } if (!string.IsNullOrEmpty(txtdemand.Text)) { strWhere = strWhere + " and b.demand like '%" + txtdemand.Text + "%' "; } if (!string.IsNullOrEmpty(txtPurchasecontractnumber.Text)) { strWhere = strWhere + " and b.Purchasecontractnumber like '%" + txtPurchasecontractnumber.Text + "%' "; } if (!string.IsNullOrEmpty(dtpStart.Text.Trim())) { strWhere = strWhere + " AND b.Signdate>='" + dtpStart.Text + "'"; } if (!string.IsNullOrEmpty(txtCode.Text.Trim())) { strWhere = strWhere + " AND b.code like'%" + txtCode.Text + "%'"; } if (!string.IsNullOrEmpty(dtpEnd.Text.Trim())) { strWhere = strWhere + " AND b.Signdate<='" + dtpEnd.Text + "'"; } if (FishEntity.Variable.User.roletype.Equals(FishEntity.Constant.Role_SalesMan)) { strWhere += string.Format(" and b.createman='{0}' ", FishEntity.Variable.User.username); } else { if (cmbTheperson.SelectedValue.ToString() != " ") { strWhere += string.Format(" and b.createman='{0}' ", cmbTheperson.SelectedValue.ToString()); } } switch (cmbeffect.SelectedItem.ToString()) { case "有效": strWhere += string.Format(" and effect IS NULL", cmbeffect.SelectedItem.ToString()); break; case "无效": strWhere += string.Format(" and effect like '%{0}%'", cmbeffect.SelectedItem.ToString()); break; case "全部": default: break; } i = 0; List <FishEntity.ProcessStateEntity> modelList = _bll.getList(strWhere); if (modelList != null) { dataGridView1.Rows.Clear(); foreach (FishEntity.ProcessStateEntity _list in modelList) { getValue(i, _list); i++; } } else { MessageBox.Show("查无数据!"); } } return(base.Query()); }