/// <summary> /// 增加一条数据 /// </summary> public string Add(UFIDA.U8.UAP.CustomApp.ControlForm.Model._OQC_RMDFs model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.OQCNo != null) { strSql1.Append("OQCNo,"); strSql2.Append("'" + model.OQCNo + "',"); } if (model.iRow != null) { strSql1.Append("iRow,"); strSql2.Append("" + model.iRow + ","); } if (model.Defect != null) { strSql1.Append("Defect,"); strSql2.Append("'" + model.Defect + "',"); } if (model.Qty != null) { strSql1.Append("Qty,"); strSql2.Append("" + model.Qty + ","); } if (model.Attachment != null) { strSql1.Append("Attachment,"); strSql2.Append("'" + model.Attachment + "',"); } if (model.Remark != null) { strSql1.Append("Remark,"); strSql2.Append("'" + model.Remark + "',"); } strSql.Append("insert into _OQC_RMDFs("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); return(strSql.ToString()); }
/// <summary> /// 更新一条数据 /// </summary> public string Update(UFIDA.U8.UAP.CustomApp.ControlForm.Model._OQC_RMDFs model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update _OQC_RMDFs set "); if (model.Defect != null) { strSql.Append("Defect='" + model.Defect + "',"); } else { strSql.Append("Defect= null ,"); } if (model.Qty != null) { strSql.Append("Qty=" + model.Qty + ","); } else { strSql.Append("Qty= null ,"); } if (model.Attachment != null) { strSql.Append("Attachment='" + model.Attachment + "',"); } else { strSql.Append("Attachment= null ,"); } if (model.Remark != null) { strSql.Append("Remark='" + model.Remark + "',"); } else { strSql.Append("Remark= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where iID=" + model.iID + ""); return(strSql.ToString()); }