private void frmSupplyReport_Load(object sender, EventArgs e) { Supply s = new Supply(); s.GetModel(_supplyID); if (string.IsNullOrEmpty(s.SupplyID)) { MessageBox.Show("该供货单不存在!"); return; } Agent _a = new Agent(s.AgentName); decimal _sum = 0; DataTable ds = GetGroupSupply(out _sum); ReportDataSource rds = new ReportDataSource("DataSet1_DataTable1", ds); reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); string _barStr = ""; string sql = "SELECT Model,Barcode FROM SupplyDetail WHERE SupplyID='" + _supplyID + "' ORDER BY Model,Barcode ASC"; DataTable dt = SqlHelper.ExecuteDataTable(sql); if (dt != null&& dt.Rows.Count>0) { string _modelNow = ""; foreach (DataRow dr in dt.Rows) { string _m = dr["Model"].ToString(); if (_modelNow != _m) { _modelNow = _m; _barStr += "\n" + _modelNow + " 型号:\n"; } _barStr += dr["Barcode"].ToString()+"、"; } if (_barStr.Substring(0, 1) == "\n") { _barStr = _barStr.Substring(1); } } ReportParameter[] pas = new ReportParameter[] { new ReportParameter("pam_GoodsName", CommonService.GetParamValue("GoodsName")), new ReportParameter("pam_Company", CommonService.GetParamValue("Name")), new ReportParameter("pam_Address", CommonService.GetParamValue("Address")), new ReportParameter("pam_Phone", CommonService.GetParamValue("Phone")), new ReportParameter("pam_Remark", _barStr), new ReportParameter("pam_Date",s.CreateTime.ToString("yyyy年MM月dd日")), new ReportParameter("pam_NO", s.SupplyID), new ReportParameter("pam_SumSmall", _sum.ToString("0.00")), new ReportParameter("pam_SumAmount", CommonService.MoneyToChinese(_sum.ToString("0.00"))), new ReportParameter("pam_SupplyPhone",_a.Phone==null?"":_a.Phone), new ReportParameter("pam_SupplyTel",_a.Tel==null?"":_a.Tel), new ReportParameter("pam_SupplyAddress",_a.Address==null?"":_a.Address), new ReportParameter("pam_Supply", s.AgentName) }; reportViewer1.LocalReport.SetParameters(pas); this.reportViewer1.RefreshReport(); }
private void frmCustomerUpdate_Load(object sender, EventArgs e) { BindLevel(); Agent a = new Agent(); a.GetModel(_agentName); txt_Name.Text = a.Name; txt_Phone.Text=a.Phone; cbx_Level.Text = a.LevelName; txt_Address.Text = a.Address; txt_Contact.Text = a.Contact; txt_Fox.Text = a.Fox; txt_Tel.Text = a.Tel; }
private void BindCBX() { DataSet ds = new Agent().GetCbxList(""); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dr["Name"] = " "; dt.Rows.InsertAt(dr, 0); cbx_Agent.DataSource = dt; cbx_Agent.DisplayMember = "Name"; cbx_Agent.ValueMember = "Name"; } else { MessageBox.Show("请先添加客户资料!"); return; } }
private void btn_Add_Click(object sender, EventArgs e) { Agent a = new Agent(); a.Name = txt_Name.Text; a.Phone = txt_Phone.Text; a.LevelName = cbx_Level.Text; a.Address = txt_Address.Text; a.Contact = txt_Contact.Text; a.Fox = txt_Fox.Text; a.Tel = txt_Tel.Text; bool re = a.Update(); if (re) { MessageBox.Show("修改成功!"); _isOK = true; this.Close(); } else { MessageBox.Show("修改失败!"); } }