/// <summary> /// 增加一条数据 /// </summary> public long Add(MobileSoft.Model.Resources.Tb_Resources_Details model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@ResourcesID", SqlDbType.BigInt, 8), new SqlParameter("@BussId", SqlDbType.BigInt, 8), new SqlParameter("@ResourcesTypeID", SqlDbType.BigInt, 8), new SqlParameter("@ResourcesName", SqlDbType.NVarChar, 100), new SqlParameter("@ResourcesSimple", SqlDbType.NVarChar, 50), new SqlParameter("@ResourcesIndex", SqlDbType.SmallInt, 2), new SqlParameter("@ResourcesBarCode", SqlDbType.NVarChar, 100), new SqlParameter("@ResourcesCode", SqlDbType.NVarChar, 50), new SqlParameter("@ResourcesUnit", SqlDbType.NVarChar, 20), new SqlParameter("@ResourcesCount", SqlDbType.Float, 8), new SqlParameter("@ResourcesPriceUnit", SqlDbType.NVarChar, 20), new SqlParameter("@ResourcesSalePrice", SqlDbType.Float, 8), new SqlParameter("@ResourcesDisCountPrice", SqlDbType.Float, 8), new SqlParameter("@IsRelease", SqlDbType.Bit, 1), new SqlParameter("@ScheduleType", SqlDbType.NVarChar, 20), new SqlParameter("@IsStopRelease", SqlDbType.Bit, 1), new SqlParameter("@Remark", SqlDbType.NVarChar, 500), new SqlParameter("@IsDelete", SqlDbType.SmallInt, 2) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.BussId; parameters[2].Value = model.ResourcesTypeID; parameters[3].Value = model.ResourcesName; parameters[4].Value = model.ResourcesSimple; parameters[5].Value = model.ResourcesIndex; parameters[6].Value = model.ResourcesBarCode; parameters[7].Value = model.ResourcesCode; parameters[8].Value = model.ResourcesUnit; parameters[9].Value = model.ResourcesCount; parameters[10].Value = model.ResourcesPriceUnit; parameters[11].Value = model.ResourcesSalePrice; parameters[12].Value = model.ResourcesDisCountPrice; parameters[13].Value = model.IsRelease; parameters[14].Value = model.ScheduleType; parameters[15].Value = model.IsStopRelease; parameters[16].Value = model.Remark; parameters[17].Value = model.IsDelete; DbHelperSQL.RunProcedure("Proc_Tb_Resources_Details_ADD", parameters, out rowsAffected); return((long)parameters[0].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.Resources.Tb_Resources_Details GetModel(long ResourcesID) { SqlParameter[] parameters = { new SqlParameter("@ResourcesID", SqlDbType.BigInt) }; parameters[0].Value = ResourcesID; MobileSoft.Model.Resources.Tb_Resources_Details model = new MobileSoft.Model.Resources.Tb_Resources_Details(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Resources_Details_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ResourcesID"].ToString() != "") { model.ResourcesID = long.Parse(ds.Tables[0].Rows[0]["ResourcesID"].ToString()); } if (ds.Tables[0].Rows[0]["BussId"].ToString() != "") { model.BussId = long.Parse(ds.Tables[0].Rows[0]["BussId"].ToString()); } if (ds.Tables[0].Rows[0]["ResourcesTypeID"].ToString() != "") { model.ResourcesTypeID = long.Parse(ds.Tables[0].Rows[0]["ResourcesTypeID"].ToString()); } model.ResourcesName = ds.Tables[0].Rows[0]["ResourcesName"].ToString(); model.ResourcesSimple = ds.Tables[0].Rows[0]["ResourcesSimple"].ToString(); if (ds.Tables[0].Rows[0]["ResourcesIndex"].ToString() != "") { model.ResourcesIndex = int.Parse(ds.Tables[0].Rows[0]["ResourcesIndex"].ToString()); } model.ResourcesBarCode = ds.Tables[0].Rows[0]["ResourcesBarCode"].ToString(); model.ResourcesCode = ds.Tables[0].Rows[0]["ResourcesCode"].ToString(); model.ResourcesUnit = ds.Tables[0].Rows[0]["ResourcesUnit"].ToString(); if (ds.Tables[0].Rows[0]["ResourcesCount"].ToString() != "") { model.ResourcesCount = decimal.Parse(ds.Tables[0].Rows[0]["ResourcesCount"].ToString()); } model.ResourcesPriceUnit = ds.Tables[0].Rows[0]["ResourcesPriceUnit"].ToString(); if (ds.Tables[0].Rows[0]["ResourcesSalePrice"].ToString() != "") { model.ResourcesSalePrice = decimal.Parse(ds.Tables[0].Rows[0]["ResourcesSalePrice"].ToString()); } if (ds.Tables[0].Rows[0]["ResourcesDisCountPrice"].ToString() != "") { model.ResourcesDisCountPrice = decimal.Parse(ds.Tables[0].Rows[0]["ResourcesDisCountPrice"].ToString()); } if (ds.Tables[0].Rows[0]["IsRelease"].ToString() != "") { if ((ds.Tables[0].Rows[0]["IsRelease"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsRelease"].ToString().ToLower() == "true")) { model.IsRelease = true; } else { model.IsRelease = false; } } model.ScheduleType = ds.Tables[0].Rows[0]["ScheduleType"].ToString(); if (ds.Tables[0].Rows[0]["IsStopRelease"].ToString() != "") { if ((ds.Tables[0].Rows[0]["IsStopRelease"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsStopRelease"].ToString().ToLower() == "true")) { model.IsStopRelease = true; } else { model.IsStopRelease = false; } } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "") { model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString()); } return(model); } else { return(null); } }