//窗口加载 private void BaseInfo_Load(object sender, EventArgs e) { My_RunCode = BLL.MyLog.DL_Run.Insert(this.Text); DC_BaseInfo BaseInfoItem = new DC_BaseInfo(); DataRow dr =BaseInfoBLL.SelectAll(" where Id=1").Tables[0].Rows[0]; this.Tb_Company.Text = dr["Company"].ToString(); this.Tb_Address.Text =dr["Address"].ToString(); this.Tb_Tel.Text = dr["Tel"].ToString(); this.Tb_PrintTitle.Text = dr["PrintTitle"].ToString(); dr = BaseInfoBLL.SelectAll(" where Id=2").Tables[0].Rows[0]; this.Tb_DCompany.Text = dr["Company"].ToString(); this.Tb_DAddress.Text = dr["Address"].ToString(); this.Tb_DTel.Text = dr["Tel"].ToString(); }
//保存 private void Btn_Save_Click(object sender, EventArgs e) { if (this.Tc_BaseInfo.SelectedIndex == 0) { DC_BaseInfo BaseInfoItem = new DC_BaseInfo(); BaseInfoItem.Id = 1; BaseInfoItem.Company = this.Tb_Company.Text.Trim(); BaseInfoItem.Address = this.Tb_Address.Text.Trim(); BaseInfoItem.Tel = this.Tb_Tel.Text.Trim(); BaseInfoItem.PrintTitle = this.Tb_PrintTitle.Text.Trim(); if (BaseInfoItem.Company == "") { Function.MessageWarning("请把数据填写完整!"); return; } if (BaseInfoBLL.Update(BaseInfoItem)) { ini.IniWriteValue("Company","Company",BaseClass.Function.VailCode(Tb_Company.Text.Trim())); Function.Message("修改成功!"); } } else { DC_BaseInfo BaseInfoItem = new DC_BaseInfo(); BaseInfoItem.Id = 2; BaseInfoItem.Company = this.Tb_DCompany.Text.Trim(); BaseInfoItem.Address = this.Tb_DAddress.Text.Trim(); BaseInfoItem.Tel = this.Tb_DTel.Text.Trim(); if (BaseInfoItem.Company == "") { Function.MessageWarning("请把数据填写完整!"); return; } if (BaseInfoBLL.Update(BaseInfoItem)) { Function.Message("修改成功!"); } } }
//窗体Load时 private void Main_Load(object sender, EventArgs e) { Initialize(); MenuMain M_Main = new MenuMain(); if (StaticMain.MainFrm.HaveOpened(M_Main.Name)) { M_Main.MdiParent = this; M_Main.WindowState = FormWindowState.Maximized; M_Main.Show(); } Model.SysInfo.DC_BaseInfo BaseInfoItem = new Model.SysInfo.DC_BaseInfo(); DataRow dr = BLL.SysInfo.BaseInfoBLL.SelectAll(" where Id=1").Tables[0].Rows[0]; this.Menu_System.Text = dr["Company"].ToString() + "设备信息管理专用系统"; //插入操作记录 My_RunCode = BLL.MyLog.DL_Run.Insert(this.Text); }