예제 #1
0
        public int Insert()
        {
            string query = "INSERT INTO OP_CODE VALUES (@group_id:NUMBER, " +
                           "@code_id:NUMBER, " +
                           "@code_nm:VARCHAR2" +
                           ")";
            string query2 = "INSERT INTO OP_CODE_GROUP VALUES (@group_id:NUMBER, " +
                            "@group_nm:VARCHAR2" +
                            ")";

            int resultRowCnt  = _commonDao.Insert(query);
            int resultRowCnt2 = _commonDao.Insert(query2);

            return(resultRowCnt);
        }
예제 #2
0
        public void InsertTest()
        {
            DataTable dt = GetSampleData();

            cmmDao.Insert(dt, "ETL_TEST", null);

            DataTable result = cmmDao.Query(new string[] { "ID", "NAME" }, "ETL_TEST");

            Assert.AreEqual(dt.Rows.Count, result.Rows.Count);
        }
예제 #3
0
        public string InsertTask([FromBody] Task Task)
        {
            UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo");
            Dictionary <string, string> param = new Dictionary <string, string>();

            // Task 데이터 파싱
            param.Add("SelectSubj", Task.SelectSubj);
            param.Add("Title", Task.Title);
            param.Add("Content", Task.Content);
            param.Add("Sdate", Task.Sdate);
            param.Add("Edate", Task.Edate);
            param.Add("Adit_sdate", Task.Adit_sdate);
            param.Add("Adit_edate", Task.Adit_edate);
            param.Add("AtchFileId", Task.AtchFileId);
            param.Add("PresentForm", Task.PresentForm);
            param.Add("FileCpctyLlmt", Task.FileCpctyLlmt);
            param.Add("user_id", userInfo.user_id);
            string query = "";

            query = "INSERT INTO OP_TASK " +
                    "VALUES(Task_SEQ.NEXTVAL" +
                    ", @SelectSubj:VARCHAR" +
                    ", @Title:VARCHAR" +
                    ", TO_DATE(@Sdate:VARCHAR, 'YYYYMMDDHH24MI')" +
                    ", TO_DATE(@Edate:VARCHAR, 'YYYYMMDDHH24MI')" +
                    ", TO_DATE(@Adit_sdate:VARCHAR, 'YYYYMMDDHH24MI')" +
                    ", TO_DATE(@Adit_edate:VARCHAR, 'YYYYMMDDHH24MI')" +
                    ", '1'" +
                    ", @Content:VARCHAR" +
                    ", @PresentForm:VARCHAR" +
                    ", @AtchFileId:VARCHAR" +
                    ", @FileCpctyLlmt:VARCHAR" +
                    ", @user_id:VARCHAR)";

            //cud 처리할 때는 트랜잭션 시작해주어야함
            using var transaction = _context.Database.BeginTransaction();

            _commonDao.Insert(query, param);

            transaction.Commit();

            return("ok");
        }
예제 #4
0
        public List <PharmaBusinessObjects.Common.AccountLedgerType> GetAccountLedgerTypesWithAll()
        {
            var accountLedgerTypes = new CommonDao().GetAccountLedgerTypes() ?? new List <PharmaBusinessObjects.Common.AccountLedgerType>();;

            accountLedgerTypes.Insert(0, new PharmaBusinessObjects.Common.AccountLedgerType()
            {
                AccountLedgerTypeID = 0, AccountLedgerTypeName = "All"
            });

            return(accountLedgerTypes);
        }
