/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txt_UnitName.Text)) { MessageBoxEx.Show("该标单位名称不能为空!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((CmcsSupplyReceive == null || CmcsSupplyReceive.UnitName != txt_UnitName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsSupplyReceive>(" where CardNumber=:CardNumber", new { CardNumber = txt_UnitName.Text }).Count > 0) { MessageBoxEx.Show("该标单位名称不可重复!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.EditMode == eEditMode.修改) { CmcsSupplyReceive.UnitName = txt_UnitName.Text; CmcsSupplyReceive.IsValid = (chb_IsUse.Checked ? 1 : 0); CmcsSupplyReceive.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Update(CmcsSupplyReceive); } else if (this.EditMode == eEditMode.新增) { CmcsSupplyReceive = new CmcsSupplyReceive(); CmcsSupplyReceive.UnitName = txt_UnitName.Text; CmcsSupplyReceive.IsValid = (chb_IsUse.Checked ? 1 : 0); CmcsSupplyReceive.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Insert(CmcsSupplyReceive); } this.DialogResult = DialogResult.OK; this.Close(); }
private void dataGridViewX1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == -1 || e.RowIndex == -1) { return; } CmcsSupplyReceive entity = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(superGridControl1.PrimaryGrid.GetCell(e.ColumnIndex, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); if (entity == null) { return; } switch (superGridControl1.PrimaryGrid.Columns[e.ColumnIndex].Name) { case "clmDelete": // 查询正在使用该单位名称的车数 if (MessageBoxEx.Show("确定要删除该单位名称?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Dbers.GetInstance().SelfDber.Delete <CmcsSupplyReceive>(entity.Id); BindData(); } else { MessageBoxEx.Show("该单位名称正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } }
/// <summary> /// 生成其他物资运输排队记录 /// </summary> /// <param name="autotruck">车辆</param> /// <param name="supply">供货单位</param> /// <param name="receive">收货单位</param> /// <param name="goodsType">物资类型</param> /// <param name="inFactoryTime">入厂时间</param> /// <param name="remark">备注</param> /// <param name="place">地点</param> /// <returns></returns> public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplyReceive supply, CmcsSupplyReceive receive, CmcsGoodsType goodsType, DateTime inFactoryTime, string remark, string place) { CmcsGoodsTransport transport = new CmcsGoodsTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, SupplyUnitId = supply.Id, SupplyUnitName = supply.UnitName, ReceiveUnitId = receive.Id, ReceiveUnitName = receive.UnitName, GoodsTypeId = goodsType.Id, GoodsTypeName = goodsType.GoodsName, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), Remark = remark }; if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.其他物资.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } return(false); }
private void btnSubmit_Click(object sender, EventArgs e) { if (txt_UnitName.Text.Length == 0) { MessageBoxEx.Show("该标单位名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if ((cmcsSupplyReceive == null || cmcsSupplyReceive.UnitName != txt_UnitName.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsSupplyReceive>(" where CardNumber=:CardNumber", new { CardNumber = txt_UnitName.Text }).Count > 0) { MessageBoxEx.Show("该标单位名称不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsSupplyReceive != null) { cmcsSupplyReceive.UnitName = txt_UnitName.Text; cmcsSupplyReceive.IsValid = (chb_IsUse.Checked ? 1 : 0); cmcsSupplyReceive.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Update(cmcsSupplyReceive); } else { cmcsSupplyReceive = new CmcsSupplyReceive(); cmcsSupplyReceive.UnitName = txt_UnitName.Text; cmcsSupplyReceive.IsValid = (chb_IsUse.Checked ? 1 : 0); cmcsSupplyReceive.Remark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Insert(cmcsSupplyReceive); } this.DialogResult = DialogResult.OK; this.Close(); }
private void FrmSupplyReceive_Select_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Output = null; this.DialogResult = DialogResult.Cancel; this.Close(); } }
private void btnReceiveUnit_Click(object sender, EventArgs e) { FrmSupplyReceive_Select Frm = new FrmSupplyReceive_Select(); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { receiveUnit = Frm.Output; } }
void Return() { GridRow gridRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow; if (gridRow == null) { return; } this.Output = (gridRow.DataItem as CmcsSupplyReceive); this.DialogResult = DialogResult.OK; this.Close(); }
private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e) { foreach (GridRow gridRow in e.GridPanel.Rows) { CmcsSupplyReceive entity = gridRow.DataItem as CmcsSupplyReceive; if (entity == null) { return; } // 填充有效状态 gridRow.Cells["clmIsUse"].Value = (entity.IsValid == 1 ? "是" : "否"); } }
private void FrmSupplyReceive_Oper_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(id)) { this.cmcsSupplyReceive = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(this.id); txt_UnitName.Text = cmcsSupplyReceive.UnitName; chb_IsUse.Checked = (cmcsSupplyReceive.IsValid == 1); txt_ReMark.Text = cmcsSupplyReceive.Remark; } if (!edit) { btnSubmit.Enabled = false; CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(panelEx2); } }
/// <summary> /// 窗体加载绑定数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmSupplyReceive_Oper_Load(object sender, EventArgs e) { this.CmcsSupplyReceive = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(this.PId); if (this.CmcsSupplyReceive != null) { txt_UnitName.Text = CmcsSupplyReceive.UnitName; chb_IsUse.Checked = (CmcsSupplyReceive.IsValid == 1); txt_ReMark.Text = CmcsSupplyReceive.Remark; } if (this.EditMode == eEditMode.查看) { btnSubmit.Enabled = false; HelperUtil.ControlReadOnly(panelEx2, true); } }
private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e) { CmcsSupplyReceive entity = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name) { case "clmShow": FrmSupplyReceive_Oper frmShow = new FrmSupplyReceive_Oper(entity.Id, eEditMode.查看); if (frmShow.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmEdit": FrmSupplyReceive_Oper frmEdit = new FrmSupplyReceive_Oper(entity.Id, eEditMode.修改); if (frmEdit.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmDelete": // 查询正在使用该单位名称的车数 if (MessageBoxEx.Show("确定要删除该单位名称?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Dbers.GetInstance().SelfDber.Delete <CmcsSupplyReceive>(entity.Id); } catch (Exception) { MessageBoxEx.Show("该单位名称正在使用中,禁止删除!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } BindData(); } break; } }
private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e) { foreach (GridRow gridRow in e.GridPanel.Rows) { CmcsGoodsTransport entity = gridRow.DataItem as CmcsGoodsTransport; if (entity == null) { return; } // 填充有效状态 gridRow.Cells["clmIsUse"].Value = (entity.IsUse == 1 ? "是" : "否"); CmcsSupplyReceive supplyunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.SupplyUnitId); if (supplyunit != null) { gridRow.Cells["SupplyUnitName"].Value = supplyunit.UnitName; } CmcsSupplyReceive receiveunit = Dbers.GetInstance().SelfDber.Get <CmcsSupplyReceive>(entity.ReceiveUnitId); if (receiveunit != null) { gridRow.Cells["ReceiveUnitName"].Value = receiveunit.UnitName; } CmcsGoodsType goodstype = Dbers.GetInstance().SelfDber.Get <CmcsGoodsType>(entity.GoodsTypeId); if (goodstype != null) { gridRow.Cells["GoodsTypeName"].Value = goodstype.GoodsName; } if (entity.FirstWeight > 0 && entity.SecondWeight > 0) { gridRow.CellStyles.Default.TextColor = Color.Green; } else if (entity.FirstWeight == 0 && entity.SecondWeight == 0) { gridRow.CellStyles.Default.TextColor = Color.Red; } } }
/// <summary> /// 生成其他物资运输排队记录 /// </summary> /// <param name="autotruck">车辆</param> /// <param name="supply">供货单位</param> /// <param name="receive">收货单位</param> /// <param name="goodsType">物资类型</param> /// <param name="inFactoryTime">入厂时间</param> /// <param name="remark">备注</param> /// <param name="place">地点</param> /// <returns></returns> public bool JoinQueueGoodsTransport(CmcsAutotruck autotruck, CmcsSupplyReceive supply, CmcsGoodsType goodsType, string mineName, string upload, string fuelKindName, DateTime inFactoryTime, string remark, string place, ref CmcsGoodsTransport transport) { transport = new CmcsGoodsTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.其他物资, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, SupplyUnitId = supply != null ? supply.Id : "", SupplyUnitName = supply != null ? supply.UnitName : "", GoodsTypeId = goodsType != null ? goodsType.Id : "", GoodsTypeName = goodsType != null ? goodsType.GoodsName : "", FromMC = mineName, ToMC = upload, FuelKindName = fuelKindName, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), Remark = remark, CarType = autotruck.CarType }; return(SelfDber.Insert(transport) > 0); }