コード例 #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Mdy(T_IPSFR_USER_Model m)
        {
            //if (PublicCls.OrgIsZhen(m.BYORGNO) == false)
            //    return new Message(false, "修改失败,所属单位必须为乡镇!", "");
            StringBuilder sb = new StringBuilder();

            //HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO
            sb.AppendFormat("UPDATE T_IPSFR_USER");
            sb.AppendFormat(" set ");
            sb.AppendFormat("HNAME='{0}'", ClsSql.EncodeSql(m.HNAME));
            sb.AppendFormat(",SN='{0}'", ClsSql.EncodeSql(m.SN));
            sb.AppendFormat(",PHONE='{0}'", ClsSql.EncodeSql(m.PHONE));
            sb.AppendFormat(",SEX='{0}'", ClsSql.EncodeSql(m.SEX));
            sb.AppendFormat(",BIRTH='{0}'", ClsSql.EncodeSql(m.BIRTH));
            sb.AppendFormat(",ONSTATE='{0}'", ClsSql.EncodeSql(m.ONSTATE));
            sb.AppendFormat(",BYORGNO='{0}'", ClsSql.EncodeSql(m.BYORGNO));
            sb.AppendFormat(",ISENABLE='{0}'", ClsSql.EncodeSql(m.ISENABLE));
            sb.AppendFormat(",PATROLLENGTH='{0}'", ClsSql.EncodeSql(m.PATROLLENGTH));
            sb.AppendFormat(",MOBILEPARAMLIST='{0}'", ClsSql.EncodeSql(m.MOBILEPARAMLIST));
            sb.AppendFormat(" where HID= '{0}'", ClsSql.EncodeSql(m.HID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "修改成功!", ""));
            }
            else
            {
                return(new Message(false, "修改失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #2
0
 /// <summary>
 /// 增、删、改
 /// </summary>
 /// <param name="m">m</param>
 /// <returns></returns>
 public static Message Manager(T_IPSFR_USER_Model m)
 {
     if (m.opMethod == "Add")
     {
         Message msgUser = BaseDT.T_IPSFR_USER.Add(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     return(new Message(false, "无效操作", ""));
 }
コード例 #3
0
        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message UnEnable(T_IPSFR_USER_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("update T_IPSFR_USER set ISENABLE=0");
            sb.AppendFormat(" where HID in({0})", ClsSql.EncodeSql(m.HID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "禁用成功!", ""));
            }
            else
            {
                return(new Message(false, "禁用失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Del(T_IPSFR_USER_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("delete T_IPSFR_USER");
            sb.AppendFormat(" where HID= '{0}'", ClsSql.EncodeSql(m.HID));
            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 UpdateHlyParameter(T_IPSFR_USER_Model m)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("UPDATE T_IPSFR_USER");
            sb.AppendFormat(" set ");
            sb.AppendFormat("MOBILEPARAMLIST='{0}'", ClsSql.EncodeSql(m.MOBILEPARAMLIST));
            sb.AppendFormat(" where HID= '{0}'", ClsSql.EncodeSql(m.HID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "设置成功!", ""));
            }
            else
            {
                return(new Message(false, "设置失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #6
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message PATROLLENGTHMdy(T_IPSFR_USER_Model m)
        {
            StringBuilder sb = new StringBuilder();

            //HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO
            sb.AppendFormat("UPDATE T_IPSFR_USER");
            sb.AppendFormat(" set ");
            sb.AppendFormat("PATROLLENGTH='{0}'", ClsSql.EncodeSql(m.PATROLLENGTH));
            sb.AppendFormat(" where HID= '{0}'", ClsSql.EncodeSql(m.HID));

            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "修改成功!", ""));
            }
            else
            {
                return(new Message(false, "修改失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #7
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(T_IPSFR_USER_Model m)
        {
            if (isExists(new T_IPSFR_USER_SW {
                PHONE = m.PHONE
            }))
            {
                return(new Message(false, "添加失败,电话号码重复!", ""));
            }
            //if (string.IsNullOrEmpty(m.SN) == false && isExists(new T_IPSFR_USER_SW { SN = m.SN }))
            //    return new Message(false, "添加失败,终端编号重复!", "");
            //if (PublicCls.OrgIsZhen(m.BYORGNO )==false)
            //    return new Message(false, "添加失败,所属单位必须为乡镇!", "");
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("INSERT INTO  T_IPSFR_USER(HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO,ISENABLE,PATROLLENGTH,MOBILEPARAMLIST)");
            sb.AppendFormat("VALUES(");
            sb.AppendFormat("'{0}'", ClsSql.EncodeSql(m.HNAME));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.SN));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.PHONE));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.SEX));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.BIRTH));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.ONSTATE));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.BYORGNO));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.ISENABLE));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.PATROLLENGTH));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.MOBILEPARAMLIST));
            sb.AppendFormat(")");
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "添加成功!", ""));
            }
            else
            {
                return(new Message(false, "添加失败,请检查各输入框是否正确!", ""));
            }
        }
