private string _tablename = "MES_Comm_DLLReflect"; //MES_CQ_DLLReflect /// <summary> /// 得到一个对象实体 /// </summary> public Model.DLLReflect GetModel(string where) { StringBuilder strSql = new StringBuilder(); strSql.Append("select tasktype,id, cvouchertype, Dllpath, Namespace, ClassName, ClassType "); strSql.Append(" from " + _tablename); strSql.Append(" where "); strSql.Append(where); Model.DLLReflect model = new Model.DLLReflect(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), null); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.TaskType = int.Parse(ds.Tables[0].Rows[0]["tasktype"].ToString()); model.Cvouchertype = ds.Tables[0].Rows[0]["cvouchertype"].ToString(); model.Dllpath = ds.Tables[0].Rows[0]["Dllpath"].ToString(); model.Npace = ds.Tables[0].Rows[0]["Namespace"].ToString(); model.ClassName = ds.Tables[0].Rows[0]["ClassName"].ToString(); model.ClassType = ds.Tables[0].Rows[0]["ClassType"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 获取数据对象 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static BaseData GetBaseData(Model.Synergismlogdt dt) { DAL.DLLReflect dal = new DAL.DLLReflect(); Model.DLLReflect model = dal.GetModel("cvouchertype='" + dt.Cvouchertype + "' and ClassType='data' and tasktype = " + dt.TaskType); Common.ErrorMsg(model, "未能取到数据对象"); return((BaseData)System.Reflection.Assembly.Load(model.Dllpath).CreateInstance(model.Npace + "." + model.ClassName, true, System.Reflection.BindingFlags.CreateInstance, null, new object[] { model.TaskType }, null, null)); }
/// <summary> /// 任务Main BLL 工厂 /// </summary> /// <param name="tasktype"></param> /// <returns></returns> public static BLL.TaskLog.ITaskLogMain GetITaskLogMainBLL(int taskType) { DAL.DLLReflect dal = new DAL.DLLReflect(); Model.DLLReflect model = dal.GetModel("ClassType='logBLL' and tasktype = " + taskType); Common.ErrorMsg(model, "未能取到数据对象"); return((BLL.TaskLog.ITaskLogMain)System.Reflection.Assembly.Load(model.Dllpath).CreateInstance(model.Npace + "." + model.ClassName, true, System.Reflection.BindingFlags.CreateInstance, null, null, null, null)); }
/// <summary> /// 获取操作对象 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static BaseOp GetBaseOp(Model.Synergismlog dt) { DAL.DLLReflect dal = new DAL.DLLReflect(); string swhere = "cvouchertype='" + dt.Cvouchertype + "' and ClassType='op' and tasktype = " + dt.TaskType; Model.DLLReflect model = dal.GetModel(swhere); Common.ErrorMsg(model, "未能取到操作类型对象"); return((BaseOp)System.Reflection.Assembly.Load(model.Dllpath).CreateInstance(model.Npace + "." + model.ClassName)); }