Пример #1
0
        //更新配置
        public void Update(WorkFlowCfg flowCfg)
        {
            SqlParameter[] sqlParams =
            {
                new SqlParameter("id",                 flowCfg.id),
                new SqlParameter("flowType",           flowCfg.flowType),
                new SqlParameter("workShop",           flowCfg.flowType),
                new SqlParameter("workShopName",       flowCfg.flowType),
                new SqlParameter("flowIdentify",       flowCfg.flowType),
                new SqlParameter("flowName",           flowCfg.flowType),
                new SqlParameter("timeBoundary_left",  flowCfg.flowType),
                new SqlParameter("timeBoundary_right", flowCfg.flowType),
                new SqlParameter("withPlanID",         flowCfg.flowType),
                new SqlParameter("enable",             flowCfg.flowType),
                new SqlParameter("necessary",          flowCfg.necessary)
            };

            string sql = @"select count(*) from TAB_Plan_WorkFlowCfg where strFlowIdentify = @flowIdentify and strflowType = @flowType and @nID <> @id";

            if (Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, sql, sqlParams)) > 0)
            {
                throw new Exception(string.Format("已存在流程类型为\"{0}\" 流程标识为\"{1}\"的配置信息.", flowCfg.flowType, flowCfg.flowIdentify));
            }


            sql = @"udpate TAB_Plan_WorkFlowCfg set strflowType = @flowType,strWorkShop = @workShop,strWorkShopName = @workShopName,
                strFlowIdentify = @flowIdentify,strFlowName = @flowName,nTimeBoundary_left = @timeBoundary_left,
                nTimeBoundary_right=@timeBoundary_right,nWithPlanID=@withPlanID,nEnable=@enable,nNecessary = @necessary) where nID = @id";
            SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, sql, sqlParams);
        }
Пример #2
0
        //查询配置列表
        public void Query(string flowType, string workShop, List <WorkFlowCfg> cfgs)
        {
            cfgs.Clear();
            string sql = @"select * from TAB_Plan_WorkFlowCfg where 1=1";

            if (!string.IsNullOrEmpty(flowType))
            {
                sql += string.Format(" and strFlowType = '{0}'", flowType);
            }


            if (!string.IsNullOrEmpty(workShop))
            {
                sql += string.Format(" and strWorkShop = '{0}'", workShop);
            }

            WorkFlowCfg cfg;
            DataTable   dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql).Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                cfg = new WorkFlowCfg();
                DataRowToCfg(dr, cfg);

                cfgs.Add(cfg);
            }
        }
Пример #3
0
        //删除配置信息
        public InterfaceRet Del(string data)
        {
            _ret.Clear();
            WorkFlowCfg workFlowCfg = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkFlowCfg>(data);

            _dbWorkFlowCfg.Del(workFlowCfg.id);

            return(_ret);
        }
Пример #4
0
 //数据行信息填充到实体
 private void DataRowToCfg(DataRow dr, WorkFlowCfg cfg)
 {
     cfg.id                 = ObjectConvertClass.static_ext_int(dr["nID"]);
     cfg.flowType           = ObjectConvertClass.static_ext_string(dr["strFlowType"]);
     cfg.flowIdentify       = ObjectConvertClass.static_ext_string(dr["strFlowIdentify"]);
     cfg.flowName           = ObjectConvertClass.static_ext_string(dr["strFlowName"]);
     cfg.timeBoundary_left  = ObjectConvertClass.static_ext_int(dr["nTimeBoundary_left"]);
     cfg.timeBoundary_right = ObjectConvertClass.static_ext_int(dr["nTimeBoundary_right"]);
     cfg.withPlanID         = ObjectConvertClass.static_ext_int(dr["nWithPlanID"]);
     cfg.workShop           = ObjectConvertClass.static_ext_string(dr["strWorkShop"]);
     cfg.workShopName       = ObjectConvertClass.static_ext_string(dr["strWorkShopName"]);
     cfg.necessary          = ObjectConvertClass.static_ext_int(dr["nNecessary"]);
     cfg.lackFlowHint       = ObjectConvertClass.static_ext_string(dr["strLackFlowHint"]);
 }
Пример #5
0
        //通过flowType,flowIdentify查找配置
        public WorkFlowCfg Find(string flowType, string flowIdentify)
        {
            string sql = @"select * from TAB_Plan_WorkFlowCfg where strFlowType = '{0}' and strFlowIdentify = '{1}'";

            sql = string.Format(sql, flowType, flowIdentify);

            WorkFlowCfg cfg;
            DataTable   dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                cfg = new WorkFlowCfg();
                DataRowToCfg(dt.Rows[0], cfg);
                return(cfg);
            }
            else
            {
                return(null);
            }
        }