private void ok_Click(object sender, EventArgs e) { bool flag = false; AccountAdd aa = new AccountAdd(); float value,power; byte[] img = new byte[] { 0 }; byte[] threeD = new byte[] { 0 }; int count,electromotor; /* 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 (!maskedText_value.Value.ToString().Equals("")) { value = (float)maskedText_value.Value; } else { value = 0.00F; } if (!maskedText_power.Value.ToString().Equals("")) { power = (float)maskedText_power.Value; } else { power = 0.00F; } if (!numeric_count.Value.ToString().Equals("")) { count = Convert.ToInt32(numeric_count.Value.ToString()); } else { count = 1; } if (!numeric_electromotor.Value.ToString().Equals("")) { electromotor = Convert.ToInt32(numeric_electromotor.Value.ToString()); } else { electromotor = 0; } try { if (!fileDialog_img.FileName.Equals("")) { img = aa.getFileBytes(fileDialog_img.FileName); } else { img = aa.getFileBytes("pic\\no_photo.jpg"); } if (!fileDialog_3d.FileName.Equals("")) { threeD = aa.getFileBytes(fileDialog_3d.FileName); } } catch (Exception mye) { MessageBox.Show("图像或三维文件读取失败,请取消文件的只读属性!", "文件读取错误", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(mye.Message); return; } //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_manu_date.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, value, count, electromotor, power, Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_eqType.SelectedValue.ToString()), text_address.Text, img, threeD); if (flag) { MessageBox.Show("数据添加成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据添加失败,请检查网络连接!"); } }
private void ok_Click(object sender, EventArgs e) { bool flag = false; AccountAdd aa = new AccountAdd(); //Account acc = new Account(); //float value,power; byte[] img = new byte[] { 0 }; //byte[] threeD = new byte[] { 0 }; if (dateTime_begin.Value <= dateTime_end.Value) { try { if (!fileDialog_img.FileName.Equals("")) { img = aa.getFileBytes(fileDialog_img.FileName); } else { img = aa.getFileBytes("pic\\no_photo.jpg"); } } catch (Exception mye) { MessageBox.Show("图像读取失败,请取消文件的只读属性!", "文件读取错误", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(mye.Message); return; } flag = aa.addFault(globalEqId, text_partname.Text, combo_level.SelectedValue.ToString(), dateTime_fault.Text, dateTime_begin.Text, dateTime_end.Text, richText_fault_process.Text, richText_fault_reason.Text, richText_countermeasure.Text, img); //flag = aa.addRepair(text_partname.Text, globalPlanId, dateTime_fault.Text, dateTime_begin.Text, numeric_stopday.Value.ToString(), combo_targetdep.SelectedValue.ToString(), combo_sourcedep.SelectedValue.ToString(), text_group.Text, text_fuzeren.Text, richText_.Text, richText_after.Text, richText_record.Text,combo_level.SelectedValue.ToString()); //flag = aa.addRepairPlan(text_repairasset.Text, globalEqId, dateTime_startdate.Text, overtime, stoptime,combo_targetdep.SelectedValue.ToString(),combo_sourcedep.SelectedValue.ToString(), text_fuzeren.Text, richText_before.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("数据保存失败,请检查网络连接!"); } } else { MessageBox.Show("起始日期不可大于结束日期!"); } }
private void ok_Click(object sender, EventArgs e) { bool flag = false; AccountAdd aa = new AccountAdd(); try { if (!fileDialog_img.FileName.Equals("")) { img = aa.getFileBytes(fileDialog_img.FileName); } if (!fileDialog_3d.FileName.Equals("")) { threeD = aa.getFileBytes(fileDialog_3d.FileName); } } catch (Exception mye) { MessageBox.Show("图像或三维文件读取失败,请取消文件的只读属性!", "文件读取错误", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(mye.Message); return; } flag = aa.updatePart(text_partasset.Text, text_partname.Text, text_partmaterial.Text, text_partweight.Text, globleStandard, img, threeD, globleId); //flag = aa.addPart(globleId, text_partasset.Text, text_partname.Text, text_partmaterial.Text, text_partweight.Text, globleStandard, img, threeD); //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_manu_date.Text, dateTime_produ_date.Text, dateTime_filing_date.Text, value, count, electromotor, power, Convert.ToInt32(combo_status.SelectedValue.ToString()), Convert.ToInt32(combo_eqType.SelectedValue.ToString()), text_address.Text, img, threeD); if (flag) { MessageBox.Show("数据保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("数据保存失败,请检查网络连接!"); } }