Example #1
0
        protected void submit_Click(object sender, EventArgs e)
        {
            if (userName.Text.Trim().Length == 0 || password.Text.Length == 0)
            {
                MessageBox.Show(this, "登录名和密码都必须输入。");
                //Terminator.Alert("登录名和密码都必须输入。");
                return;
            }

            string result = me.ApplyLogin(userName.Text.Trim(), Strings.MD5(password.Text), false);

            if (result.Length == 0)
            {
                //记录日志
                Diary.Insert(ContextUser.Current.Id, 0, 0, userName.Text.Trim() + "登录成功。");
                NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(userName.Text.Trim());
                Session["LoginUser"] = oUser;
                Response.Redirect("../Home.aspx");
                //Terminator.Redirect(PathUtil.ResolveUrl("Default.aspx"));
            }
            else
            {
                //记录日志
                Diary.Insert(ContextUser.Current.Id, 0, 0, userName.Text.Trim() + "登录失败。");
                MessageBox.Show(this, result);
                //Terminator.Alert(result);
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.LoadRepeater();

                if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison)
                {
                    ObjectNavigator.Visible = true;
                }
                else
                {
                    ObjectNavigator.Visible = false;
                }
            }
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role < (int)UserRole.Admin)
            {
                deleteButtonRow.Visible = false;
            }
            else
            {
                deleteButtonRow.Visible = true;
            }
        }
