private void initDBNameDictionary() { List <PwnDocArchDBRepVO> list = new List <PwnDocArchDBRepVO>(); CouchDAO.getInstance().GetCouchDBRepos(ref list); if (list == null || list.Count == 0) { return; } foreach (var pwnDocArchDbRepVO in list) { if (this.dbDictionary.ContainsKey(pwnDocArchDbRepVO.DBName)) { dbDictionary[pwnDocArchDbRepVO.DBName] = pwnDocArchDbRepVO; } else { dbDictionary.Add(pwnDocArchDbRepVO.DBName, pwnDocArchDbRepVO); } } }
private bool addDBNameInCouchAndDB(string name, out PwnDocArchDBRepVO repvo) { CouchVo vo = this.mainForm.getMainForm().getTargetCouch(); repvo = new PwnDocArchDBRepVO(); if (string.IsNullOrEmpty(vo.adminUserName)) { log.Error("Vo values are not set DB Creation Aborted"); return(false); } CouchUtil util = new CouchUtil(); string retMsg = null; bool retBool = false; try { util.createDBInCouch(name, out retMsg, out retBool, vo); if (!retBool) { log.Error("Couch DB Creation failed due to :" + retMsg); return(false); } }catch (Exception e) { log.Error("Couch DB Creation failed", e); log.Error(e.StackTrace); return(false); } try { List <PwnDocArchDBRepVO> list = new List <PwnDocArchDBRepVO>(); repvo.DBName = name; repvo.DBInfo = vo.serverName + ":" + vo.serverport + ":" + vo.userName; string str = ""; //repvo.Id = ConnDAO.getInstance().getUniqueID(ref str,connection1); list.Add(repvo); /*if (repvo.Id == 0) * { * log.Error("Did not get unique id for db"); * return false; * }*/ int dbID = 0; if (!CouchDAO.getInstance().AddCouchDbToRepos(list, out dbID)) { log.Error("create dbname in database failed"); return(false); } repvo.Id = dbID; } catch (Exception e) { log.Error("Couch DB Creation in DB failed", e); log.Error(e.StackTrace); return(false); } return(true); }