private void editDgvMain_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (dgvEX1.ReadOnly || dgvEX1.CurrentCell == null || !dgvEX1.CurrentCell.IsInEditMode) { return; } string str = dgvEX1.CurrentCell.EditedFormattedValue.ToString(); if (str == "") { return; } switch (dgvEX1.Columns[e.ColumnIndex].Name) { case "Column3": if (UserProc.IsNumeric(str) && !(Convert.ToDecimal(str) < new Decimal(0))) { break; } int num1 = (int)MessageBox.Show((IWin32Window)this, "请输入正确 <比例>( >= 0数值 )!!!", "提示"); e.Cancel = true; break; case "Column4": if (!(str != "owf") || !(str != "g/L") || !(str != "mL/L")) { break; } int num2 = (int)MessageBox.Show((IWin32Window)this, "请输入正确 <浓度单位>!!!", "提示"); e.Cancel = true; break; } }
private void coboEX_Validating(object sender, CancelEventArgs e) { if (this.chk.Checked) { if (this._allowInput) { this.coboex.Text = this.coboex.Text.Trim(); } if (this.coboex.Text == "" && !this._allowEmpty) { e.Cancel = true; this.errP.SetError((Control)this, "输入数据"); return; } if (this.coboex.Text.Length > this._txtLen) { e.Cancel = true; this.errP.SetError((Control)this, "字数不能大于:" + this._txtLen.ToString()); return; } if (this._txtISbyte && (!UserProc.IsInt(this.coboex.Text) || Convert.ToInt16(this.coboex.Text) >= (short)256)) { e.Cancel = true; this.errP.SetError((Control)this, "小于256的整数"); return; } } this.errP.SetError((Control)this, ""); }
private void getVal_AND() { string str1 = this.ReadExisting(); this.DiscardInBuffer(); this.DiscardOutBuffer(); int num = str1.LastIndexOf('g'); int startIndex = num - 13; if (num >= 0 && startIndex >= 0) { string str2 = str1.Substring(startIndex, 13); this.WenDing = !str2.StartsWith("SD"); string str3 = str2.Trim('S', 'D', ' '); if (str3 != "" && UserProc.IsNumeric(str3)) { this.showVal = new Decimal?(Convert.ToDecimal(str3) / new Decimal(1000)); } else { this.showVal = new Decimal?(); this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } }
private void btnOK_Click(object sender, EventArgs e) { string asd = UserProc.EncryptDES(txtWy.txt.Text, "12345678"); if (asd != ClsLogUser.PassWord) { int num = (int)MessageBox.Show(this, "原密码不对!"); this.txtWy.txt.Focus(); } else if (this.txtWn1.txt.Text != this.txtWn2.txt.Text) { int num = (int)MessageBox.Show(this, "两次新密码不一致!请正确操作!"); this.txtWn1.txt.Focus(); } else { var all = db.Queryable <T_Base>() .Where(it => it.SN == ClsLogUser.SNuser) .ToList(); if (all.Count > 0) { var sad = all[0]; sad.item0 = UserProc.EncryptDES(txtWn1.txt.Text, "12345678"); //sad.item0 = txtWn1.txt.Text; db.Updateable <T_Base>(sad).ExecuteCommand(); MessageBox.Show(this, "修改成功!"); } else { MessageBox.Show(this, "修改失败,关闭后重试!"); } } }
private void Txt_Validating(object sender, CancelEventArgs e) { this.txt.Text = this.txt.Text.Trim(); if (this.txt.Text.Length > 0) { if (this.txt.Text.Length > this._txtLen) { e.Cancel = true; this.errP.SetError(this, "字数不能大于:" + this._txtLen.ToString()); return; } if (this._txtISid && !Regex.IsMatch(this.txt.Text, "[A-Z0-9-]{" + this.txt.Text.Length.ToString() + "}")) { e.Cancel = true; this.errP.SetError(this, "大写字母、数字、- 的组合"); return; } if (this._txtISint && !UserProc.IsInt(this.txt.Text)) { e.Cancel = true; this.errP.SetError(this, "整数"); return; } if (this._txtISmoney && !UserProc.IsNumeric(this.txt.Text)) { e.Cancel = true; this.errP.SetError(this, "数值"); return; } } this.errP.SetError(this, ""); }
private void dgvRL_CurrentCellChanged(object sender, EventArgs e) { string str = this.dgvRL.CurrentRow.Cells[this.colDT.Name].FormattedValue.ToString(); if (str != "" && UserProc.IsInt(str)) { int num1 = -1; int num2 = 0; int num3 = (int)Convert.ToInt16(this.dgvRL.CurrentRow.Cells[this.colDT.Name].Value) - 1; for (int index = 0; index < UserProc.DLparaDT.Length; ++index) { num2 += UserProc.DLparaDT[index]; if (num3 < num2) { num1 = index; break; } } this.lblCheng.Text = num1 >= 0 ? (num1 + 1).ToString() : ""; this.lblDT.Text = str; } else { this.lblCheng.Text = ""; this.lblDT.Text = ""; } this.lblRL.Text = this.dgvRL.CurrentRow.Cells[this.colRL.Name].FormattedValue.ToString(); }
//新建按钮 private void button1_Click(object sender, EventArgs e) { SetTextNull(); lblgh.txt.Text = LiuShuiHao(); pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; show_ReadOnly = false; ref_txt(); btnExe.Text = "保存"; }
private void btnNewNow_Click(object sender, EventArgs e) { this.show_ReadOnly = false; this.ref_txt(); lblgh.txt.Text = LiuShuiHao(); pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; dateTimePicker1.Value = DateTime.Now.AddSeconds((double)(-(double)DateTime.Now.Second)); //txtRiqijiaohuo.dtime.Value = DateTime.Today.AddDays(1.0); //txtKahao.txt.Focus(); btnExe.Text = "保存"; }
private void SetText(T_Base nowRow) { Empty(); if (nowRow != null) { txtBH.txt.Text = nowRow.bianhao; txtXM.txt.Text = nowRow.itemName; txtMK.txt.Text = UserProc.DecryptDES(nowRow.item0, "12345678"); lblTxt4.txt.Text = nowRow.item1; lblTxt5.txt.Text = nowRow.beizhu; } }
private void this_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Prior) { int rowIndex = this.dgvRL.CurrentCell.RowIndex; if (rowIndex <= 0) { return; } this.dgvRL.CurrentCell = this.dgvRL.Rows[rowIndex - 1].Cells[0]; } else if (e.KeyCode == Keys.Next) { int rowIndex = this.dgvRL.CurrentCell.RowIndex; if (rowIndex >= this.dgvRL.RowCount - 1) { return; } this.dgvRL.CurrentCell = this.dgvRL.Rows[rowIndex + 1].Cells[0]; } else if (e.KeyCode == this.cancelKey) { this.DialogResult = DialogResult.Cancel; } else { if (e.KeyCode != Keys.Return) { return; } if (this.lblCheng.Text == "" || this.lblDT.Text == "") { frmError frmError = new frmError("请选择正确滴头!!!"); int num = (int)frmError.ShowDialog((IWin32Window)this); frmError.Close(); this.txtZL.Focus(); } else if (this.txtZL.Text == "" || !UserProc.IsNumeric(this.txtZL.Text) || Convert.ToDecimal(this.txtZL.Text) <= new Decimal(0)) { frmError frmError = new frmError("请输入正确重量( >=0 )!!!"); int num = (int)frmError.ShowDialog((IWin32Window)this); frmError.Close(); this.txtZL.Focus(); } else { this.DialogResult = DialogResult.OK; } } }
private void getVal_Tscale_QHW() { string str1 = this.ReadExisting(); this.DiscardInBuffer(); this.DiscardOutBuffer(); int num = str1.LastIndexOf('g'); int startIndex = num - 16; if (num >= 0 && startIndex >= 0) { string str2 = str1.Substring(startIndex, 17); string str3 = str2.Substring(6, 8); bool flag = !str3.StartsWith("-"); string str4 = str3.Trim('-', ' '); if (UserProc.IsNumeric(str4)) { this.showVal = new Decimal?(Convert.ToDecimal(str4)); Decimal?showVal; if (!flag) { showVal = this.showVal; this.showVal = showVal.HasValue ? new Decimal?(-showVal.GetValueOrDefault()) : new Decimal?(); } if (str2.Substring(15, 2) == "kg") { showVal = this.showVal; this.showVal = showVal.HasValue ? new Decimal?(showVal.GetValueOrDefault() * new Decimal(1000)) : new Decimal?(); } if (str2.StartsWith("ST,")) { this.WenDing = true; } else { this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } }
private void ourButton2_Click_1(object sender, EventArgs e) { UserProc.WaitStart(this); var das = db.Queryable <BaseIList>().Where(it => it.leibie == benleibie && it.SN == SN_SN).First(); if (das != null) { BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = das; FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.RDLC.rptMD.rdlc"; string[] asdf = das.item3.Split("||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); float[] a = { 0, 0, 0, 0, 0 }; for (var i = 0; i < asdf.Length; i++) { asdf[i] = asdf[i] == "-" ? " " : asdf[i]; int www = (int)Math.Floor((double)i / 12); a[www] += asdf[i] == " " ? 0 : float.Parse(asdf[i]); } string[] b = new string[5]; for (int i = 0; i < a.Length; i++) { b[i] = a[i] + ""; b[i] = b[i] == "0" ? " " : b[i]; } ReportParameter parameters2 = new ReportParameter("P2", asdf); ReportParameter parameters3 = new ReportParameter("P3", ClsLogUser.XinMing); ReportParameter parameters4 = new ReportParameter("P4", b); frmPrn.rptView.LocalReport.SetParameters(parameters2); frmPrn.rptView.LocalReport.SetParameters(parameters3); frmPrn.rptView.LocalReport.SetParameters(parameters4); frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = bindingSource; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); } else { MessageBox.Show("数据错误,请重新选择在打印", "提示"); } UserProc.WaitEnd(this); }
private void getVal_ZHUOJING() { string str1 = this.ReadExisting(); if (str1.Length == 0) { this.WenDing = true; if (isFrist) { this.showVal = new Decimal?(Convert.ToDecimal("0.00")); } return; } isFrist = false; this.DiscardInBuffer(); this.DiscardOutBuffer(); int num = str1.LastIndexOf("g"); int startIndex = num - 10; if (num >= 0 && startIndex >= 0) { string str2 = str1.Substring(startIndex, 10); this.WenDing = UserProc.IsNumeric(str2); //str2.IndexOf("0.00") >= 0; // .StartsWith("S"); string str3 = str2.Substring(1); bool flag = !str3.StartsWith("-"); string str4 = str3.Trim('-', ' ').Trim(); if (str4 != "" && UserProc.IsNumeric(str4)) { this.showVal = new Decimal?(Convert.ToDecimal(str4)); if (flag) { return; } Decimal?showVal = this.showVal; this.showVal = showVal.HasValue ? new Decimal?(-showVal.GetValueOrDefault()) : new Decimal?(); } else { this.showVal = new Decimal?(); this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } }
private void getVal_Tscale_T2000() { this.DiscardInBuffer(); this.DiscardOutBuffer(); this.Write("R"); Thread.Sleep(100); string str1 = this.ReadExisting(); if (str1.Length == 17) { string str2 = str1.Substring(5, 8); bool flag = !str2.StartsWith("-"); string str3 = str2.Trim('-', ' '); if (UserProc.IsNumeric(str3)) { this.showVal = new Decimal?(Convert.ToDecimal(str3)); Decimal?showVal; if (!flag) { showVal = this.showVal; this.showVal = showVal.HasValue ? new Decimal?(-showVal.GetValueOrDefault()) : new Decimal?(); } if (str1.Substring(13, 2) == "kg") { showVal = this.showVal; this.showVal = showVal.HasValue ? new Decimal?(showVal.GetValueOrDefault() * new Decimal(1000)) : new Decimal?(); } if (str1.StartsWith("ST,")) { this.WenDing = true; } else { this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } }
private void dgvDH_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (this.dgvDH.ReadOnly || this.dgvDH.CurrentCell == null || !this.dgvDH.CurrentCell.IsInEditMode || e.ColumnIndex != this.colRLdh.Index) { return; } this.colRLdh.SortMode = DataGridViewColumnSortMode.NotSortable; string str1 = this.dgvDH.CurrentCell.EditedFormattedValue.ToString(); if (str1 == "") { this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic; } else if (!UserProc.IsInt(str1) || Convert.ToInt16(str1) < (short)1 || Convert.ToInt16(str1) > (short)48) { int num = (int)MessageBox.Show((IWin32Window)this, "请输入正确 <灯号>( 1 <= 数值 <= 48 )!!!", "提示"); e.Cancel = true; this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic; } else if (str1.TrimStart('0') != str1) { int num = (int)MessageBox.Show((IWin32Window)this, "灯号数值请不要以 0 开头 !!!", "提示"); e.Cancel = true; this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic; } else { int int16 = (int)Convert.ToInt16(str1); for (int index = 0; index < this.dgvDH.RowCount; ++index) { if (index != e.RowIndex) { string str2 = dgvDH.Rows[index].Cells[this.colRLdh.Name].FormattedValue.ToString(); if (!(str2 == "") && (int)Convert.ToInt16(str2) == int16) { int num = (int)MessageBox.Show((IWin32Window)this, "该灯号已存在!!!", "提示"); e.Cancel = true; this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic; return; } } } this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic; } }
private void getVal_OHAUS() { string str1 = this.ReadExisting(); this.DiscardInBuffer(); this.DiscardOutBuffer(); int startIndex = -1; int num = str1.LastIndexOf("g?"); if (num >= 0) { this.WenDing = false; } else { num = str1.LastIndexOf("g\r"); if (num >= 0) { this.WenDing = true; } } if (num - 3 >= 0) { startIndex = str1.LastIndexOf(' ', num - 3); } if (num >= 0 && startIndex >= 0) { string str2 = str1.Substring(startIndex, num - startIndex).Trim(); if (str2 != "" && UserProc.IsNumeric(str2)) { this.showVal = new Decimal?(Convert.ToDecimal(str2)); } else { this.showVal = new Decimal?(); this.WenDing = false; } } else { this.showVal = new Decimal?(); this.WenDing = false; } }
private void buttonX1_Click(object sender, EventArgs e) { string value = DateTime.Now.ToString("yy-mm-dd hh").Replace("-", "").Replace(" ", ""); string sad = UserProc.DecryptDES(textBox2.Text, value); Console.WriteLine(sad); if (sad.Contains(textBox1.Text)) { Settings.Default.rtime = DateTime.Now.ToString("yy-MM-dd hh:mm:ss"); DialogResult = DialogResult.Yes; Settings.Default.rKey = "已注册"; Settings.Default.dqtime = sad.Split(',')[1]; if (!Settings.Default.dqtime.Contains("永久")) { MessageBox.Show("注册成功,有效期:" + Settings.Default.dqtime + "天"); } else { MessageBox.Show("注册成功,有效期:" + Settings.Default.dqtime); } Settings.Default.Save(); } else { MessageBox.Show("注册码有效期为当天,请检查注册码"); } if (!Settings.Default.dqtime.Contains("永久")) { int asd = int.Parse(Settings.Default.dqtime); if (Settings.Default.rtime.CompareTo(DateTime.Now.AddDays(-asd).ToString("yy-MM-dd hh:mm:ss")) < 0) { MessageBox.Show("注册码到期,请重新获取注册码"); Settings.Default.rKey = ""; Settings.Default.Save(); return; } } }
private void getMao_XK3190C8() { byte[] buffer = new byte[7] { (byte)0, (byte)2, (byte)65, (byte)66, (byte)48, (byte)51, (byte)3 }; this.DiscardInBuffer(); this.DiscardOutBuffer(); this.Write(buffer, 0, 7); Thread.Sleep(150); string str1 = this.ReadExisting(); if (str1.Length == 14) { string str2 = str1.Substring(3, 8); if (UserProc.IsNumeric(str2)) { this.maoVal = new Decimal?(Convert.ToDecimal(str2) * new Decimal(1000)); this.WenDing = true; } else { this.maoVal = new Decimal?(); this.WenDing = false; } } else { this.maoVal = new Decimal?(); this.WenDing = false; } }
private void this_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { this.txtZL.Text = this.txtZL.Text.Trim(); if (this.txtZL.Text == "" || !UserProc.IsNumeric(this.txtZL.Text) || Convert.ToDecimal(this.txtZL.Text) < new Decimal(0) || Convert.ToDecimal(this.txtZL.Text) > this.CLmbzl) { this.txtZL.SelectAll(); this.txtZL.Focus(); } else { this.DialogResult = DialogResult.OK; } } else { if (e.KeyCode != this.cancelKey) { return; } this.DialogResult = DialogResult.Cancel; } }
private bool showLD() { this.emptyLDmain(); this.emptyLDdata(); this.editBtnPrn.Enabled = false; if (this.showLDH == "") { return(false); } DataTable dataTable1 = new DataTable(); DataTable dataTable2 = new DataTable(); //using (SqlConnection sqlConnection = new SqlConnection(Settings.Default.DBconn)) { //sqlConnection.Open(); //SqlCommand command = sqlConnection.CreateCommand(); //command.CommandTimeout = 300; string CommandText = "select * from T_PFmain where danhao = '" + this.showLDH + "'"; dataTable1 = db.Ado.GetDataTable(CommandText); if (dataTable1.Rows.Count != 1) { //sqlDataReader1.Close(); //sqlDataReader1.Dispose(); //command.Dispose(); dataTable1.Dispose(); dataTable2.Dispose(); int num = (int)MessageBox.Show((IWin32Window)this, "无法找到此料单主数据!!!", "提示"); return(false); } string sql = ""; if (this.showLDH.StartsWith("LD") || this.showLDH.StartsWith("8") && this.showLDH.Length == 10) { this.editLblShowLB.Text = "配方单成本"; this.editColJL.Visible = false; this.editColJLYL.Visible = false; this.editColJLDW.Visible = false; sql = "select a.*,danjia=cast(b.item1 as money),jine=case when a.yongliangDW in('g','mL') then cast(cast(b.item1 as money)*a.yongliang/1000 as decimal(10,2)) else cast(cast(b.item1 as money)*a.yongliang as decimal(10,2)) end from T_PFdata a left join T_Base b on a.ranliao = b.item0 and (b.leibie = '染料名称' or b.leibie = '助剂名称') and a.yongliang > 0 where a.danhao = '" + dataTable1.Rows[0].Field <string>("danhao") + "' order by a.SN"; } else { this.editLblShowLB.Text = "加料单成本"; this.editColJL.Visible = true; this.editColJLYL.Visible = true; this.editColJLDW.Visible = true; sql = "select a.*,danjia=cast(b.item1 as money),jine=case when a.JLyongliangDW in('g','mL') then cast(cast(b.item1 as money)*a.JLyongliang/1000 as decimal(10,2)) else cast(cast(b.item1 as money)*a.JLyongliang as decimal(10,2)) end from T_PFdata a left join T_Base b on a.ranliao = b.item0 and (b.leibie = '染料名称' or b.leibie = '助剂名称') and a.JLyongliang > 0 where a.danhao = '" + dataTable1.Rows[0].Field <string>("danhao") + "' order by a.SN"; } //SqlDataReader sqlDataReader2 = command.ExecuteReader(); dataTable2 = db.Ado.GetDataTable(sql); //sqlDataReader2.Close(); ///sqlDataReader2.Dispose(); //command.Dispose(); } if (dataTable2.Rows.Count == 0) { dataTable1.Dispose(); dataTable2.Dispose(); int num = (int)MessageBox.Show((IWin32Window)this, "无法找到此料单行数据!!!", "提示"); return(false); } this.editImgLDH.Image = this.showLDH.Length != 11 || !this.showLDH.StartsWith("8") ? UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width, TYPE.CODE128, this.showLDH) : UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width * 62 / 100, TYPE.CODE128, this.showLDH); this.editImgLDH.Tag = (object)this.showLDH; this.editTxtKH.txt.Text = dataTable1.Rows[0].Field <string>("kehu"); this.editTxtSZ.txt.Text = dataTable1.Rows[0].Field <string>("shazhong"); this.editTxtSH.txt.Text = dataTable1.Rows[0].Field <string>("sehao"); this.editTxtYS.txt.Text = dataTable1.Rows[0].Field <string>("yanse"); this.editTxtDDH.txt.Text = dataTable1.Rows[0].Field <string>("dingdan"); this.editTxtDY.txt.Text = dataTable1.Rows[0].Field <string>("dayang"); this.editTxtZC.txt.Text = dataTable1.Rows[0].Field <string>("zhuche"); this.editTxtDJ.txt.Text = dataTable1.Rows[0].Field <Decimal>("danjia").ToString("0.###;-0.###;\"\""); TextBox txt1 = this.editTxtKZ.txt; //Decimal num1 = dataTable1.Rows[0].Field<Decimal>("kezhong"); //string str1 = num1.ToString("0.###;-0.###;\"\""); string str1 = dataTable1.Rows[0].Field <string>("kezhong"); txt1.Text = str1; TextBox txt2 = this.editTxtMS.txt; Decimal num1 = dataTable1.Rows[0].Field <Decimal>("mishu"); string str2 = num1.ToString("0.###;-0.###;\"\""); txt2.Text = str2; this.editTxtJH.txt.Text = dataTable1.Rows[0].Field <string>("jihao"); TextBox txt3 = this.editTxtSL.txt; num1 = dataTable1.Rows[0].Field <Decimal>("shuiliang"); string str3 = num1.ToString("0.####;-0.####;\"\""); txt3.Text = str3; TextBox txt4 = this.editTxtZL.txt; num1 = dataTable1.Rows[0].Field <Decimal>("zhongliang"); string str4 = num1.ToString("0.####;-0.####;\"\""); txt4.Text = str4; this.editTxtBZ.txt.Text = dataTable1.Rows[0].Field <string>("beizhu"); this.editTxtJLCS.txt.Text = dataTable1.Rows[0].Field <int>("JLciHJ").ToString("0"); for (int index = 0; index < dataTable2.Rows.Count; ++index) { this.editDgvMain.Rows.Add(); DataGridViewRow row = this.editDgvMain.Rows[this.editDgvMain.RowCount - 1]; row.Cells[this.editColSN.Name].Value = (object)dataTable2.Rows[index].Field <long>("SN"); row.Cells[this.editColGX.Name].Value = (object)dataTable2.Rows[index].Field <string>("gongxu"); row.Cells[this.editColRL.Name].Value = (object)dataTable2.Rows[index].Field <string>("ranliao"); row.Cells[this.editColBL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("bili"); row.Cells[this.editColBLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("biliDW"); row.Cells[this.editColYL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("yongliang"); row.Cells[this.editColYLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("yongliangDW"); row.Cells[this.editColGY.Name].Value = (object)dataTable2.Rows[index].Field <string>("yaoqiu"); row.Cells[this.editColJL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("JLbili"); row.Cells[this.editColJLYL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("JLyongliang"); row.Cells[this.editColJLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("JLyongliangDW"); row.Cells[this.editColSNld.Name].Value = (object)dataTable2.Rows[index].Field <long>("SNld"); row.Cells[this.editColDJ.Name].Value = (object)dataTable2.Rows[index].Field <Decimal?>("danjia"); row.Cells[this.editColJE.Name].Value = (object)dataTable2.Rows[index].Field <Decimal?>("jine"); } this.editDgvMain.HeJi(); this.editBtnPrn.Enabled = true; this.bsShowMain.DataSource = (object)dataTable1; this.bsShowData.DataSource = (object)dataTable2; dataTable1.Dispose(); dataTable2.Dispose(); return(true); }
private void 打印简历ToolStripMenuItem_Click(object sender, EventArgs e) { UserProc.WaitStart(this); RSManage rSManage = db.Queryable <RSManage>().Where(it => it.SN == sn_sn).First(); if (rSManage == null) { MessageBox.Show("请先选择要打印的行"); } else { RSManage1 rSManage1 = new RSManage1(); string[] xinbie = rSManage.Xingbie.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.SN = rSManage.SN; rSManage1.Name = rSManage.Name; rSManage1.Yixiang = rSManage.Yixiang; rSManage1.Addr = rSManage.Addr; rSManage1.phone = rSManage.phone; rSManage1.EMail = rSManage.EMail; rSManage1.born = rSManage.born; rSManage1.JiGuan = rSManage.JiGuan; rSManage1.Xingbie = rSManage.Xingbie; rSManage1.Ziwopngjia = rSManage.Ziwopngjia; rSManage1.Xingbie = xinbie.Length == 0 ? "" : xinbie[0]; rSManage1.sf = xinbie.Length == 1 ? "" : xinbie[1]; string[] jy = rSManage.JiaoYu.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.JiaoYu1 = jy[0] == "null" ? "" : jy[0]; rSManage1.JiaoYu2 = jy[1] == "null" ? "" : jy[1]; rSManage1.JiaoYu3 = jy[2] == "null" ? "" : jy[2]; rSManage1.JiaoYu4 = jy[3] == "null" ? "" : jy[3]; string[] gzjy = rSManage.gzjy.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.gzjy1 = gzjy[0] == "null" ? "" : gzjy[0]; rSManage1.gzjy2 = gzjy[1] == "null" ? "" : gzjy[1]; rSManage1.gzjy3 = gzjy[2] == "null" ? "" : gzjy[2]; rSManage1.gzjy4 = gzjy[3] == "null" ? "" : gzjy[3]; string[] JiNeng = rSManage.JiNeng.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.JiNeng1 = JiNeng[0] == "null" ? "" : JiNeng[0]; rSManage1.JiNeng2 = JiNeng[1] == "null" ? "" : JiNeng[1]; rSManage1.JiNeng3 = JiNeng[2] == "null" ? "" : JiNeng[2]; rSManage1.JiNeng4 = JiNeng[3] == "null" ? "" : JiNeng[3]; FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.RDLC.rptTXL.rdlc"; BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = rSManage1; ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = bindingSource; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); var a = frmPrn.rptView.LocalReport.DataSources; frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); UserProc.WaitEnd(this); } }
//保存 private void button4_Click(object sender, EventArgs e) { string sad = lblTxt1.txt.Text; if (dgvEX2.Rows.Count == 0 || dgvEX2.RowCount > 16) { MessageBox.Show(this, "请输入 流程明细,行数不能大于 16 !"); } for (int i = 0; i < dgvEX2.Rows.Count; i++) { if (dgvEX2.Rows[i].Cells[0].FormattedValue.ToString() == "") { MessageBox.Show(this, "请输入 流程明细!"); return; } } bool flag = false; int num = db.Queryable <BaseList>().Where(it => it.leibie == "流程" && it.itemkey == sad).Count(); if (num > 0) { if (MessageBox.Show(this, " 已存在此加工流程:" + sad + ",要覆盖吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } flag = true; } try { int num1 = db.Deleteable <BaseList>().Where(it => it.leibie == "流程" && it.itemkey == sad).ExecuteCommand(); for (int i = 0; i < dgvEX2.Rows.Count; i++) { var baselist = new BaseList() { leibie = "流程", bianhao = "", itemkey = sad, itemname = dgvEX2.Rows[i].Cells[0].FormattedValue.ToString(), }; db.Insertable(baselist).ExecuteCommand(); } } catch (Exception ex) { MessageBox.Show(this, ex.Message + "\r\n\r\n 保存失败,请刷新再试一次!"); } if (flag) { MessageBox.Show(this, "修改成功!"); } else { this.dgvEX1.Rows.Add(new object[] { this.lblTxt1.txt.Text }); MessageBox.Show(this, "增加成功!"); } UserProc.WaitEnd(this); }
static void Main() { Process currentProcess = Process.GetCurrentProcess(); Process[] processesByName = Process.GetProcessesByName(currentProcess.ProcessName); if (processesByName.Length > 1) { for (int index = 0; index < processesByName.Length; ++index) { if (processesByName[index].Id != currentProcess.Id && Program.GetProcessUserName(processesByName[index].Id) == Program.GetProcessUserName(currentProcess.Id)) { IntPtr mainWindowHandle = processesByName[index].MainWindowHandle; if (Program.IsIconic(mainWindowHandle)) { Program.ShowWindowAsync(mainWindowHandle, 9); } Program.SetForegroundWindow(mainWindowHandle); return; } } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string regNumber = UserProc.getRegNumber(); string rKey = Settings.Default.rKey;//119BFFCF8 //UserProc.EncryptDES("", ); //Settings.Default.rtime = DateTime.Now.ToString("yy-MM-dd hh:mm:ss"); //Settings.Default.Save(); /* * if (Settings.Default.rtime == "") * { * Settings.Default.rtime = DateTime.Now.ToString("yy-MM-dd hh:mm:ss"); * Settings.Default.Save(); * MessageBox.Show("本软件为测试版本,有效期为1天"); * } * * if (Settings.Default.rtime.CompareTo(DateTime.Now.AddDays(-1).ToString("yy-MM-dd hh:mm:ss")) < 0 ) * { * MessageBox.Show("有效期超过48小时,请联系作者"); * return; * } */ if (UserProc.getSerialNumber() != "119BFFCF7") { if (rKey == "") { FormRes frmReg = new FormRes(); int num = (int)frmReg.ShowDialog(); if (frmReg.DialogResult == DialogResult.Yes) { //Application.Run(new Form1()); } else { return; } } else { //Application.Run(new Form1()); } } if (!Settings.Default.dqtime.Contains("永久")) { int asd = int.Parse(Settings.Default.dqtime); if (Settings.Default.rtime.CompareTo(DateTime.Now.AddDays(-asd).ToString("yy-MM-dd hh:mm:ss")) < 0) { MessageBox.Show("注册码到期,请重新获取注册码"); Settings.Default.rKey = ""; Settings.Default.Save(); return; } } //Application.Run(new Form1()); try { SqlSugarClient db = SqlBase.GetInstance(); //using (SqlConnection sqlConnection = new SqlConnection(Settings.Default.DBconn)) { //sqlConnection.Open(); //SqlCommand command = sqlConnection.CreateCommand(); string CommandText = "select a.name from sys.triggers a where a.is_disabled = 1"; //SqlDataReader sqlDataReader1 = command.ExecuteReader(); DataTable dataTable = db.Ado.GetDataTable(CommandText);//new DataTable(); //dataTable.Load((IDataReader)sqlDataReader1); if (dataTable.Rows.Count > 0) { string str1 = ""; for (int index = 0; index < dataTable.Rows.Count; ++index) { str1 = str1 + dataTable.Rows[index].Field <string>("name") + ","; } string str2 = str1.TrimEnd(','); //sqlDataReader1.Close(); //sqlDataReader1.Dispose(); //command.Dispose(); dataTable.Dispose(); int num = (int)MessageBox.Show("触发器(" + str2 + ")被禁用,软件无法启动,请联系开发人员!", "严重错误!"); Process.GetCurrentProcess().Kill(); } //sqlDataReader1.Close(); dataTable.Clear(); string aCommandText = "select GETDATE() as srvTime"; //SqlDataReader sqlDataReader2 = command.ExecuteReader(); DataTable dataTable1 = db.Ado.GetDataTable(aCommandText); //sqlDataReader2.Read(); DateTime dateTime = (DateTime)dataTable1.Rows[0]["srvTime"]; //sqlDataReader2.Close(); //sqlDataReader2.Dispose(); //command.Dispose(); dataTable.Dispose(); dataTable1.Dispose(); dataTable.Dispose(); if (DateTime.Now < dateTime.AddMinutes(-30.0) || DateTime.Now > dateTime.AddMinutes(30.0)) { int num = (int)MessageBox.Show("本机日期与时间不对\r\n\r\n服务器时间:" + dateTime.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n 本机时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n 请核对!", "提示"); Process.GetCurrentProcess().Kill(); } } } catch (Exception ex) { int num = (int)MessageBox.Show("服务器连接失败!!!" + ex.Message, "提示"); Process.GetCurrentProcess().Kill(); return; } if (Settings.Default.DiLiao) { Application.Run((Form) new frmDL()); } else if (Settings.Default.ChengLiao) { Application.Run((Form) new frmCL()); } else { if (Settings.Default.islogin.Length == 0) { FrmLogin frmLogin = new FrmLogin(false); int num = (int)frmLogin.ShowDialog(); if (frmLogin.DialogResult == DialogResult.OK) { // frmLogin.Close(); Application.Run((Form) new Form1()); } } else { Application.Run((Form) new Form1()); } //else { // frmLogin.Close(); Process.GetCurrentProcess().Kill(); } } }
private void setPict(string code) { editImgLDH.Image = UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width, TYPE.CODE128, code); editImgLDH.Tag = (object)code; }
private void Login() { try { T_Base t_Base = db.Queryable <T_Base>() .Where(it => (it.itemName == textBox1.Text || it.bianhao == textBox1.Text) && it.item0 == UserProc.EncryptDES(textBox2.Text, "123456789") && it.leibie == "用户登录") .Single(); if (t_Base == null) { MessageBox.Show("用户名或者密码错误"); return; } Settings.Default.islogin = t_Base.SN + ""; Settings.Default.Save(); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void this_Load(object sender, EventArgs e) { this.textBox1.Text = UserProc.getSerialNumber(); }
public void SetData(Object o) { if (db == null) { return; } if ((long)o == -1L) { return; } getByWhere = db.Queryable <LCKA>().Where(it => it.SN == (long)o).ToList(); if (getByWhere.Count != 1) { MessageBoxEx.Show("参数错误,请检查"); return; } SN = (long)o; //客户, dateTimePicker1.Value = getByWhere[0].riqiZhidan; lblgh.txt.Text = getByWhere[0].liushuihao; txtKehu.cobodgv.Text = getByWhere[0].kehu; txtPinming.cobodgv.Text = getByWhere[0].peiming; txtSebie.cobodgv.Text = getByWhere[0].sebie; lblSH.cobodgv.Text = getByWhere[0].sehao; lblFUK.txt.Text = getByWhere[0].fukuan; lblKZ.txt.Text = getByWhere[0].kezhong; lblpishu.txt.Text = getByWhere[0].peishu; lblzhongliang.txt.Text = getByWhere[0].zhongliang; lblCW.cobodgv.Text = getByWhere[0].cangwei; lblZgs.txt.Text = getByWhere[0].zonggangshu; lblZps.txt.Text = getByWhere[0].zongpishu; lbDaih.txt.Text = getByWhere[0].daihao; lblDDH.txt.Text = getByWhere[0].dingdanhao; lblShouGan.txt.Text = getByWhere[0].shougan; lblSsl.txt.Text = getByWhere[0].suoshuilv; lblSld.txt.Text = getByWhere[0].selaodu; lblMC.txt.Text = getByWhere[0].michang; lblYWY.cobodgv.Text = getByWhere[0].yewuyuan; lblTS.txt.Text = getByWhere[0].taose; txtLiuchen.cobodgv.Text = getByWhere[0].shengchanlc; sclcgx.txt.Text = getByWhere[0].shengchangongxu; lblJGYQ.txt.Text = getByWhere[0].jiagongyaoqiu; lblBZ.txt.Text = getByWhere[0].beizhu; lblJH.cobodgv.Text = getByWhere[0].jihao; lblRSGY.txt.Text = getByWhere[0].ransegongyi; lblDXGY.txt.Text = getByWhere[0].dingxinggongyi; lblBZGY.txt.Text = getByWhere[0].baozhuanggongyi; lblMZ.txt.Text = getByWhere[0].mizhong; pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; btnNewNow.Enabled = true; btnEdit.Enabled = true; btnDel.Enabled = true; btnPrn.Enabled = true; }
private void button5_Click(object sender, EventArgs e) { LCKA lcka = getByWhere[0]; UserProc.WaitStart(this); string asd = lcka.riqiZhidan.ToString("yy-MM-dd HH:mm"); //asd = asd.Replace("月", "-").Replace("日", ""); Console.WriteLine("-------------" + asd); List <LCKA> list = new List <LCKA>(); if (lcka == null) { MessageBox.Show(this, "该流程卡已不存在!请核对!", "提示"); UserProc.WaitEnd(this); } else { var asdfg = db.Queryable <BaseIList>() .Where(it => it.leibie == "产量登记" && it.item1 == "开卡" && it.dingdanhao == lcka.liushuihao) .First(); if (asdfg == null) { var sd = new BaseIList() { leibie = "产量登记", dingdanhao = lcka.liushuihao, pingmin = lcka.peiming, seming = lcka.sebie, sehao = lcka.sehao, item0 = ClsLogUser.XinMing, //操作人员 pishu = lcka.peishu, item1 = "开卡", //工序 zongliang = lcka.zhongliang, item2 = "0%", //百分比 riqi = DateTime.Now, item3 = "开卡", kehu = lcka.kehu, }; db.Insertable <BaseIList>(sd).ExecuteCommand(); } list.Add(lcka); /* * if (lcka.zonggangshu == "" || !UserProc.IsInt(lcka.zonggangshu)) * { * list.Add(lcka); * } * else * { * int num = Convert.ToInt32(lcka.zonggangshu); * for (int i = 0; i < num; i++) * { * LCKA asd1 = new LCKA(); * asd1 = TransExpV2<LCKA, LCKA>.Trans(lcka); * asd1.liushuihao = string.Format("{0}", (int.Parse(lcka.liushuihao) + i)); * list.Add(asd1); * } * } */ FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.Report2.rdlc"; string filename = Application.StartupPath + "\\imgLCK.Bmp"; pictureBox1.Image.Save(filename, ImageFormat.Bmp); string str = "file:///" + filename.Replace("\\", "/"); frmPrn.rptView.LocalReport.EnableExternalImages = true; ReportParameter reportParameter1 = new ReportParameter("LDH", str); ReportParameter parameters = new ReportParameter("p1", sclcgx.txt.Text); ReportParameter parameters1 = new ReportParameter("riqi", asd); string[] array = new string[30]; var asde = db.Queryable <LCMX>().Where(it => it.SNka == lcka.SN).ToList(); //string[] asdf = sclcgx.txt.Text.Split("->".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < asde.Count; i++) { array[i] = asde[i].gongxu; } for (int i = asde.Count; i < 30; i++) { array[i] = ""; } ReportParameter parameters2 = new ReportParameter("p2", array); //BindingSource asdfds = new BindingSource(); //asdfds.DataSource = asde; //ReportDataSource reportDataSource1 = new ReportDataSource(); //reportDataSource1.Name = "lblcmx"; //reportDataSource1.Value = asdfds; frmPrn.rptView.LocalReport.SetParameters(parameters); frmPrn.rptView.LocalReport.SetParameters(parameters1); frmPrn.rptView.LocalReport.SetParameters(reportParameter1); frmPrn.rptView.LocalReport.SetParameters(parameters2); frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = list; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); //frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource1); var a = frmPrn.rptView.LocalReport.DataSources; frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); UserProc.WaitEnd(this); } }