public BDSX getDemarcateInf() { BDSX model = new BDSX(); string sql = "select * from [设备标定时限]"; try { DataTable dt = DBHelperSQL.GetDataTable(sql, CommandType.Text); if (dt.Rows.Count > 0) { model.HXSX = dt.Rows[0]["HXSX"].ToString(); model.JSGLSX = dt.Rows[0]["JSGLSX"].ToString(); model.GLSX = dt.Rows[0]["GLSX"].ToString(); model.FXYSX = dt.Rows[0]["FXYSX"].ToString(); model.LLJSX = dt.Rows[0]["LLJSX"].ToString(); } else { model.HXSX = "-2"; //当服务器上没有找到本线时,本线编号置为-2,以免为0 } } catch (Exception) { throw; } return(model); }
public BDSX getDemarcateInf() { BDSX model = new BDSX(); string sql = "select * from [设备标定时限]"; try { DataTable dt = DBHelperSQL.GetDataTable(sql, CommandType.Text); if (dt.Rows.Count > 0) { model.HXSX = ((dt.Rows[0]["HXSX"].ToString() == "")?"30":dt.Rows[0]["HXSX"].ToString()); model.JSGLSX = ((dt.Rows[0]["JSGLSX"].ToString() == "") ? "30" : dt.Rows[0]["JSGLSX"].ToString()); model.GLSX = ((dt.Rows[0]["GLSX"].ToString() == "") ? "30" : dt.Rows[0]["GLSX"].ToString()); model.LLJSX = ((dt.Rows[0]["LLJSX"].ToString() == "") ? "30" : dt.Rows[0]["LLJSX"].ToString()); model.YDJSX = ((dt.Rows[0]["YDJSX"].ToString() == "") ? "30" : dt.Rows[0]["YDJSX"].ToString()); model.FXYLOWSX = ((dt.Rows[0]["FXYLOWSX"].ToString() == "") ? "30" : dt.Rows[0]["FXYLOWSX"].ToString()); model.FXYHIGHSX = ((dt.Rows[0]["FXYHIGHSX"].ToString() == "") ? "30" : dt.Rows[0]["FXYHIGHSX"].ToString()); model.FXYMIDSX = ((dt.Rows[0]["FXYMIDSX"].ToString() == "") ? "30" : dt.Rows[0]["FXYMIDSX"].ToString()); model.FXYLOWMIDSX = ((dt.Rows[0]["FXYLOWMIDSX"].ToString() == "") ? "30" : dt.Rows[0]["FXYLOWMIDSX"].ToString()); model.FXYHIGHMIDSX = ((dt.Rows[0]["FXYHIGHMIDSX"].ToString() == "") ? "30" : dt.Rows[0]["FXYHIGHMIDSX"].ToString()); model.ZJSX = ((dt.Rows[0]["ZJSX"].ToString() == "") ? "30" : dt.Rows[0]["ZJSX"].ToString()); model.YRSX = ((dt.Rows[0]["YRSX"].ToString() == "") ? "30" : dt.Rows[0]["YRSX"].ToString()); model.YLJSX = ((dt.Rows[0]["YLJSX"].ToString() == "") ? "30" : dt.Rows[0]["YLJSX"].ToString()); model.SDSX = ((dt.Rows[0]["SDSX"].ToString() == "") ? "30" : dt.Rows[0]["SDSX"].ToString()); model.HJCSSX = ((dt.Rows[0]["HJCSSX"].ToString() == "") ? "30" : dt.Rows[0]["HJCSSX"].ToString()); model.ZSJSX = ((dt.Rows[0]["ZSJSX"].ToString() == "") ? "30" : dt.Rows[0]["ZSJSX"].ToString()); model.JLSX = ((dt.Rows[0]["JLSX"].ToString() == "") ? "30" : dt.Rows[0]["JLSX"].ToString()); } else { model.HXSX = "-2"; //当服务器上没有找到本线时,本线编号置为-2,以免为0 } } catch (Exception) { throw; } return(model); }
public bool updateBdsx(BDSX model) { int i = 0; StringBuilder strSql = new StringBuilder(); strSql.Append("update [设备标定时限] set "); strSql.Append("HXSX=@HXSX,"); strSql.Append("JSGLSX=@JSGLSX,"); strSql.Append("GLSX=@GLSX,"); strSql.Append("LLJSX=@LLJSX,"); strSql.Append("YDJSX=@YDJSX,"); strSql.Append("FXYLOWSX=@FXYLOWSX,"); strSql.Append("FXYHIGHSX=@FXYHIGHSX,"); strSql.Append("FXYMIDSX=@FXYMIDSX,"); strSql.Append("FXYLOWMIDSX=@FXYLOWMIDSX,"); strSql.Append("FXYHIGHMIDSX=@FXYHIGHMIDSX,"); strSql.Append("ZJSX=@ZJSX,"); strSql.Append("YRSX=@YRSX,"); strSql.Append("YLJSX=@YLJSX,"); strSql.Append("SDSX=@SDSX,"); strSql.Append("HJCSSX=@HJCSSX,"); strSql.Append("ZSJSX=@ZSJSX,"); strSql.Append("JLSX=@JLSX"); SqlParameter[] parameters = { //new SqlParameter("@STAFFID", SqlDbType.VarChar,50), new SqlParameter("@HXSX", SqlDbType.VarChar, 50), new SqlParameter("@JSGLSX", SqlDbType.VarChar, 50), new SqlParameter("@GLSX", SqlDbType.VarChar, 50), new SqlParameter("@LLJSX", SqlDbType.VarChar, 50), new SqlParameter("@YDJSX", SqlDbType.VarChar, 50), new SqlParameter("@FXYLOWSX", SqlDbType.VarChar, 50), new SqlParameter("@FXYHIGHSX", SqlDbType.VarChar, 50), new SqlParameter("@FXYMIDSX", SqlDbType.VarChar, 50), new SqlParameter("@FXYLOWMIDSX", SqlDbType.VarChar, 50), new SqlParameter("@FXYHIGHMIDSX", SqlDbType.VarChar, 50), new SqlParameter("@ZJSX", SqlDbType.VarChar, 50), new SqlParameter("@YRSX", SqlDbType.VarChar, 50), new SqlParameter("@YLJSX", SqlDbType.VarChar, 50), new SqlParameter("@SDSX", SqlDbType.VarChar, 50), new SqlParameter("@HJCSSX", SqlDbType.VarChar, 50), new SqlParameter("@ZSJSX", SqlDbType.VarChar, 50), new SqlParameter("@JLSX", SqlDbType.VarChar, 50) }; //parameters[i++].Value = model.STAFFID; parameters[i++].Value = model.HXSX; parameters[i++].Value = model.JSGLSX; parameters[i++].Value = model.GLSX; parameters[i++].Value = model.LLJSX; parameters[i++].Value = model.YDJSX; parameters[i++].Value = model.FXYLOWSX; parameters[i++].Value = model.FXYHIGHSX; parameters[i++].Value = model.FXYMIDSX; parameters[i++].Value = model.FXYLOWMIDSX; parameters[i++].Value = model.FXYHIGHMIDSX; parameters[i++].Value = model.ZJSX; parameters[i++].Value = model.YRSX; parameters[i++].Value = model.YLJSX; parameters[i++].Value = model.SDSX; parameters[i++].Value = model.HJCSSX; parameters[i++].Value = model.ZSJSX; parameters[i++].Value = model.JLSX; try { if (DBHelperSQL.Execute(strSql.ToString(), parameters) > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }