示例#1
0
 internal BusinessObject[] GetBusinessObjects(string businessId)
 {
     try
     {
         string           sql     = string.Format("select Summary, SQL, Repeated, InterActive, AffectedParam from t_frm_BusinessProcs where BusinessID = '{0}' and Enabled=1 order by Idx", businessId);
         DataTable        data    = Frm_Helper.GetDataSet_SQL(sql).Tables[0];
         BusinessObject[] objects = new BusinessObject[data.Rows.Count];
         for (int i = 0; i < data.Rows.Count; i++)
         {
             objects[i]               = new BusinessObject();
             objects[i].Summary       = data.Rows[i]["Summary"].ToString();
             objects[i].Repeated      = data.Rows[i]["Repeated"].ToString() == "True" ? true : false;
             objects[i].InterActive   = data.Rows[i]["InterActive"].ToString() == "True" ? true : false;
             objects[i].AffectedParam = data.Rows[i]["AffectedParam"].ToString();
             objects[i].Sql           = data.Rows[i]["SQL"].ToString();
             objects[i].Sql           = objects[i].Sql.Replace(':', '@');
         }
         return(objects);
     }
     catch (Exception ex)
     {
         Loger.Error(ex);
         throw ex;
     }
 }
示例#2
0
        public void Load()
        {
            if (Loaded)
            {
                return;
            }
            if (BusinessName == string.Empty)
            {
                throw new RFException(AlertMessage.Business_ObjNameEmpyt);
            }
            string    sql  = string.Format("select * from t_frm_Business  where BusinessID = '{0}'", BusinessName);
            DataTable data = Frm_Helper.GetDataSet_SQL(sql).Tables[0];

            if (data == null || data.Rows.Count <= 0)//"业务过程[" + BusinessName + "]不存在,请检阅相关文档!"
            {
                throw new RFException(string.Format(AlertMessage.Business_NoBusinessName, BusinessName));
            }

            NeedTranscation = (bool)data.Rows[0]["NeedTranscation"] == true ? true : false;
            data.Dispose();

            //if (dsDataObject == null)2018-1-5
            //{
            //    throw new RFException(AlertMessage.Business_ObjNameEmpyt);
            //}
            GetBusinessParams();
            //if (OnlySubmitModify)
            //{
            //    for (int n = 0; n < dsDataObject.Tables.Count; n++)
            //    {
            //        if (dsDataObject.Tables[n].TableName.IndexOf("Detail") != -1)
            //        {
            //            string UpdateFlag = "UpdateFlag";
            //            if (dsDataObject.Tables[n].TableName.IndexOf("Detail_") != -1)
            //                UpdateFlag += dsDataObject.Tables[n].TableName.Substring(8);
            //            dsDataObject.Tables[n].DefaultView.RowFilter = UpdateFlag + " in('I','U','D')";
            //        }
            //    }

            //}
            CheckObjects        = GetBusinessCheckObjects("*");
            ProcessObjects      = GetBusinessProcessObjects();
            ParamsRequiredValid = GetRequiredValidJson();
            Loaded = true;
        }
