/// <summary> /// 得到一个对象实体 /// </summary> public HM.Model.Eq.Tb_EQ_TaskEquipmentLine GetModel(string TaskLineId) { SqlParameter[] parameters = { new SqlParameter("@TaskLineId", SqlDbType.VarChar, 50) }; parameters[0].Value = TaskLineId; HM.Model.Eq.Tb_EQ_TaskEquipmentLine model = new HM.Model.Eq.Tb_EQ_TaskEquipmentLine(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_EQ_TaskEquipmentLine_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { model.TaskLineId = ds.Tables[0].Rows[0]["TaskLineId"].ToString(); model.TaskId = ds.Tables[0].Rows[0]["TaskId"].ToString(); model.StanId = ds.Tables[0].Rows[0]["StanId"].ToString(); model.DetailId = ds.Tables[0].Rows[0]["DetailId"].ToString(); model.EquiId = ds.Tables[0].Rows[0]["EquiId"].ToString(); model.PollingNote = ds.Tables[0].Rows[0]["PollingNote"].ToString(); model.ChooseValue = ds.Tables[0].Rows[0]["ChooseValue"].ToString(); if (ds.Tables[0].Rows[0]["NumValue"].ToString() != "") { model.NumValue = decimal.Parse(ds.Tables[0].Rows[0]["NumValue"].ToString()); } model.TextValue = ds.Tables[0].Rows[0]["TextValue"].ToString(); if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "") { model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString()); } if (ds.Tables[0].Rows[0]["AddDate"].ToString() != "") { model.AddDate = DateTime.Parse(ds.Tables[0].Rows[0]["AddDate"].ToString()); } model.AddPId = ds.Tables[0].Rows[0]["AddPId"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.ReferenceValue = ds.Tables[0].Rows[0]["ReferenceValue"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(HM.Model.Eq.Tb_EQ_TaskEquipmentLine model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@TaskLineId", SqlDbType.VarChar, 36), new SqlParameter("@TaskId", SqlDbType.VarChar, 36), new SqlParameter("@StanId", SqlDbType.VarChar, 36), new SqlParameter("@DetailId", SqlDbType.VarChar, 36), new SqlParameter("@EquiId", SqlDbType.VarChar, 36), new SqlParameter("@PollingNote", SqlDbType.NVarChar, 500), new SqlParameter("@ChooseValue", SqlDbType.NVarChar, 4), new SqlParameter("@NumValue", SqlDbType.Decimal, 5), new SqlParameter("@TextValue", SqlDbType.NVarChar, 500), new SqlParameter("@IsDelete", SqlDbType.Int, 4), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@AddPId", SqlDbType.VarChar, 36), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@ReferenceValue", SqlDbType.VarChar, 50) }; parameters[0].Value = model.TaskLineId; parameters[1].Value = model.TaskId; parameters[2].Value = model.StanId; parameters[3].Value = model.DetailId; parameters[4].Value = model.EquiId; parameters[5].Value = model.PollingNote; parameters[6].Value = model.ChooseValue; parameters[7].Value = model.NumValue; parameters[8].Value = model.TextValue; parameters[9].Value = model.IsDelete; parameters[10].Value = model.AddDate; parameters[11].Value = model.AddPId; parameters[12].Value = model.Sort; parameters[13].Value = model.ReferenceValue; DbHelperSQL.RunProcedure("Proc_Tb_EQ_TaskEquipmentLine_Update", parameters, out rowsAffected); }