当前位置: 首页>>代码示例>>C#>>正文


C# CMModel.DBManager类代码示例

本文整理汇总了C#中CMModel.DBManager的典型用法代码示例。如果您正苦于以下问题:C# DBManager类的具体用法?C# DBManager怎么用?C# DBManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DBManager类属于CMModel命名空间,在下文中一共展示了DBManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAccountTypeByHostType

 public AccountTypeDB GetAccountTypeByHostType(HostType hostType)
 {
     DBManager db = new DBManager();
     string accountTypeName = AccountTypeDB.FromTypeCodeToString(hostType);
     var accountType = db.GetAccountTypeByName(accountTypeName);
     return accountType;
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:7,代码来源:DatabaseController.cs

示例2: DeleteAccountList

 public int DeleteAccountList(List<int> IdList)
 {
     DBManager db = new DBManager();
     foreach(int id in IdList)
     {
         db.DeleteAccountById(id);
     }
     return 1;
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:9,代码来源:DatabaseController.cs

示例3: GetOrAddAccountByAccountText

        // Account

        public AccountD GetOrAddAccountByAccountText(string accountText, HostType hostType)
        {
            DBManager db = new DBManager();
            string accountTypeName = AccountTypeDB.FromTypeCodeToString(hostType);
            AccountD account = db.GetAccountByUserNameAndAccountTypeName(accountText, accountTypeName);

            if(account == null) // add new
            {
                AccountType type = db.GetAccountTypeByName(accountTypeName);
                int accountID = db.AddNewAccount(accountText, "", type.Id);

                account = db.GetAccountById(accountID);             
            }
            account.HostType = hostType;
            return account;
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:18,代码来源:DatabaseController.cs

示例4: SaveDatabaseParameters

        public void SaveDatabaseParameters(int contactLimit, int groupLimit)
        {
            DBManager db = new DBManager();

            string saveData = "{";
            saveData += "'contact_limit':" + contactLimit + ",";
            saveData += "'group_limit':" + groupLimit;
            saveData += "}";
            SecurityManager secMng = new SecurityManager();
            saveData = secMng.EncryptText(saveData);

            db.SaveDatabaseParameters(saveData);


            ContactDB.MAX_CONTACT = contactLimit;
            GroupDB.MAX_GROUP = groupLimit;
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:17,代码来源:DatabaseParameterController.cs

示例5: GetOrAddAccountByAccountText

        // Account

        public AccountDB GetOrAddAccountByAccountText(string accountText)
        {
            DBManager db = new DBManager();
            HostType hostType = MyUtils.GetHostTypeFromAccount(accountText);
            string accountTypeName = AccountTypeDB.FromTypeCodeToString(hostType);
            AccountDB account = db.GetAccountByUserNameAndAccountTypeName(accountText, accountTypeName);

            if(account.Id <= 0) // add new
            {
                AccountTypeDB type = db.GetAccountTypeByName(accountTypeName);
                int accountID = db.AddNewAccount(accountText, "", type.Id);

                account = db.GetAccountById(accountID);
                account.HostType = hostType;
            }
            account.AccountTypeName = accountTypeName;
            return account;
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:20,代码来源:DatabaseController.cs

示例6: LoadDatabaseParameters

        public void LoadDatabaseParameters()
        {
            DBManager db = new DBManager();
            string text = db.LoadDatabaseParameters();
            if (!String.IsNullOrEmpty(text))
            {
                SecurityManager secMng = new SecurityManager();
                string json = secMng.DecryptText(text);

                if (!String.IsNullOrEmpty(json))
                {
                    JToken token = null;
                    try
                    {
                        token = JObject.Parse(json);
                    }
                    catch (Exception e)
                    {
                        return;
                    }
                    JToken temp = token.SelectToken("contact_limit");
                    string contact_limit = temp != null ? temp.ToString() : "";
                    temp = token.SelectToken("group_limit");
                    string group_limit = temp != null ? temp.ToString() : "";

                    int limitContact = 500;
                    Int32.TryParse(contact_limit, out limitContact);
                    limitContact = limitContact == 0 ? 500 : limitContact;

                    int limitGroup = 20;
                    Int32.TryParse(group_limit, out limitGroup);
                    limitGroup = limitGroup == 0 ? 20 : limitGroup;

                    ContactDB.MAX_CONTACT = limitContact;
                    GroupDB.MAX_GROUP = limitGroup;
                }
            }
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:38,代码来源:DatabaseParameterController.cs

示例7: AddNewAccount

 public int AddNewAccount(string username, string password, int accountTypeId)
 {
     DBManager db = new DBManager();
     return db.AddNewAccount(username, password, accountTypeId);
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例8: GetAllAccounts

 public List<Account> GetAllAccounts()
 {
     DBManager db = new DBManager();
     return db.GetAllDisplayAccounts();
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例9: GetAllUserNameOfAccounts

 public List<string> GetAllUserNameOfAccounts()
 {
     DBManager db = new DBManager();
     return db.GetAllUserNameOfAccounts();
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例10: SetPreferredHostNameOrder

 public bool SetPreferredHostNameOrder(HostContactNameOrder hostContactNameOrder)
 {
     DBManager db = new DBManager();
     return db.SetPreferredHostNameOrder(hostContactNameOrder);
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例11: SetDefaultHostNameOrder

 public bool SetDefaultHostNameOrder(HostContactNameOrder hostContactNameOrder)
 {
     DBManager db = new DBManager();
     return db.SetDefaultHostNameOrder(hostContactNameOrder);
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例12: ImportContactsFromListContactDB

        public void ImportContactsFromListContactDB(List<CMData.Contact> list)
        {
            // save/update database
            DBManager db = new DBManager();
            int res = db.AddOrUpdateContactsFromAccount(list, MultiDownloadController.Instance.accountTypeName, MultiDownloadController.Instance.mode);

            // notify UI
            if (res > 0)
            {
                NotifyDownloadStatus(DownloadStatus.DONE, string.Format(resourceLoader.GetString("import_num_contacts"), res));
            }
            else
            {
                NotifyDownloadStatus(DownloadStatus.DONE, resourceLoader.GetString("no_contact_import"));
            }
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:16,代码来源:MultiDownloadController.cs

示例13: SetPreferredListEmailType

 public bool SetPreferredListEmailType(EmailType emailType)
 {
     DBManager db = new DBManager();
     return db.SetPreferredListEmailType(emailType);
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:5,代码来源:DatabaseController.cs

示例14: DownloadContacts

 public void DownloadContacts(int account_type_id, string username, string password, AccountDownloadListener notify)
 {
     DBManager db = new DBManager();
     Account account = db.AddOrUpdateAccountByUserPassAccTypeId(username, password, account_type_id);
     if (account.Id > 0)
     {
         //DownloadContacts(account, notify);
     }
     else
     {
         notify.NotifyStatusByAccountId(-1, DownloadStatus.DATABASE_ERROR, ResourceStringLoader.GetString("database_error"));
     }
 }
开发者ID:thongvo,项目名称:myfiles,代码行数:13,代码来源:MultiDownloadController.cs

示例15: IsMaximumContactExeed

        private bool IsMaximumContactExeed(List<ContactDB> list)
        {
            int moreContactCount = list.Count();
            DBManager db = new DBManager();
            currentContactNumber = db.GetTotalContactCount();

            if (currentContactNumber + moreContactCount > ContactDB.MAX_CONTACT)
            {
                DownloadControllerAndData controllerAndData = new DownloadControllerAndData
                {
                    Controller = this,
                    ListData = list
                };
                NotifyDownloadStatus(DownloadStatus.MAXIMUM_CONTACT_EXEED, controllerAndData);
                return true;
            }
            return false;
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:18,代码来源:MultiDownloadController.cs


注:本文中的CMModel.DBManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。