示例#1
0
        /// <summary>
        /// 获取单条记录
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static WILD_LOCALANIMAL_Model getModel(WILD_LOCALANIMAL_SW sw)
        {
            DataTable dt    = BaseDT.WILD_LOCALANIMAL.getDT(sw);
            DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位
            DataTable dtBiolo        = BaseDT.T_SYS_BIOLOGICALTYPE.getDT(new T_SYS_BIOLOGICALTYPE_SW());
            WILD_LOCALANIMAL_Model m = new WILD_LOCALANIMAL_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.WILD_LOCALANIMALID     = dt.Rows[i]["WILD_LOCALANIMALID"].ToString();
                m.BYORGNO                = dt.Rows[i]["BYORGNO"].ToString();
                m.ORGNONAME              = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                m.BIOLOGICALTYPECODE     = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString();
                m.BIOLOGICALTYPECODENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.BIOLOGICALTYPECODE);
                m.PESTKECODE             = m.BIOLOGICALTYPECODE.Substring(0, 10) + "0000";
                m.PESTKENAME             = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTKECODE);
                m.PESTSHUCODE            = m.BIOLOGICALTYPECODE.Substring(0, 12) + "00";
                m.PESTSHUNAME            = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTSHUCODE);
            }
            dtORG.Clear();
            dtORG.Dispose();
            dtBiolo.Clear();
            dtBiolo.Dispose();
            dt.Clear();
            dt.Dispose();
            return(m);
        }
示例#2
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static IEnumerable <WILD_LOCALANIMAL_Model> getListModel(WILD_LOCALANIMAL_SW sw)
        {
            var       result = new List <WILD_LOCALANIMAL_Model>();
            DataTable dtORG  = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位
            DataTable dtBiolo = BaseDT.T_SYS_BIOLOGICALTYPE.getDT(new T_SYS_BIOLOGICALTYPE_SW());
            DataTable dt      = BaseDT.WILD_LOCALANIMAL.getDT(sw);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WILD_LOCALANIMAL_Model m = new WILD_LOCALANIMAL_Model();
                m.WILD_LOCALANIMALID     = dt.Rows[i]["WILD_LOCALANIMALID"].ToString();
                m.BYORGNO                = dt.Rows[i]["BYORGNO"].ToString();
                m.ORGNONAME              = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                m.BIOLOGICALTYPECODE     = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString();
                m.BIOLOGICALTYPECODENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.BIOLOGICALTYPECODE);
                m.PESTKECODE             = m.BIOLOGICALTYPECODE.Substring(0, 10) + "0000";
                m.PESTKENAME             = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTKECODE);
                m.PESTSHUCODE            = m.BIOLOGICALTYPECODE.Substring(0, 12) + "00";
                m.PESTSHUNAME            = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTSHUCODE);
                result.Add(m);
            }
            dtORG.Clear();
            dtORG.Dispose();
            dtBiolo.Clear();
            dtBiolo.Dispose();
            dt.Clear();
            dt.Dispose();
            return(result);
        }
示例#3
0
 /// <summary>
 /// 管理
 /// </summary>
 /// <param name="m">参见模型</param>
 /// <returns>参见模型</returns>
 public static Message Manager(WILD_LOCALANIMAL_Model m)
 {
     if (m.opMethod == "Add")
     {
         Message msg = BaseDT.WILD_LOCALANIMAL.Add(m);
         return(new Message(msg.Success, msg.Msg, msg.Url));
     }
     else if (m.opMethod == "Del")
     {
         Message msg = BaseDT.WILD_LOCALANIMAL.Del(m);
         return(new Message(msg.Success, msg.Msg, msg.Url));
     }
     return(new Message(false, "无效操作", ""));
 }
示例#4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Del(WILD_LOCALANIMAL_Model m)
        {
            List <string> sqllist = new List <string>();
            StringBuilder sb      = new StringBuilder();

            sb.AppendFormat("Delete From  WILD_LOCALANIMAL WHERE 1=1 ");
            sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(m.BYORGNO));
            sb.AppendFormat(" AND BIOLOGICALTYPECODE  IN ({0})", ClsSql.SwitchStrToSqlIn(m.BIOLOGICALTYPECODE));
            sqllist.Add(sb.ToString());
            var y = DataBaseClass.ExecuteSqlTran(sqllist);

            if (y > 0)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败,事物回滚!", ""));
            }
        }
示例#5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(WILD_LOCALANIMAL_Model m)
        {
            List <string> sqllist = new List <string>();

            string[]      arrBIOLOGICALTYPECODE = m.BIOLOGICALTYPECODE.Split(',');
            StringBuilder sb = new StringBuilder();

            if (arrBIOLOGICALTYPECODE.Length > 0)
            {
                sb.AppendFormat("INSERT INTO WILD_LOCALANIMAL(BYORGNO, BIOLOGICALTYPECODE) ");
                for (int i = 0; i < arrBIOLOGICALTYPECODE.Length; i++)
                {
                    if (!isExists(new WILD_LOCALANIMAL_SW {
                        BYORGNO = m.BYORGNO, BIOLOGICALTYPECODE = arrBIOLOGICALTYPECODE[i]
                    }))
                    {
                        sb.AppendFormat(" select '{0}'", ClsSql.EncodeSql(m.BYORGNO));
                        sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(arrBIOLOGICALTYPECODE[i]));
                        sb.AppendFormat(" UNION ALL ");
                    }
                }
                string insertStr = sb.ToString();
                if (insertStr.Contains(" UNION ALL "))
                {
                    insertStr = insertStr.Substring(0, insertStr.Length - 10);
                    sqllist.Add(insertStr);
                }
            }
            var y = DataBaseClass.ExecuteSqlTran(sqllist);

            if (y > 0)
            {
                return(new Message(true, "添加成功!", ""));
            }
            else
            {
                return(new Message(false, "添加失败,事物回滚!", ""));
            }
        }