/// <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_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> /// ����/ɾ��/�� sys_SystemInfo /// </summary> /// <param name="fam">sys_SystemInfoTableʵ����</param> /// <returns>����0������</returns> public override int sys_SystemInfoInsertUpdate(sys_SystemInfoTable fam) { int rInt = 0; using (OracleConnection Conn = GetSqlConnection()) { string CommTxt; OracleCommand cmd = new OracleCommand(); cmd.Connection = Conn; if (fam.DB_Option_Action_ == "Insert") { CommTxt = "Insert into sys_SystemInfo(SystemID,S_Name,S_Version,S_SystemConfigData,S_Licensed)VALUES(SEQ_sys_SystemInfo_ID.NEXTVAL,:S_Name,:S_Version,:S_SystemConfigData,:S_Licensed)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("S_Name", OracleType.NVarChar).Value = fam.S_Name + ""; //ϵͳ���� cmd.Parameters.Add("S_Version", OracleType.NVarChar).Value = fam.S_Version + ""; //�汾�� cmd.Parameters.Add("S_SystemConfigData", OracleType.LongRaw).Value = FrameSystemInfo.Serializable_sys_ConfigDataTable(fam.S_SystemConfigData); //ϵͳ������Ϣ cmd.Parameters.Add("S_Licensed", OracleType.VarChar).Value = fam.S_Licensed + ""; //���к� } else if (fam.DB_Option_Action_ == "Update") { CommTxt = "UPDATE sys_SystemInfo SET S_Name = :S_Name,S_Version = :S_Version,S_SystemConfigData = :S_SystemConfigData,S_Licensed = :S_Licensed WHERE (SystemID = :SystemID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("S_Name", OracleType.NVarChar).Value = fam.S_Name + ""; //ϵͳ���� cmd.Parameters.Add("S_Version", OracleType.NVarChar).Value = fam.S_Version + ""; //�汾�� cmd.Parameters.Add("S_SystemConfigData", OracleType.LongRaw).Value = FrameSystemInfo.Serializable_sys_ConfigDataTable(fam.S_SystemConfigData); //ϵͳ������Ϣ cmd.Parameters.Add("S_Licensed", OracleType.VarChar).Value = fam.S_Licensed + ""; //���к� cmd.Parameters.Add("SystemID", OracleType.Int32).Value = fam.SystemID; } else if (fam.DB_Option_Action_ == "Delete") { CommTxt = "Delete from sys_SystemInfo WHERE (SystemID = :SystemID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("SystemID", OracleType.Int32).Value = fam.SystemID; } else throw new ApplicationException("��ʶ��IJ�������!"); Conn.Open(); OracleTransaction Tran = Conn.BeginTransaction(); cmd.Transaction = Tran; try { rInt = cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); if (fam.DB_Option_Action_ == "Insert") { cmd.CommandText = "select SEQ_sys_SystemInfo_ID.CURRVAL from dual"; rInt = Convert.ToInt32(cmd.ExecuteScalar()); } Tran.Commit(); } catch (Exception ex) { Tran.Rollback(); throw new ApplicationException(ex.ToString()); } finally { Tran.Dispose(); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } } return rInt; }
/// <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 (OleDbConnection Conn = GetSqlConnection()) { string CommTxt; OleDbCommand cmd = new OleDbCommand(); cmd.Connection = Conn; if (fam.DB_Option_Action_ == "Insert") { CommTxt = "Insert into sys_SystemInfo(S_Name,S_Version,S_SystemConfigData,S_Licensed)VALUES(@S_Name,@S_Version,@S_SystemConfigData,@S_Licensed)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@S_Name", OleDbType.VarWChar).Value = fam.S_Name + ""; //系统名称 cmd.Parameters.Add("@S_Version", OleDbType.VarWChar).Value = fam.S_Version + ""; //版本号 cmd.Parameters.Add("@S_SystemConfigData", OleDbType.VarBinary).Value = FrameSystemInfo.Serializable_sys_ConfigDataTable(fam.S_SystemConfigData); //系统配置信息 cmd.Parameters.Add("@S_Licensed", OleDbType.VarWChar).Value = fam.S_Licensed + ""; //序列号 } else if (fam.DB_Option_Action_ == "Update") { CommTxt = "UPDATE sys_SystemInfo SET S_Name = @S_Name,S_Version = @S_Version,S_SystemConfigData = @S_SystemConfigData,S_Licensed = @S_Licensed WHERE (SystemID = @SystemID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@S_Name", OleDbType.VarWChar).Value = fam.S_Name + ""; //系统名称 cmd.Parameters.Add("@S_Version", OleDbType.VarWChar).Value = fam.S_Version + ""; //版本号 cmd.Parameters.Add("@S_SystemConfigData", OleDbType.VarBinary).Value = FrameSystemInfo.Serializable_sys_ConfigDataTable(fam.S_SystemConfigData); //系统配置信息 cmd.Parameters.Add("@S_Licensed", OleDbType.VarWChar).Value = fam.S_Licensed + ""; //序列号 cmd.Parameters.Add("@SystemID", OleDbType.Integer).Value = fam.SystemID; } else if (fam.DB_Option_Action_ == "Delete") { CommTxt = "Delete from sys_SystemInfo WHERE (SystemID = @SystemID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@SystemID", OleDbType.Integer).Value = fam.SystemID; } else throw new ApplicationException("无法识别的操作命令!"); Conn.Open(); rInt = cmd.ExecuteNonQuery(); if (fam.DB_Option_Action_ == "Insert") { cmd.CommandText = "SELECT @@identity"; rInt = Convert.ToInt32(cmd.ExecuteScalar()); } cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <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); }
/// <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 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; }