Example #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            //CouchVo vo = getTargetCouch();
            CouchVo vo = new CouchVo();

            vo.userName      = "******";
            vo.pwd           = "mydbuser";
            vo.serverName    = "localhost";
            vo.serverport    = "5984";
            vo.dbName        = "mydb";
            vo.adminUserName = "******";
            vo.adminPwd      = "adminadmin";


            CouchUtil util    = new CouchUtil();
            string    retMsg  = null;
            bool      retBool = false;

            for (int i = 0; i < 1; i++)
            {
                util.createDBInCouch("clx_jan_2011" + i, out retMsg, out retBool, vo);
                appendConsole("%%%%%%%%%%%%%%%%%%%%%%%");
                appendConsole("Ret MSG" + retMsg);
                appendConsole("Ret retBool" + retBool);
                appendConsole("%%%%%%%%%%%%%%%%%%%%%%%");
            }
        }
Example #2
0
        private void createDBClick(object sender, EventArgs e)
        {
            string  dbName = this.dbNameText.Text;
            CouchVo vo     = new CouchVo();

            vo.userName      = "******";
            vo.pwd           = "pa55w0rd1";
            vo.serverName    = Properties.Settings.Default.CouchServerName;
            vo.serverport    = Properties.Settings.Default.CouchPort;
            vo.dbName        = "clx_cust_docs_dev";
            vo.adminUserName = "******";
            vo.adminPwd      = "adminadmin";
            CouchUtil util    = new CouchUtil();
            string    msg     = null;
            bool      retFlag = false;

            util.createDBInCouch(dbName, out msg, out retFlag, vo);
            MessageBox.Show("DB Created " + retFlag + " Message " + msg);
            //util.
        }
        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);
        }