예제 #5
0
        public List <PharmaBusinessObjects.Common.RecordType> GetRecordTypesWithAll()
        {
            var recordTypes = new CommonDao().GetRecordTypes() ?? new List <PharmaBusinessObjects.Common.RecordType>();


            recordTypes.Insert(0, new PharmaBusinessObjects.Common.RecordType()
            {
                RecordTypeId = 0, RecordTypeName = "All"
            });

            return(recordTypes);
        }
        public string InsertRecsroom([FromBody] Recsroom Recsroom)
        {
            UserModel userInfo = SessionExtensionTool.GetObject <UserModel>(HttpContext.Session, "userInfo");
            Dictionary <string, string> param = new Dictionary <string, string>();

            // Recsroom 데이터 파싱
            param.Add("SelectSubj", Recsroom.SelectSubj);
            param.Add("Title", Recsroom.Title);
            param.Add("OthbcAt", Recsroom.OthbcAt);
            param.Add("Content", Recsroom.Content);
            param.Add("AtchFileId", Recsroom.AtchFileId);
            param.Add("user_id", userInfo.user_id);

            string query = "";

            query = "INSERT INTO OP_BBS " +
                    "VALUES(NOTICE_SEQ.NEXTVAL" +
                    ", @SelectSubj:VARCHAR" +
                    ", " + _codeMngTool.getCode("BBS", "RECSROOM") +
                    ", @Title:VARCHAR" +
                    ", TO_CHAR(SYSDATE, 'yyyy/mm/dd hh:mi')" +
                    ", 0" +
                    ", @Content:VARCHAR" +
                    ", @user_id:VARCHAR" +
                    ", @AtchFileId:VARCHAR" +
                    ", @OthbcAt:VARCHAR" +
                    ", NULL" +
                    ", NULL" +
                    ", NULL)";

            //cud 처리할 때는 트랜잭션 시작해주어야함
            using var transaction = _context.Database.BeginTransaction();

            _commonDao.Insert(query, param);

            transaction.Commit();

            return("ok");
        }
예제 #7
0
        public IActionResult InsertData()
        {
            using var transaction = _context.Database.BeginTransaction();


            string query = "INSERT INTO PERSONS VALUES(@person_id:NUMBER,"
                           + "@last_name:VARCHAR,"
                           + "@first_name:VARCHAR,"
                           + "@address:VARCHAR,"
                           + "@city:VARCHAR"
                           + ")";


            _commonDao.Insert(query, Request.Form);

            transaction.Commit();

            return(Redirect("Index"));
        }
예제 #8
0
        public string Uploads(IFormCollection param)
        {
            string fileName  = "";
            string fileEXTSN = "";
            string docId;

            if (param["attachId"].Equals(""))
            {
                docId = getRandomString();
            }
            else
            {
                docId = param["attachId"];
            }
            DateTime timeNow = DateTime.Now;

            removeFile(docId);

            foreach (IFormFile file in param.Files)
            {
                fileName = file.FileName;
                string[] result = fileName.Split(new string[] { "." }, System.StringSplitOptions.None);
                //파일명 해쉬
                string sSourceData = fileName + DateTime.Now;
                byte[] tmpSource;
                byte[] tmpHash;
                tmpSource = UnicodeEncoding.Unicode.GetBytes(sSourceData);
                tmpHash   = new MD5CryptoServiceProvider().ComputeHash(tmpSource);

                string fileHash      = BitConverter.ToString(tmpHash);//해쉬
                string fileNameSplit = "";

                for (int i = 0; i < result.Length - 1; i++)
                {
                    fileNameSplit += result[i];
                    if (i < result.Length - 2)
                    {
                        fileNameSplit += ".";//확장자뗀이름
                    }
                }
                fileEXTSN = result[result.Length - 1];                        //확장자

                string FileTimeNow = timeNow.ToString("yyyy-MM-dd HH:mm:ss"); //업로드시각

                //속성마다 값 넣어주기
                Dictionary <string, string> files = new Dictionary <string, string>();
                files.Add("file_id", fileHash);
                files.Add("file_name", fileNameSplit);
                files.Add("file_extsn", fileEXTSN);
                files.Add("upload_time", FileTimeNow);
                files.Add("doc_id", docId);

                //INSERT 쿼리
                using var transaction = _context.Database.BeginTransaction();

                string query = "INSERT INTO OP_FILE VALUES(@file_id:VARCHAR,"
                               + "@file_name:VARCHAR,"
                               + "@file_extsn:VARCHAR,"
                               + "@upload_time:VARCHAR,"
                               + "@doc_id:VARCHAR"
                               + ")";
                _commonDao.Insert(query, files);

                transaction.Commit();

                //폴더에 파일쓰기
                if (file.Length > 0)
                {
                    string folder   = System.IO.Directory.GetCurrentDirectory() + @"\wwwroot\upload";
                    string filePath = Path.Combine(folder, fileHash);

                    using (Stream fileStream = new FileStream(filePath, FileMode.Create)) {
                        file.CopyTo(fileStream);

                        fileStream.Flush();
                    }
                }
            }
            return(docId);
            //Response.WriteAsync("<script language=\"javascript\">alert('" + fileName + " is uploaded!');</script>");
            //Response.WriteAsync("<script language=\"javascript\">window.location=\"/Main/Main\"</script>");
        }