using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using EAS.Services; using SOH.BLL; using SOH.Entities; using SOH; using SOH.Common; using SOH.Data; using TiJianJieGuoGuanLi; namespace TiJianJieGuo { public partial class frmMoBan : Form { public frmMoBan() { InitializeComponent(); } public int xmbm; public int rowindexs; //public DataTable tempAllDt; frmYiShengJieGuoLuRuNew fysjglrn; public DataTable templetDt; public frmMoBan(int jcxmbm, int rowindex, frmYiShengJieGuoLuRuNew fysjglrn) { InitializeComponent(); xmbm = jcxmbm; rowindexs = rowindex; this.fysjglrn = fysjglrn; } private void frmMoBan_Load(object sender, EventArgs e) { var vservice = ServiceContainer.GetService(); t_jcxm jcxmOne = vservice.getJcxm(xmbm); var ZongJian = ServiceContainer.GetService(); //if (jcxmOne.jcxmbm == 1031 || jcxmOne.jcxmbm == 1030 || jcxmOne.jcxmbm == 1028 || jcxmOne.jcxmbm == 1029 || jcxmOne.jcxmbm == 322 || jcxmOne.jcxmbm == 1075 || jcxmOne.jcxmbm == 1076) //{ // templetDt = ZongJian.getAllMoban(1028); //} //else //{ templetDt = ZongJian.getAllMoban(xmbm); //} //设置列自动排列 this.dataGridView1.AutoGenerateColumns = false; //设置自动换行 this.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True; //设置自动调整高度 this.dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; this.Text = jcxmOne.jcxmmc + "模板"; //tempAllDt = fysjglrn.templetDt; //fysjglrn.templetDt.DefaultView.RowFilter = string.Format("项目ID={0}", xmbm); //DataView dv = new DataView(tempAllDt); //dv.Sort = "项目ID="+xmbm; //tempAllDt = dv.ToTable(); dataGridView1.DataSource = templetDt; dataGridView1.ClearSelection(); dataGridView1.Refresh(); } private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { } private void button1_Click(object sender, EventArgs e) { DataTable jgDt = templetDt.Clone(); foreach (DataGridViewRow dgvr in dataGridView1.Rows) { string _selectValue = dgvr.Cells["mrxz"].EditedFormattedValue.ToString(); if (_selectValue == "True") { DataRow dataRow = (dgvr.DataBoundItem as DataRowView).Row; jgDt.Rows.Add(dataRow.ItemArray); } } if (jgDt.Rows.Count != 0) { fysjglrn.GengXinJgAandZd(jgDt, rowindexs, xmbm); } this.Close(); } private void txtPY_TextChanged(object sender, EventArgs e) { if (txtPY.Text.Trim() != "") { //if (xmbm == 1031 || xmbm == 1030 || xmbm == 1028 || xmbm == 1029 || xmbm == 322 || xmbm == 1075 || xmbm == 1076) //{ // (dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("项目ID={0}", 1028); //} //else //{ (dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("项目ID={0} and 简拼 Like '%{1}%'", xmbm, this.txtPY.Text.Trim()); //} } else { //if (xmbm == 1031 || xmbm == 1030 || xmbm == 1028 || xmbm == 1029 || xmbm == 322 || xmbm == 1075 || xmbm == 1076) //{ // (dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("项目ID={0}", 1028); //} //else //{ (dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("项目ID={0}", xmbm); //} } } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } else { if ((bool)dataGridView1.Rows[e.RowIndex].Cells["mrxz"].EditedFormattedValue != true) { dataGridView1.Rows[e.RowIndex].Cells["mrxz"].Value = true; } else { dataGridView1.Rows[e.RowIndex].Cells["mrxz"].Value = false; } } } } }