Пример #1
0
 /// <summary>
 /// 新增流程
 /// </summary>
 /// <param name="flow"></param>
 /// <returns></returns>
 public bool AddFlowDefine(V_FLOWDEFINITION flow)
 {
     try
     {
         return(dal.AddFlowDefine(flow));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Пример #2
0
 /// <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);
     }
 }
Пример #3
0
 /// <summary>
 /// 新增流程
 /// </summary>
 /// <param name="flow"></param>
 /// <returns></returns>
 public string  AddFlowDefine(V_FLOWDEFINITION flow)
 {
     try
     {
         if (flowBLL.AddFlowDefine(flow))
         {
             return("1");
         }
         return("新建流程失败!");
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog("新建流程出错:" + ex.Message + "   公司ID:" + flow.ModelRelation.COMPANYID);
         return(ex.Message);
     }
 }
Пример #4
0
        /// <summary>
        /// 新增流程
        /// </summary>
        /// <param name="flow">视图</param>
        /// <returns>bool</returns>
        public bool AddFlowDefine(V_FLOWDEFINITION flow)
        {
            OracleConnection  conn    = MicrosoftOracle.CreateOracleConnection(ConnectionString);
            OracleCommand     command = conn.CreateCommand();
            OracleTransaction transaction;

            transaction         = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
            command.Transaction = transaction;
            try
            {
                AdddFlowDefine(conn, command, flow);
                transaction.Commit();
                conn.Close();
                return(true);
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                conn.Close();
                throw new Exception(ex.Message, ex);
            }
        }
Пример #5
0
 /// <summary>
 /// 获取指定流程
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void clientFlow_GetFlowEntityCompleted(object sender, GetFlowEntityCompletedEventArgs e)
 {
     if (e.Result != null)
     {
         _currentFlow = e.Result as V_FLOWDEFINITION;
         ucFlowSetting.flowProperty.CurrentFlow = _currentFlow.FlowDefinition;
         ucFlowSetting.flowProperty.CurrentFlowView = _currentFlow;
         ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation = _currentFlow.ModelRelation;
         if (ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation != null)
         {//绑定初始化
             if (!string.IsNullOrEmpty(ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID))
             {
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID = _currentFlow.ModelRelation.COMPANYID;//公司ID
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYNAME = _currentFlow.ModelRelation.COMPANYNAME;//公司名称
             }
             else
             {//如果没有绑定公司,则以当前登录人公司进行绑定
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;//公司ID
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;//公司名称
             }
             if (!string.IsNullOrEmpty(_currentFlow.ModelRelation.DEPARTMENTID))
             {//如果绑定部门不为空
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.DEPARTMENTID = _currentFlow.ModelRelation.DEPARTMENTID;//部门ID
                 ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.DEPARTMENTNAME = _currentFlow.ModelRelation.DEPARTMENTNAME;//部门名称
             }
         }
         InitFlowContainer();
     }
     pBar.Stop();
 }
Пример #6
0
        private void ClearData()
        {
            _lastSelectedElement = null;
            _lineObjects = new List<LineObject>();
            _activityObjects = new List<ActivityObject>();
            if (this.CurrentFlow == null)
            {
                this.CurrentFlow = new V_FLOWDEFINITION();
                this._currentFlow = new V_FLOWDEFINITION();
                this.ucFlowSetting.flowProperty.CurrentFlow = new FLOW_FLOWDEFINE_T();
                this.ucFlowSetting.flowProperty.CurrentFlowView = new V_FLOWDEFINITION();
                this.ucFlowSetting.flowProperty.CurrentFlowView.FlowDefinition = new FLOW_FLOWDEFINE_T();
                this.ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation = new FLOW_MODELFLOWRELATION_T();
            }
            this.CleareContainer();
            this.ucFlowSetting.activityProperty.ActivityObjects.Clear();//新建时清空活动数据
            this.ucFlowSetting.lineProperty.LineObjects.Clear();//新建时清空连线数据

            this.ucFlowSetting.flowProperty.CurrentFlow.FLOWCODE = _uniqueID;
            this.ucFlowSetting.flowProperty.CurrentFlowView.FlowDefinition.FLOWCODE = _uniqueID;

            //关联设置
            this.ucFlowSetting.flowProperty.txtCompanyName.Text = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            this.ucFlowSetting.flowProperty.txtDepartmentName.Text = "";
            this.ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;//公司ID
            this.ucFlowSetting.flowProperty.CurrentFlowView.ModelRelation.COMPANYNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;//公司名称
            this.ucFlowSetting.flowProperty.txtCreateDate.Text = DateTime.Now.ToString();
            FLOW_MODELDEFINE_T modelCode = ucFlowSetting.flowProperty.cbModelCode.SelectedItem as FLOW_MODELDEFINE_T;
            if (modelCode != null)
            {
                this.ucFlowSetting.flowProperty.txtFlowName.Text = modelCode.DESCRIPTION;
            }
            else
            {
                this.ucFlowSetting.flowProperty.txtFlowName.Text = "";
            }
            this.ucFlowSetting.flowProperty.txtUpdateDate.Text = DateTime.Now.ToString();
            this.ucFlowSetting.flowProperty.txtCreateUser.Text = Utility.CurrentUser.USERNAME;
            this.ucFlowSetting.flowProperty.txtUpdateUser.Text = Utility.CurrentUser.USERNAME;

            this.ucFlowSetting.flowProperty.CurrentFlow.DESCRIPTION = this.ucFlowSetting.flowProperty.txtFlowName.Text; //流程名称
            this.ucFlowSetting.flowProperty.CurrentFlow.CREATEUSERNAME = Utility.CurrentUser.USERNAME;
            this.ucFlowSetting.flowProperty.CurrentFlow.CREATEDATE = DateTime.Now;

            this.ucFlowSetting.flowProperty.LoadProperty();
        }
