public OAOfficeResRationSet GetModel(int ID) { StringBuilder builder = new StringBuilder(); builder.Append("select * "); builder.Append(" RationType,RecordCode,Ration,Remark,UserCode,RecordDate "); builder.Append(" from OA_OfficeRes_RationSet "); builder.Append(" where ID=" + ID); OAOfficeResRationSet set = new OAOfficeResRationSet(); DataSet set2 = publicDbOpClass.DataSetQuary(builder.ToString()); if (set2.Tables[0].Rows.Count <= 0) { return(null); } set.RationType = set2.Tables[0].Rows[0]["RationType"].ToString(); set.RecordCode = set2.Tables[0].Rows[0]["RecordCode"].ToString(); if (set2.Tables[0].Rows[0]["Ration"].ToString() != "") { set.Ration = decimal.Parse(set2.Tables[0].Rows[0]["Ration"].ToString()); } set.Remark = set2.Tables[0].Rows[0]["Remark"].ToString(); set.UserCode = set2.Tables[0].Rows[0]["UserCode"].ToString(); if (set2.Tables[0].Rows[0]["RecordDate"].ToString() != "") { set.RecordDate = DateTime.Parse(set2.Tables[0].Rows[0]["RecordDate"].ToString()); } return(set); }
public int Update(OAOfficeResRationSet model) { StringBuilder builder = new StringBuilder(); builder.Append("update OA_OfficeRes_RationSet set "); builder.Append("RationType='" + model.RationType + "',"); builder.Append("RecordCode='" + model.RecordCode + "',"); builder.Append("Ration=" + model.Ration + ","); builder.Append("Remark='" + model.Remark + "',"); builder.Append("UserCode='" + model.UserCode + "',"); builder.Append("RecordDate='" + model.RecordDate + "'"); builder.Append(" where RecordCode=" + model.RecordCode); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(OAOfficeResRationSet model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into OA_OfficeRes_RationSet("); builder.Append("RationType,RecordCode,Ration,Remark,UserCode,RecordDate"); builder.Append(")"); builder.Append(" values ("); builder.Append("'" + model.RationType + "',"); builder.Append("'" + model.RecordCode + "',"); builder.Append(model.Ration + ","); builder.Append("'" + model.Remark + "',"); builder.Append("'" + model.UserCode + "',"); builder.Append("'" + model.RecordDate + "'"); builder.Append(")"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }