/// <summary> /// 删除事件 /// edit xlb 2013-01-21 /// 单据项排序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { try { CommonNote_ItemEntity commonNote_ItemEntity = gvCommonItem.GetFocusedRow() as CommonNote_ItemEntity; int index = gvCommonItem.GetFocusedDataSourceRowIndex(); List <CommonNote_ItemEntity> commonNote_ItemEntityListData = gridControlCommomItem.DataSource as List <CommonNote_ItemEntity>; if (commonNote_ItemEntity == null) { return; } if (!string.IsNullOrEmpty(commonNote_ItemEntity.CommonNote_Item_Flow)) { commonNote_ItemEntity.Valide = "0"; commonNote_ItemEntityDelList.Add(commonNote_ItemEntity); } commonNote_ItemEntityListData.Remove(commonNote_ItemEntity); gridControlCommomItem.DataSource = new List <CommonNote_ItemEntity>(commonNote_ItemEntityListData); gvCommonItem.MoveBy(index); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 列表行下移事件 /// xlb 2013-01-21 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDown_Click(object sender, EventArgs e) { try { List <CommonNote_ItemEntity> commonNote_ItemList = gridControlCommomItem.DataSource as List <CommonNote_ItemEntity>; if (commonNote_ItemList == null) { return; } CommonNote_ItemEntity commonNote_Item = gvCommonItem.GetFocusedRow() as CommonNote_ItemEntity; if (commonNote_Item == null) { return; } int index = gvCommonItem.FocusedRowHandle; int max = commonNote_ItemList.Count; if (index + 1 >= max) { //throw new Exception("最后一行无法下移"); MessageBox.Show("最后一行无法下移"); return; } commonNote_ItemList.Remove(commonNote_Item); commonNote_ItemList.Insert(index + 1, commonNote_Item); gridControlCommomItem.DataSource = new List <CommonNote_ItemEntity>(commonNote_ItemList); gvCommonItem.FocusedRowHandle = index + 1; } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
//通用单项目 private void SaveCommonNoteItem(CommonNote_ItemEntity commonNote_ItemEntity) { try { if (string.IsNullOrEmpty(commonNote_ItemEntity.CommonNote_Item_Flow)) { commonNote_ItemEntity.CommonNote_Item_Flow = Guid.NewGuid().ToString(); } if (string.IsNullOrEmpty(commonNote_ItemEntity.CreateDoctorID) || string.IsNullOrEmpty(commonNote_ItemEntity.CreateDoctorName)) { commonNote_ItemEntity.CreateDoctorID = m_app.User.DoctorId; commonNote_ItemEntity.CreateDoctorName = m_app.User.DoctorName; } SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@CommonNote_Item_Flow", SqlDbType.VarChar, 50), new SqlParameter("@CommonNote_Tab_Flow", SqlDbType.VarChar, 50), new SqlParameter("@CommonNoteFlow", SqlDbType.VarChar, 50), new SqlParameter("@DataElementFlow", SqlDbType.VarChar, 50), new SqlParameter("@DataElementId", SqlDbType.VarChar, 50), new SqlParameter("@DataElementName", SqlDbType.VarChar, 50), new SqlParameter("@OrderCode", SqlDbType.VarChar, 50), new SqlParameter("@IsValidate", SqlDbType.VarChar, 50), new SqlParameter("@CreateDoctorID", SqlDbType.VarChar, 50), new SqlParameter("@CreateDoctorName", SqlDbType.VarChar, 50), new SqlParameter("@Valide", SqlDbType.VarChar, 50), new SqlParameter("@OtherName", SqlDbType.VarChar, 50) }; sqlParams[0].Value = commonNote_ItemEntity.CommonNote_Item_Flow; sqlParams[1].Value = commonNote_ItemEntity.CommonNote_Tab_Flow; sqlParams[2].Value = commonNote_ItemEntity.CommonNoteFlow; sqlParams[3].Value = commonNote_ItemEntity.DataElementFlow; sqlParams[4].Value = commonNote_ItemEntity.DataElementId; sqlParams[5].Value = commonNote_ItemEntity.DataElementName; sqlParams[6].Value = commonNote_ItemEntity.OrderCode; sqlParams[7].Value = commonNote_ItemEntity.IsValidate; sqlParams[8].Value = commonNote_ItemEntity.CreateDoctorID; sqlParams[9].Value = commonNote_ItemEntity.CreateDoctorName; sqlParams[10].Value = commonNote_ItemEntity.Valide; sqlParams[11].Value = commonNote_ItemEntity.OtherName; m_app.SqlHelper.ExecuteNoneQuery("EMR_CommonNote.usp_AddOrModCommonNote_Item", sqlParams, CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } }
//数据元改变时触发事件 对CommonNote_ItemEntity进行赋值 private void repositoryItemSearchLookUpEdit1_EditValueChanged(object sender, EventArgs e) { try { SearchLookUpEdit searchLookUpEdit = sender as SearchLookUpEdit; DataElementEntity dataElementEntity = searchLookUpEdit.Properties.View.GetFocusedRow() as DataElementEntity; CommonNote_ItemEntity commonNote_Item = gvCommonItem.GetFocusedRow() as CommonNote_ItemEntity; if (dataElementEntity != null && commonNote_Item != null) { commonNote_Item.DataElementName = dataElementEntity.ElementName; commonNote_Item.DataElementId = dataElementEntity.ElementId; commonNote_Item.DataElementFlow = dataElementEntity.ElementFlow; commonNote_Item.OtherName = dataElementEntity.ElementName; } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 新增事件 /// edit by xlb 203-01-21 /// 对单据项进行排序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { try { List <CommonNote_ItemEntity> commonNote_ItemEntityList = gridControlCommomItem.DataSource as List <CommonNote_ItemEntity>; if (commonNote_ItemEntityList == null) { commonNote_ItemEntityList = new List <CommonNote_ItemEntity>(); } CommonNote_ItemEntity commonNote_ItemEntity = new CommonNote_ItemEntity(); commonNote_ItemEntity.IsValidate = "是"; commonNote_ItemEntity.Valide = "1"; commonNote_ItemEntityList.Add(commonNote_ItemEntity); gridControlCommomItem.DataSource = new List <CommonNote_ItemEntity>(commonNote_ItemEntityList); gvCommonItem.MoveBy(commonNote_ItemEntityList.Count - 1); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }