Ejemplo n.º 1
0
        public static SmartDbParams Parse(JObject values)
        {
            SmartDbParams dbParams = new SmartDbParams();

            foreach (var val in values)
            {
                dbParams.SetParameter(val.Key, val.Value);
            }
            return(dbParams);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行Business业务 通过参数赋值,执行
        /// </summary>
        /// <returns></returns>
        public void ExecuteForParam(SmartDbParams dbParams = null)
        {
            CurrentValidateParam = string.Empty;
            if (!DBHelper.CheckBusinessPower(BusinessName, this.Operator))
            {
                throw new RFException(AlertMessage.Business_NoPower);
            }
            if (!Loaded)
            {
                Load();
            }
            ValidateUser();
            if (dbParams != null)
            {
                foreach (var par in dbParams.paras)
                {
                    SetParameter(par.Key.ToString(), par.Value.Value);
                }
            }
            ExecBusinessCheckForParams();//执行业务检查

            object val = GetParameter("LastUpdateTime");

            SetParameter("Old_LastUpdateTime", val.ToString() == string.Empty ? null : val);
            SetParameter("LastUpdateTime", GetServerDateTime());

            string Summary = string.Empty;

            if (NeedTranscation)
            {
                Bss_Helper.BeginTrans();//开始事务
            }
            try
            {
                foreach (BusinessObject bis in ProcessObjects)
                {
                    Summary = bis.Summary;
                    bis.DoValidate(paras, this);
                }
                if (NeedTranscation)
                {
                    Bss_Helper.Commit();//事务提交
                }
            }
            catch (Exception ex)
            {
                if (NeedTranscation)
                {
                    Bss_Helper.RollBack();
                }
                throw new RFException("执行【" + FormatSummary(Summary) + "】错误:<br/><br/>" + ex.Message);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 根据参数修改主表dt的值
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="dbParams"></param>
 /// <param name="allowSysParams"></param>
 public static void DataObjectMasterTableModify(DataTable dt, SmartDbParams dbParams, bool allowSysParams = false)
 {
     //从视图界面传入,如有系统参数不处理
     if (dt == null || dbParams == null || dbParams.paras.Count == 0)
     {
         return;
     }
     foreach (var par in dbParams.paras)
     {
         string a = par.Key;
         if (!allowSysParams && SysParams.Contains <string>(par.Key))
         {
             continue;
         }
         if (dt.Columns.Contains(par.Key))
         {
             dt.Rows[0][par.Key] = dbParams.GetParameter(par.Key);
         }
     }
 }