public ProviderGoodsModel GetModel(int MaterialId) { StringBuilder builder = new StringBuilder(); builder.Append("select * from pm_provider_Goods "); builder.Append(" where MaterialId=" + MaterialId); ProviderGoodsModel model = new ProviderGoodsModel(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); model.MaterialId = MaterialId; if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["ProviderId"].ToString() != "") { model.ProviderId = int.Parse(set.Tables[0].Rows[0]["ProviderId"].ToString()); } model.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString(); if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "") { model.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString()); } model.Comment = set.Tables[0].Rows[0]["Comment"].ToString(); return(model); }
public int Update(ProviderGoodsModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update pm_provider_Goods set "); builder.Append("ProviderId=" + model.ProviderId + ","); builder.Append("UserCode='" + model.UserCode + "',"); builder.Append("RecordDate='" + model.RecordDate + "',"); builder.Append("Comment='" + model.Comment + "'"); builder.Append(" where MaterialId=" + model.MaterialId); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(ProviderGoodsModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into pm_provider_Goods("); builder.Append("MaterialId,ProviderId,UserCode,RecordDate,Comment"); builder.Append(")"); builder.Append(" values ("); builder.Append(model.MaterialId + ","); builder.Append(model.ProviderId + ","); builder.Append("'" + model.UserCode + "',"); builder.Append("'" + model.RecordDate + "',"); builder.Append("'" + model.Comment + "'"); builder.Append(")"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }