public void Update(MaterialWarehouseLogDetail model) { string sql = string.Format(@" update MaterialWarehouseLogDetail set Qty ={0},Remark = '{1}' where Guid = '{2}'", model.Qty, model.Remark, model.Guid); SqlHelper.ExecuteSql(sql); }
public void Create(MaterialWarehouseLogDetail model) { string sql = string.Format(@" insert into MaterialWarehouseLogDetail (WarehouseNumber,DocumentNumber,MaterialNumber,CreateTime,SupplierMaterialNumber,Qty,Remark,Guid,supplierId,supplierName) select '{0}','{1}','{2}','{3}',(select SupplierMaterialNumber from MaterialSupplierProperty where MaterialNumber='{2}' and supplierId=( select supplierId from SupplierInfo where supplierName='{7}' )),{4},'{5}','{6}',supplierId,supplierName from SupplierInfo where supplierName='{7}' ", model.WarehouseNumber, model.DocumentNumber, model.MaterialNumber, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") , model.Qty, model.Remark, model.Guid, model.SupplierName); SqlHelper.ExecuteSql(sql); }
public MaterialWarehouseLogDetail Get(string guid) { MaterialWarehouseLogDetail model = new MaterialWarehouseLogDetail(); string sql = string.Format(@"select top 1 * from MaterialWarehouseLogDetail where guid='{0}'", guid); DataTable dt = SqlHelper.GetTable(sql); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; model.Guid = guid; model.WarehouseNumber = dr["WarehouseNumber"] == null ? string.Empty : dr["WarehouseNumber"].ToString(); model.DocumentNumber = dr["DocumentNumber"] == null ? string.Empty : dr["DocumentNumber"].ToString(); model.MaterialNumber = dr["MaterialNumber"] == null ? string.Empty : dr["MaterialNumber"].ToString(); model.SupplierMaterialNumber = dr["SupplierMaterialNumber"] == null ? string.Empty : dr["SupplierMaterialNumber"].ToString(); model.Remark = dr["Remark"] == null ? string.Empty : dr["Remark"].ToString(); model.Qty = dr["Qty"] == null ? 0 : Convert.ToDouble(dr["Qty"].ToString()); } return(model); }