コード例 #8
0
        /// <summary>
        /// 根据护林员ID获取在线状态 ,用于点名|
        /// </summary>
        /// <param name="sw">参见条件模型T_IPS_REALDATATEMPORARYSW</param>
        /// <example>
        /// sw.USERID       用户序号(多用户以逗号分隔)
        /// sw.SearchTime   判断时间 可为空,为空默认为当前时间
        /// </example>
        /// <param name="FRUserCount">总人数</param>
        /// <param name="FRUserOnLineCount">在线人数</param>
        /// <returns>
        /// m.HID       护林员序号
        /// m.HNAME     姓名
        /// m.PHONE     电话
        /// m.BYORGNO   机构编码
        /// m.ORGNAME   机构名称
        /// m.isOnLine  在线状态 1在线 0离线
        /// </returns>
        public static IEnumerable <T_IPSFR_USER_Model> getFROnLineByUID(T_IPS_REALDATATEMPORARYSW sw, out int FRUserCount, out int FRUserOnLineCount)
        {
            var result = new List <T_IPSFR_USER_Model>();

            DataTable dtOrg = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW {
                SYSFLAG = ConfigCls.getSystemFlag()
            });                                                                                               //获取当前登录用户有权限查看的组织机构
            DataTable dtOnState = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTFLAG = "固兼职状态"
            });

            DataTable dtFRUser = BaseDT.T_IPSFR_USER.getDT(new T_IPSFR_USER_SW {
                ISENABLE = "1", HID = sw.USERID
            });                                                                                                     //获取所有有权限查看的护林员
            //当前在线的护林员
            DataTable dtRealTmp = BaseDT.T_IPS_REALDATATEMPORARY.getOnLineDtByOrgno(new T_IPS_REALDATATEMPORARYSW {
                USERID = sw.USERID
            });

            FRUserCount       = dtFRUser.Rows.Count;
            FRUserOnLineCount = dtRealTmp.Rows.Count;
            //获取在线人员列表
            for (int i = 0; i < dtRealTmp.Rows.Count; i++)
            {//HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO,ISENABLE,SBTIME
                T_IPSFR_USER_Model m = new T_IPSFR_USER_Model();
                m.HID         = dtRealTmp.Rows[i]["HID"].ToString();
                m.HNAME       = dtRealTmp.Rows[i]["HNAME"].ToString();
                m.PHONE       = dtRealTmp.Rows[i]["PHONE"].ToString();
                m.BYORGNO     = dtRealTmp.Rows[i]["BYORGNO"].ToString();
                m.ORGNAME     = BaseDT.T_SYS_ORG.getName(dtOrg, m.BYORGNO);
                m.ONSTATE     = dtRealTmp.Rows[i]["ONSTATE"].ToString();
                m.ONSTATENAME = BaseDT.T_SYS_DICT.getName(dtOnState, m.ONSTATE);
                m.SBTIME      = dtRealTmp.Rows[i]["SBTIME"].ToString();
                m.isOnLine    = "1";
                result.Add(m);
            }

            //获取非在线人员列表
            for (int i = 0; i < dtFRUser.Rows.Count; i++)
            {
                //判断该用户是否是在线状态
                if (dtRealTmp.Select("HID=" + dtFRUser.Rows[i]["HID"].ToString()).Length == 0)
                {
                    T_IPSFR_USER_Model m = new T_IPSFR_USER_Model();
                    m.HID         = dtFRUser.Rows[i]["HID"].ToString();
                    m.HNAME       = dtFRUser.Rows[i]["HNAME"].ToString();
                    m.PHONE       = dtFRUser.Rows[i]["PHONE"].ToString();
                    m.BYORGNO     = dtFRUser.Rows[i]["BYORGNO"].ToString();
                    m.ORGNAME     = BaseDT.T_SYS_ORG.getName(dtOrg, m.BYORGNO);
                    m.ONSTATE     = dtFRUser.Rows[i]["ONSTATE"].ToString();
                    m.ONSTATENAME = BaseDT.T_SYS_DICT.getName(dtOnState, m.ONSTATE);
                    m.SBTIME      = "";
                    m.isOnLine    = "0";
                    result.Add(m);
                }
            }
            dtOnState.Clear();
            dtOnState.Dispose();
            dtOrg.Clear();
            dtOrg.Dispose();
            dtFRUser.Clear();
            dtFRUser.Dispose();
            dtRealTmp.Clear();
            dtRealTmp.Dispose();
            return(result);
        }