Exemple #1
0
        public static string QianShi(Data.Model.WorkFlowCustomEventParams eventParams)
        {
            string title    = System.Web.HttpContext.Current.Request.Form["Title"];
            string Contents = System.Web.HttpContext.Current.Request.Form["Contents"];

            if (eventParams.InstanceID.IsInt())
            {
                string         sql      = "UPDATE TempTest_CustomForm SET Title=@Title,Contents=@Contents WHERE ID=@ID";
                SqlParameter[] parArray =
                {
                    new SqlParameter("@Title",    title),
                    new SqlParameter("@Contents", Contents),
                    new SqlParameter("@ID",       eventParams.InstanceID.ToString())
                };
                new Data.MSSQL.DBHelper().Execute(sql, parArray);
                return(eventParams.InstanceID.ToString());
            }
            else
            {
                string         sql      = "INSERT INTO TempTest_CustomForm(Title,Contents,FlowCompleted) VALUES(@Title,@Contents,@FlowCompleted);SELECT SCOPE_IDENTITY();";
                SqlParameter[] parArray =
                {
                    new SqlParameter("@Title",         title),
                    new SqlParameter("@Contents",      Contents),
                    new SqlParameter("@FlowCompleted", "0")
                };
                return(new Data.MSSQL.DBHelper().ExecuteScalar(sql, parArray));
            }
        }
Exemple #2
0
        /// <summary>
        /// 执行自定义步骤事件
        /// </summary>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public object ExecuteFlowCustomEvent(string eventName, Data.Model.WorkFlowCustomEventParams eventParams, string dllName = "App_Code")
        {
            System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(dllName);
            string typeName   = System.IO.Path.GetFileNameWithoutExtension(eventName);
            string methodName = eventName.Substring(typeName.Length + 1);
            Type   type       = assembly.GetType(typeName, true);

            object obj    = System.Activator.CreateInstance(type, false);
            var    method = type.GetMethod(methodName);

            if (method != null)
            {
                return(method.Invoke(obj, new object[] { eventParams }));
            }
            else
            {
                throw new MissingMethodException(typeName, methodName);
            }
        }
Exemple #3
0
 public static object GetJson(Data.Model.WorkFlowCustomEventParams eventParams)
 {
     return(new Data.MSSQL.DBHelper().GetDataTable("select * from users"));
 }
Exemple #4
0
        /// <summary>
        /// 得到Grid的html
        /// </summary>
        /// <param name="dataFormat"></param>
        /// <param name="dataSource"></param>
        /// <param name="dataSource1"></param>
        /// <returns></returns>
        public string GetFormGridHtml(string connID, string dataFormat, string dataSource, string dataSource1)
        {
            if (!dataFormat.IsInt() || !dataSource.IsInt() || dataSource1.IsNullOrEmpty())
            {
                return("");
            }

            switch (dataSource)
            {
            case "0":
                DBConnection dbConn = new DBConnection();
                var          dbconn = dbConn.Get(connID.ToGuid());
                if (dbconn == null)
                {
                    return("");
                }
                DataTable dt = dbConn.GetDataTable(dbconn, dataSource1.ReplaceSelectSql());
                switch (dataFormat)
                {
                case "0":
                    return(dataTableToHtml(dt));

                case "1":
                    return(dt.Rows.Count > 0 ? dt.Rows[0][0].ToString() : "");

                case "2":
                    return(dt.Rows.Count > 0 ? jsonToHtml(dt.Rows[0][0].ToString()) : "");

                default:
                    return("");
                }

            case "1":
                string str = string.Empty;
                try
                {
                    str = Utility.HttpHelper.SendGet(dataSource1);
                    switch (dataFormat)
                    {
                    case "0":
                    case "1":
                        return(str);

                    case "2":
                        return(jsonToHtml(str));

                    default:
                        return("");
                    }
                }
                catch
                {
                    return("");
                }

            case "2":
                Data.Model.WorkFlowCustomEventParams eventParams = new Data.Model.WorkFlowCustomEventParams();
                eventParams.FlowID     = (System.Web.HttpContext.Current.Request.QueryString["FlowID"] ?? "").ToGuid();
                eventParams.GroupID    = (System.Web.HttpContext.Current.Request.QueryString["GroupID"] ?? "").ToGuid();
                eventParams.StepID     = (System.Web.HttpContext.Current.Request.QueryString["StepID"] ?? "").ToGuid();
                eventParams.TaskID     = (System.Web.HttpContext.Current.Request.QueryString["TaskID"] ?? "").ToGuid();
                eventParams.InstanceID = System.Web.HttpContext.Current.Request.QueryString["InstanceID"] ?? "";
                object obj = null;
                try
                {
                    obj = new WorkFlowTask().ExecuteFlowCustomEvent(dataSource1, eventParams);
                    switch (dataFormat)
                    {
                    case "0":
                        return(dataTableToHtml((DataTable)obj));

                    case "1":
                        return(obj.ToString());

                    case "2":
                        return(jsonToHtml(obj.ToString()));

                    default:
                        return("");
                    }
                }
                catch
                {
                    return("");
                }
            }

            return("");
        }