public FormArt( ) { InitializeComponent( ); model = new LineProductMesEntityu.ArtEntity( ); body = new LineProductMesEntityu.ArsEntity( ); _bll = new LineProductMesBll.Bll.ArtBll( ); _bodyOne = new LineProductMesEntityu.AruEntity( ); //获取UI线程同步上下文 m_SyncContext = SynchronizationContext.Current; GridViewMoHuSelect.SetFilter(new DevExpress.XtraGrid.Views.Grid.GridView [] { gridView1, gridView2, gridView3, View1, View4, View2, View3, gridView4 }); GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { gridView1, gridView2, gridView3, View1, View4, View2, View3, gridView4 }); FieldInfo fi = typeof(XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic); fi.SetValue(null, new DrawXPaint( )); ToolBarContain.ToolbarsC(barTool, new DevExpress.XtraBars.BarButtonItem [] { toolCancellation, toolExamin }); Query( ); controlUnEnable( ); controlClear( ); InitData( ); }
private void gridView2_DoubleClick(object sender, EventArgs e) { if (toolSave.Visibility == DevExpress.XtraBars.BarItemVisibility.Always) { return; } DataRow row = gridView2.GetFocusedDataRow( ); if (row == null) { return; } model.ART001 = row ["ARS001"].ToString( ); xtraTabControl1.SelectedTabPage = TabPageOne; LineProductMesEntityu.ArsEntity body = _bll.getModel(model.ART001); setValue(body); tableBody = _bll.getTableViewMain(model.ART001); gridControl1.DataSource = tableBody; if (tableBody != null && tableBody.Rows.Count > 0) { _bodyOne.ARU001 = tableBody.Rows [0] ["ART001"].ToString( ); _bodyOne.ARU002 = tableBody.Rows [0] ["ART011"].ToString( ); tableBodyOne = _bll.getTableViewBody(_bodyOne.ARU001, _bodyOne.ARU002); } else { tableBodyOne = _bll.getTableViewBody(string.Empty, string.Empty); } gridControl3.DataSource = tableBodyOne; QueryTool( ); toolExport.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; }
void AddHeader(Dictionary <object, object> SQLString, LineProductMesEntityu.ArsEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("INSERT INTO MIKARS ("); strSql.Append("ARS001,ARS002,ARS003,ARS004,ARS005,ARS006,ARS007,ARS008,ARS009,ARS011) "); strSql.Append("VALUES ("); strSql.Append("@ARS001,@ARS002,@ARS003,@ARS004,@ARS005,@ARS006,@ARS007,@ARS008,@ARS009,@ARS011) "); SqlParameter [] parameters = { new SqlParameter("@ARS001", SqlDbType.NVarChar, 20), new SqlParameter("@ARS002", SqlDbType.NVarChar, 50), new SqlParameter("@ARS003", SqlDbType.NVarChar, 20), new SqlParameter("@ARS004", SqlDbType.NVarChar, 20), new SqlParameter("@ARS005", SqlDbType.NVarChar, 20), new SqlParameter("@ARS006", SqlDbType.NVarChar, 5), new SqlParameter("@ARS007", SqlDbType.NVarChar, 20), new SqlParameter("@ARS008", SqlDbType.Decimal, 9), new SqlParameter("@ARS009", SqlDbType.NVarChar, 20), new SqlParameter("@ARS011", SqlDbType.Decimal, 9) }; parameters [0].Value = model.ARS001; parameters [1].Value = model.ARS002; parameters [2].Value = model.ARS003; parameters [3].Value = model.ARS004; parameters [4].Value = model.ARS005; parameters [5].Value = model.ARS006; parameters [6].Value = model.ARS007; parameters [7].Value = model.ARS008; parameters [8].Value = model.ARS009; parameters [9].Value = model.ARS011; SQLString.Add(strSql, parameters); }
void setValue(LineProductMesEntityu.ArsEntity model) { txtARS001.EditValue = model.ARS001; txtARS001.Text = model.ARS001; txtARS002.Text = model.ARS002; txtARS003.Text = model.ARS003; txtARS004.Text = model.ARS004; txtARS005.Text = model.ARS005; txtARS006.Text = model.ARS006; txtARS007.Text = model.ARS007; txtARS008.Text = Convert.ToDecimal(model.ARS008).ToString("0.###"); txtARS009.Text = model.ARS009; txtARS011.Text = Convert.ToDecimal(model.ARS011).ToString("0.######"); }
public LineProductMesEntityu.ArsEntity getModel(DataRow row) { LineProductMesEntityu.ArsEntity model = new LineProductMesEntityu.ArsEntity( ); if (row != null) { if (row ["ARS001"] != null) { model.ARS001 = row ["ARS001"].ToString( ); } if (row ["ARS002"] != null) { model.ARS002 = row ["ARS002"].ToString( ); } if (row ["ARS003"] != null) { model.ARS003 = row ["ARS003"].ToString( ); } if (row ["ARS004"] != null) { model.ARS004 = row ["ARS004"].ToString( ); } if (row ["ARS005"] != null) { model.ARS005 = row ["ARS005"].ToString( ); } if (row ["ARS006"] != null) { model.ARS006 = row ["ARS006"].ToString( ); } if (row ["ARS007"] != null) { model.ARS007 = row ["ARS007"].ToString( ); } if (row ["ARS008"] != null && row ["ARS008"].ToString( ) != "") { model.ARS008 = decimal.Parse(row ["ARS008"].ToString( )); } if (row ["ARS009"] != null) { model.ARS009 = row ["ARS009"].ToString( ); } if (row ["ARS011"] != null && row ["ARS011"].ToString( ) != "") { model.ARS011 = decimal.Parse(row ["ARS011"].ToString( )); } } return(model); }
/// <summary> /// 保存数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Save(LineProductMesEntityu.ArsEntity model, DataTable table, Hashtable haTable) { Dictionary <object, object> SQLString = new Dictionary <object, object> ( ); AddHeader(SQLString, model); if (table != null && table.Rows.Count > 0) { LineProductMesEntityu.ArtEntity body = new LineProductMesEntityu.ArtEntity( ); body.ART001 = model.ARS001; foreach (DataRow row in table.Rows) { body.ART011 = row ["ART011"].ToString( ); body.ART002 = row ["ART002"].ToString( ); body.ART003 = row ["ART003"].ToString( ); body.ART004 = string.IsNullOrEmpty(row ["ART004"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["ART004"].ToString( )); body.ART005 = string.IsNullOrEmpty(row ["ART005"].ToString( )) == true ? 0 : Convert.ToDecimal(row ["ART005"].ToString( )); body.ART006 = row ["ART006"].ToString( ); body.ART007 = row ["ART007"].ToString( ); //body . ART008 = row [ "ART008" ] . ToString ( ); body.ART009 = row ["ART009"].ToString( ); body.ART010 = string.IsNullOrEmpty(row ["ART010"].ToString( )) == true ? "否" : row ["ART010"].ToString( ); body.ART012 = string.IsNullOrEmpty(row ["ART012"].ToString( )) == true ? 0 : Convert.ToInt32(row ["ART012"].ToString( )); body.ART013 = row ["ART013"].ToString( ); AddBody(SQLString, body); if (haTable != null && haTable.Count > 0) { DataTable tableView = ( DataTable )haTable [body.ART001 + body.ART011]; if (tableView != null && tableView.Rows.Count > 0) { LineProductMesEntityu.AruEntity bodyOne = new LineProductMesEntityu.AruEntity( ); bodyOne.ARU001 = body.ART001; bodyOne.ARU002 = body.ART011; foreach (DataRow rows in tableView.Rows) { bodyOne.ARU003 = rows ["ARU003"].ToString( ); bodyOne.ARU004 = rows ["ARU004"].ToString( ); AddBodyOne(SQLString, bodyOne); } } } } } return(SqlHelper.ExecuteSqlTranDic(SQLString)); }
void EditHeader(Dictionary <object, object> SQLString, LineProductMesEntityu.ArsEntity model) { StringBuilder strSql = new StringBuilder( ); strSql.Append("UPDATE MIKARS SET "); strSql.Append("ARS008=@ARS008,"); strSql.Append("ARS011=@ARS011 "); strSql.Append("WHERE ARS001=@ARS001"); SqlParameter [] parameters = { new SqlParameter("@ARS001", SqlDbType.NVarChar, 20), new SqlParameter("@ARS008", SqlDbType.Decimal, 9), new SqlParameter("@ARS011", SqlDbType.Decimal, 9) }; parameters [0].Value = model.ARS001; parameters [1].Value = model.ARS008; parameters [2].Value = model.ARS011; SQLString.Add(strSql, parameters); }
protected override int Query( ) { tableView = _bll.getTableViewAll( ); gridControl2.DataSource = tableView; if (tableView != null && tableView.Rows.Count > 0) { table = new Hashtable( ); model.ART001 = tableView.Rows [0] ["ARS001"].ToString( ); LineProductMesEntityu.ArsEntity body = _bll.getModel(model.ART001); setValue(body); tableBody = _bll.getTableViewMain(model.ART001); gridControl1.DataSource = tableBody; if (tableBody != null && tableBody.Rows.Count > 0) { _bodyOne.ARU001 = tableBody.Rows [0] ["ART001"].ToString( ); _bodyOne.ARU002 = tableBody.Rows [0] ["ART011"].ToString( ); tableBodyOne = _bll.getTableViewBody(_bodyOne.ARU001, _bodyOne.ARU002); } else { tableBodyOne = _bll.getTableViewBody(string.Empty, string.Empty); } gridControl3.DataSource = tableBodyOne; if (tableBodyOne != null && tableBodyOne.Rows.Count > 0) { _bodyOne.ARU001 = tableBodyOne.Rows [0] ["ARU001"].ToString( ); _bodyOne.ARU002 = tableBodyOne.Rows [0] ["ARU002"].ToString( ); table.Add(_bodyOne.ARU001 + _bodyOne.ARU002, tableBodyOne); } } QueryTool( ); toolExport.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; return(base.Query( )); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="model"></param> /// <param name="table"></param> /// <param name="idxList"></param> /// <returns></returns> public bool Edit(LineProductMesEntityu.ArsEntity model, DataTable table, List <string> idxList, Hashtable haTable, List <string> idxListOne) { return(dal.Edit(model, table, idxList, haTable, idxListOne)); }
/// <summary> /// 保存数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Save(LineProductMesEntityu.ArsEntity model, DataTable table, Hashtable haTable) { return(dal.Save(model, table, haTable)); }