Example #1
0
        public static void Server_FileUpload(enSeverType svrType, string strUpdateType, FileInfo fi, DataRow row, Function.Db.OracleDB.delExcuteProcedure_Progress evt,
                                             Function.Db.OracleDB.strConnect strConn, AutoUpdateServer_Web.AutoUpdateServer web)
        {
            switch (svrType)
            {
            case enSeverType.ORACLE:
                clsDBFunc.FileInfo_Save(strConn, clsDBFunc.enUType.FILE,
                                        strUpdateType, fi, Fnc.obj2String(row["crc"]), string.Empty, evt);
                break;

            case enSeverType.WEB:


                FileStream   fs           = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
                BinaryReader br           = new BinaryReader(fs);
                int          intBlockSize = 1024 * 256;                  //256kb

                try
                {
                    byte[] bytes = new byte[intBlockSize];

                    int intBytes;
                    int intTotalBytes = 0;
                    int key           = -1;

                    DataTable dt = row.Table.Clone();
                    DataRow   dr = dt.NewRow();
                    dr.ItemArray = row.ItemArray;
                    dt.Rows.Add(dr);

                    while ((intBytes = br.Read(bytes, 0, bytes.Length)) > 0)
                    {
                        key = web.FileUpload(strUpdateType, dt, bytes, intBytes, fs.Length, intTotalBytes, key);

                        intTotalBytes += intBytes;

                        if (evt != null)
                        {
                            evt(int.Parse(fi.Length.ToString()), intTotalBytes);
                        }
                    }


                    dt.Dispose();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    br.Close();
                    fs.Close();

                    fs.Dispose();
                }

                break;
            }
        }
Example #2
0
        public static void Server_FileDelete(enSeverType svrType, string strUpdateType, DataRow row,
                                             Function.Db.OracleDB.strConnect strConn, AutoUpdateServer_Web.AutoUpdateServer web)
        {
            string strFileName = Fnc.obj2String(row["FILENAME"]);


            switch (svrType)
            {
            case enSeverType.ORACLE:
                clsDBFunc.FileInfo_DeleteFile(strConn, strUpdateType, clsDBFunc.enUType.FILE.ToString(), strFileName.ToUpper());
                break;

            case enSeverType.WEB:
                web.FileDelete(strUpdateType, strFileName);
                break;
            }
        }
Example #3
0
        /// <summary>
        /// 서버에 파일 등록 리스트를 가져온다.
        /// </summary>
        /// <param name="svrType"></param>
        /// <param name="strUpdateType"></param>
        /// <param name="strConn"></param>
        /// <param name="web"></param>
        /// <returns></returns>
        public static DataSet Server_FilList_Get(enSeverType svrType, string strUpdateType,
                                                 Function.Db.OracleDB.strConnect strConn, AutoUpdateServer_Web.AutoUpdateServer web)
        {
            DataSet ds = null;

            switch (svrType)
            {
            case enSeverType.ORACLE:
                ds = clsDBFunc.FileInfo_GetList(strConn, strUpdateType);
                break;

            case enSeverType.WEB:

                ds = web.UpdateDataSet_Req(strUpdateType);

                if (ds == null)
                {
                    ds = new DataSet();
                    ds.ReadXml(fnc.UpdateTypeSchema_FileName);

                    web.UpdateDataSet_Schema_Upload(strUpdateType, ds);
                }

                break;
            }

            return(ds);
        }