Пример #7
0
        /// <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());
                }
            }
        }
Пример #8
0
        /// <summary>
        /// 根据FlowCode取流程
        /// </summary>
        /// <param name="flowCode">FlowCode</param>
        /// <returns>V_FLOWDEFINITION</returns>
        public V_FLOWDEFINITION GetFlowEntity(string flowCode)
        {
            string sql = "SELECT  a.FlowDefineID, a.FlowCode, a.Description, a.XOML, a.Rules, a.WFLayout, a.Layout, a.FlowType, a.CreateUserId, " +
                         "        a.CreateUserName, a.CreateCompanyId, a.CreateDepartmentID, a.CreatePostId, " +
                         "        a.CreateDate, a.EditUserId, a.EditUserName, a.EditDate,a.SYSTEMCODE,a.BUSINESSOBJECT, " +
                         "        b.MODELFLOWRELATIONID, b.COMPANYID, b.DEPARTMENTID, b.MODELCODE, " +
                         "        b.COMPANYNAME, b.DEPARTMENTNAME, b.SYSTEMCODE as SYSTEMCODE2, " +
                         "        b.FLAG, b.CREATEUSERID M_CreateUserId, b.CREATEUSERNAME M_CreateuserName, b.CREATECOMPANYID M_CreateCompanyId, " +
                         "        b.CREATEDEPARTMENTID M_CreateDepartmentId, b.CREATEPOSTID M_CreatePostId, b.CREATEDATE M_CreateDate, " +
                         "        b.EDITUSERID M_EditUserId, b.EDITUSERNAME M_EditUserName, b.EDITDATE M_EditDate " +
                         " FROM    Flow_FlowDefine_t a left join Flow_Modelflowrelation_t b on a.Flowcode = b.FlowCode " +
                         "WHERE   a.FlowCode = '" + flowCode + "' ";
            V_FLOWDEFINITION flowDefinition = new V_FLOWDEFINITION();

            try
            {
                dao.Open();
                DataTable dtFlow = dao.GetDataTable(sql);
                dao.Close();
                if (dtFlow.Rows.Count > 0)
                {
                    DataRow drFlow = dtFlow.Rows[0];
                    #region 流程定义表
                    flowDefinition.FlowDefinition = new FLOW_FLOWDEFINE_T()
                    {
                        FLOWDEFINEID       = drFlow["FlowDefineID"].ToString(),
                        FLOWCODE           = drFlow["FlowCode"].ToString(),
                        DESCRIPTION        = drFlow["Description"].ToString(),
                        XOML               = drFlow["XOML"].ToString(),
                        RULES              = drFlow["Rules"].ToString(),
                        LAYOUT             = drFlow["Layout"].ToString(),
                        WFLAYOUT           = drFlow["WFLayout"].ToString(),
                        FLOWTYPE           = drFlow["FlowType"].ToString(),
                        CREATEUSERID       = drFlow["CreateUserId"].ToString(),
                        CREATEUSERNAME     = drFlow["CreateUserName"].ToString(),
                        CREATECOMPANYID    = drFlow["CreateCompanyId"].ToString(),
                        CREATEDEPARTMENTID = drFlow["CreateDepartmentID"].ToString(),
                        CREATEPOSTID       = drFlow["CreatePostId"].ToString(),
                        CREATEDATE         = DateTime.Parse(drFlow["CreateDate"].ToString()),
                        EDITUSERID         = DBNull.Value.Equals(drFlow["EditUserId"]) ? string.Empty : drFlow["EditUserId"].ToString(),
                        EDITUSERNAME       = DBNull.Value.Equals(drFlow["EditUserName"]) ? string.Empty : drFlow["EditUserName"].ToString(),
                        EDITDATE           = DBNull.Value.Equals(drFlow["EditDate"]) ? DateTime.Now : DateTime.Parse(drFlow["EditDate"].ToString()),
                        SYSTEMCODE         = drFlow["SYSTEMCODE"].ToString(),
                        BUSINESSOBJECT     = drFlow["BUSINESSOBJECT"].ToString()
                    };
                    #endregion
                    #region 模块与流程定义关联表
                    if (!DBNull.Value.Equals(drFlow["MODELCODE"]))
                    {
                        flowDefinition.ModelRelation = new FLOW_MODELFLOWRELATION_T()
                        {
                            MODELFLOWRELATIONID = drFlow["MODELFLOWRELATIONID"].ToString(),
                            COMPANYID           = drFlow["COMPANYID"].ToString(),
                            DEPARTMENTID        = drFlow["DEPARTMENTID"].ToString(),

                            COMPANYNAME    = drFlow["COMPANYNAME"].ToString(),    //公司名称
                            DEPARTMENTNAME = drFlow["DEPARTMENTNAME"].ToString(), //部门名称
                            SYSTEMCODE     = drFlow["SYSTEMCODE2"].ToString(),    //系统代码

                            MODELCODE          = drFlow["MODELCODE"].ToString(),
                            FLOWCODE           = drFlow["FLOWCODE"].ToString(),
                            FLAG               = drFlow["FLAG"].ToString(),
                            FLOWTYPE           = drFlow["FLOWTYPE"].ToString(),
                            CREATEUSERID       = drFlow["M_CREATEUSERID"].ToString(),
                            CREATEUSERNAME     = drFlow["M_CREATEUSERNAME"].ToString(),
                            CREATECOMPANYID    = drFlow["M_CREATECOMPANYID"].ToString(),
                            CREATEDEPARTMENTID = drFlow["M_CREATEDEPARTMENTID"].ToString(),
                            CREATEPOSTID       = drFlow["M_CREATEPOSTID"].ToString(),
                            CREATEDATE         = DateTime.Parse(drFlow["M_CREATEDATE"].ToString()),
                            EDITUSERID         = DBNull.Value.Equals(drFlow["M_EDITUSERID"]) ? string.Empty : drFlow["M_EDITUSERID"].ToString(),
                            EDITUSERNAME       = DBNull.Value.Equals(drFlow["M_EDITUSERNAME"]) ? string.Empty : drFlow["M_EDITUSERNAME"].ToString(),
                            EDITDATE           = DBNull.Value.Equals(drFlow["M_EditDate"]) ? DateTime.Now : DateTime.Parse(drFlow["M_EDITDATE"].ToString()),
                        };
                    }
                    #endregion
                    return(flowDefinition);//返回
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Пример #9
0
 /// <summary>
 /// 插入历史数据,然后删除
 /// </summary>
 /// <param name="conn">数据库链接</param>
 /// <param name="command">数据库命令</param>
 /// <param name="companyID">公司ID</param>
 /// <param name="modelCode">模块</param>
 /// <param name="departmentID">部门</param>
 /// <param name="flow">视图</param>
 /// <returns>string</returns>
 private string InsertHistory(OracleConnection conn, OracleCommand command, string companyID, string modelCode, string departmentID, V_FLOWDEFINITION flow)
 {
     try
     {
         StringBuilder sb       = new StringBuilder();
         string        flowCode = string.Empty;
         sb.AppendLine("select  flowcode from FLOW_MODELFLOWRELATION_T t");
         sb.AppendLine(" where t.COMPANYID='" + companyID + "'  and t.MODELCODE='" + modelCode + "'");
         if (!string.IsNullOrWhiteSpace(departmentID))
         {
             sb.AppendLine(" AND DEPARTMENTID ='" + departmentID + "'");
         }
         else
         {
             sb.AppendLine(" AND t.departmentid is null");
         }
         DataTable dt = MicrosoftOracle.ExecuteTable(conn, command, sb.ToString(), null);
         if (dt.Rows.Count > 0)
         {
             sb.Clear();
             flowCode = dt.Rows[0]["FLOWCODE"].ToString();
             sb.AppendLine("insert into flow_flowdefine_t_history ");
             sb.AppendLine("SELECT sys_guid(),FLOWCODE,DESCRIPTION,XOML,RULES,LAYOUT,FLOWTYPE,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,");
             sb.AppendLine("CREATEPOSTID,CREATEDATE,'" + flow.FlowDefinition.EDITUSERID + "' as EDITUSERID,'" + flow.FlowDefinition.EDITUSERNAME + "' as EDITUSERNAME,EDITDATE,");
             sb.AppendLine("SYSTEMCODE,BUSINESSOBJECT,WFLAYOUT,FLOWCODE1 FROM FLOW_FLOWDEFINE_T  t");
             sb.AppendLine("where t.FLOWCODE='" + flowCode + "'");
             int n = MicrosoftOracle.ExecuteSQL(conn, command, sb.ToString(), null);
             if (n > 0)
             {
                 sb.Clear();
                 sb.AppendLine("delete FLOW_MODELFLOWRELATION_T t where FLOWCODE='" + flowCode + "'");
                 MicrosoftOracle.ExecuteSQL(conn, command, sb.ToString(), null);
                 sb.Clear();
                 sb.AppendLine("delete FLOW_FLOWDEFINE_T t where FLOWCODE='" + flowCode + "'");
                 MicrosoftOracle.ExecuteSQL(conn, command, sb.ToString(), null);
             }
         }
         return(flowCode);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }