void ass( ) { _model = _bll.GetModel(_model.IDX); textBox10.Text = _model.OZ002; textBox1.Text = _model.OZ001; textBox2.Text = _model.OZ003; textBox3.Text = _model.OZ004; textBox4.Text = _model.OZ005.ToString( ); textBox5.Text = _model.OZ006.ToString( ); textBox6.Text = _model.OZ007; textBox8.Text = _model.OZ015; }
protected override void select( ) { base.select( ); _model = new MulaolaoLibrary.WaiXianLibrary( ); query.StartPosition = FormStartPosition.CenterScreen; query.PassDataBetweenForm += new SelectAll.WaiXianAll.PassDataBetweenFormHandler(query_PassDataBetweenForm); query.ShowDialog( ); if (_model.OZ011 != null && _model.OZ011 != "") { autoQuery( ); } }
/// <summary> /// 获取数据集 /// </summary> /// <param name="row"></param> /// <returns></returns> public MulaolaoLibrary.WaiXianLibrary GetDataRow(DataRow row) { MulaolaoLibrary.WaiXianLibrary _model = new MulaolaoLibrary.WaiXianLibrary( ); if (row != null) { if (row["idx"] != null && row["idx"].ToString( ) != "") { _model.IDX = int.Parse(row["idx"].ToString( )); } if (row["OZ001"] != null && row["OZ001"].ToString( ) != "") { _model.OZ001 = row["OZ001"].ToString( ); } if (row["OZ002"] != null && row["OZ002"].ToString( ) != "") { _model.OZ002 = row["OZ002"].ToString( ); } if (row["OZ003"] != null && row["OZ003"].ToString( ) != "") { _model.OZ003 = row["OZ003"].ToString( ); } if (row["OZ004"] != null && row["OZ004"].ToString( ) != "") { _model.OZ004 = row["OZ004"].ToString( ); } if (row["OZ005"] != null && row["OZ005"].ToString( ) != "") { _model.OZ005 = long.Parse(row["OZ005"].ToString( )); } if (row["OZ006"] != null && row["OZ006"].ToString( ) != "") { _model.OZ006 = decimal.Parse(row["OZ006"].ToString( )); } if (row["OZ007"] != null && row["OZ007"].ToString( ) != "") { _model.OZ007 = row["OZ007"].ToString( ); } if (row["OZ008"] != null && row["OZ008"].ToString( ) != "") { _model.OZ008 = int.Parse(row["OZ008"].ToString( )); } if (row["OZ009"] != null && row["OZ009"].ToString( ) != "") { _model.OZ009 = decimal.Parse(row["OZ009"].ToString( )); } if (row["OZ010"] != null && row["OZ010"].ToString( ) != "") { _model.OZ010 = row["OZ010"].ToString( ); } if (row["OZ011"] != null && row["OZ011"].ToString( ) != "") { _model.OZ011 = row["OZ011"].ToString( ); } if (row["OZ013"] != null && row["OZ013"].ToString( ) != "") { _model.OZ013 = row["OZ013"].ToString( ); } if (row["OZ015"] != null && row["OZ015"].ToString( ) != "") { _model.OZ015 = row["OZ015"].ToString( ); } } return(_model); }
void queryConten( ) { _model = _bll.GetModel(_model.OZ011); textBox7.Text = _model.OZ013; refre( ); }
/// <summary> /// 生成 /// </summary> /// <param name="num"></param> /// <returns></returns> public bool GetDataTableGener(string num, string oddNum, string oddNumOf349) { bool result = false; ArrayList SQLString = new ArrayList( ); MulaolaoLibrary.WaiXianLibrary _model = new MulaolaoLibrary.WaiXianLibrary( ); StringBuilder strSql = new StringBuilder( ); strSql.Append("SELECT WX10,WX03,WX15,WX82,SUM(CASE WHEN WX10='双瓦外箱' THEN ((WX27 + WX28 + WX29) * (WX30 + WX31 + WX32) + (WX23 + WX24) * (WX25 + WX26)) * 0.0001 * WX13 * WX15 WHEN WX10='小箱式' THEN ((WX27 + WX28 + WX29) * (WX30 + WX31 + WX32) + (WX23 + WX24) * (WX25 + WX26)) * 0.0001 * WX13 * WX15 WHEN WX10='牙膏式' THEN ((WX27 + 2*WX28 + WX29) * (2*WX30 + 2*WX31 + WX32) +(WX23 + WX24) * (WX25 + WX26)) * 0.0001*WX13* WX15 WHEN WX10='插口式' THEN ((WX27 + 2*WX28 + WX29) * (2*WX30 + 2*WX31 + WX32) +(WX23 + WX24) * (WX25 + WX26)) * 0.0001*WX13* WX15 WHEN WX10='天盖' THEN ((WX27 + 2*WX28 + WX29) * (WX30 + 2*WX31 + WX32) +(WX23 + WX24) * (WX25 + WX26)) * 0.0001*WX13* WX15 WHEN WX10='地盖' THEN ((WX27 + 2*WX28 + WX29) * (WX30 + 2*WX31 + WX32) +(WX23 + WX24) * (WX25 + WX26)) * 0.0001*WX13* WX15 WHEN WX10='折叠式' THEN ((2*WX27 + 2*WX28 + WX29) * (1.5*WX30 + WX31 + WX32) +(WX23 + WX24) * (WX25 + WX26)) * 0.0001*WX13* WX15 WHEN WX10 NOT IN ('双瓦外箱','小箱式','牙膏式','插口式','天盖','地盖','折叠式') THEN (WX23 + WX24) * (WX25 + WX26) * 0.0001 * WX13* WX15 END) PQ FROM R_PQT "); strSql.Append("WHERE WX82=@WX82"); strSql.Append(" GROUP BY WX10,WX15,WX03,WX82"); SqlParameter[] parameter = { new SqlParameter("@WX82", SqlDbType.NVarChar, 2000) }; parameter[0].Value = oddNumOf349; DataTable da = SqlHelper.ExecuteDataTable(strSql.ToString( ), parameter); if (da.Rows.Count > 0) { string[] str = num.Split(','); foreach (string s in str) { StringBuilder strS = new StringBuilder( ); strS.Append("SELECT PQF02,PQF03,PQF04,PQF06 FROM R_PQF WHERE PQF01=@PQF01"); SqlParameter[] paramete = { new SqlParameter("@PQF01", SqlDbType.NVarChar, 20) }; paramete[0].Value = s; DataTable de = SqlHelper.ExecuteDataTable(strS.ToString( ), paramete); if (de.Rows.Count > 0) { _model.OZ001 = s; _model.OZ002 = de.Rows[0]["PQF04"].ToString( ); _model.OZ003 = de.Rows[0]["PQF03"].ToString( ); _model.OZ004 = de.Rows[0]["PQF02"].ToString( ); _model.OZ005 = string.IsNullOrEmpty(de.Rows[0]["PQF06"].ToString( )) == true ? 0 : Convert.ToInt32(de.Rows[0]["PQF06"].ToString( )); _model.OZ006 = 0M; for (int i = 0; i < da.Rows.Count; i++) { _model.OZ007 = da.Rows[i]["WX10"].ToString( ); _model.OZ008 = string.IsNullOrEmpty(da.Rows[i]["WX15"].ToString( )) == true ? 0 : Convert.ToInt32(da.Rows[i]["WX15"].ToString( )); _model.OZ009 = string.IsNullOrEmpty(da.Rows[i]["PQ"].ToString( )) == true ? 0 : Convert.ToDecimal(da.Rows[i]["PQ"].ToString( )); _model.OZ010 = num; _model.OZ011 = oddNum; _model.OZ014 = da.Rows[i]["WX03"].ToString( ); _model.OZ015 = da.Rows[i]["WX82"].ToString( ); StringBuilder strSq = new StringBuilder( ); strSq.Append("SELECT COUNT(1) FROM R_PQOZ"); strSq.Append(" WHERE OZ001=@OZ001 AND OZ011=@OZ011 AND OZ007=@OZ007 AND OZ014=@OZ014 AND OZ015=@OZ015"); SqlParameter[] parame = { new SqlParameter("@OZ001", SqlDbType.NVarChar, 20), new SqlParameter("@OZ011", SqlDbType.NVarChar, 20), new SqlParameter("@OZ007", SqlDbType.NVarChar, 20), new SqlParameter("@OZ014", SqlDbType.NVarChar, 20), new SqlParameter("@OZ015", SqlDbType.NVarChar, 20) }; parame[0].Value = _model.OZ001; parame[1].Value = oddNum; parame[2].Value = _model.OZ007; parame[3].Value = _model.OZ014; parame[4].Value = _model.OZ015; if (SqlHelper.Exists(strSq.ToString( ), parame) == true) { StringBuilder strSqlEdit = new StringBuilder( ); strSqlEdit.Append("UPDATE R_PQOZ SET "); //strSqlEdit.AppendFormat( "OZ001='{0}'" ,_model.OZ001 ); strSqlEdit.AppendFormat("OZ002='{0}',", _model.OZ002); strSqlEdit.AppendFormat("OZ003='{0}',", _model.OZ003); strSqlEdit.AppendFormat("OZ004='{0}',", _model.OZ004); strSqlEdit.AppendFormat("OZ005='{0}',", _model.OZ005); //strSqlEdit.AppendFormat( "OZ006='{0}'," ,_model.OZ006 ); //strSqlEdit.AppendFormat( "OZ007='{0}'," ,_model.OZ007 ); strSqlEdit.AppendFormat("OZ008='{0}',", _model.OZ008); strSqlEdit.AppendFormat("OZ009='{0}',", _model.OZ009); strSqlEdit.AppendFormat("OZ010='{0}'", _model.OZ010); //strSqlEdit.AppendFormat( "OZ011='{0}'" ,_model.OZ011 ); strSqlEdit.AppendFormat(" WHERE OZ001='{0}' AND OZ011='{1}' AND OZ007='{2}' AND OZ014='{3}' AND OZ015='{4}'", _model.OZ001, _model.OZ011, _model.OZ007, _model.OZ014, _model.OZ015); SQLString.Add(strSqlEdit); } else { StringBuilder strSqlAdd = new StringBuilder( ); strSqlAdd.Append("INSERT INTO R_PQOZ ("); strSqlAdd.Append("OZ001,OZ002,OZ003,OZ004,OZ005,OZ006,OZ007,OZ008,OZ009,OZ010,OZ011,OZ014,OZ015)"); strSqlAdd.Append(" VALUES ("); strSqlAdd.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", _model.OZ001, _model.OZ002, _model.OZ003, _model.OZ004, _model.OZ005, _model.OZ006, _model.OZ007, _model.OZ008, _model.OZ009, _model.OZ010, _model.OZ011, _model.OZ014, _model.OZ015); SQLString.Add(strSqlAdd); } } } else { result = false; } } result = SqlHelper.ExecuteSqlTran(SQLString); } else { result = false; } return(result); }