public void GetPartByKey(string PartKey) { try { DataSet dsReturn = null; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.CreateIPartEngine().GetPartByKey(PartKey); string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (returnMsg != string.Empty) { MessageService.ShowError(returnMsg); } else { SetPartProperty(dsReturn); } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } }
/// <summary> /// bind data to gridview /// </summary> private void BindData(string partName) { try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { DataSet ds = new DataSet(); //查询成品数据通过物料号 ds = serverFactory.CreateIPartEngine().SearchPart(partName); string msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(ds); if (msg != "") {//查询出错! MessageService.ShowError("${res:FanHai.Hemera.Addins.Msg.SearchFailed}"); } else { if (ds.Tables.Count > 0) { gridControl1.MainView = gridView1; gridControl1.DataSource = ds.Tables[0]; } } } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } }
/// <summary> /// 删除成品 /// </summary> /// <returns></returns> public override bool Delete() { bool bResult = false; try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { DataSet retDS = factor.CreateIPartEngine().PartDelete(_partKey); string returnMessage = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(retDS); if (returnMessage.Length < 1) { bResult = true; } else { MessageService.ShowError(returnMessage); } } } catch (Exception e) { MessageService.ShowError(e); } finally { CallRemotingService.UnregisterChannel(); } return(bResult); }
//add by chao.pang 2013-12-04 start public DataSet GetPartType() { DataSet dsReturn = new DataSet(); try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { dsReturn = serverFactory.CreateIPartEngine().GetPartType(); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
private void toolbarSearch_Click(object sender, EventArgs e) { string partName = this.txtPartNumber.Text.Trim(); //绑定数据表数据参数值_partName为物料号 try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { DataSet ds = new DataSet(); //查询成品数据通过物料号 ds = serverFactory.CreateIPartEngine().SearchPart(partName); string msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(ds); if (msg != "") {//查询出错! MessageService.ShowError("${res:FanHai.Hemera.Addins.Msg.SearchFailed}"); } else { if (ds.Tables.Count > 0) { gridControl1.MainView = gridView1; gridControl1.DataSource = ds.Tables[0]; } } } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } //PartSearch pSearch = new PartSearch(); //if (DialogResult.OK == pSearch.ShowDialog()) //{ // if (null == pSearch.PartKey || pSearch.PartKey.Length < 1) // return; // if (null == pSearch.PartName || pSearch.PartName.Length < 1) // return; // string title = StringParser.Parse("${res:FanHai.Hemera.Addins.FMM.PartManagement.Name}") + "_" + pSearch.PartName; // foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) // { // if (viewContent.TitleName == title) // { // viewContent.WorkbenchWindow.SelectWindow(); // return; // } // } // this._part = new Part(pSearch.PartKey); // MapPartToControls(); // State = ControlState.Edit; //} }
public override bool Insert() { bool bResult = false; DataSet dataSet = new DataSet(); List <string> fields = new List <string>() { POR_PART_FIELDS.FIELD_PART_KEY, POR_PART_FIELDS.FIELD_PART_ID, POR_PART_FIELDS.FIELD_PART_NAME, POR_PART_FIELDS.FIELD_PART_VERSION, POR_PART_FIELDS.FIELD_PART_DESC, POR_PART_FIELDS.FIELD_EFFECTIVITY_START, POR_PART_FIELDS.FIELD_EFFECTIVITY_END, POR_PART_FIELDS.FIELD_CREATOR, POR_PART_FIELDS.FIELD_EDITOR, POR_PART_FIELDS.FIELD_PART_TYPE, POR_PART_FIELDS.FIELD_PART_MODULE, POR_PART_FIELDS.FIELD_CUR_ENTERPRISE_VER_KEY, POR_PART_FIELDS.FIELD_CUR_ROUTE_VER_KEY, POR_PART_FIELDS.FIELD_CUR_STEP_VER_KEY, POR_PART_FIELDS.FIELD_PART_STATUS, POR_PART_FIELDS.FIELD_PART_CLASS }; DataTable dtPart = FanHai.Hemera.Utils.Common.Utils .CreateDataTableWithColumns(POR_PART_FIELDS.DATABASE_TABLE_NAME, fields); //为插入做准备 object[] partValues = new object[] { _partKey, _partName, _partName, _partVersion, _descriptions, _effectivityStart, _effectivityEnd, PropertyService.Get(PROPERTY_FIELDS.USER_NAME), PropertyService.Get(PROPERTY_FIELDS.USER_NAME), _type, _module, _enterpriseKey, _routeKey, _stepKey, Convert.ToInt32(_partStatus).ToString(), _partClass }; dtPart.Rows.Add(partValues); dataSet.Tables.Add(dtPart); // Part UDAs if (_uda.UserDefinedAttrList.Count > 0) { DataTable dtPartUDAs = DataTableHelper.CreateDataTableForUDA(POR_PART_ATTR_FIELDS.DATABASE_TABLE_NAME, POR_PART_ATTR_FIELDS.FIELDS_PART_KEY); _uda.ParseInsertDataToDataTable(ref dtPartUDAs); if (dtPartUDAs.Rows.Count > 0) { dataSet.Tables.Add(dtPartUDAs); } } try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { DataSet retDS = factor.CreateIPartEngine().PartInsert(dataSet); string returnMessage = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(retDS); if (returnMessage.Length < 1) { foreach (UserDefinedAttr uda in _uda.UserDefinedAttrList) { uda.OperationAction = OperationAction.Update; } this.ResetDirtyList(); bResult = true; } else { MessageService.ShowError(returnMessage); } } } catch (Exception e) { MessageService.ShowError(e); } finally { CallRemotingService.UnregisterChannel(); } return(bResult); }
private bool partUpdate() { bool bResult = false; DataSet dataSet = new DataSet(); if (IsDirty) { if (DirtyList.Count > 0) { DataTable partTable = DataTableHelper.CreateDataTableForUpdateBasicData(POR_PART_FIELDS.DATABASE_TABLE_NAME); foreach (string Key in this.DirtyList.Keys) { Dictionary <string, string> rowData = new Dictionary <string, string>() { { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _partKey }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, Key }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[Key].FieldOriginalValue }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[Key].FieldNewValue } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref partTable, rowData); } if (partTable.Rows.Count > 0) { dataSet.Tables.Add(partTable); } } if (_uda.IsDirty) { DataTable partUdaTable = DataTableHelper.CreateDataTableForUDA (POR_PART_ATTR_FIELDS.DATABASE_TABLE_NAME, POR_PART_ATTR_FIELDS.FIELDS_PART_KEY); _uda.ParseUpdateDataToDataTable(ref partUdaTable); dataSet.Tables.Add(partUdaTable); } try { DataSet dsReturn = null; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.CreateIPartEngine().PartUpdate(dataSet); string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (returnMsg != string.Empty) { MessageService.ShowError(returnMsg); } else { foreach (UserDefinedAttr uda in _uda.UserDefinedAttrList) { uda.OperationAction = OperationAction.Update; } this.ResetDirtyList(); bResult = true; } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } } else { MessageService.ShowMessage ("${res:Global.UpdateItemDataMessage}", "${res:Global.SystemInfo}"); } return(bResult); }