/// <summary> /// 构造函数 /// </summary> static FrameSystemInfo() { if (GetSystemInfoTable == null) { sys_SystemInfoTable si = new sys_SystemInfoTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.OrderType = 0; int Recount = 0; ArrayList lst = BusinessFacade.sys_SystemInfoList(qp, out Recount); if (Recount == 0) { si.DB_Option_Action_ = "Insert"; si.SystemID = BusinessFacade.sys_SystemInfoInsertUpdate(si); } else { si = lst[0] as sys_SystemInfoTable; //更新新加配置 sys_ConfigDataTable sys_ConfigDB = si.S_SystemConfigData; sys_ConfigDataTable sys_Config = new sys_ConfigDataTable(); //foreach (PropertyInfo pi in new sys_ConfigDataTable().GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) foreach (PropertyInfo pi in sys_ConfigDB.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) { if (pi.GetValue(sys_ConfigDB, null) == null) { pi.SetValue(sys_ConfigDB, pi.GetValue(sys_Config, null), null); } } //从Dll中更新版本 //sys_FrameWorkInfoTable sys_Db = si.S_FrameWorkInfo; //sys_FrameWorkInfoTable sys_Dll = new sys_FrameWorkInfoTable(); //foreach (PropertyInfo pi in sys_Db.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) //{ // if (pi.Name != "S_Licensed") // { // pi.SetValue(sys_Db, pi.GetValue(sys_Dll, null), null); // } //} } GetSystemInfoTable = si; } FrameWorkPermission.InitStat = true; }
/// <summary> /// 新增/删除/修改 sys_SystemInfo /// </summary> /// <param name="fam">sys_SystemInfoTable实体类</param> /// <returns>返回0操正常</returns> public override int sys_SystemInfoInsertUpdate(sys_SystemInfoTable fam) { int rInt = 0; using (SqlConnection Conn = GetSqlConnection()) { SqlCommand cmd = new SqlCommand("sys_SystemInfoInsertUpdateDelete", Conn); cmd.CommandType = CommandType.StoredProcedure; //设置参数 cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录 cmd.Parameters.Add("@SystemID", SqlDbType.Int).Value = fam.SystemID; //自动ID cmd.Parameters.Add("@S_Name", SqlDbType.NVarChar).Value = fam.S_Name; //系统名称 cmd.Parameters.Add("@S_Version", SqlDbType.NVarChar).Value = fam.S_Version; //版本号 cmd.Parameters.Add("@S_Licensed", SqlDbType.VarChar).Value = fam.S_Licensed; //序列号 cmd.Parameters.Add("@S_SystemConfigData", SqlDbType.Image).Value = FrameSystemInfo.Serializable_sys_ConfigDataTable(fam.S_SystemConfigData); //系统配置信息 Conn.Open(); rInt = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <summary> /// 将记录集转为sys_SystemInfoTable实体类 /// </summary> /// <param name="dr">记录集</param> /// <returns>sys_SystemInfoTable</returns> protected object Populatesys_SystemInfo(IDataReader dr) { sys_SystemInfoTable nc = new sys_SystemInfoTable(); if (!Convert.IsDBNull(dr["SystemID"])) nc.SystemID = Convert.ToInt32(dr["SystemID"]); // 自动ID if (!Convert.IsDBNull(dr["S_Name"])) nc.S_Name = Convert.ToString(dr["S_Name"]).Trim(); // 系统名称 if (!Convert.IsDBNull(dr["S_Version"])) nc.S_Version = Convert.ToString(dr["S_Version"]).Trim(); // 版本号 if (!Convert.IsDBNull(dr["S_Licensed"])) nc.S_Licensed = Convert.ToString(dr["S_Licensed"]).Trim(); // 序列号 if (!Convert.IsDBNull(dr["S_SystemConfigData"])) nc.S_SystemConfigData = FrameSystemInfo.Deserialize_sys_ConfigDataTable((byte[])dr["S_SystemConfigData"]); // 系统配置信息 if (nc.S_SystemConfigData.C_UploadSizeKb == 0) nc.S_SystemConfigData.C_UploadSizeKb = 512; if (nc.S_SystemConfigData.C_LoginErrorDisableMinute == 0) nc.S_SystemConfigData.C_LoginErrorDisableMinute = 30; if (nc.S_SystemConfigData.C_LoginErrorMaxNum == 0) nc.S_SystemConfigData.C_LoginErrorMaxNum = 5; return nc; }
/// <summary> /// 新增/删除/修改 sys_SystemInfo /// </summary> /// <param name="fam">sys_SystemInfoTable实体类</param> /// <returns>返回0操正常</returns> public abstract int sys_SystemInfoInsertUpdate(sys_SystemInfoTable fam);
/// <summary> /// 根据ID返回 sys_SystemInfoTable实体类 单笔资料 /// </summary> /// <param name="SystemID">自动ID</param> /// <returns>返回sys_SystemInfoTable实体类 SystemID为0则无记录</returns> public static sys_SystemInfoTable sys_SystemInfoDisp(int SystemID) { sys_SystemInfoTable fam = new sys_SystemInfoTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = " Where sys_SystemInfo.SystemID = " + SystemID; int RecordCount = 0; ArrayList lst = sys_SystemInfoList(qp, out RecordCount); if (RecordCount > 0) { fam = (sys_SystemInfoTable)lst[0]; } return fam; }
/// <summary> /// 新增/删除/修改 sys_SystemInfo /// </summary> /// <param name="fam">sys_SystemInfoTable实体类</param> /// <returns>返回0操正常</returns> public static int sys_SystemInfoInsertUpdate(sys_SystemInfoTable fam) { return DataProvider.Instance().sys_SystemInfoInsertUpdate(fam); }