private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e) { foreach (GridRow gridRow in e.GridPanel.Rows) { CmcsGoodsPlan entity = gridRow.DataItem as CmcsGoodsPlan; if (entity == null) { return; } } }
private void FrmGoodsPlan_Oper_Load(object sender, EventArgs e) { this.cmcsGoodsPlan = Dbers.GetInstance().SelfDber.Get <CmcsGoodsPlan>(this.PId); if (this.cmcsGoodsPlan != null) { txtCarNumber_Goods.Text = cmcsGoodsPlan.CarNumber; txtSupplyUnitName_Goods.Text = cmcsGoodsPlan.SupplyUnitName; txtReceiveUnitName_Goods.Text = cmcsGoodsPlan.ReceiveUnitName; txtGoodsTypeName_Goods.Text = cmcsGoodsPlan.GoodsTypeName; txtRemark_Goods.Text = cmcsGoodsPlan.Remark; } if (this.EditMode == eEditMode.查看) { btnSubmit.Enabled = false; HelperUtil.ControlReadOnly(panelEx2, true); } }
private void superGridControl1_CellMouseDown(object sender, GridCellMouseEventArgs e) { CmcsGoodsPlan entity = Dbers.GetInstance().SelfDber.Get <CmcsGoodsPlan>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name) { case "clmShow": FrmGoodsPlan_Oper frmShow = new FrmGoodsPlan_Oper(entity.Id, eEditMode.查看); if (frmShow.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmEdit": FrmGoodsPlan_Oper frmEdit = new FrmGoodsPlan_Oper(entity.Id, eEditMode.修改); if (frmEdit.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmDelete": // 查询正在使用该供应商的车数 if (MessageBoxEx.Show("确定要删除该配置信息?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { try { Dbers.GetInstance().SelfDber.Delete <CmcsGoodsPlan>(entity.Id); } catch (Exception) { MessageBoxEx.Show("该配置信息正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } BindData(); } break; } }
private void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtCarNumber_Goods.Text)) { MessageBoxEx.Show("车牌号不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(txtSupplyUnitName_Goods.Text)) { MessageBoxEx.Show("供货单位不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(txtReceiveUnitName_Goods.Text)) { MessageBoxEx.Show("收货单位不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(txtGoodsTypeName_Goods.Text)) { MessageBoxEx.Show("物资类型不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((cmcsGoodsPlan == null || cmcsGoodsPlan.CarNumber != txtCarNumber_Goods.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsGoodsPlan>(" where CarNumber=:CarNumber", new { CarNumber = txtCarNumber_Goods.Text }).Count > 0) { MessageBoxEx.Show("该车号物资计划已存在!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.EditMode == eEditMode.修改) { if (this.SelectedAutotruck != null) { cmcsGoodsPlan.AutotruckId = this.SelectedAutotruck.Id; cmcsGoodsPlan.CarNumber = this.SelectedAutotruck.CarNumber; } if (this.SelectedSupplyUnit_Goods != null) { cmcsGoodsPlan.SupplyUnitId = this.SelectedSupplyUnit_Goods.Id; cmcsGoodsPlan.SupplyUnitName = this.SelectedSupplyUnit_Goods.Name; } if (this.SelectedReceiveUnit_Goods != null) { cmcsGoodsPlan.ReceiveUnitId = this.SelectedReceiveUnit_Goods.Id; cmcsGoodsPlan.ReceiveUnitName = this.SelectedReceiveUnit_Goods.Name; } if (this.SelectedGoodsType_Goods != null) { cmcsGoodsPlan.GoodsTypeId = this.SelectedGoodsType_Goods.Id; cmcsGoodsPlan.GoodsTypeName = SelectedGoodsType_Goods.GoodsName; } cmcsGoodsPlan.Remark = txtRemark_Goods.Text; Dbers.GetInstance().SelfDber.Update(cmcsGoodsPlan, GlobalVars.LoginUser.UserName); } else if (this.EditMode == eEditMode.新增) { cmcsGoodsPlan = new CmcsGoodsPlan(); cmcsGoodsPlan.AutotruckId = this.SelectedAutotruck.Id; cmcsGoodsPlan.CarNumber = this.SelectedAutotruck.CarNumber; cmcsGoodsPlan.SupplyUnitId = this.SelectedSupplyUnit_Goods.Id; cmcsGoodsPlan.SupplyUnitName = this.SelectedSupplyUnit_Goods.Name; cmcsGoodsPlan.ReceiveUnitId = this.SelectedReceiveUnit_Goods.Id; cmcsGoodsPlan.ReceiveUnitName = this.SelectedReceiveUnit_Goods.Name; cmcsGoodsPlan.GoodsTypeId = this.SelectedGoodsType_Goods.Id; cmcsGoodsPlan.GoodsTypeName = SelectedGoodsType_Goods.GoodsName; cmcsGoodsPlan.Remark = txtRemark_Goods.Text; Dbers.GetInstance().SelfDber.Insert(cmcsGoodsPlan); } this.DialogResult = DialogResult.OK; this.Close(); }