Example #3
0
        protected void repeater_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            DiaryView log = e.Item.DataItem as DiaryView;

            if (log != null)
            {
                SmartLabel         selection = (SmartLabel)e.Item.FindControl("selection");
                NetRadio.Data.User oUser     = NetRadio.Data.User.SelectByUserName(me.Name);
                if (oUser.Role >= (int)UserRole.Admin)
                {
                    //selection.Text = "<input type='checkbox' name='selection' value='" + log.Id + "' />";
                }
                else
                {
                    //selection.Text = "-";
                }

                if (log.UserId != 0)
                {
                    SmartLabel userName = (SmartLabel)e.Item.FindControl("userName");
                    userName.Text = log.UserName;
                }

                SmartLabel description = (SmartLabel)e.Item.FindControl("description");
                description.Text = log.Action;

                //SmartLabel hostName = (SmartLabel)e.Item.FindControl("hostName");
                //hostName.Text = log.HostName;

                SmartLabel tagMac = (SmartLabel)e.Item.FindControl("tagMac");
                tagMac.Text = log.TagMac;

                DateTimeLabel writeTime = (DateTimeLabel)e.Item.FindControl("writeTime");
                writeTime.DisplayValue = log.WriteTime;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role >= (int)UserRole.Admin)
            {
                isAdmin = true;
            }

            if (!Page.IsPostBack)
            {
                AjaxUtil.RegisterClientScript(typeof(__TagUser), this.Page);

                int    _tagId;
                string _tagMac = null;

                using (AppDataContext db = new AppDataContext())
                {
                    var position = db.HostTagGroupStatus.SingleOrDefault(h => h.HostId == _id && h.HostGroupId == (int)TagUserType.Position);
                    if (position == null)
                    {
                        Terminator.End("记录不存在。");
                    }

                    _tagId = position.TagId;
                    var tag = Tag.Select(_tagId);
                    if (tag != null)
                    {
                        _tagMac = tag.TagMac;
                    }

                    currentTagId.Value = _tagId.ToString();
                    tagMac.Text        = _tagMac;
                    userId.Value       = position.HostId.ToString();

                    name.Text = newName.Text = position.HostName;

                    memo.Text = newMemo.Text = Strings.TextEncode(position.Description);



                    if (!isAdmin)
                    {
                        changeMemo.Visible   = false;
                        deleteButton.Visible = false;
                    }
                }


                if (!LocatingServiceUtil.IsAvailable() || !isAdmin)
                {
                    //changeTag.Visible = false;
                    clearAllEvents.Visible            = false;
                    locatingServiceDownMarker.Visible = true;
                }
                else
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(_tagMac))
                        {
                            TagStatusView tagStatus = LocatingServiceUtil.Instance <IServiceApi>().SelectTagStatus(_tagMac);
                            if (tagStatus != null)
                            {
                                batteryInsufficient.Text = Misc.GetEventStatusDescription(tagStatus.BatteryInsufficientStatus);
                                batteryReset.Text        = Misc.GetEventStatusDescription(tagStatus.BatteryResetStatus);
                                buttonPressed.Text       = Misc.GetEventStatusDescription(tagStatus.ButtonPressedStatus);
                                eventUpdateTime.Value    = tagStatus.EventUpdateTime;

                                clearBatteryInsufficient.Visible = tagStatus.BatteryInsufficientStatus != (byte)EventStatus.Cleared;
                                clearBatteryReset.Visible        = tagStatus.BatteryResetStatus != (byte)EventStatus.Cleared;
                                clearButtonPressed.Visible       = tagStatus.ButtonPressedStatus != (byte)EventStatus.Cleared;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role >= (int)UserRole.Admin)
            {
                isAdmin = true;
            }



            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                tagSelector.Visible            = true;
                selectStrongestRssiTag.Visible = false;
                changeTag.Href = "javascript:tt();";
            }
            else
            {
                tagSelector.Visible            = false;
                selectStrongestRssiTag.Visible = true;
                changeTag.Href = "javascript:tt2();";
            }

            if (!Page.IsPostBack)
            {
                Ajax.AjaxManager.RegisterClass(typeof(__TagUser));
                AjaxUtil.RegisterClientScript(typeof(__TagUser), this.Page);

                int    _tagId;
                string _tagMac = null;

                using (AppDataContext db = new AppDataContext())
                {
                    var cop = db.HostTagGroupStatus.SingleOrDefault(h => h.HostId == _id && h.HostGroupId == (int)TagUserType.Cop);
                    if (cop == null)
                    {
                        ShowMessagePage("记录不存在。");
                    }

                    _tagId = cop.TagId;
                    var tag = Tag.Select(_tagId);
                    if (tag != null)
                    {
                        _tagMac = tag.TagMac;
                    }

                    currentTagId.Value = _tagId.ToString();
                    tagMac.Text        = _tagMac;
                    userId.Value       = cop.HostId.ToString();

                    name.Text   = newName.Text = cop.HostName;
                    number.Text = newNumber.Text = cop.HostExternalId;
                    string[] aGroupIds = HostTagGroupStatus.GetBelongsGroupNameArrayByHostId(_id);
                    if (aGroupIds != null && aGroupIds.Length > 0)
                    {
                        LabelGroup.Text = String.Join(", ", aGroupIds);
                    }
                    memo.Text = newMemo.Text = Strings.TextEncode(cop.Description);

                    groups.Text = string.Join(",", HostTagGroupStatus.GetBelongsGroupNameArrayByHostId(_id));

                    tagBound.Text = cop.TagId == 0 ? "未携带标签" : "已领用标签";
                    photo.Src     = "UserPhoto.ashx?id=" + _id;

                    if (!isAdmin)
                    {
                        changeName.Visible   = false;
                        changeNumber.Visible = false;
                        changeMemo.Visible   = false;
                        deleteButton.Visible = false;
                        uploadButton.Visible = false;
                    }
                }

                if (Config.Settings.ProjectType == ProjectTypeEnum.YZPrison)
                {
                    absencediv.Visible = false;
                }
                else
                {
                    absencediv.Visible = true;
                }

                locatingServiceDownMarker.Visible = !LocatingServiceUtil.IsAvailable();

                if (!LocatingServiceUtil.IsAvailable() || !isAdmin)
                {
                    changeTag.Visible      = false;
                    clearAllEvents.Visible = false;
                    //locatingServiceDownMarker.Visible = true;
                }
                else
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(_tagMac))
                        {
                            TagStatusView tagStatus = LocatingServiceUtil.Instance <IServiceApi>().SelectTagStatus(_tagMac);
                            if (tagStatus != null)
                            {
                                coordinatesName.Text     = Coordinates.GetName(tagStatus.CoordinatesId);
                                positionUpdateTime.Value = tagStatus.PositionUpdateTime;

                                absence.Text             = Misc.GetEventStatusDescription(tagStatus.AbsenceStatus);
                                areaEvent.Text           = Misc.GetEventStatusDescription(tagStatus.AreaEventStatus);
                                batteryInsufficient.Text = Misc.GetEventStatusDescription(tagStatus.BatteryInsufficientStatus);
                                batteryReset.Text        = Misc.GetEventStatusDescription(tagStatus.BatteryResetStatus);
                                buttonPressed.Text       = Misc.GetEventStatusDescription(tagStatus.ButtonPressedStatus);
                                //wristletBroken.Text = Misc.GetEventStatusDescription(tagStatus.WristletBrokenStatus);
                                eventUpdateTime.Value = tagStatus.EventUpdateTime;

                                clearAbsence.Visible             = tagStatus.AbsenceStatus != (byte)EventStatus.Cleared;
                                clearAreaEvent.Visible           = tagStatus.AreaEventStatus != (byte)EventStatus.Cleared;
                                clearBatteryInsufficient.Visible = tagStatus.BatteryInsufficientStatus != (byte)EventStatus.Cleared;
                                clearBatteryReset.Visible        = tagStatus.BatteryResetStatus != (byte)EventStatus.Cleared;
                                clearButtonPressed.Visible       = tagStatus.ButtonPressedStatus != (byte)EventStatus.Cleared;
                                //clearWristletBroken.Visible = tagStatus.WristletBrokenStatus != (byte)EventStatus.Cleared;
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NetRadio.Data.User oUser = NetRadio.Data.User.SelectByUserName(me.Name);
            if (oUser.Role >= (int)UserRole.Admin)
            {
                isAdmin = true;
            }

            if (BusSystemConfig.IsAutoSelectStrongestRssiTag() == false)
            {
                tagSelector.Visible            = true;
                selectStrongestRssiTag.Visible = false;
                changeTag.Href = "javascript:tt();";
            }
            else
            {
                tagSelector.Visible            = false;
                selectStrongestRssiTag.Visible = true;
                changeTag.Href = "javascript:tt2();";
            }
            Ajax.AjaxManager.RegisterClass(typeof(__TagUser));
            AjaxUtil.RegisterClientScript(typeof(__TagUser), this.Page);

            if (!Page.IsPostBack)
            {
                LoadJailRoomList();
            }

            int    _tagId;
            string _tagMac = null;

            userId.Value = _id.ToString();
            using (AppDataContext db = new AppDataContext())
            {
                var culprit = db.HostTagGroupStatus.SingleOrDefault(u => u.HostGroupId == (int)TagUserType.Culprit && u.HostId == _id);
                if (culprit == null)
                {
                    ShowMessagePage("记录不存在。");
                }

                _tagId = culprit.TagId;
                var tag = Tag.Select(_tagId);
                if (tag != null)
                {
                    _tagMac = tag.TagMac;
                }

                currentTagId.Value = _tagId.ToString();
                tagMac.Text        = _tagMac;
                userId.Value       = culprit.HostId.ToString();

                name.Text   = newName.Text = culprit.HostName;
                number.Text = newNumber.Text = culprit.HostExternalId;
                memo.Text   = newMemo.Text = Strings.TextEncode(culprit.Description);

                if (Config.Settings.IsLoadHostInfo)
                {
                    CulMoreInfo.Visible = true;
                    string        strConnect = System.Configuration.ConfigurationSettings.AppSettings["FXConnectionString"].ToString();
                    SqlConnection conn       = new SqlConnection(strConnect);

                    string strSQL = "SELECT top 1 RYBH, ZJHM, JYAQ,V_SSJD.HZ as SSJDHZ, V_AJLB.HZ as AJLBHZ from V_RYXXALL join V_AJLB on V_RYXXALL.AJLB=V_AJLB.DM join V_SSJD on V_SSJD.DM=V_RYXXALL.SSJD where RYBH='" + culprit.HostExternalId + "'";

                    DataSet ds = new DataSet();                                //   创建一个   DataSet
                    conn.Open();
                    SqlDataAdapter command = new SqlDataAdapter(strSQL, conn); //   用   SqlDataAdapter   得到一个数据集
                    command.Fill(ds, "CulInfo");                               //把Dataset绑定到数据表
                    DataTable dt = ds.Tables["CulInfo"];

                    if (dt.Rows.Count > 0)
                    {
                        IDNO.Text     = dt.Rows[0]["ZJHM"].ToString();
                        CulKind.Text  = dt.Rows[0]["AJLBHZ"].ToString();
                        CulState.Text = dt.Rows[0]["SSJDHZ"].ToString();
                        CulDes.Text   = dt.Rows[0]["JYAQ"].ToString();
                    }
                }
                else
                {
                    CulMoreInfo.Visible = false;
                }

                tagBound.Text = culprit.TagId == 0 ? "未携带标签" : "已领用标签";
                photo.Src     = "UserPhoto.ashx?id=" + _id;
                jailRoom.Text = MapArea.All.Where(a => a.Id == CulpritRoomReference.All.Where(r => r.CulpritId == _id).Select(r => r.JailRoomId).SingleOrDefault()).Select(a => a.AreaName).SingleOrDefault();

                if (!isAdmin)
                {
                    changeName.Visible   = false;
                    changeNumber.Visible = false;
                    changeMemo.Visible   = false;
                    deleteButton.Visible = false;
                    uploadButton.Visible = false;
                }
            }


            if (!LocatingServiceUtil.IsAvailable() || !isAdmin)
            {
                changeTag.Visible                  = false;
                changeJailRoom.Visible             = false;
                clearAllEvents.Visible             = false;
                locatingServiceDownMarker.Visible  = true;
                setStatus.Visible                  = false;
                locatingServiceDownMarker1.Visible = true;
            }
            else
            {
                try
                {
                    if (!string.IsNullOrEmpty(_tagMac))
                    {
                        TagStatusView tagStatus = LocatingServiceUtil.Instance <IServiceApi>().SelectTagStatus(_tagMac);
                        if (tagStatus != null)
                        {
                            coordinatesName.Text     = Coordinates.GetName(tagStatus.CoordinatesId);
                            positionUpdateTime.Value = tagStatus.PositionUpdateTime;

                            if (tagStatus.HostTag.HostGroupId.Contains(4))
                            {
                                illness.Checked = true;
                            }

                            if (tagStatus.HostTag.HostGroupId.Contains(3))
                            {
                                serious.Checked = true;
                            }

                            if (tagStatus.HostTag.HostStatusId == (int)HostTagStatusType.Interrogation)
                            {
                                arraignment.Checked = true;

                                using (AppExtensionDataContext dbExtension = new AppExtensionDataContext())
                                {
                                    InterrogationLog interrogationLog = dbExtension.InterrogationLogs.SingleOrDefault(t => t.CulpritId == tagStatus.HostTag.HostId && t.StartTime == null);

                                    if (interrogationLog != null)
                                    {
                                        if (interrogationLog.PoliceId == me.Id)
                                        {
                                            arraignment.Enabled = true;
                                        }
                                        else
                                        {
                                            arraignment.Enabled = false;
                                        }
                                    }
                                    else
                                    {
                                        //状态与数据库不一致,需要同步
                                    }
                                }
                            }


                            absence.Text             = Misc.GetEventStatusDescription(tagStatus.AbsenceStatus);
                            areaEvent.Text           = Misc.GetEventStatusDescription(tagStatus.AreaEventStatus);
                            batteryInsufficient.Text = Misc.GetEventStatusDescription(tagStatus.BatteryInsufficientStatus);
                            batteryReset.Text        = Misc.GetEventStatusDescription(tagStatus.BatteryResetStatus);
                            buttonPressed.Text       = Misc.GetEventStatusDescription(tagStatus.ButtonPressedStatus);
                            wristletBroken.Text      = Misc.GetEventStatusDescription(tagStatus.WristletBrokenStatus);
                            eventUpdateTime.Value    = tagStatus.EventUpdateTime;

                            clearAbsence.Visible             = tagStatus.AbsenceStatus != (byte)EventStatus.Cleared;
                            clearAreaEvent.Visible           = tagStatus.AreaEventStatus != (byte)EventStatus.Cleared;
                            clearBatteryInsufficient.Visible = tagStatus.BatteryInsufficientStatus != (byte)EventStatus.Cleared;
                            clearBatteryReset.Visible        = tagStatus.BatteryResetStatus != (byte)EventStatus.Cleared;
                            clearButtonPressed.Visible       = tagStatus.ButtonPressedStatus != (byte)EventStatus.Cleared;
                            clearWristletBroken.Visible      = tagStatus.WristletBrokenStatus != (byte)EventStatus.Cleared;
                        }
                    }
                }
                catch
                {
                }
            }

            using (AppDataContext db = new AppDataContext())
            {
                list.DataSource   = db.DBViewTagAlerts.Where(x => x.TagId == _tagId).OrderByDescending(x => x.WriteTime).Take(10).ToList();
                list.ItemCreated += new RepeaterItemEventHandler(list_ItemCreated);
                list.DataBind();

                if (latestWarnings.Visible = list.Items.Count > 0)
                {
                    moreWarninngs.Href = "../History/MarshalEventLog.aspx?tagNameKeyword=" + Server.UrlEncode(name.Text);
                }
            }
        }