示例#3
0
        /// <summary>
        /// 获取业务检查对象
        /// </summary>
        /// <param name="paramName"></param>
        /// <returns></returns>
        internal CheckObject[] GetBusinessCheckObjects(string paramName)
        {
            try
            {
                string sql = "";
                if (paramName == "*")
                {
                    sql = string.Format("select a.Summary,a.ValidateType,a.CompareType,a.MaximumValue,a.MinimumValue,a.ParamToValidate,a.ParamToCompare,a.SQL,b.Repeated, a.CheckType from t_frm_BusinessChecks a left join t_frm_BusinessParams b on a.BusinessID = b.BusinessID and a.ParamToValidate = b.ParamName where a.BusinessID = '{0}' and a.Enabled=1 order by a.Idx", BusinessName);
                }
                else
                {
                    sql = string.Format("select a.Summary,a.ValidateType,a.CompareType,a.MaximumValue,a.MinimumValue,a.ParamToValidate,a.ParamToCompare,a.SQL,b.Repeated, a.CheckType from t_frm_BusinessChecks a left join t_frm_BusinessParams b on a.BusinessID = b.BusinessID and a.ParamToValidate = b.ParamName where a.BusinessID = '{0}' and a.ParamToValidate = '{1}' and a.Enabled=1 order by a.Idx", BusinessName, paramName);
                }
                DataTable data = Frm_Helper.GetDataSet_SQL(sql).Tables[0];
                if (data.Rows.Count == 0 && paramName != "*") //2016-7-01 && paramName != "*"
                {
                    throw new RFException(string.Format(AlertMessage.Business_NoCheckParam, paramName));
                }
                CheckObject[] objects = new CheckObject[data.Rows.Count];
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    objects[i]                   = new CheckObject();
                    objects[i].Summary           = FormatSummary(data.Rows[i]["Summary"].ToString());
                    objects[i].ValidateType      = data.Rows[i]["ValidateType"].ToString();
                    objects[i].CompareType       = data.Rows[i]["CompareType"].ToString();
                    objects[i].MaxValue          = data.Rows[i]["MaximumValue"].ToString();
                    objects[i].MinValue          = data.Rows[i]["MinimumValue"].ToString();
                    objects[i].ValidateParamName = data.Rows[i]["ParamToValidate"].ToString();
                    objects[i].CompareParamName  = data.Rows[i]["ParamToCompare"].ToString();
                    objects[i].Sql               = data.Rows[i]["SQL"].ToString();
                    objects[i].Sql               = objects[i].Sql.Replace(':', '@');
                    objects[i].Repeated          = data.Rows[i]["Repeated"].ToString() == "True" ? true : false;                                    //2016-06-23 增加初始参数是否为重复执行
                    objects[i].CheckType         = data.Rows[i]["CheckType"] == DBNull.Value ? 0 : int.Parse(data.Rows[i]["CheckType"].ToString()); //0.警告后终止;1.警告继续;2.警告后确认是否继续
                    objects[i].Index             = i;
                }

                return(objects);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
 internal QueryObject GetQueryObject(string query_name)
 {
     try
     {
         string      sql  = string.Format("select SQL from t_frm_StdQuery where QueryName = '{0}'", query_name);
         DataTable   data = Frm_Helper.GetDataSet_SQL(sql).Tables[0];
         QueryObject obj  = null;
         if (data.Rows.Count > 0)
         {
             obj     = new QueryObject();
             obj.Sql = data.Rows[0]["SQL"].ToString().Replace(':', '@');
         }
         return(obj);
     }
     catch (Exception ex)
     {
         Loger.Error(ex);
         throw ex;
     }
 }
示例#5
0
        internal CheckObject[] GetCheckObjects(string businessId, string paramName)
        {
            try
            {
                string sql = "";
                if (paramName == "*")
                {
                    sql = string.Format("select Summary,ValidateType,CompareType,MaximumValue,MinimumValue,ParamToValidate,ParamToCompare,SQL from t_frm_BusinessChecks where BusinessID = '{0}' and Enabled=1 order by Idx", businessId);
                }
                else
                {
                    sql = string.Format("select Summary,ValidateType,CompareType,MaximumValue,MinimumValue,ParamToValidate,ParamToCompare,SQL from t_frm_BusinessChecks where BusinessID = '{0}' and ParamToValidate = '{1}' and Enabled=1 order by Idx", businessId, paramName);
                }
                DataTable data = Frm_Helper.GetDataSet_SQL(sql).Tables[0];
                if (data.Rows.Count == 0)
                {
                    throw new RFException("业务检查参数[" + paramName + "]不存在!");
                }
                CheckObject[] objects = new CheckObject[data.Rows.Count];
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    objects[i]                   = new CheckObject();
                    objects[i].Summary           = data.Rows[i]["Summary"].ToString();
                    objects[i].ValidateType      = data.Rows[i]["ValidateType"].ToString();
                    objects[i].CompareType       = data.Rows[i]["CompareType"].ToString();
                    objects[i].MaxValue          = data.Rows[i]["MaximumValue"].ToString();
                    objects[i].MinValue          = data.Rows[i]["MinimumValue"].ToString();
                    objects[i].ValidateParamName = data.Rows[i]["ParamToValidate"].ToString();
                    objects[i].CompareParamName  = data.Rows[i]["ParamToCompare"].ToString();
                    objects[i].Sql               = data.Rows[i]["SQL"].ToString();
                    objects[i].Sql               = objects[i].Sql.Replace(':', '@');
                }

                return(objects);
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
                throw ex;
            }
        }