コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dmObject"></param>
        /// <param name="bllObject"></param>
        /// <param name="keyValues"></param>
        /// <param name="statusName"></param>
        /// <param name="loginUserName"></param>
        /// <returns></returns>
        public static bool EntityStatusInfo(object dmObject, object bllObject, object[][] keyValues, string statusName, string loginUserName)
        {
            int codeValue = new CodeItemBLL().GetValueByCodeItemName("SET_STATUS_TYPE", statusName.Replace("#", string.Empty));

            if (codeValue == 0)
            {
                throw new Exception("MC:7x00000000");///未配置设定状态类型
            }
            string     methodName = statusName.Substring(0, 1).ToUpper() + statusName.Substring(1).ToLower();
            MethodInfo method     = bllObject.GetType().GetMethod("Entity" + methodName + "Infos");

            if (method == null)
            {
                throw new Exception("MC:0x00000188");///后端没找到对应的方法
            }
            List <object> objs    = new List <object>();
            List <string> rowKeys = new List <string>();

            for (int i = 0; i < keyValues.Length; i++)
            {
                string rowKeyValues = string.Empty;
                for (int j = 0; j < keyValues[i].Length; j++)
                {
                    rowKeyValues += "^" + keyValues[i][j].ToString();
                }
                rowKeys.Add(rowKeyValues.Substring(1));
            }
            objs.Add(dmObject);
            objs.Add(rowKeys);
            objs.Add(loginUserName);
            return(bool.Parse(method.Invoke(bllObject, objs.ToArray()).ToString()));
        }
コード例 #2
0
        /// <summary>
        /// 更新数据状态函数
        /// </summary>
        /// <param name="bllObject"></param>
        /// <param name="keyValues"></param>
        /// <param name="statusName"></param>
        /// <param name="loginUserName"></param>
        /// <returns></returns>
        private static bool StatusInfo(object bllObject, object[][] keyValues, string statusName, string loginUserName)
        {
            int codeValue = new CodeItemBLL().GetValueByCodeItemName("SET_STATUS_TYPE", statusName.Replace("#", string.Empty));

            ///未配置设定状态类型
            if (codeValue == 0)
            {
                throw new Exception("MC:7x00000000");
            }
            string methodName = statusName.Substring(0, 1).ToUpper() + statusName.Substring(1).ToLower();

            if (statusName.StartsWith("#"))
            {
                methodName = "Undo" + statusName.Substring(1, 1).ToUpper() + statusName.Substring(2).ToLower();
            }
            MethodInfo method = bllObject.GetType().GetMethod(methodName + "Info");

            if (method == null)
            {
                method = bllObject.GetType().GetMethod(methodName + "Infos");
            }
            if (method == null)
            {
                throw new Exception("MC:0x00000188");
            }
            List <object> objs = new List <object>();

            if (method.Name.Contains("Infos"))
            {
                List <string> rowKeys = new List <string>();
                for (int i = 0; i < keyValues.Length; i++)
                {
                    string rowKeyValues = string.Empty;
                    for (int j = 0; j < keyValues[i].Length; j++)
                    {
                        rowKeyValues += "^" + keyValues[i][j].ToString();
                    }
                    rowKeys.Add(rowKeyValues.Substring(1));
                }
                objs.Add(rowKeys);
                objs.Add(loginUserName);
            }
            else
            {
                objs = keyValues[0].ToList();
                objs.Add(loginUserName);
            }
            return(bool.Parse(method.Invoke(bllObject, objs.ToArray()).ToString()));
        }