Example #4
0
        private void frmUploadWindow_Load(object sender, EventArgs e)
        {
            try
            {
                //setting 정보 조회..
                DataRow[] dr = frmUploader.dsSetting.Tables["Setting"].Select(string.Format("UpdateType = '{0}'", strUpdateType));
                if (dr.Length < 1)
                {
                    SetMessage(true, "설정에 저장 되어 있지 않은 UPDATETYPE입니다.", false);
                    return;
                }

                //암축파일 사용 여부확인
                UseZip = Fnc.obj2Bool(dr[0]["UseZip"]);

                SvrType = (enSeverType)Fnc.String2Enum(new enSeverType(), Fnc.obj2String(dr[0]["TYPE"]));

                string strBigo = Fnc.obj2String(dr[0]["bigo"]);

                //db 접속 정보 보회
                switch (SvrType)
                {
                case enSeverType.ORACLE:
                    dr = frmUploader.dsSetting.Tables["ORACLE"].Select(string.Format("UPDATETYPE = '{0}'", strUpdateType));
                    if (dr.Length < 1)
                    {
                        SetMessage(true, "오라클 설정에 해당 UPDATETYPE이 등록되어 있지 않습니다.", false);
                        return;
                    }

                    btnDB_Init.Visible = true;

                    strConn.strTNS = Fnc.obj2String(dr[0]["tns"]);

#if (TEST_DB)
                    strConn.strTNS = @"(DESCRIPTION=
	(ADDRESS =
	  (PROTOCOL = TCP)
	  (HOST = 210.100.74.22)
	  (PORT = 17521)
	)
	(CONNECT_DATA =
	  (SERVICE_NAME = KGCSCM)
	)
  )";
#endif

                    strConn.strID   = Fnc.obj2String(dr[0]["id"]);
                    strConn.strPass = Fnc.obj2String(dr[0]["pass"]);

                    txtInfo.Text = string.Format("UPDATETYPE:{2}({3})     Zip압축사용:{4}\r\nDB Type : {0}\r\nTNS:{1}", SvrType, strConn.strTNS, strUpdateType, strBigo, UseZip ? "예" : "아니요");
                    break;

                case enSeverType.WEB:
                    dr = frmUploader.dsSetting.Tables["WEB"].Select(string.Format("UPDATETYPE = '{0}'", strUpdateType));
                    if (dr.Length < 1)
                    {
                        SetMessage(true, "오라클 설정에 해당 UPDATETYPE이 등록되어 있지 않습니다.", false);
                        return;
                    }


                    web = new AutoUpdateServer_Web.AutoUpdateServer();


                    web.Url = Fnc.obj2String(dr[0]["URL"]);


                    txtInfo.Text = string.Format("UPDATETYPE:{2}({3})     Zip압축사용:{4}\r\nDB Type : {0}\r\nURL:{1}", SvrType, web.Url, strUpdateType, strBigo, UseZip ? "예" : "아니요");
                    break;

                default:
                    SetMessage(true, "오라클/WEB 이외에는 지원 하지 않습니다. 추후 지원예정.", false);
                    return;
                }

                //로컬 설정 파일을 가져온다.
                dsUpdateType = new DataSet();

                if (system.clsFile.FileExists(strSaveFileName))
                {
                    dsUpdateType.ReadXml(strSaveFileName, XmlReadMode.Auto);
                }
                else
                {
                    //dsUpdateType = clsDBFunc.FileInfo_GetList(strConn, strUpdateType);
                    dsUpdateType = new DataSet();
                    dsUpdateType.ReadXml(fnc.UpdateTypeSchema_FileName, XmlReadMode.ReadSchema);
                }

                //데이터™ 초기화
                dsUpdateType_init();


                //201512 추가 컬럼 확인 - UpdateTypeSchema.xml 에도 추가 하여야 한다.
                string[] Add_Cols  = new string[] { "ZipFilePath", "CompType" };
                string[] Add_Types = new string[] { "System.String", "System.String" };
                object[] dValue    = new object[] { string.Empty, "A" };


                if (Fnc.DataTable_ColumnsAdd(dsUpdateType.Tables[0], Add_Cols, Add_Types, dValue))
                {
                    dsUpdateType.Tables[0].AcceptChanges();
                    dsUpdateType.WriteXml(strSaveFileName, XmlWriteMode.WriteSchema);
                }

                //웹에 추가 컬럼처리를 하여 준다.
                if (SvrType == enSeverType.WEB)
                {
                    web.ColumnAddedChk(strUpdateType, Add_Cols, Add_Types, dValue);
                }



                gcFileList.DataSource = dsUpdateType.Tables[0];

                cmsFpList = new ContextMenuStrip();

                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuAddItem", "항목 추가", Function.resIcon16.add, new EventHandler[] { cmsFpList_Click });
                //control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] {cmsFpList_Click});
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuAddFolder", "폴더 추가", Function.resIcon16.folder_white_up, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuCompAll", "전체 비교", Function.resIcon16.misc_green, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuCompVer", "버젼만 비교", Function.resIcon16.server, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuCompDate", "파일날짜 만 비교", Function.resIcon16.cal, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuDelItem", "항목삭제(SVR, Local)", Function.resIcon16.delete, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuDeLink", "항목삭제(Local)", Function.resIcon16.delete_alt, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuAllChecked", "전체 체크", Function.resIcon16.ok, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuAllUnchecked", "전체 체크해제", Function.resIcon16.button_withe, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuSelChecked", "선택 체크", Function.resIcon16.misc_green, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "mnuSelUnchecked", "선택 체크해제", Function.resIcon16.misc, new EventHandler[] { cmsFpList_Click });
                control.Invoke_ContextMenuStrip_ItemAdd(cmsFpList, "", "", null, new EventHandler[] { cmsFpList_Click });


                cmsFpList.Opening             += new CancelEventHandler(cmsFpList_Opening);
                cmsOldVersion                  = new ContextMenuStrip();
                tsiOldVersion                  = new ToolStripMenuItem("OLD Version", Function.resIcon16.redo);
                tsiOldVersion.DropDown         = cmsOldVersion;
                tsiOldVersion.DropDownOpening += new EventHandler(tsiOldVersion_DropDownOpening);
                cmsFpList.Items.Add(tsiOldVersion);

                gcFileList.ContextMenuStrip = cmsFpList;



                //그리트 포맷 적용 -> 미사용.. RowCellStyle 에서 처리
                //StyleFormatCondition con = new StyleFormatCondition();
                //con.Condition = FormatConditionEnum.Expression;
                //con.Expression = "!(FILEDATE = FILE_FILEDATE AND VERSION = FILE_VERSION)";

                ////con.Expression = "FILEDATE = FILE_FILEDATE";

                //con.Appearance.BackColor = Color.LightCoral;
                //con.Appearance.Options.UseBackColor = true;
                //con.ApplyToRow = false;


                //gvFileList.FormatConditions.Add(con);



                List_DataClear();


                //SetMessage(false, "Refresh 버튼을 클릭하여 파일과 서버정보를 확인 하십시요.", false);

                ListCheckAllFile();
            }
            catch (Exception ex)
            {
                ProcException(ex, "Form Load", true);
            }
        }