/// <summary> /// 데이터셑에 데이터테이블을 추가한다. /// </summary> /// <param name="ds"></param> /// <param name="tableName"></param> /// <param name="Add_Cols"></param> /// <param name="Add_Types"></param> /// <param name="dValue"></param> /// <returns></returns> private bool DataTable_Add(DataSet ds, string tableName, string[] Add_Cols, string[] Add_Types, object[] dValue) { if (dsSetting.Tables.IndexOf(tableName) >= 0) { return(false); } DataTable grp = new DataTable(tableName); Fnc.DataTable_ColumnsAdd(grp, Add_Cols, Add_Types, dValue); ds.Tables.Add(grp); return(true); }
private void frmSetting_Load(object sender, EventArgs e) { try { Function.Component.DevExp.fnc.GridView_ViewInit(gvSettingList, false, true); //Function.Component.DevExp.fnc.GridView_EditInit(gvSettingList); //type 콤보 박스 foreach (string i in Fnc.EnumItems2Strings(new enSeverType())) { cmbType.ComboBoxItems.Add(i); } dsSetting = frmUploader.dsSetting; //Group 콤보 박스 cmbGroup.ComboBoxValueMember = "GroupCode"; cmbGroup.ComboBoxDisplayMember = "GroupName"; cmbGroup.ComboBoxDataSource = dsSetting.Tables[fnc.GroupTable_Name].DefaultView; dsSetting.Tables[fnc.GroupTable_Name].DefaultView.Sort = "GroupCode"; DataTable dt = dsSetting.Tables["Setting"]; //201512 추가 컬럼 확인 string[] Add_Cols = new string[] { "UseZip", "GroupCode", "GroupName", "Priority" }; Type[] Add_Types = new Type[] { typeof(System.Boolean), typeof(System.Int32), typeof(System.String), typeof(System.Int32) }; object[] dValue = new object[] { false, string.Empty, string.Empty, 0 }; if (Fnc.DataTable_ColumnsAdd(dt, Add_Cols, Add_Types, dValue)) { dt.AcceptChanges(); DataSet_Save(); } int cnt = 0; //그룹을 강제 입력 foreach (DataRow r in dt.Rows) { cnt += row_chk(r) ? 1: 0; } if (cnt > 0) { dt.AcceptChanges(); DataSet_Save(); } dt.Columns["GroupCode"].AllowDBNull = false; gcSettingList.DataSource = dt.DefaultView; dt.DefaultView.Sort = "GroupCode, Priority"; DataView dv = dt.DefaultView; //input box binding cmbType.DataBindings.Add(new Binding("SelectedItem", dv, "Type")); txtUpdateType.DataBindings.Add(new Binding("Text", dv, "UPDATETYPE")); txtBigo.DataBindings.Add(new Binding("Text", dv, "BIGO")); chkUseZip.DataBindings.Add(new Binding("Checked", dv, "UseZip")); //Group, Priority 추가 cmbGroup.DataBindings.Add(new Binding("SelectedValue", dv, "GroupCode")); txtPriority.DataBindings.Add(new Binding("Text", dv, "Priority")); dt = dsSetting.Tables["ORACLE"]; dv = dt.DefaultView; txtOraTNS.DataBindings.Add(new Binding("Text", dv, "TNS")); txtOraID.DataBindings.Add(new Binding("Text", dv, "ID")); txtOraPass.DataBindings.Add(new Binding("Text", dv, "PASS")); dv = dsSetting.Tables["SQL"].DefaultView; txtSqlIP.DataBindings.Add(new Binding("Text", dv, "IP")); txtSqlDB.DataBindings.Add(new Binding("Text", dv, "DataBase")); txtSqlID.DataBindings.Add(new Binding("Text", dv, "ID")); txtSqlPass.DataBindings.Add(new Binding("Text", dv, "PASS")); dv = dsSetting.Tables["WEB"].DefaultView; txtWEBUrl.DataBindings.Add(new Binding("Text", dv, "URL")); txtWEBPass.DataBindings.Add(new Binding("Text", dv, "PASS")); cmdAdd.Image = (Image)Function.resIcon16.add; cmdDelete.Image = (Image)Function.resIcon16.delete; InputBox_Collapes(); } catch (Exception ex) { ProcException(ex, "frmSetting_Load"); } }
private void frmUploader_Load(object sender, EventArgs e) { //config.xml 파일을 읽는다.. dsSetting = new DataSet(); mdiMain = this; string[] Add_Cols = new string[] { "GroupCode", "GroupName" }; string[] Add_Types = new string[] { "System.Int32", "System.String" }; object[] dValue = new object[] { dGrpCode, dGrpName }; bool isCh = false; if (Function.system.clsFile.FileExists(strDSFileName)) { dsSetting.ReadXml(strDSFileName); if (DataTable_Add(dsSetting, "Group", Add_Cols, Add_Types, dValue)) { DataRow dr = dsSetting.Tables["Group"].NewRow(); //기본 그룹을 생성한다. dr["GroupCode"] = dGrpCode; dr["GroupName"] = dGrpName; dsSetting.Tables["Group"].Rows.Add(dr); dsSetting.Tables["Group"].AcceptChanges(); isCh = true; } if (Fnc.DataTable_ColumnsAdd(dsSetting.Tables["Setting"], Add_Cols, Add_Types, dValue)) { foreach (DataRow r in dsSetting.Tables["Setting"].Rows) { //기본 그룹을 생성한다. r["GroupCode"] = dGrpCode; r["GroupName"] = dGrpName; } dsSetting.Tables["Setting"].AcceptChanges(); isCh = true; } foreach (DataTable dt in dsSetting.Tables) { dt.PrimaryKey = new DataColumn[] { dt.Columns["UPLOADTYPE"] }; } dsSetting.AcceptChanges(); if (isCh) { dsSetting.WriteXml(strDSFileName, XmlWriteMode.WriteSchema); } } else { dsSetting = new DataSet(); DataTable_Add(dsSetting, "Group", Add_Cols, Add_Types, dValue); DataTable dt = new DataTable("Setting"); dt.Columns.Add(new DataColumn("TYPE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("UPDATETYPE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("BIGO", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("생성일", Type.GetType("System.DateTime"))); dt.Columns.Add(new DataColumn("UseZip", Type.GetType("System.Boolean"))); dt.Columns.Add(new DataColumn("GroupCode", Type.GetType("System.Int32"))); dt.Columns.Add(new DataColumn("GroupName", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("Priority", Type.GetType("System.Int32"))); dt.PrimaryKey = new DataColumn[] { dt.Columns["UPLOADTYPE"] }; dsSetting.Tables.Add(dt); dt = new DataTable("ORACLE"); dt.Columns.Add(new DataColumn("UPDATETYPE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("TNS", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("ID", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("PASS", Type.GetType("System.String"))); dt.PrimaryKey = new DataColumn[] { dt.Columns["UPLOADTYPE"] }; dsSetting.Tables.Add(dt); dt = new DataTable("SQL"); dt.Columns.Add(new DataColumn("UPDATETYPE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("IP", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("DATABASE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("ID", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("PASS", Type.GetType("System.String"))); dt.PrimaryKey = new DataColumn[] { dt.Columns["UPLOADTYPE"] }; dsSetting.Tables.Add(dt); dt = new DataTable("TCP"); dt.Columns.Add(new DataColumn("UPDATETYPE", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("IP", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("PORT", Type.GetType("System.Int32"))); dt.PrimaryKey = new DataColumn[] { dt.Columns["UPLOADTYPE"] }; dsSetting.Tables.Add(dt); } UpdateItemMenu_ReMake(); }
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); } }