コード例 #1
0
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <param name="total">记录总数</param>
        /// <returns>参见模型</returns>
        public static IEnumerable <JC_UAV_Model> getModelList(JC_UAV_SW sw, out int total)
        {
            var result = new List <JC_UAV_Model>();

            DataTable dt    = BaseDT.JC_UAV.getDT(sw, out total);//列表
            DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                JC_UAV_Model m = new JC_UAV_Model();
                m.UAVID        = dt.Rows[i]["UAVID"].ToString();
                m.UAVNAME      = dt.Rows[i]["UAVNAME"].ToString();
                m.UAVEQUIPNAME = dt.Rows[i]["UAVEQUIPNAME"].ToString();
                m.BYORGNO      = dt.Rows[i]["BYORGNO"].ToString();
                m.ORDERBY      = dt.Rows[i]["ORDERBY"].ToString();
                m.ORGNAME      = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Update(JC_UAV_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("update  JC_UAV set ");
            if (string.IsNullOrEmpty(m.BYORGNO) == false)
            {
                sb.AppendFormat(" BYORGNO= '{0}',", ClsSql.EncodeSql(m.BYORGNO));
            }
            if (string.IsNullOrEmpty(m.UAVNAME) == false)
            {
                sb.AppendFormat(" UAVNAME= '{0}',", ClsSql.EncodeSql(m.UAVNAME));
            }
            if (string.IsNullOrEmpty(m.UAVEQUIPNAME) == false)
            {
                sb.AppendFormat(" UAVEQUIPNAME= '{0}'", ClsSql.EncodeSql(m.UAVEQUIPNAME));
            }
            sb.AppendFormat(" where UAVID = '{0}'", ClsSql.EncodeSql(m.UAVID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "修改成功!", ""));
            }
            else
            {
                return(new Message(false, "修改失败!", ""));
            }
        }
コード例 #3
0
 /// <summary>
 /// 无人机增删改
 /// </summary>
 /// <param name="m"></param>
 /// <returns></returns>
 public static Message Manager(JC_UAV_Model m)
 {
     if (m.opMethod == "Add")
     {
         Message msgUser = BaseDT.JC_UAV.Add(m);//任务信息表
         return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
     }
     else if (m.opMethod == "Del")
     {
         Message msgUser = BaseDT.JC_UAV.Del(m);
         return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
     }
     else if (m.opMethod == "Mdy")
     {
         Message msgUser = BaseDT.JC_UAV.Update(m);
         return(new Message(msgUser.Success, msgUser.Msg, msgUser.Url));
     }
     return(new Message(false, "无效操作", ""));
 }
コード例 #4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static Message Del(JC_UAV_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("delete from  JC_UAV");
            sb.AppendFormat(" where 1=1 ");
            if (string.IsNullOrEmpty(m.UAVID) == false)
            {
                sb.AppendFormat(" AND UAVID = '{0}'", ClsSql.EncodeSql(m.UAVID));
            }
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败!", ""));
            }
        }
コード例 #5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(JC_UAV_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("INSERT INTO  JC_UAV(BYORGNO, UAVNAME,UAVEQUIPNAME, ORDERBY)");
            sb.AppendFormat("VALUES(");
            sb.AppendFormat("'{0}'", ClsSql.EncodeSql(m.BYORGNO));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.UAVNAME));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.UAVEQUIPNAME));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.ORDERBY));
            sb.AppendFormat(")");
            var bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "添加成功!", ""));
            }
            else
            {
                return(new Message(false, "添加失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #6
0
        /// <summary>
        /// 根据查询条件获取某一条记录
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static JC_UAV_Model getModel(JC_UAV_SW sw)
        {
            JC_UAV_Model m     = new JC_UAV_Model();
            DataTable    dt    = BaseDT.JC_UAV.getDT(sw);//列表
            DataTable    dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取单位

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.UAVID        = dt.Rows[i]["UAVID"].ToString();
                m.UAVNAME      = dt.Rows[i]["UAVNAME"].ToString();
                m.UAVEQUIPNAME = dt.Rows[i]["UAVEQUIPNAME"].ToString();
                m.BYORGNO      = dt.Rows[i]["BYORGNO"].ToString();
                m.ORGNAME      = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO);
                m.ORDERBY      = dt.Rows[i]["ORDERBY"].ToString();
            }
            dt.Clear();
            dt.Dispose();
            dtORG.Clear();
            dtORG.Dispose();
            return(m);
        }