public RepairEditForm(string eqasset, string eqname, string eqdep, string repairId) { InitializeComponent(); text_eqasset.Text = eqasset; text_eqname.Text = eqname; text_dep.Text = eqdep; globalRepairId = repairId; // DataSet ds_department1 = null, ds_department2 = null, ds_level = null, ds = null; AccountAdd aa = new AccountAdd(); Account ads = new Account(); ds_department1 = aa.CreateDataSet_Department();//部门列表 ds_department2 = aa.CreateDataSet_Department();//部门列表 ds_level = aa.CreateDataSet_RepairLevel();//维修级别列表 ds = ads.queryRepairById(repairId); // InitComboBox(combo_targetdep, ds_department1, "id", "departname", ds, "target_department"); InitComboBox(combo_sourcedep, ds_department2, "id", "departname", ds, "source_department"); InitComboBox(combo_level, ds_level, "id", "level_name", ds, "repair_level"); //表头塞值 text_repairasset.DataBindings.Add(new Binding("Text", ds.Tables[0], "repair_asset")); dateTime_startdate.DataBindings.Add(new Binding("Value", ds.Tables[0], "start_date")); dateTime_enddate.DataBindings.Add(new Binding("Value", ds.Tables[0], "end_date")); numeric_stopday.DataBindings.Add(new Binding("Value", ds.Tables[0], "stop_time")); text_group.DataBindings.Add(new Binding("Text", ds.Tables[0], "repair_group")); text_fuzeren.DataBindings.Add(new Binding("Text", ds.Tables[0], "principal")); richText_before.DataBindings.Add(new Binding("Text", ds.Tables[0], "memo_before")); richText_record.DataBindings.Add(new Binding("Text", ds.Tables[0], "memo_record")); richText_after.DataBindings.Add(new Binding("Text", ds.Tables[0], "memo_after")); }
private void ok_Click(object sender, EventArgs e) { bool flag = false, flag_same = false; Account acc = new Account(); if (text_username.Text.Trim() != "") { flag_same = acc.hasSameUsername(text_username.Text); if (!flag_same) { flag = acc.updateUserByUsername(text_username.Text, text_realname.Text, globleUserRight, globleUsername); if (flag) { MessageBox.Show("数据保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据保存失败,请检查网络连接!"); } } else { MessageBox.Show("已经存在同名用户!", "禁止操作", MessageBoxButtons.OK, MessageBoxIcon.Warning); text_username.Focus(); return; } } else { MessageBox.Show("用户名不能为空!", "禁止操作", MessageBoxButtons.OK, MessageBoxIcon.Warning); text_username.Focus(); return; } }
public FaultViewForm(string faultId) { InitializeComponent(); // DataSet ds = null; Account aa = new Account(); ds = aa.queryFaultByIdIncludeImage(faultId); //InitComboBox(combo_level, ds_level, "id", "level_name"); sbbh.DataBindings.Add(new Binding("Text", ds.Tables[0], "asset")); sbmc.DataBindings.Add(new Binding("Text", ds.Tables[0], "eqname")); szbm.DataBindings.Add(new Binding("Text", ds.Tables[0], "departname")); lbjmc.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_name")); gzms.DataBindings.Add(new Binding("Text", ds.Tables[0], "level_name")); dateTimePicker1.DataBindings.Add(new Binding("Value", ds.Tables[0], "fault_date")); dateTimePicker2.DataBindings.Add(new Binding("Value", ds.Tables[0], "repair_date")); dateTimePicker3.DataBindings.Add(new Binding("Value", ds.Tables[0], "repairover_date")); gzxx.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_process")); gzyy.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_reason")); jjff.DataBindings.Add(new Binding("Text", ds.Tables[0], "countermeasure")); //加载图片 MemoryStream ms = new MemoryStream((byte[])ds.Tables[0].Rows[0][12]); Image img = Image.FromStream(ms); pictureBox1.Image = img; ms.Close(); }
private void ok_Click(object sender, EventArgs e) { bool flag = false; //AccountAdd aa = new AccountAdd(); Account acc = new Account(); float value; if (!maskedText_value.Value.ToString().Equals("")) { value = (float)maskedText_value.Value; } else { value = 0.00F; } flag = acc.writeOffAccount(true, dateTime_offDate.Text, Convert.ToInt32(combo_offType.SelectedValue.ToString()), value, richTextBox_memo.Text, globleId); //flag = aa.addAccount(false, text_asset.Text, text_eqname.Text, text_model.Text, text_specification.Text, Convert.ToInt32(combo_depart.SelectedValue.ToString()), text_weight.Text, text_brand.Text, text_manufacturer.Text, text_supplier.Text, dateTime_manu_date.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, float.Parse(maskedText_value.Text), Convert.ToInt32(numeric_count.Value.ToString()), Convert.ToInt32(numeric_electromotor.Value.ToString()), float.Parse(maskedText_power.Text), Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_eqType.SelectedValue.ToString()), text_address.Text, aa.getFileBytes(fileDialog_img.FileName), aa.getFileBytes(fileDialog_3d.FileName)); //flag = aa.addAccount(false, text_asset.Text, text_eqname.Text, text_model.Text, text_specification.Text, Convert.ToInt32(combo_depart.SelectedValue.ToString()), text_weight.Text, text_brand.Text, text_manufacturer.Text, text_supplier.Text, dateTime_offDate.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, value, count, electromotor, power, Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_offType.SelectedValue.ToString()), text_address.Text, img, threeD); if (flag) { MessageBox.Show("销帐成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("销帐失败,请检查网络连接!"); } }
public RepairPlanEditForm(string planId) { InitializeComponent(); globalPlanId = planId; // DataSet ds_department1 = null, ds_department2 = null, ds_level = null, ds = null; AccountAdd aa = new AccountAdd(); Account ads = new Account(); //初始化下拉列表 ds_department1 = aa.CreateDataSet_Department();//部门列表 ds_department2 = aa.CreateDataSet_Department();//部门列表 ds_level = aa.CreateDataSet_RepairLevel();//维修级别列表 ds = ads.queryRepairPlanById(planId); InitComboBox(combo_targetdep, ds_department1, "id", "departname", ds, "target_department"); InitComboBox(combo_sourcedep, ds_department2, "id", "departname", ds, "source_department"); InitComboBox(combo_level, ds_level, "id", "level_name", ds, "level_id"); //表头塞值 text_eqasset.DataBindings.Add(new Binding("Text", ds.Tables[0], "asset")); text_eqname.DataBindings.Add(new Binding("Text", ds.Tables[0], "eqname")); text_dep.DataBindings.Add(new Binding("Text", ds.Tables[0], "departname")); text_repairasset.DataBindings.Add(new Binding("Text", ds.Tables[0], "plan_asset")); dateTime_plandate.DataBindings.Add(new Binding("Value", ds.Tables[0], "start_date")); numeric_repairday.DataBindings.Add(new Binding("Value", ds.Tables[0], "over_time")); numeric_stopday.DataBindings.Add(new Binding("Value", ds.Tables[0], "stop_time")); text_fuzeren.DataBindings.Add(new Binding("Text", ds.Tables[0], "principal")); richText_memo.DataBindings.Add(new Binding("Text", ds.Tables[0], "memo")); }
public AccountOffForm(string id, string eq_asset, string eq_name) { InitializeComponent(); text_asset.Text = eq_asset; text_eqname.Text = eq_name; globleId = id; DataSet ds_offType = null; Account acc = new Account(); ds_offType = acc.queryOffType(); InitComboBox(combo_offType, ds_offType, "id", "off_typename"); }
public KnowledgeViewForm(string id) { InitializeComponent(); DataSet ds = null; Account aa = new Account(); ds = aa.queryKnowledgeById(id); text_eqname.DataBindings.Add(new Binding("Text", ds.Tables[0], "eq_name")); text_partname.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_name")); text_level.DataBindings.Add(new Binding("Text", ds.Tables[0], "level_name")); richText_fault_process.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_process")); richText_fault_reason.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_reason")); richText_countermeasure.DataBindings.Add(new Binding("Text", ds.Tables[0], "countermeasure")); }
private void ok_Click(object sender, EventArgs e) { bool flag = false; Account acc = new Account(); flag = acc.addInfomation("eq_type", "type_name", text_name.Text); if (flag) { MessageBox.Show("数据保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据保存失败,请检查网络连接!"); } }
public KnowledgeEditForm(string id) { InitializeComponent(); globalId = id; DataSet ds_level = null, ds = null; AccountAdd aa = new AccountAdd(); Account acc = new Account(); ds_level = aa.CreateDataSet_FaultLevel();//故障模式列表 ds = acc.queryKnowledgeByIdForEdit(id); //InitComboBox(combo_level, ds_level, "id", "level_name"); text_eqname.DataBindings.Add(new Binding("Text", ds.Tables[0], "eq_name")); text_partname.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_name")); richText_fault_process.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_process")); richText_fault_reason.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_reason")); richText_countermeasure.DataBindings.Add(new Binding("Text", ds.Tables[0], "countermeasure")); InitComboBox(combo_level, ds_level, "id", "level_name", ds, "fault_level"); }
public TroubleEditForm(string troubleId,string eqName) { InitializeComponent(); globalTroubleId = troubleId; text_eqname.Text = eqName; DataSet ds = null; Account acc = new Account(); ds = acc.queryTroubleByIdIncludeImage(troubleId); dateTime_troubletime.DataBindings.Add(new Binding("Value", ds.Tables[0], "trouble_date")); richText_process.DataBindings.Add(new Binding("Text", ds.Tables[0], "process")); richText_reason.DataBindings.Add(new Binding("Text", ds.Tables[0], "reason")); richText_lose.DataBindings.Add(new Binding("Text", ds.Tables[0], "lose")); richText_todo.DataBindings.Add(new Binding("Text", ds.Tables[0], "solve")); img = (byte[])(ds.Tables[0]).Rows[0][6]; }
private void ok_Click(object sender, EventArgs e) { bool flag = false; Account acc = new Account(); flag = acc.updateInfomation(globleId, "repair_level", "level_name", text_name.Text); if (flag) { MessageBox.Show("数据保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据保存失败,请检查网络连接!"); } }
public UserEditForm(string username) { InitializeComponent(); globleUsername = username; Account acc = new Account(); DataSet ds = acc.queryUserByUsername(username); text_username.DataBindings.Add(new Binding("Text", ds.Tables[0], "username")); text_realname.DataBindings.Add(new Binding("Text", ds.Tables[0], "realname")); //设置单选框 if (ds.Tables[0].Rows[0][2].ToString() == "1") { globleUserRight = 1; InitCheckBox(globleUserRight); } else { globleUserRight = 0; InitCheckBox(globleUserRight); } }
//byte[] img = new byte[] { 0 }; public TroubleViewForm(string troubleId, string eqName) { InitializeComponent(); text_eqname.Text = eqName; DataSet ds = null; Account acc = new Account(); ds = acc.queryTroubleByIdIncludeImage(troubleId); dateTime_troubletime.DataBindings.Add(new Binding("Value", ds.Tables[0], "trouble_date")); richText_process.DataBindings.Add(new Binding("Text", ds.Tables[0], "process")); richText_reason.DataBindings.Add(new Binding("Text", ds.Tables[0], "reason")); richText_lose.DataBindings.Add(new Binding("Text", ds.Tables[0], "lose")); richText_todo.DataBindings.Add(new Binding("Text", ds.Tables[0], "solve")); //img = (byte[])(ds.Tables[0]).Rows[0][6]; //加载图片 MemoryStream ms = new MemoryStream((byte[])ds.Tables[0].Rows[0][6]); Image img = Image.FromStream(ms); pictureBox1.Image = img; ms.Close(); }
public AccountEditForm(string id) { InitializeComponent(); accountId = id; DataSet ds_eqType = null, ds_department = null, ds_Status = null; DataSet ds = null; // DataTable data = null; AccountAdd aa = new AccountAdd(); Account ads = new Account(); //初始化下拉列表用 ds_eqType = aa.CreateDataSet_EquipmentType(); ds_department = aa.CreateDataSet_Department(); ds_Status = aa.CreateDataSet_Status(); //获取指定id的信息 ds = ads.queryAccountById(id); //ds2.Tables[0].Rows[0][] //log.Debug("设备类型是:"+ds.Tables[0].Rows[0][19].ToString()); InitComboBox(combo_eqType, ds_eqType, "id", "type_name",ds,"type"); InitComboBox(combo_depart, ds_department, "id", "departname",ds,"department"); InitComboBox(combo_status, ds_Status, "id", "status_name",ds ,"status"); text_asset.DataBindings.Add(new Binding("Text", ds.Tables[0], "asset")); text_eqname.DataBindings.Add(new Binding("Text",ds.Tables[0],"eqname")); text_model.DataBindings.Add(new Binding("Text", ds.Tables[0], "model")); text_specification.DataBindings.Add(new Binding("Text", ds.Tables[0], "specification")); text_weight.DataBindings.Add(new Binding("Text", ds.Tables[0], "weight")); text_brand.DataBindings.Add(new Binding("Text", ds.Tables[0], "brand")); text_manufacturer.DataBindings.Add(new Binding("Text", ds.Tables[0], "manufacturer")); text_supplier.DataBindings.Add(new Binding("Text", ds.Tables[0], "supplier")); maskedText_value.DataBindings.Add(new Binding("Value", ds.Tables[0], "value")); numeric_count.DataBindings.Add(new Binding("Value", ds.Tables[0], "count")); numeric_electromotor.DataBindings.Add(new Binding("Value", ds.Tables[0], "electromotor")); maskedText_power.DataBindings.Add(new Binding("Value", ds.Tables[0], "power")); dateTime_manu_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "manu_date")); dateTime_produ_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "produ_date")); dateTime_filing_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "filing_date")); text_address.DataBindings.Add(new Binding("Text", ds.Tables[0], "address")); img = (byte[])(ds.Tables[0]).Rows[0][21]; threeD = (byte[])(ds.Tables[0]).Rows[0][22]; }
private void ok_Click(object sender, EventArgs e) { bool flag = false; if (dateTime_startDate.Value <= dateTime_endDate.Value) { /* text_planAsset.Text = plan_asset; text_eqname.Text = eq_name; text_eqAsset.Text = eq_asset; globleMaintainId = maintainId; dateTime_startDate.Text = startDate; dateTime_endDate.Text = endDate; text_principal.Text = principal; text_status.Text = status; richTextBox_memo.Text = memo; */ Account acc = new Account(); flag = acc.updateMaintainById(dateTime_startDate.Text, dateTime_endDate.Text, text_principal.Text, text_status.Text, richTextBox_memo.Text, globleMaintainId); //flag = acc.addMaintain(globleplanId, text_status.Text, dateTime_startDate.Text, dateTime_endDate.Text, richTextBox_memo.Text, text_principal.Text); if (flag) { MessageBox.Show("修改维护记录成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("修改维护记录失败,请检查网络连接!"); } } else { MessageBox.Show("起始日期不可大于结束日期!"); } }
public FaultEditForm(string faultId) { InitializeComponent(); globalFaultId = faultId; // DataSet ds_level = null, ds = null; AccountAdd aa = new AccountAdd(); Account acc = new Account(); ds_level = aa.CreateDataSet_FaultLevel();//故障模式列表 ds = acc.queryFaultById(faultId); text_eqasset.DataBindings.Add(new Binding("Text", ds.Tables[0], "asset")); text_eqname.DataBindings.Add(new Binding("Text", ds.Tables[0], "eqname")); text_dep.DataBindings.Add(new Binding("Text", ds.Tables[0], "departname")); text_partname.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_name")); dateTime_fault.DataBindings.Add(new Binding("Value", ds.Tables[0], "fault_date")); dateTime_begin.DataBindings.Add(new Binding("Value", ds.Tables[0], "repair_date")); dateTime_end.DataBindings.Add(new Binding("Value", ds.Tables[0], "repairover_date")); richText_fault_process.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_process")); richText_fault_reason.DataBindings.Add(new Binding("Text", ds.Tables[0], "fault_reason")); richText_countermeasure.DataBindings.Add(new Binding("Text", ds.Tables[0], "countermeasure")); InitComboBox(combo_level, ds_level, "id", "level_name", ds, "fault_level"); img = (byte[])(ds.Tables[0]).Rows[0][12]; }
private void ok_Click(object sender, EventArgs e) { bool flag = false; if (dateTime_startDate.Value <= dateTime_endDate.Value) { Account acc = new Account(); flag = acc.addMaintain(globleplanId, text_status.Text, dateTime_startDate.Text, dateTime_endDate.Text, richTextBox_memo.Text, text_principal.Text); if (flag) { MessageBox.Show("新增维护记录成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("新增维护记录失败,请检查网络连接!"); } } else { MessageBox.Show("起始日期不可大于结束日期!"); } }
/// <summary> /// 添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addButton_Click(object sender, EventArgs e) { EqstatusAddForm addForm = new EqstatusAddForm(); if (addForm.ShowDialog() == DialogResult.OK) { //重新绑定DataGridView; Account acc = new Account(); DataSet ds = acc.queryInfomation("eq_status"); BindSourceGrid(grid1, ds.Tables[0], "设备状态名称"); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); } }
/// <summary> /// 删除按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void delButton_Click(object sender, EventArgs e) { DialogResult dr; Boolean flag = false; if (grid1[grid1.Selection.ActivePosition.Row, 0] != null) { dr = MessageBox.Show("您确认删除此条记录?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Account acc = new Account(); //flag = acc.deleteFaultById(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); flag = acc.deleteInfomation(grid1[grid1.Selection.ActivePosition.Row, 0].ToString(), "repair_level"); if (flag) { MessageBox.Show("删除成功!"); DataSet ds = acc.queryInfomation("repair_level"); BindSourceGrid(grid1, ds.Tables[0], "维修等级"); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); } else { MessageBox.Show("删除失败!"); } } } }
private void ok_Click(object sender, EventArgs e) { bool flag = false; Account aa = new Account(); //float value,power; //byte[] img = new byte[] { 0 }; //byte[] threeD = new byte[] { 0 }; int overtime,stoptime; /* if (Util.Tools.IsFloat(maskedText_value.Text)) { log.Debug(maskedText_value.Text); value = float.Parse(maskedText_value.Text); } else { MessageBox.Show("“设备单价”格式错误!"); maskedText_value.Focus(); maskedText_value.Text = "0.00"; return ; } if (Util.Tools.IsFloat(maskedText_power.Text)) { power= float.Parse(maskedText_power.Text); } else { MessageBox.Show("“总功率”格式错误!"); maskedText_power.Focus(); maskedText_power.Text = "0.00"; return; } * */ if (!numeric_repairday.Value.ToString().Equals("")) { overtime = Convert.ToInt32(numeric_repairday.Value.ToString()); } else { overtime = 0; } if (!numeric_stopday.Value.ToString().Equals("")) { stoptime = Convert.ToInt32(numeric_stopday.Value.ToString()); } else { stoptime = 0; } flag = aa.addRepairPlan(text_repairasset.Text, globalEqId, dateTime_plandate.Text, overtime, stoptime,combo_targetdep.SelectedValue.ToString(),combo_sourcedep.SelectedValue.ToString(), text_fuzeren.Text, richText_memo.Text, combo_level.SelectedValue.ToString()); //flag = aa.addAccount(false, text_asset.Text, text_eqname.Text, text_model.Text, text_specification.Text, Convert.ToInt32(combo_depart.SelectedValue.ToString()), text_weight.Text, text_brand.Text, text_manufacturer.Text, text_supplier.Text, dateTime_manu_date.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, float.Parse(maskedText_value.Text), Convert.ToInt32(numeric_count.Value.ToString()), Convert.ToInt32(numeric_electromotor.Value.ToString()), float.Parse(maskedText_power.Text), Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_eqType.SelectedValue.ToString()), text_address.Text, aa.getFileBytes(fileDialog_img.FileName), aa.getFileBytes(fileDialog_3d.FileName)); //flag = aa.addAccount(false, text_eqasset.Text, text_eqname.Text, text_repairasset.Text, text_specification.Text, Convert.ToInt32(combo_sourcedep.SelectedValue.ToString()), text_fuzeren.Text, text_dep.Text, text_manufacturer.Text, text_supplier.Text, dateTime_plandate.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, value, count, electromotor, power, Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_targetdep.SelectedValue.ToString()), text_address.Text, img, threeD); if (flag) { MessageBox.Show("数据添加成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据添加失败,请检查网络连接!"); } }
/// <summary> /// 修改按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editButton_Click(object sender, EventArgs e) { string id = grid1[grid1.Selection.ActivePosition.Row, 0].ToString();//选中行的id UserEditForm kef = new UserEditForm(id); try { if (kef.ShowDialog() == DialogResult.OK) { Account acc = new Account(); DataSet ds = acc.queryUsers(); BindSourceGrid(grid1, ds.Tables[0]); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); } ///MessageBox.Show(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); } catch (Exception mye) { log.Error(mye.Message); } }
/// <summary> /// 删除按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void delButton_Click(object sender, EventArgs e) { DialogResult dr; Boolean flag = false; if (grid1[grid1.Selection.ActivePosition.Row, 0] != null) { dr = MessageBox.Show("您确认删除用户\"" + grid1[grid1.Selection.ActivePosition.Row, 0].ToString() + "\"?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Account acc = new Account(); //flag = acc.deleteFaultById(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); //flag = acc.deleteKnowledgeById(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); flag = acc.deleteUserByUsername(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); if (flag) { MessageBox.Show("删除成功!"); DataSet ds = acc.queryUsers(); BindSourceGrid(grid1, ds.Tables[0]); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); } else { MessageBox.Show("删除失败!"); } } } }
private void chongzhimima_Click(object sender, EventArgs e) { DialogResult dr; Boolean flag = false; if (grid1[grid1.Selection.ActivePosition.Row, 0] != null) { dr = MessageBox.Show("您确认将用户\"" + grid1[grid1.Selection.ActivePosition.Row, 0].ToString() + "\"的密码重置为初始密码\"123456\"吗?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Account acc = new Account(); //flag = acc.deleteFaultById(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); //flag = acc.deleteKnowledgeById(grid1[grid1.Selection.ActivePosition.Row, 0].ToString()); flag = acc.updatePasswordForInit(grid1[grid1.Selection.ActivePosition.Row, 0].ToString(), "123456"); if (flag) { MessageBox.Show("密码重置成功!"); } else { MessageBox.Show("密码重置失败!"); } } } }
/// <summary> /// 添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addButton_Click(object sender, EventArgs e) { UserAddForm uaf = new UserAddForm(); if (uaf.ShowDialog() == DialogResult.OK) { //重新绑定DataGridView; Account acc = new Account(); DataSet ds = acc.queryUsers(); BindSourceGrid(grid1, ds.Tables[0]); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); } }
//窗体初始化 private void AccountForm_Load(object sender, EventArgs e) { Cursor cr = Cursor.Current; Cursor.Current = Cursors.WaitCursor;//将光标置为等待状态 //this.WindowState = FormWindowState.Maximized; //数据格 Account acc = new Account(); DataSet ds = acc.queryUsers(); BindSourceGrid(grid1, ds.Tables[0]); grid1.Selection.SelectRow(1, true); grid1.Selection.FocusFirstCell(true); Cursor.Current = cr;//将光标置回原来状态 }
private void PartEditForm_Load(object sender, EventArgs e) { Account acc = new Account(); DataSet ds = null; ds = acc.queryPartById(globleId); //表头塞值 text_partasset.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_asset")); text_partname.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_name")); text_partmaterial.DataBindings.Add(new Binding("Text", ds.Tables[0], "material")); text_partweight.DataBindings.Add(new Binding("Text", ds.Tables[0], "part_weight")); //设置单选框 if (ds.Tables[0].Rows[0][4].ToString() == "True") { globleStandard = true; InitCheckBox(globleStandard); } else { globleStandard = false; InitCheckBox(globleStandard); } img = (byte[])(ds.Tables[0]).Rows[0][5]; threeD = (byte[])(ds.Tables[0]).Rows[0][6]; }