/// <summary> /// 获取列表 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static IEnumerable <DC_SUPPLIESPROP_Model> getModelList(DC_SUPPLIESPROP_SW sw) { var result = new List <DC_SUPPLIESPROP_Model>(); DataTable dt = BaseDT.DC_SUPPLIESPROP.getDT(sw);//列表 for (int i = 0; i < dt.Rows.Count; i++) { DC_SUPPLIESPROP_Model m = new DC_SUPPLIESPROP_Model(); m.DC_SUPPLIESPROP_ID = dt.Rows[i]["DC_SUPPLIESPROP_ID"].ToString(); m.DCSUPPROPNAME = dt.Rows[i]["DCSUPPROPNAME"].ToString(); m.DCSUPPROPMODEL = dt.Rows[i]["DCSUPPROPMODEL"].ToString(); m.DCSUPPROPUNIT = dt.Rows[i]["DCSUPPROPUNIT"].ToString(); m.MARK = dt.Rows[i]["MARK"].ToString(); m.DCSUPPROPFACTORY = dt.Rows[i]["DCSUPPROPFACTORY"].ToString(); m.REPERTORYCOUNT = BaseDT.DC_SUPPLIES.getNum(new DC_SUPPLIES_SW { SUPID = m.DC_SUPPLIESPROP_ID }); m.PRICE = BaseDT.DC_SUPPLIES.getPrice(new DC_SUPPLIES_SW { SUPID = m.DC_SUPPLIESPROP_ID }); result.Add(m); } dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 物资id获取物资名称 /// </summary> /// <param name="supid"></param> /// <returns></returns> public static string getsupmodel(string supid) { DC_SUPPLIESPROP_Model m = getModel(new DC_SUPPLIESPROP_SW { DC_SUPPLIESPROP_ID = supid }); return(m.DCSUPPROPMODEL); }
/// <summary> /// 物资id获取物资名称 /// </summary> /// <param name="supid"></param> /// <returns></returns> public static string getsupname(string supid) { DC_SUPPLIESPROP_Model m = getModel(new DC_SUPPLIESPROP_SW { DC_SUPPLIESPROP_ID = supid }); return(m.DCSUPPROPNAME); }
/// <summary> /// 修改 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Mdy(DC_SUPPLIESPROP_Model m) { if (DC_SUPPLIESPROP.isExists(new DC_SUPPLIESPROP_Model { DC_SUPPLIESPROP_ID = m.DC_SUPPLIESPROP_ID }) == false) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("INSERT INTO DC_SUPPLIESPROP(DC_SUPPLIESPROP_ID,DCSUPPROPNAME, DCSUPPROPMODEL, DCSUPPROPUNIT, DCSUPPROPFACTORY, MARK)"); sb.AppendFormat("VALUES("); sb.AppendFormat("{0}", ClsSql.saveNullField(m.DC_SUPPLIESPROP_ID)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPNAME)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPMODEL)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPUNIT)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPFACTORY)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.MARK)); sb.AppendFormat(")"); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "添加成功!", m.DC_SUPPLIESPROP_ID)); } else { return(new Message(false, "添加失败,请检查各输入框是否正确!", "")); } } else { StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE DC_SUPPLIESPROP"); sb.AppendFormat(" set "); sb.AppendFormat("DCSUPPROPNAME={0}", ClsSql.saveNullField(m.DCSUPPROPNAME)); sb.AppendFormat(",DCSUPPROPMODEL={0}", ClsSql.saveNullField(m.DCSUPPROPMODEL)); sb.AppendFormat(",DCSUPPROPUNIT={0}", ClsSql.saveNullField(m.DCSUPPROPUNIT)); sb.AppendFormat(",DCSUPPROPFACTORY={0}", ClsSql.saveNullField(m.DCSUPPROPFACTORY)); sb.AppendFormat(",MARK={0}", ClsSql.saveNullField(m.MARK)); sb.AppendFormat(" where DC_SUPPLIESPROP_ID= '{0}'", ClsSql.EncodeSql(m.DC_SUPPLIESPROP_ID)); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "修改成功!", m.DC_SUPPLIESPROP_ID)); } else { return(new Message(false, "修改失败,请检查各输入框是否正确!", "")); } } }
/// <summary> /// 删除 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Del(DC_SUPPLIESPROP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete DC_SUPPLIESPROP"); sb.AppendFormat(" where DC_SUPPLIESPROP_ID= '{0}'", ClsSql.EncodeSql(m.DC_SUPPLIESPROP_ID)); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "删除成功!", m.DC_SUPPLIESPROP_ID)); } else { return(new Message(false, "删除失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 更新 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Mdyunit(DC_SUPPLIESPROP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("UPDATE DC_SUPPLIESPROP"); sb.AppendFormat(" set "); sb.AppendFormat("DCSUPPROPUNIT={0}", ClsSql.saveNullField(m.DCSUPPROPUNIT)); sb.AppendFormat(" where DC_SUPPLIESPROP_ID= '{0}'", ClsSql.EncodeSql(m.DC_SUPPLIESPROP_ID)); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "修改成功!", m.DC_SUPPLIESPROP_ID)); } else { return(new Message(false, "修改失败,请检查各输入框是否正确!", "")); } }
/// <summary> /// 增、删、改 /// </summary> /// <param name="m">参见模型</param> /// <returns>参见模型</returns> public static Message Manager(DC_SUPPLIESPROP_Model m) { if (m.opMethod == "Add") { Message msgUser = BaseDT.DC_SUPPLIESPROP.Add(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } if (m.opMethod == "Mdy") { Message msgUser = BaseDT.DC_SUPPLIESPROP.Mdy(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } if (m.opMethod == "Del") { Message msgUser = BaseDT.DC_SUPPLIESPROP.Del(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } if (m.opMethod == "Mdyunit") { Message msgUser = BaseDT.DC_SUPPLIESPROP.Mdyunit(m); return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url)); } return(new Message(false, "无效操作", "")); }
/// <summary> /// 添加 /// </summary> /// <param name="m"></param> /// <returns></returns> public static Message Add(DC_SUPPLIESPROP_Model m) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("INSERT INTO DC_SUPPLIESPROP(DC_SUPPLIESPROP_ID,DCSUPPROPNAME, DCSUPPROPMODEL, DCSUPPROPUNIT, DCSUPPROPFACTORY, MARK) "); sb.AppendFormat(" VALUES("); sb.AppendFormat("{0}", ClsSql.saveNullField(m.DC_SUPPLIESPROP_ID)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPNAME)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPMODEL)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPUNIT)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.DCSUPPROPFACTORY)); sb.AppendFormat(",{0}", ClsSql.saveNullField(m.MARK)); sb.AppendFormat(")"); bool bln = DataBaseClass.ExeSql(sb.ToString()); if (bln == true) { return(new Message(true, "添加成功!", "")); } else { return(new Message(false, "添加失败,请检查各输入框是否正确!", "")); } }