public KPIPointInfo(FormTypes type, ObservableCollection<T_HR_KPIPOINT> KPIPointList, string stepname, FLOW_MODELFLOWRELATION_T modelFlowRelation) { InitializeComponent(); if (KPIPointList != null && KPIPointList.Count != 0 && stepname != null) { //获取KPI点信息 foreach (T_HR_KPIPOINT point in KPIPointList) { if (stepname.Equals(point.STEPID)) { KPIPoint = point; break; } } } // 1s 冉龙军 ////设置KPI点信息为不可用 //SetPointInfoEnable(false); ////设置KPI点信息 //SetControlsEnable(false); // 1e //设置系统评分信息为不可用 SetSystemScoreEnable(false); //设置提醒信息为不可用 SetRemindEnable(false); //抽查组 chkIsRandom.IsEnabled = false; // 1s 冉龙军 txtRandomWeight.IsEnabled = false; cboRandomGroup.IsEnabled = false; //机打 chkIsMachine.IsEnabled = false; txtMachineWeight.IsEnabled = false; //人打 chkIsPerson.IsEnabled = false; txtPersonWeight.IsEnabled = false; // 1e // 1s 冉龙军 chkIsSetKPI.IsChecked = KPIPoint == null ? false : true; // 1e cboIsSetKPI.SelectedIndex = KPIPoint == null ? 1 : 0; this.FormType = type; this.stepname = stepname; this.modelFlowRelation = modelFlowRelation; //if (KPIPoint == null) //{ //} //设置节点名称 lblStatusName.Text = stepname; InitPara(stepname); }
private void dtgProject_SelectionChanged(object sender, RoutedEventArgs e) { //清理掉设计器里的东西 ClearContain(); if (dtgProject.SelectedItem != null) { this.SelectedModelFlowRelation = (FLOW_MODELFLOWRELATION_T)dtgProject.SelectedItem; client.GetKPIPointListByBusinessCodeAsync(SelectedModelFlowRelation.MODELFLOWRELATIONID); } //fClient.GetFlowDefineByFlowCodeAsync(((FLOW_MODELFLOWRELATION_T)dtgProject.SelectedItem).FLOW_FLOWDEFINE_T.FLOWCODE); }
/// <summary> /// 新增流程 /// </summary> /// <param name="conn"></param> /// <param name="command"></param> /// <param name="flow"></param> private void AdddFlowDefine(OracleConnection conn, OracleCommand command, V_FLOWDEFINITION flow) { try { FLOW_MODELFLOWRELATION_T relation = flow.ModelRelation; FLOW_FLOWDEFINE_T define = flow.FlowDefinition; string[] companyids = relation.COMPANYID.TrimEnd('|').Split('|'); //所有关联公司的ID string[] companynames = relation.COMPANYNAME.TrimEnd('|').Split('|'); //所有关联公司的名称 for (int i = 0; i < companyids.Length; i++) //循环公司新增 { if (!string.IsNullOrEmpty(relation.DEPARTMENTID)) //如果存在部门 { string[] departmentids = relation.DEPARTMENTID.TrimEnd('|').Split('|'); //所有关联部门的ID string[] departmentnames = relation.DEPARTMENTNAME.TrimEnd('|').Split('|'); //所有关联部门名称 for (int j = 0; j < departmentids.Length; j++) //循环部门新增 { string flowCode = InsertHistory(conn, command, companyids[i], relation.MODELCODE, departmentids[j], flow); if (string.IsNullOrWhiteSpace(flowCode)) { flowCode = Guid.NewGuid().ToString().Replace("-", string.Empty); } relation.COMPANYID = companyids[i]; relation.COMPANYNAME = companynames[i]; relation.DEPARTMENTID = departmentids[j]; relation.DEPARTMENTNAME = departmentnames[j]; relation.FLOWCODE = flowCode; define.FLOWCODE = flowCode; AddFlow(conn, command, define); AddRelation(conn, command, relation); } } else { string flowCode = InsertHistory(conn, command, companyids[i], relation.MODELCODE, string.Empty, flow); if (string.IsNullOrWhiteSpace(flowCode)) { flowCode = Guid.NewGuid().ToString().Replace("-", string.Empty); } relation.COMPANYID = companyids[i]; relation.COMPANYNAME = companynames[i]; relation.FLOWCODE = flowCode; define.FLOWCODE = flowCode; AddFlow(conn, command, define); AddRelation(conn, command, relation); } } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
/// <summary> /// KPI调用 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="filterString"></param> /// <param name="paras"></param> /// <param name="pageCount"></param> /// <returns></returns> public List<FLOW_MODELFLOWRELATION_T> GetModelFlowRelationInfosListBySearch(int pageIndex, int pageSize, string sort, string filterString, object[] paras, ref int pageCount) { OracleConnection con = ADOHelper.GetOracleConnection(); try { List<FLOW_MODELFLOWRELATION_T> ents = new List<FLOW_MODELFLOWRELATION_T>(); string sql = " select t.MODELFLOWRELATIONID,t.COMPANYID,t.DEPARTMENTID,t.FLOWCODE,a.DESCRIPTION,t.FLAG from smtwf.FLOW_MODELFLOWRELATION_T t left join smtwf.FLOW_FLOWDEFINE_T a on t.flowcode=a.flowcode"; if (!string.IsNullOrEmpty(sort)) { sql += " order by " + sort + ""; } DataTable dt = MsOracle.GetDataTableByTransaction(con, sql, null); foreach (DataRow row in dt.Rows) { FLOW_MODELFLOWRELATION_T ent = new FLOW_MODELFLOWRELATION_T(); ent.MODELFLOWRELATIONID = row["MODELFLOWRELATIONID"] == null ? "" : row["MODELFLOWRELATIONID"].ToString(); ent.MODELFLOWRELATIONID = row["COMPANYID"] == null ? "" : row["COMPANYID"].ToString(); ent.MODELFLOWRELATIONID = row["DEPARTMENTID"] == null ? "" : row["DEPARTMENTID"].ToString(); ent.MODELFLOWRELATIONID = row["FLOWCODE"] == null ? "" : row["FLOWCODE"].ToString(); ent.MODELFLOWRELATIONID = row["DESCRIPTION"] == null ? "" : row["DESCRIPTION"].ToString(); ent.MODELFLOWRELATIONID = row["FLAG"] == null ? "" : row["FLAG"].ToString(); ents.Add(ent); } IQueryable<FLOW_MODELFLOWRELATION_T> listTemp = ents.AsQueryable(); int Count = ents.Count; pageCount = Count / pageSize + (Count % pageSize > 0 ? 1 : 0); var entList = listTemp.Skip((pageIndex - 1) * pageSize).Take(pageSize); return entList.ToList(); } catch (Exception ex) { return null; throw (ex); } finally { con.Close(); } }
/// <summary> /// 查询 [模块与流程定义关联] /// </summary> /// <param name="CompanyID">创建公司ID</param> /// <param name="DepartID">创建部门ID</param> /// <param name="ModelCode">模块代码</param> /// <param name="FlowType">0:审批流程,1:任务流程</param> /// <param name="OrgType">1:代表部门ID为空,否则部门ID不为空</param> /// <returns></returns> public static List<FLOW_MODELFLOWRELATION_T> GetFlowByModelName(OracleConnection con,string CompanyID, string DepartID, string ModelCode, string FlowType, string OrgType) { List<FLOW_MODELFLOWRELATION_T> listRelation = new List<FLOW_MODELFLOWRELATION_T>(); OracleDataReader dr = null; string sql = ""; try { if (con.State != ConnectionState.Open) { con.Open(); } sql = @" select * from FLOW_MODELFLOWRELATION_T where COMPANYID='{0}' and FLOWTYPE='{1}' and FLAG='1' and MODELCODE='{2}'"; if (OrgType != "1") { sql = sql + " and DEPARTMENTID is null"; } else { sql = sql + " and DEPARTMENTID='{3}'"; } sql = string.Format(sql, CompanyID, FlowType, ModelCode, DepartID); #region //OracleCommand cmd = con.CreateCommand(); //cmd.CommandText = sql; //dr = cmd.ExecuteReader(); LogHelper.WriteLog("FLOW_MODELFLOWRELATION_TDAL->GetFlowByModelName SQL语句:" + sql); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_MODELFLOWRELATION_T FLOW_MODELFLOWRELATION_T relation = new FLOW_MODELFLOWRELATION_T(); relation.COMPANYID = dr["COMPANYID"] == DBNull.Value ? null : dr["COMPANYID"].ToString(); relation.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); relation.CREATEDATE = (DateTime)dr["CREATEDATE"]; relation.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); relation.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); relation.DEPARTMENTID = dr["DEPARTMENTID"] == DBNull.Value ? null : dr["DEPARTMENTID"].ToString(); relation.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; relation.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); relation.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); relation.FLAG = dr["FLAG"] == DBNull.Value ? null : dr["FLAG"].ToString(); relation.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); relation.MODELFLOWRELATIONID = dr["MODELFLOWRELATIONID"] == DBNull.Value ? null : dr["MODELFLOWRELATIONID"].ToString(); relation.FLOW_FLOWDEFINE_T = new FLOW_FLOWDEFINE_T(); relation.FLOW_FLOWDEFINE_T.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); listRelation.Add(relation); break; #endregion } dr.Close(); if (listRelation.Count > 0) { sql = @"select * from FLOW_FLOWDEFINE_T where FLOWCODE='" + listRelation[0].FLOW_FLOWDEFINE_T.FLOWCODE + "'"; //dr = cmd.ExecuteReader(); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_FLOWDEFINE_T FLOW_FLOWDEFINE_T define = new FLOW_FLOWDEFINE_T(); define.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); define.CREATEDATE = (DateTime)dr["CREATEDATE"]; define.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); define.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); define.DESCRIPTION = dr["DESCRIPTION"] == DBNull.Value ? null : dr["DESCRIPTION"].ToString(); define.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; define.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); define.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); define.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); define.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); define.FLOWDEFINEID = dr["FLOWDEFINEID"] == DBNull.Value ? null : dr["FLOWDEFINEID"].ToString(); define.LAYOUT = dr["LAYOUT"] == DBNull.Value ? null : dr["LAYOUT"].ToString(); define.RULES = dr["RULES"] == DBNull.Value ? null : dr["RULES"].ToString(); define.XOML = dr["XOML"] == DBNull.Value ? null : dr["XOML"].ToString(); ; listRelation[0].FLOW_FLOWDEFINE_T = define; break; #endregion } dr.Close(); } #endregion return listRelation; } catch (Exception ex) { if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("GetFlowByModelName-->" + ex.Message); } }
/// <summary> /// 保存数据到数据库 /// </summary> private void SaveDataToDataBase() { try { _activityObjects = this.ucFlowSetting.activityProperty.ActivityObjects;//新建时活动数据 _lineObjects = this.ucFlowSetting.lineProperty.LineObjects;//新建时连线数据 //刷新上次选中元素的属性数据 RefreshFlowData(); #region 判断完成整性 foreach (var role in _activityObjects) { if (role.IsCounterSign) { if (role.CounterSignRoleList==null || role.CounterSignRoleList.Count < 1) { ComfirmWindow.ConfirmationBox("提示信息", "【会签节点】的角色不能为空,请添加角色!", "确定"); return; } } if ((role.IsSpecifyCompany == true && string.IsNullOrEmpty(role.OtherCompanyId)) || (role.IsSpecifyCompany == false && !string.IsNullOrEmpty(role.OtherCompanyId) )) { ComfirmWindow.ConfirmationBox("提示信息", "【" + role.Remark + "】指定了公司【" + role .OtherCompanyName+ "】,但没有钩选中,请重新钩选!", "确定"); return; } #region 会签角色判断是否有指定公司 if (role.CounterSignRoleList != null && role.CounterSignRoleList.Count > 0) { string warlName = ""; foreach (var roleSingn in role.CounterSignRoleList) { if ((roleSingn.IsOtherCompany == true && roleSingn.OtherCompanyId.Trim() == "") || (roleSingn.IsOtherCompany == false && roleSingn.OtherCompanyId.Trim() != "")) { warlName += "【" + roleSingn.StateName + "】指定了公司【" + roleSingn.OtherCompanyName + "】,但没有钩选中,请重新钩选!\r\n"; } } if (warlName.Trim() != "") { ComfirmWindow.ConfirmationBox("会签角色提示信息", warlName, "确定"); return; } } // IsOtherCompany false bool //OtherCompanyId "1a1f745c-e0df-4d21-b000-8d80d91b1743" string //OtherCompanyName null string //StateCode "da662417-baf1-4dab-ba34-5ae648c2047b" string //StateName "副总经理" string //TypeCode "CREATEUSER" string //TypeName "单据所有者" string #endregion } if (ucFlowSetting.flowProperty.txtFlowName.Text.Trim() == "") { ComfirmWindow.ConfirmationBox("提示信息", "流程名称不能为空!", "确定"); return; } if (ucFlowSetting.flowProperty.cbSystemCode.SelectedIndex < 1) { //MessageBox.Show("关联设置-〉业务系统:不能为空。", "警告:", MessageBoxButton.OK); ComfirmWindow.ConfirmationBox("提示信息", "所属系统:不能为空!", "确定"); return; } if (ucFlowSetting.flowProperty.cbModelCode.SelectedIndex < 1) { ComfirmWindow.ConfirmationBox("提示信息", "所属模块:不能为空!", "确定"); return; } if (ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation == null) { ComfirmWindow.ConfirmationBox("提示信息", "所属公司:不能为空!", "确定"); return; } if (ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation != null && string.IsNullOrEmpty(ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID)) { //MessageBox.Show("关联设置-〉所属公司:不能为空。", "警告:", MessageBoxButton.OK); ComfirmWindow.ConfirmationBox("提示信息", "所属公司:不能为空!", "确定"); return; } #endregion #region 系统与模块的选择 FLOW_MODELDEFINE_T systemCode = ucFlowSetting.flowProperty.cbSystemCode.SelectedItem as FLOW_MODELDEFINE_T; FLOW_MODELDEFINE_T modelCode = ucFlowSetting.flowProperty.cbModelCode.SelectedItem as FLOW_MODELDEFINE_T; #endregion string strWFLayout = ToXmlString(); string strXOML = GetXoml(_uniqueID);// ToXoml(_uniqueID); string strRules = ToRule(systemCode.SYSTEMCODE, modelCode.MODELCODE); string strLayout = GetLayout();// ToLayout(); //工作流程定义 #region 工作流程定义 FLOW_FLOWDEFINE_T flowDefine = new FLOW_FLOWDEFINE_T(); flowDefine.FLOWDEFINEID = Guid.NewGuid().ToString().Replace("-", ""); ;//暂时存在数据库,但没有用到 flowDefine.FLOWCODE = _uniqueID; flowDefine.DESCRIPTION = ucFlowSetting.flowProperty.txtFlowName.Text; flowDefine.XOML = strXOML; flowDefine.RULES = strRules; flowDefine.LAYOUT = strLayout; flowDefine.WFLAYOUT = strWFLayout; flowDefine.FLOWTYPE = ucFlowSetting.flowProperty.cboFlowType.SelectedIndex.ToString(); flowDefine.CREATEUSERID = Utility.CurrentUser.OWNERID; flowDefine.CREATEUSERNAME = Utility.CurrentUser.USERNAME; flowDefine.CREATECOMPANYID = Utility.CurrentUser.OWNERCOMPANYID; flowDefine.CREATEDEPARTMENTID = Utility.CurrentUser.OWNERDEPARTMENTID; flowDefine.CREATEPOSTID = Utility.CurrentUser.OWNERPOSTID; flowDefine.CREATEDATE = newtag == 0 ? DateTime.Now : ucFlowSetting.flowProperty.CurrentFlowView.FlowDefinition.CREATEDATE; flowDefine.EDITUSERID = Utility.CurrentUser.UPDATEUSER; flowDefine.EDITUSERNAME = Utility.CurrentUser.USERNAME; flowDefine.EDITDATE = DateTime.Now; flowDefine.SYSTEMCODE = systemCode.SYSTEMCODE; flowDefine.BUSINESSOBJECT = modelCode.MODELCODE; #endregion //模块定义 #region 模块定义 FLOW_MODELFLOWRELATION_T flowRealtion = new FLOW_MODELFLOWRELATION_T(); flowRealtion.MODELFLOWRELATIONID = newtag == 0 ? Guid.NewGuid().ToString().Replace("-", "") : ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.MODELFLOWRELATIONID; flowRealtion.COMPANYID = ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID;//公司ID flowRealtion.DEPARTMENTID = ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.DEPARTMENTID; //部门Id flowRealtion.COMPANYNAME = ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYNAME;//公司名称 flowRealtion.DEPARTMENTNAME = ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.DEPARTMENTNAME;//部门名称 flowRealtion.SYSTEMCODE = systemCode.SYSTEMCODE; //系统代码 flowRealtion.MODELCODE = modelCode.MODELCODE; flowRealtion.FLOWCODE = _uniqueID; flowRealtion.FLAG = "1"; flowRealtion.FLOWTYPE = ucFlowSetting.flowProperty.cboFlowType.SelectedIndex.ToString(); flowRealtion.CREATEUSERID = Utility.CurrentUser.OWNERID; flowRealtion.CREATEUSERNAME = Utility.CurrentUser.USERNAME; flowRealtion.CREATECOMPANYID = Utility.CurrentUser.OWNERCOMPANYID; flowRealtion.CREATEDEPARTMENTID = Utility.CurrentUser.OWNERDEPARTMENTID; flowRealtion.CREATEPOSTID = Utility.CurrentUser.OWNERPOSTID; flowRealtion.CREATEDATE = DateTime.Now; flowRealtion.EDITUSERID = Utility.CurrentUser.UPDATEUSER; flowRealtion.EDITUSERNAME = Utility.CurrentUser.USERNAME; flowRealtion.EDITDATE = DateTime.Now; #endregion _currentFlow = new V_FLOWDEFINITION() { FlowDefinition = flowDefine, ModelRelation = flowRealtion }; ucFlowSetting.flowProperty.CurrentFlowView = _currentFlow; pBar.Start(); clientFlow.AddFlowDefineAsync(_currentFlow); } catch (Exception e) { try{ ComfirmWindow.ConfirmationBox("提示信息", "出错信息如下:\r\n" + e.ToString(), "确定"); }catch(Exception ex) { MessageBox.Show("保存流程出错,出错信息如下:\r\n" + e.ToString()); } } }
/// <summary> /// 查询 [模块与流程定义关联] /// </summary> /// <param name="CompanyID">创建公司ID</param> /// <param name="DepartID">创建部门ID</param> /// <param name="ModelCode">模块代码</param> /// <param name="FlowType">0:审批流程,1:任务流程</param> /// <param name="OrgType">1:代表部门ID为空,否则部门ID不为空</param> /// <returns></returns> public static List <FLOW_MODELFLOWRELATION_T> GetFlowByModelName(OracleConnection con, string CompanyID, string DepartID, string ModelCode, string FlowType, string OrgType) { List <FLOW_MODELFLOWRELATION_T> listRelation = new List <FLOW_MODELFLOWRELATION_T>(); OracleDataReader dr = null; string sql = ""; try { if (con.State != ConnectionState.Open) { con.Open(); } sql = @" select * from FLOW_MODELFLOWRELATION_T where COMPANYID='{0}' and FLOWTYPE='{1}' and FLAG='1' and MODELCODE='{2}'"; if (OrgType != "1") { sql = sql + " and DEPARTMENTID is null"; } else { sql = sql + " and DEPARTMENTID='{3}'"; } sql = string.Format(sql, CompanyID, FlowType, ModelCode, DepartID); #region //OracleCommand cmd = con.CreateCommand(); //cmd.CommandText = sql; //dr = cmd.ExecuteReader(); LogHelper.WriteLog("FLOW_MODELFLOWRELATION_TDAL->GetFlowByModelName SQL语句:" + sql); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_MODELFLOWRELATION_T FLOW_MODELFLOWRELATION_T relation = new FLOW_MODELFLOWRELATION_T(); relation.COMPANYID = dr["COMPANYID"] == DBNull.Value ? null : dr["COMPANYID"].ToString(); relation.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); relation.CREATEDATE = (DateTime)dr["CREATEDATE"]; relation.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); relation.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); relation.DEPARTMENTID = dr["DEPARTMENTID"] == DBNull.Value ? null : dr["DEPARTMENTID"].ToString(); relation.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; relation.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); relation.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); relation.FLAG = dr["FLAG"] == DBNull.Value ? null : dr["FLAG"].ToString(); relation.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); relation.MODELFLOWRELATIONID = dr["MODELFLOWRELATIONID"] == DBNull.Value ? null : dr["MODELFLOWRELATIONID"].ToString(); relation.FLOW_FLOWDEFINE_T = new FLOW_FLOWDEFINE_T(); relation.FLOW_FLOWDEFINE_T.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); listRelation.Add(relation); break; #endregion } dr.Close(); if (listRelation.Count > 0) { sql = @"select * from FLOW_FLOWDEFINE_T where FLOWCODE='" + listRelation[0].FLOW_FLOWDEFINE_T.FLOWCODE + "'"; //dr = cmd.ExecuteReader(); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_FLOWDEFINE_T FLOW_FLOWDEFINE_T define = new FLOW_FLOWDEFINE_T(); define.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); define.CREATEDATE = (DateTime)dr["CREATEDATE"]; define.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); define.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); define.DESCRIPTION = dr["DESCRIPTION"] == DBNull.Value ? null : dr["DESCRIPTION"].ToString(); define.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; define.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); define.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); define.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); define.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); define.FLOWDEFINEID = dr["FLOWDEFINEID"] == DBNull.Value ? null : dr["FLOWDEFINEID"].ToString(); define.LAYOUT = dr["LAYOUT"] == DBNull.Value ? null : dr["LAYOUT"].ToString(); define.RULES = dr["RULES"] == DBNull.Value ? null : dr["RULES"].ToString(); define.XOML = dr["XOML"] == DBNull.Value ? null : dr["XOML"].ToString();; listRelation[0].FLOW_FLOWDEFINE_T = define; break; #endregion } dr.Close(); } #endregion return(listRelation); } catch (Exception ex) { if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("GetFlowByModelName-->" + ex.Message); } }
private void dtgProject_SelectionChanged(object sender, RoutedEventArgs e) { //清理掉设计器里的东西 ClearContain(); if (dtgProject.SelectedItem != null) { this.SelectedModelFlowRelation = (FLOW_MODELFLOWRELATION_T)dtgProject.SelectedItem; client.GetKPIPointListByBusinessCodeAsync(SelectedModelFlowRelation.MODELFLOWRELATIONID); } //fClient.GetFlowDefineByFlowCodeAsync(((FLOW_MODELFLOWRELATION_T)dtgProject.SelectedItem).FLOW_FLOWDEFINE_T.FLOWCODE); }
/// <summary> /// 新增流程关系 /// </summary> /// <param name="conn">数据库链接</param> /// <param name="command">数据库命令</param> /// <param name="relation">关系实体</param> /// <returns>bool</returns> private bool AddRelation(OracleConnection conn, OracleCommand command, FLOW_MODELFLOWRELATION_T relation) { try { string relationSql = @"INSERT INTO FLOW_MODELFLOWRELATION_T (MODELFLOWRELATIONID,COMPANYID,DEPARTMENTID,COMPANYNAME,DEPARTMENTNAME, SYSTEMCODE,MODELCODE,FLOWCODE,FLAG,FLOWTYPE,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID, CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,EDITDATE) VALUES (:MODELFLOWRELATIONID,:COMPANYID,:DEPARTMENTID, :COMPANYNAME,:DEPARTMENTNAME,:SYSTEMCODE,:MODELCODE,:FLOWCODE,:FLAG,:FLOWTYPE,:CREATEUSERID,:CREATEUSERNAME, :CREATECOMPANYID,:CREATEDEPARTMENTID,:CREATEPOSTID,:CREATEDATE,:EDITUSERID,:EDITUSERNAME,:EDITDATE)"; OracleParameter[] relationParm = { new OracleParameter(":MODELFLOWRELATIONID", OracleType.NVarChar, 100), new OracleParameter(":COMPANYID", OracleType.NVarChar, 100), new OracleParameter(":DEPARTMENTID", OracleType.NVarChar, 100), new OracleParameter(":COMPANYNAME", OracleType.NVarChar, 100), new OracleParameter(":DEPARTMENTNAME", OracleType.NVarChar, 100), new OracleParameter(":SYSTEMCODE", OracleType.NVarChar, 100), new OracleParameter(":MODELCODE", OracleType.NVarChar, 100), new OracleParameter(":FLOWCODE", OracleType.NVarChar, 100), new OracleParameter(":FLAG", OracleType.NVarChar, 2), new OracleParameter(":FLOWTYPE", OracleType.NVarChar, 2), new OracleParameter(":CREATEUSERID", OracleType.NVarChar, 100), new OracleParameter(":CREATEUSERNAME", OracleType.NVarChar, 100), new OracleParameter(":CREATECOMPANYID", OracleType.NVarChar, 100), new OracleParameter(":CREATEDEPARTMENTID", OracleType.NVarChar, 100), new OracleParameter(":CREATEPOSTID", OracleType.NVarChar, 100), new OracleParameter(":CREATEDATE", OracleType.DateTime), new OracleParameter(":EDITUSERID", OracleType.NVarChar, 100), new OracleParameter(":EDITUSERNAME", OracleType.NVarChar, 100), new OracleParameter(":EDITDATE", OracleType.DateTime) }; relationParm[0].Value = Guid.NewGuid().ToString(); //关联ID relationParm[1].Value = GetValue(relation.COMPANYID); //公司ID relationParm[2].Value = GetValue(relation.DEPARTMENTID); //部门ID relationParm[3].Value = GetValue(relation.COMPANYNAME); //公司名称 relationParm[4].Value = GetValue(relation.DEPARTMENTNAME); //部门名称 relationParm[5].Value = GetValue(relation.SYSTEMCODE); //系统代码 relationParm[6].Value = GetValue(relation.MODELCODE); //模块代码 relationParm[7].Value = GetValue(relation.FLOWCODE); //流程代码 relationParm[8].Value = "1"; //1这可用,0为不可用 relationParm[9].Value = GetValue(relation.FLOWTYPE); //0:审批流程,1:任务流程 relationParm[10].Value = GetValue(relation.CREATEUSERID); //操作人员ID relationParm[11].Value = GetValue(relation.CREATEUSERNAME); //操作人员名 relationParm[12].Value = GetValue(relation.CREATECOMPANYID); //创建公司ID relationParm[13].Value = GetValue(relation.CREATEDEPARTMENTID); //创建部门ID relationParm[14].Value = GetValue(relation.CREATEPOSTID); //创建岗位ID relationParm[15].Value = DateTime.Now; //创建时间 relationParm[16].Value = GetValue(relation.CREATEUSERID); //修改人ID relationParm[17].Value = GetValue(relation.CREATEUSERNAME); //修改人用户名 relationParm[18].Value = DateTime.Now; //修改时间 int k = MicrosoftOracle.ExecuteSQL(conn, command, relationSql, relationParm); if (k > 0) { return(true); } return(false); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }