public ActionResult Update(Dbconfig dbconfig) { DbConfigService dbconfigService = DbConfigService.GetInstance(); dbconfig = dbconfigService.GetDbcongifById(dbconfig.id); return(View(dbconfig)); }
public ActionResult Detail(Dbconfig dbconfig) { string code = Request.QueryString["id"].ToString(); DbConfigService dbconfigService = DbConfigService.GetInstance(); dbconfig = dbconfigService.GetDbcongifById(dbconfig.id); return(View(dbconfig)); }
public int Save(Dbconfig config) { if (config.id > 0) { return(_dbconfigDao.Update(config)); } else { return(_dbconfigDao.Insert(config)); } }
public ActionResult Add(Dbconfig dbconfig) { PlantService plantInfoService = PlantService.GetInstance(); Plant plantInfo = plantInfoService.GetPlantInfoById(dbconfig.id); if (plantInfo == null) { ModelState.AddModelError("Error", "该电站不存在"); } else { //if (string.IsNullOrEmpty(dbconfig.Id)) // ModelState.AddModelError("Code", "采集器编号不能为空"); if (string.IsNullOrEmpty(dbconfig.year)) { ModelState.AddModelError("Year", "年份不能为空"); } if (string.IsNullOrEmpty(dbconfig.url)) { ModelState.AddModelError("地址", "地址不能为空"); } if (ModelState.IsValid) { // 创建电站数据分布服务 DbConfigService dbconfigService = DbConfigService.GetInstance(); try { // 添加电站数据分布 dbconfigService.Add(dbconfig); } catch { ModelState.AddModelError("Error", "已存在该电站信息"); } } } return(View(dbconfig)); }
public Dbconfig Get(Dbconfig config) { return(_dbconfigDao.Get(config)); }
/// <summary> /// 根据条件修改电站数据分布 /// </summary> /// <param name="dbconfig">修改条件</param> public void Update(Dbconfig dbconfig) { _dbconfigDao.Update(dbconfig); }
/// <summary> /// 根据条件删除电站数据分布 /// </summary> /// <param name="dbconfig">删除条件</param> /// <returns>是否删除成功</returns> public int Delete(Dbconfig dbconfig) { return(_dbconfigDao.Remove(dbconfig)); }
/// <summary> /// 添加一条电站数据分布信息 /// </summary> /// <param name="dbconfig">电站数据分布服务字段</param> public void Add(Dbconfig dbconfig) { _dbconfigDao.Insert(dbconfig); }
public Main() { // // The InitializeComponent() call is required for Windows Forms designer support. // Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine; Microsoft.Win32.RegistryKey dbc = key.OpenSubKey("software\\WisoftWatchClient", true); //注册热键(窗体句柄,热键ID,辅助键,实键) RegisterHotKey(this.Handle, 888, (int)KeyModifiers.Ctrl , Keys.N); RegisterHotKey(this.Handle, 999, ((int)KeyModifiers.Ctrl + (int)KeyModifiers.Shift), Keys.A); string username = ConfigurationManager.AppSettings["Username"]; string password = ConfigurationManager.AppSettings["Password"]; bool checkpass = true; string errorstr = ""; if (dbc == null || dbc.GetValue("Username") == null) { { checkpass = false; errorstr = "对不起,您的设置可能有问题,请重新设置!"; } } else if (string.IsNullOrEmpty(username)) { { checkpass = false; errorstr = "您好像是第一次登录系统,请设置用户名密码"; } } else if (PersonDao.getAllPersonInfo(username, password).Count != 1) { { checkpass = false; errorstr = "您的用户名密码好像不正确,请设置用户名密码"; } } else if (dbc.GetValue("Version").ToString() != "0.4.3") { { System.Diagnostics.Process.Start("notepad.exe", System.Environment.CurrentDirectory + "\\releasenote.txt"); dbc.SetValue("Version", "0.4.3"); } } if (!checkpass) { MessageBox.Show(errorstr); Dbconfig db = new Dbconfig(); if (db.ShowDialog() != DialogResult.OK) { //this.Load += new EventHandler(main_Load); this.Close(); System.Windows.Forms.Application.Exit(); //return; } else { if (dbc.GetValue("Version").ToString() != "0.4.3") { { System.Diagnostics.Process.Start("notepad.exe", System.Environment.CurrentDirectory + "\\releasenote.txt"); dbc.SetValue("Version", "0.4.3"); } } InitializeComponent(); username = ConfigurationManager.AppSettings["Username"]; if (string.IsNullOrEmpty(username)) { this.Text = this.Text + "--未登录"; } else { this.Text = this.Text + "--" + username; } } } else { try { SqlDBUtil.CheckDBState(); } catch (Exception) { MessageBox.Show("数据库异常", "DBERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); System.Windows.Forms.Application.Exit(); } GlobalParams.User = PersonDao.getAllPersonInfo(username, password)[0]; InitializeComponent(); this.Text = this.Text + "--" + username; } this.notifyIcon1.Visible = true; this.notifyIcon1.MouseClick += new MouseEventHandler(notifyIcon1_Click); this.SizeChanged += new EventHandler(Main_MinimumSizeChanged); this.Closing += new CancelEventHandler(Main_Closing); LoadModules(); // // TODO: Add constructor code after the InitializeComponent() call. // }