private void superGridControl1_DataBindingComplete(object sender, GridDataBindingCompleteEventArgs e) { foreach (GridRow gridRow in e.GridPanel.Rows) { CmcsSetSampler entity = gridRow.DataItem as CmcsSetSampler; } }
private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e) { CmcsSetSampler entity = Dbers.GetInstance().SelfDber.Get <CmcsSetSampler>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString()); switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name) { case "clmShow": FrmSetSampler_Oper frmShow = new FrmSetSampler_Oper(entity, Enums.eEditMode.查看); if (frmShow.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmEdit": FrmSetSampler_Oper frmShow2 = new FrmSetSampler_Oper(entity, Enums.eEditMode.修改); if (frmShow2.ShowDialog() == DialogResult.OK) { BindData(); } break; case "clmDelete": if ((MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)) { entity.IsDeleted = 1; entity.DeletionTime = DateTime.Now; CommonDAO.GetInstance().SelfDber.Update <CmcsSetSampler>(entity); BindData(); } break; } }
/// <summary> /// 根据矿点获取设置的采样机 /// </summary> /// <param name="mineName"></param> /// <returns></returns> public string GetSamplerByMineName(string mineName) { CmcsSetSampler entity = commonDAO.SelfDber.Entity <CmcsSetSampler>("where IsDeleted=0 and MineName=:MineName and StartTime<=sysdate and EndTime >sysdate order by EndTime desc", new { MineName = mineName }); if (entity != null) { return(entity.Sampler); } return(string.Empty); }
private void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txt_MineName.Text)) { MessageBoxEx.Show("请选择矿点", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(this.dtpStartTime.Text)) { MessageBoxEx.Show("请选择开始时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(this.dtpEndTime.Text)) { MessageBoxEx.Show("请选择结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(GetSelectedSampler())) { MessageBoxEx.Show("请选择采样机", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.EditMode == eEditMode.修改) { noSampler.MineId = this.CmcsMine.Id; noSampler.MineName = this.CmcsMine.Name; noSampler.StartTime = this.dtpStartTime.Value; noSampler.EndTime = this.dtpEndTime.Value; noSampler.Sampler = GetSelectedSampler(); //Dbers.GetInstance().SelfDber.Execute(string.Format("update cmcstbnosampler set mineid='{0}',minename='{1}',starttime='{2}',endtime='{3}' where id='{4}'", noSampler.MineId, noSampler.MineName, noSampler.StartTime, noSampler.EndTime, noSampler.Id)); Dbers.GetInstance().SelfDber.Update(noSampler); } else if (this.EditMode == eEditMode.新增) { noSampler = new CmcsSetSampler(); noSampler.MineId = this.CmcsMine.Id; noSampler.MineName = this.CmcsMine.Name; noSampler.StartTime = this.dtpStartTime.Value; noSampler.EndTime = this.dtpEndTime.Value; noSampler.Sampler = GetSelectedSampler(); CommonDAO.GetInstance().SelfDber.Insert(noSampler); } this.DialogResult = DialogResult.OK; this.Close(); }
public FrmSetSampler_Oper(CmcsSetSampler pId, eEditMode editMode) { InitializeComponent(); noSampler = pId; this.EditMode = editMode; }