private void frm_worker_main_Load(object sender, EventArgs e) { try { if (commonVar.IsThisServer) { if (commonVar.IsServerRunning == false) { MethodMain.StartServerMode(machineInformations, commonVar.ServerPrivatePort); commonVar.IsServerRunning = true; } } else { string serverIp = commonVar.ServerPublicIpAddress; int serverPort = commonVar.ServerPublicPort; MethodMain.StartClientMode(serverIp, serverPort); } string date = string.Format("{0:yyyy.MM.dd}", DateTime.Today); lbl_verdate.Text = date + "\r\nv" + commonVar.version; lbl_user.Text = commonVar.login_name; menu_user.Text = commonVar.CompanyName; } catch (Exception ex) { //MessageBox.Show(ex.Message); LogWriter.WriteLog_Error(ex); } menu_Click(menu_home, e); }
public frm_worker_main() { InitializeComponent(); commonFX.setThisLanguage(this); try { DbHelper.setSqlConnectionString(commonVar.dbConnectionString); machineInfoTable = DbHelper.LoadMachineList(); //그리드 컨트롤에 맞게 테이블 컬럼 추가 if (machineInfoTable != null) { machineInformations = MethodMain.getMachineInformations(machineInfoTable); } else { throw new Exception("설비 정보가 등록되지 않았습니다."); } initializeTileMenus(); } catch (Exception ex) { LogWriter.WriteLog_Error(ex); //MessageBox.Show(ex.Message); } }
static void initializeSetting(string companyCode) { try { commonVar.CompanyCode = companyCode; DataTable companyTable = MethodMain.LoadCompanyInfo(companyCode); if (companyTable.Rows.Count > 0) { commonVar.CompanyName = companyTable.Rows[0]["COMPANY_NAME"].ToString(); commonVar.ServerPublicIpAddress = companyTable.Rows[0]["PUBLIC_IP"].ToString(); commonVar.ServerPublicPort = (int)companyTable.Rows[0]["PUBLIC_PORT"]; commonVar.ServerPrivateIpAddress = companyTable.Rows[0]["PRIVATE_IP"].ToString(); commonVar.ServerPrivatePort = (int)companyTable.Rows[0]["PRIVATE_PORT"]; string serverPrivateIp = companyTable.Rows[0]["PRIVATE_IP"].ToString(); string thisPrivateIp = string.Empty; IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName()); foreach (IPAddress addr in addresses) { if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { thisPrivateIp = addr.ToString(); } } if (serverPrivateIp == thisPrivateIp) { commonVar.IsThisServer = true; } else { commonVar.IsThisServer = false; } string serverName = companyTable.Rows[0]["SQL_SERVERNAME"].ToString(); string dbName = companyTable.Rows[0]["SQL_DBNAME"].ToString(); string id = companyTable.Rows[0]["SQL_ID"].ToString(); string pw = companyTable.Rows[0]["SQL_PW"].ToString(); commonVar.setDbConString(serverName, dbName, id, pw); } else { throw new Exception("서버 정보 읽기가 실패하였습니다"); } } catch (Exception ex) { throw ex; } }
private void getMoldNames() { DataDisplayParameter parameter1 = new DataDisplayParameter(); parameter1.MachineCodes = this.machineCodes; parameter1.FieldCodes = SpecialFieldCodes.moldNameCodes; DataDisplayCallback callback1 = new DataDisplayCallback(DisplayMoldName); parameter1.Callback = callback1; if (commonVar.IsThisServer) { MethodMain.showMachineDataFromServer(parameter1); } else { MethodMain.showMachineDataFromClient(parameter1); } }
private void getMachineStateAndDisplay() { string[] stateFieldCodes = SpecialFieldCodes.stateCodes; DataDisplayParameter parameter1 = new DataDisplayParameter(); parameter1.MachineCodes = new string[] { MACHINE_CODE }; parameter1.FieldCodes = stateFieldCodes; DataDisplayCallback callback1 = new DataDisplayCallback(DisplayMachineState); parameter1.Callback = callback1; if (commonVar.IsThisServer) { MethodMain.showMachineDataFromServer(parameter1); } else { MethodMain.showMachineDataFromClient(parameter1); } }
private void getDataAndDisplay() { TileDetail detail = selectedMenu.Tag as TileDetail; BaseControl body = detail.BodyControl; BaseControl right = detail.RightControl; string[] codes1 = body.getFieldCodes(); string[] codes2 = right.getFieldCodes(); DataDisplayParameter parameter1 = new DataDisplayParameter(); parameter1.MachineCodes = new string[] { MACHINE_CODE }; parameter1.FieldCodes = codes1; DataDisplayCallback callback1 = new DataDisplayCallback(DisplayDataBody); parameter1.Callback = callback1; DataDisplayParameter parameter2 = new DataDisplayParameter(); parameter2.MachineCodes = new string[] { MACHINE_CODE }; parameter2.FieldCodes = codes2; DataDisplayCallback callback2 = new DataDisplayCallback(DisplayDataRight); parameter2.Callback = callback2; if (commonVar.IsThisServer) { MethodMain.showMachineDataFromServer(parameter1); MethodMain.showMachineDataFromServer(parameter2); } else { MethodMain.showMachineDataFromClient(parameter1); MethodMain.showMachineDataFromClient(parameter2); } body.BringToFront(); right.BringToFront(); }
static void Main(string[] args) { MethodMain.PrintOwing(); }