示例#1
0
        /// <summary>
        /// 删除用户数据
        /// </summary>
        /// <param name="infos"></param>
        /// <returns></returns>
        public bool DeleteDatabaseToUser(params UserInfo[] infos)
        {
            UserInfoDll user = new UserInfoDll();
            int         cout = user.Delete(infos.ToList());

            if (cout == infos.Length)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 序列化
        /// </summary>
        public static void Serialize()
        {
            string dllPath  = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string userPath = dllPath.Replace("application\\", "Cofigure\\SerializeUser.dat");

            if (File.Exists(userPath))
            {
                File.Delete(userPath);
            }
            List <UserInfo> users = new UserInfoDll().GetList();
            FileStream      fs    = new FileStream(userPath, FileMode.Create);
            BinaryFormatter bf    = new BinaryFormatter();

            bf.Serialize(fs, users);
            fs.Close();
        }
        private static void DeleUserData()
        {
            string dllPath  = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string userPath = dllPath.Replace("application\\", "Cofigure\\SerializeUser.dat");

            if (File.Exists(userPath))
            {
                try
                {
                    File.Delete(userPath);
                }
                catch
                {
                }
            }

            UserInfoDll user = new UserInfoDll();

            user.Delete(user.GetList());
        }