protected void Page_Load(object sender, EventArgs e) { #region 绑定ContactStr Config config = new Config(); ConfigBll configbll = new ConfigBll(); config = configbll.GetModel(1); string linkUsCategoryId = ConfigurationManager.AppSettings["LinkUsCategoryId"]; Category category = new CategoryBll().GetModel(Convert.ToInt32(linkUsCategoryId)); StringBuilder sb = new StringBuilder(); sb.Append("<div class='topic'>"); sb.AppendFormat("<div class='TopicTitle'>{0} Contact</div>", category.Name); sb.Append("<div class='TopicMore'>"); sb.AppendFormat("<a href='{0}'><img src='images/more.png'></a>", category.Url); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div class='img'>"); sb.AppendFormat("<img src='{0}' width='250' height='100' alt='{1}'>", config.ContactImgUrl, category.Name); sb.Append("</div>"); sb.Append("<div class='txt ColorLink'>"); sb.Append("<div style='padding-left: 20px;'>"); sb.AppendFormat("<p><strong>{0}</strong></p>", config.CompanyName); sb.AppendFormat("<p>地址:{0}</p>", config.Address); sb.AppendFormat("<p>邮编:{0}</p>", config.Postcode); sb.AppendFormat("<p>电话:{0}</p>", config.Telephone); sb.AppendFormat("<p>网址:<a href='{0}' target='_blank'>{0}</a></p>", config.Website); sb.AppendFormat("<p>邮箱:<a href='mailto:{0}'>{0}</a></p>", config.Email); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div class=' clearfix'></div>"); ContactStr = sb.ToString(); #endregion }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); try { ConfigBll.GetInst().LoadConfig(); AGENT_NAME = GlobalValues.AGENT_NAME; AGENT_FILTER = GlobalValues.AGENT_FILTER; log = LogBll.GenLogBll(AGENT_NAME); testLog = TestLogBll.GetInst(); Thread t = new Thread(() => startListen()); t.Start(); for (; ;) { log.HeartBeat("I'm alive"); Thread.Sleep(1000 * 20); } } catch (MongoConnectionException ex) { Console.WriteLine("无法连接到server端!请检查ip配置及网络连接后重试"); } catch (SocketException ex) { Console.WriteLine("连接被中断,请检查网络连接,重启本程序!\n" + "错误信息:" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { #region 绑定AboutCompanyStr oyxf.Model.Config config = new oyxf.Model.Config(); ConfigBll configbll = new ConfigBll(); config = configbll.GetModel(1); string categoryId = ConfigurationManager.AppSettings["AboutCompanyCategoryId"]; Category category = new CategoryBll().GetModel(Convert.ToInt32(categoryId)); StringBuilder sb = new StringBuilder(); sb.Append("<div class='topic'>"); sb.AppendFormat("<div class='TopicTitle'>{0} About</div>", category.Name); sb.Append("<div class='TopicMore'>"); sb.AppendFormat("<a href='{0}'><img src='images/more.png' /></a>", category.Url); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div class='img'>"); sb.AppendFormat("<img src='{0}' width='220' height='100' alt='{1}'>", config.AboutImgUrl, category.Name); sb.Append("</div>"); sb.Append("<div class='txt ColorLink'>"); sb.Append("<p>"); sb.AppendFormat("{0}<a href='{1}'> 详细>></a>", config.AboutIntro.Length > 60 ? config.AboutIntro.Substring(0, 60) + "..." : config.AboutIntro, config.AboutUrl); sb.Append("</p>"); sb.Append("</div>"); AboutCompanyStr = sb.ToString(); #endregion }
public FrmSetting() { InitializeComponent(); ConfigBll config = new ConfigBll(); this.textBox1.Text = config.getDir(enumModel.AppCut); this.textBox2.Text = config.getDir(enumModel.AppXls); }
static void Main() { //这句话为了解决界面崩溃的问题 //GlobalValues.MONGO_URL = "mongodb://192.168.163.50/chinattl"; ConfigBll.GetInst().LoadConfig(); GlobalValues.MONGO_URL = "mongodb://127.0.0.1/chinattl"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }
static void Main() { //处理未捕获的异常 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //处理非UI线程异常 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ConfigBll.GetInst().LoadConfig(); Application.Run(FormMain.GetInst()); // Application.Run(new FormTest()); }
private void btnOk_Click(object sender, EventArgs e) { string xmlFilePath = ConfigBll._startupPath;//路径 ConfigBll confige = new ConfigBll(); if (!string.IsNullOrWhiteSpace(this.textBox1.Text)) { confige.updateItem(this.textBox1.Text, enumModel.AppCut); } if (!string.IsNullOrWhiteSpace(this.textBox2.Text)) { confige.updateItem(this.textBox2.Text, enumModel.AppXls); } this.Close(); }
/// <summary> /// 设置切割方案 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { this.panelStep3.Dock = DockStyle.Fill; this.panelStep3.Visible = true; this.panelStep3.BringToFront(); this.toolStripStatusLabel.Text = "切割方案"; ConfigBll config = new ConfigBll(); string strDir = config.getDir(enumModel.AppCut); if (!File.Exists(strDir)) { MessageBox.Show("找不到默认切割方案,请重新设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { initAllCutMothed(strDir); } }
/// <summary> /// 计算结果输出为Excel /// </summary> private void button5_Click(object sender, EventArgs e) { this.toolStripStatusLabel.Text = "导出Excel"; string strFilePath = string.Empty; try { ConfigBll config = new ConfigBll(); string strDir = config.getDir(enumModel.AppXls); if (File.Exists(strDir)) { strFilePath = strDir; } else { if (this.BZH) { MessageBox.Show("找不到默认输出模板,请重新设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "选择输出模版"; openFileDialog.Filter = "原油数据模版文件 (*.xls)|*.xls";//Excel2010与2003不兼容 openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { strFilePath = openFileDialog.FileName; } else { return; } } } int outResult = DataToExcelBll.DataToExcel(null, this._oilB, strFilePath, _cutMotheds, "B"); if (outResult == 1) { MessageBox.Show("数据导出成功!", "提示"); } else if (outResult == -1) { MessageBox.Show("当前系统尚未安装EXCEL软件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (outResult == -2) { MessageBox.Show("不能打开Excel进程,请关闭Excel后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (outResult == -3) { MessageBox.Show("数据导出失败,请检查模版是否正确或者关闭正在运行的Excel重试!", "提示"); } else if (outResult == -11) { MessageBox.Show("切割数据不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (outResult == -99) { MessageBox.Show("数据导出失败,找不到正确模板!", "提示"); } else if (outResult == 0)//取消保存 { //MessageBox.Show("数据导出失败,错误信息:\r\n" + outResult, "提示"); } } catch (Exception ex) { Log.Error("导出原油数据出错:" + ex.ToString()); } }