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 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); }
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); } }
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); } }