private void gridControl_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { var list = new List <SRCModel>(gridControl.DataSource as SRCModel[]); this.SelectData = list[gridView名称代码.GetDataSourceRowIndex(gridView名称代码.FocusedRowHandle)]; //this.SelectID = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FID").ToString(); // this.SelectName = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FNAME").ToString(); this.DialogResult = DialogResult.OK; this.Close(); } }
public ActionResult SrcAdd() { UserBll.Instance.CheckUserOnlingState(); SRCModel model = SRCDal.Instance.Get(Request.QueryString["id"]); if (model == null) { model = new SRCModel(); } return(View(model)); }
private void gridView名称代码_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView名称代码.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { var list = new List <SRCModel>(gridControl.DataSource as SRCModel[]); this.SelectData = list[gridView名称代码.GetDataSourceRowIndex(gridView名称代码.FocusedRowHandle)]; //this.SelectID = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FID").ToString(); // this.SelectName = gridView名称代码.GetRowCellValue(gridView名称代码.FocusedRowHandle, "FNAME").ToString(); this.DialogResult = DialogResult.OK; this.Close(); } } }
public string SrcSave(FormCollection context) { try { string id = context["FID"]; if (!string.IsNullOrEmpty(id)) { SRCModel model = SRCDal.Instance.Get(id); model.FPRODUCTID = context["FPRODUCTID"]; model.FSRCNAME = context["FSRCNAME"]; model.FSRCCODE = context["FSRCCODE"]; model.FSRCMODEL = context["FSRCMODEL"]; model.FUNIT = context["FUNIT"]; model.FORDERUNIT = context["FORDERUNIT"]; model.FRATE = context["FRATE"].ToDecimal(); model.FWEIGHT = context["FWEIGHT"].ToDecimal(); SRCDal.Instance.Update(model); } else { SRCModel model = new SRCModel(); model.FPRODUCTID = context["FPRODUCTID"]; model.FSRCNAME = context["FSRCNAME"]; model.FSRCCODE = context["FSRCCODE"]; model.FSRCMODEL = context["FSRCMODEL"]; model.FUNIT = context["FUNIT"]; model.FORDERUNIT = context["FORDERUNIT"]; model.FRATE = context["FRATE"].ToDecimal(); model.FWEIGHT = context["FWEIGHT"].ToDecimal(); SRCDal.Instance.Insert(model); } return(JSONhelper.ToJson(new { errCode = 0, errMsg = "" })); } catch (Exception ex) { LogHelper.WriteLog(ex); return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message })); } }