Exemplo n.º 1
0
 /// <summary>
 /// 判断是否存在cookies,不存在则跳转到登录窗口
 /// </summary>
 public static void JudgeTeacherCookies()
 {
     if (HttpContext.Current.Request.Cookies[teaCookieNname] == null)//如果没登录,跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         string hs  = HttpContext.Current.Request.Cookies[teaCookieNname]["Hs"].ToString();
         string hid = HttpContext.Current.Request.Cookies[teaCookieNname]["Hid"].ToString();
         if (hs == Common.WordProcess.GetMD5_8bit(hid.ToString()))
         {
             LearnSite.BLL.Room rbll = new BLL.Room();
             if (!rbll.ExistMyClass(Int32.Parse(hid)))
             {
                 //如果没有任教班级,则始终跳转至信息页面
                 HttpContext.Current.Response.Redirect("~/Teacher/infomation.aspx", true);
             }
         }
         else
         {
             ClearTeacherCookies();//非法cookies,清除再跳转
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 教师退出时,匹配移除当前上课班级学生
        /// </summary>
        /// <param name="strUserId"></param>
        public static void CurrentClassRemove(int Rhid)
        {
            HttpContext.Current.Application.Lock();
            ArrayList list = HttpContext.Current.Application.Get("LearnSite_User_List") as ArrayList;
            ArrayList kick = HttpContext.Current.Application.Get("LearnSite_User_kick") as ArrayList;

            if (list != null)
            {
                if (list.Count > 0)
                {
                    BLL.Room  rbll     = new BLL.Room();
                    ArrayList students = rbll.GetCurrentClassSnum(Rhid);
                    if (students != null)
                    {
                        foreach (string stu in students)
                        {
                            if (list.IndexOf(stu) > -1)
                            {
                                list.Remove(stu);
                            }

                            if (kick.IndexOf(stu) > -1)
                            {
                                kick.Remove(stu);
                            }
                        }
                    }
                    HttpContext.Current.Application.Add("LearnSite_User_List", list);
                    //  HttpContext.Current.Application.Add("LearnSite_User_Kick", kick);//退出时都移除两个列表
                }
            }
            HttpContext.Current.Application.UnLock();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 判断是否存在cookies,不存在则跳转到登录窗口
 /// </summary>
 public static void JudgeTeacherCookies()
 {
     if (HttpContext.Current.Request.Cookies[teaCookieNname] == null)//如果没登录,跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         Model.TeaCook tmcook = new Model.TeaCook();
         if (tmcook.Ss == teaCookieNname)
         {
             LearnSite.BLL.Room rbll = new BLL.Room();
             if (!rbll.ExistMyClass(tmcook.Hid))
             {
                 //如果没有任教班级,则始终跳转至信息页面
                 HttpContext.Current.Response.Redirect("~/Teacher/infomation.aspx", true);
             }
         }
         else
         {
             ClearTeacherCookies();//非法cookies,清除再跳转
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }
Exemplo n.º 4
0
        protected void btnUpdateRoomStatus_Click(object sender, EventArgs e)
        {
            BLL.Room room = new BLL.Room();
            if (room.LoadByPrimaryKey(RoomID))
            {
                if (drpRoomStatus.SelectedValue != room.s_RowStatusID)
                {
                    room.RowStatusID = Convert.ToByte(drpRoomStatus.SelectedValue);
                    room.Save();

                    //SEND MAIL MESSAGE BY THE NEW STATUS TO ROOM OWNERS AND ADMINS
                    string msgTitle = "تغيير حالة غرفة";
                    string msgBody = String.Format("عزيزى العضو<br><br>تحية طيبة وبعد<br><br>نود إبلاغكم بأنه تم تغيير حالة الغرفة <b>{0}</b> إلى <b>{1}</b><br><br><br>شكرا<br>",room.Name,drpRoomStatus.SelectedItem.Text);
                    BLL.Message msg = new BLL.Message();
                    msg.AddNew();
                    msg.SenderID = BLL.Member.SiteMembers.Where(m => String.Equals(m.Name, Helper.StringEnum.GetStringValue(Helper.Enums.SiteMembers.Admin))).FirstOrDefault().MemberID; ;
                    msg.Subject=msgTitle;
                    msg.Body=msgBody;
                    msg.ToMembers=room.CreatedByMember.Name;
                    msg.Save();
                    BLL.MemberMessage memberMsg = new BLL.MemberMessage();
                    memberMsg.AddNew();
                    memberMsg.MemberID = room.CreatedBy;
                    memberMsg.MessageID = msg.ID;
                    memberMsg.Save();
                }
            }
        }
Exemplo n.º 5
0
        private void BindReport()
        {
            BLL.Room rm = new BLL.Room();
            rm.LoadByPrimaryKey(RoomID);
            lblRoomName.Text = rm.Name;

            DateTime dtCreateDate = DateTime.Now;
            switch (Schedule)
            {
                case Helper.Enums.FollowAdminBotSchedule.Daily:
                    dtCreateDate.AddDays(-1);
                    break;
                case Helper.Enums.FollowAdminBotSchedule.Month:
                    dtCreateDate.AddMonths(-1);
                    break;
                default:
                    dtCreateDate.AddDays(-7);
                    break;

            }
            BLL.MemberLog log = new BLL.MemberLog();
            log.LoadForRoom(RoomID,dtCreateDate,MembersLevel);

            grdLog.DataSource = log.DefaultView;
            grdLog.DataBind();
        }
Exemplo n.º 6
0
        private void SendBotMsg(string mailURL, Info.RoomBot roomBot,int senderID)
        {
            System.Net.WebClient wClient = new System.Net.WebClient();
            wClient.Encoding = System.Text.Encoding.UTF8;
            string msgBody = wClient.DownloadString(mailURL);

            BLL.Room bllRoom = new BLL.Room();
            bllRoom.LoadByPrimaryKey(roomBot.RoomID);

            BLL.Message msg = new BLL.Message();
            msg.AddNew();
            msg.Body = msgBody;
            msg.SenderID = senderID;
            msg.Subject = "بوت متابعة إدارة الغرفة - " + bllRoom.Name;
            msg.ToMembers = bllRoom.CreatedByMember.Name;
            msg.Save();

            BLL.MemberMessage memberMsg = new BLL.MemberMessage();
            //add to member sent items
            //add to room owner
            memberMsg.AddNew();
            memberMsg.MemberID = bllRoom.CreatedBy;
            memberMsg.MessageID = msg.ID;
            memberMsg.Save();

            //send mail notifications
            Chat2Connect.SRCustomHubs.NotificationHub notifications = new Chat2Connect.SRCustomHubs.NotificationHub();
            notifications.SendMailNotifications(bllRoom.CreatedBy);
        }
Exemplo n.º 7
0
 private void BindRoomInfo()
 {
     BLL.Room room = new BLL.Room();
     if (room.LoadByPrimaryKey(RoomID))
     {
         drpRoomStatus.SelectedValue = room.s_RowStatusID;
     }
 }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.Room room = new BLL.Room();
                room.LoadAll();
                room.DefaultView.Sort = BLL.Room.ColumnNames.Name + " ASC";

                drpRooms.DataTextField = BLL.Room.ColumnNames.Name;
                drpRooms.DataValueField = BLL.Room.ColumnNames.RoomID;
                drpRooms.DataSource = room.DefaultView;
                drpRooms.DataBind();
            }
        }
Exemplo n.º 9
0
        private void RoomAbandonedRefesh(string floorNum, string roomNum)
        {
            room = new Model.Room();
            DataSet ds = new BLL.Room().GetListRoomInfo(String.Format(" floorNum = '{0}' and roomID = '{1}' ", floorNum, roomNum));

            dgvRoom.DataSource = ds.Tables["ds"];
            int columnNumber = dgvRoom.ColumnCount;

            foreach (DataGridViewColumn col in dgvRoom.Columns)
            {
                col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                col.SortMode   = DataGridViewColumnSortMode.NotSortable;
                col.FillWeight = 100 / columnNumber;
            }
            dgvRoom.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvRoom.AllowUserToAddRows = false;
            dgvRoom.RowHeadersVisible  = false;
            dgvRoom.ReadOnly           = true;
        }
Exemplo n.º 10
0
        private void BindResult()
        {
            BLL.Room rooms = new BLL.Room();
            DateTime? dateFrom = null, dateTo = null;
            if (!String.IsNullOrEmpty(txtCreatedFrom.Text))
            {
                dateFrom = Helper.Date.ToDate(txtCreatedFrom.Text);
            }
            if (!String.IsNullOrEmpty(txtCreatedTo.Text))
            {
                dateTo = Helper.Date.ToDate(txtCreatedTo.Text);
            }
            int? status = null;
            if (!String.IsNullOrEmpty(lstRoomStatus.SelectedValue))
                status = Helper.TypeConverter.ToInt32(lstRoomStatus.SelectedValue);
            rooms.Search(dateFrom,dateTo,status);

            grdResult.DataSource = rooms.DefaultView;
            grdResult.DataBind();
        }
Exemplo n.º 11
0
        /// <summary>
        /// 匹配踢除该班级学生
        /// </summary>
        /// <param name="strUserId"></param>
        public static void GradeClassRemove(int Sgrade, int Sclass)
        {
            HttpContext.Current.Application.Lock();
            ArrayList list = HttpContext.Current.Application.Get("LearnSite_User_List") as ArrayList;
            ArrayList kick = HttpContext.Current.Application.Get("LearnSite_User_kick") as ArrayList;

            if (list != null)
            {
                if (list.Count > 0)
                {
                    BLL.Room  rbll     = new BLL.Room();
                    ArrayList students = rbll.GetGradeClassSnum(Sgrade, Sclass);
                    if (students != null)
                    {
                        foreach (string stu in students)
                        {
                            if (list.IndexOf(stu) > -1)
                            {
                                list.Remove(stu);//如果存在,则移除

                                if (kick == null)
                                {
                                    kick = new ArrayList();
                                    kick.Add(stu);
                                }
                                else
                                {
                                    if (kick.IndexOf(stu) < 0)
                                    {
                                        kick.Add(stu);//如果不存在则添加
                                    }
                                }
                            }
                        }
                    }
                    HttpContext.Current.Application.Add("LearnSite_User_List", list);
                    HttpContext.Current.Application.Add("LearnSite_User_Kick", kick);
                }
            }
            HttpContext.Current.Application.UnLock();
        }
Exemplo n.º 12
0
        private void btConfirm_Click(object sender, EventArgs e)
        {
            string floorNum = nudFloorNum.Value.ToString().Trim(),
                   roomID   = nudRoomID.Value.ToString().Trim(),
                   roomType = combRoomType.SelectedValue.ToString();
            int intRoomID   = Convert.ToInt32(nudRoomID.Value);

            if (floorNum == "" || floorNum == null || roomID == "" || roomID == null || roomType == "" || roomType == null)
            {
                MessageBox.Show("不能有空!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (intRoomID < 10)
                {
                    roomID = "00" + roomID;
                }
                else if (intRoomID < 100)
                {
                    roomID = "0" + roomID;
                }

                Model.Room model = new Model.Room();
                int        flag  = 0;

                if (new BLL.Room().Exists(floorNum, roomID))
                {
                    model = new BLL.Room().GetModel(floorNum, roomID);
                    if (model.roomAbandoned == 0)
                    {
                        model.roomAbandoned = 1;
                        if (new BLL.Room().Update(model))
                        {
                            flag = 1;
                        }
                    }
                    else
                    {
                        MessageBox.Show("房间已存在!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                else
                {
                    model.floorNum    = floorNum;
                    model.roomID      = roomID;
                    model.roomTypeID  = roomType;
                    model.liveState   = 0;
                    model.cleanState  = 1;
                    model.damageState = 1;
                    if (new BLL.Room().Add(model))
                    {
                        flag = 1;
                    }
                }

                if (flag == 1)
                {
                    MessageBox.Show("添加成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ((Main_Admin)this.Owner).LoadData_RoomInfo();
                    Main_Admin.room = new Model.Room();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("添加失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 创建所教班级的模型xml
        /// </summary>
        /// <param name="hid"></param>
        /// <param name="xdoc"></param>
        /// <param name="savepath"></param>
        /// <param name="months"></param>
        /// <returns></returns>
        public static string SetAllStuName(int hid, XmlDocument xdoc, string savepath, int weeks, string xmlfile)
        {
            string      result       = "这是默认值:创建失败!";
            XmlNode     root         = xdoc.SelectSingleNode("classmodel");
            XmlNodeList nodeListtest = root.ChildNodes;

            if (nodeListtest[0].Name != "student")
            {
                root = root.SelectSingleNode("students");
            }
            if (root != null)
            {
                XmlNodeList nodeList = root.ChildNodes;
                int         stucount = nodeList.Count;
                if (stucount > 0)
                {
                    BLL.Signin gbll          = new BLL.Signin();
                    DataTable  allclassstu   = gbll.GetQnameQip(hid, weeks);
                    int        allclassCount = allclassstu.Rows.Count;
                    if (allclassCount > 0)
                    {
                        //string teststr = ClassModeSavePath(hid.ToString()) + @"\test" + hid + "all.xml";
                        //allclassstu.WriteXml(teststr);//测试输出
                        BLL.Room  bll       = new BLL.Room();
                        DataTable dtclass   = bll.GetMyGradeClass(hid);
                        int       dtcscount = dtclass.Rows.Count;
                        result = "信息提示:有签到的任教" + dtcscount.ToString() + "个班级共" + allclassstu.Rows.Count.ToString() + "人 |";
                        int right = 0;
                        int wrong = 0;
                        int miss  = 0;
                        for (int i = 0; i < dtcscount; i++)
                        {
                            string   rgrade    = dtclass.Rows[i]["Rgrade"].ToString();
                            string   rclass    = dtclass.Rows[i]["Rclass"].ToString();
                            string   classname = rgrade + "年级" + rclass + "班";
                            DataView dv        = allclassstu.DefaultView;
                            dv.RowFilter = "Qgrade=" + rgrade + " and Qclass=" + rclass;
                            DataTable dt = dv.ToTable();
                            //dt.Columns.Remove("Qgrade");
                            //dt.Columns.Remove("Qclass");//清理掉无用字段
                            //string testclassstr = ClassModeSavePath(hid.ToString()) + @"\test" + rgrade + "_" + rclass +".xml";
                            //dt.WriteXml(testclassstr);//测试输出
                            int thiscount = dt.Rows.Count;
                            if (thiscount > 0)
                            {
                                try
                                {
                                    SetStuName(dt, classname, savepath, xmlfile);                               //创建该班级的模型
                                    right++;
                                    result = result + rgrade + "." + rclass + "(" + thiscount.ToString() + ")"; //生成该班级模型
                                }
                                catch (Exception ex)
                                {
                                    wrong++;
                                    result = result + rgrade + "." + rclass + "(??)";
                                    string msgtype = "班级模型" + rgrade + "." + rclass + "班模型生成出错";
                                    LearnSite.Common.Log.Addlog(msgtype, ex.Message);
                                }
                            }
                            else
                            {
                                miss++;
                                result = result + rgrade + "." + rclass + "(0)";
                            }
                        }
                        result = result + "<br/><br/>创建成功" + right.ToString() + "个班级模型xml文件,失效" + miss.ToString() + "个,出错" + wrong.ToString() + "个。";
                        DelUpXml(xmlfile);//删除上传的xml文件
                    }
                    else
                    {
                        result = "没有在指定时间内签到的班级学生,无法根据签到IP生成相应的班级模型!";
                    }
                }
                else
                {
                    result = "上传的原有班级模型xml文件中学生机为0,无法创建!";
                }
            }
            else
            {
                result = "上传的原有班级模型xml文件中无classmodel根节点!";
            }
            return(result);
        }
Exemplo n.º 14
0
        private void BindAccountInfo()
        {
            dtlAccountInfo.DataSource = null;
            dtlAccountInfo.DataBind();
            try
            {
                BLL.Member member = new BLL.Member();
                if (member.GetMemberByUserName(MemberUserName))
                {

                    List<dynamic> dataSource = new List<dynamic>()
                        {
                            new {
                                UserName=member.UserName,
                                Email=member.Email,
                                Password=member.Password,
                                PasswordQuestion=member.PasswordQuestion,
                                QuestionAnswer=member.Answer,
                                CreationDate=member.CreationDate,
                                IP=member.s_IP,
                                MemberTypeExpiryDate=member.s_MemberTypeExpiryDate,
                                Credit_Money=member.s_Credit_Money,
                                MemberTypeColor=member.MemberType.MemberTypeSpecDuration.MemberTypeSpec.Color,
                                StatusName=member.StatusName,
                                IsOnline=(member.IsOnLine?"نعم":"لا"),
                                FriendsCount=member.FriendsCount()
                            }
                        };
                    dtlAccountInfo.DataSource = dataSource;
                    dtlAccountInfo.DataBind();
                    if (Helper.Admin.HasRole(Helper.Enums.AdminRoles.Admin_AccountInfo.ToString()))
                    {
                        Repeater repOwnerRooms = (Repeater)dtlAccountInfo.FindControl("repOwnerRooms");
                        Repeater repAdminRooms = (Repeater)dtlAccountInfo.FindControl("repAdminRooms");

                        BLL.RoomMember roomMember = new BLL.RoomMember();
                        roomMember.GetAllRoomsByAdminMemberID(member.MemberID);
                        repAdminRooms.DataSource = roomMember.DefaultView;
                        repAdminRooms.DataBind();
                        //string adminRoom = string.Join(",", roomMember.DefaultView.Table.AsEnumerable().Select(x => x["RoomName"].ToString()).ToArray());
                        BLL.Room room = new BLL.Room();
                        room.GetRoomsByCreatorID(member.MemberID);
                        repOwnerRooms.DataSource = room.DefaultView;
                        repOwnerRooms.DataBind();
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BLL.Bot bllBot = new BLL.Bot();
                bllBot.LoadAllWithPoints();
                repBots.DataSource = bllBot.DefaultView;
                repBots.DataBind();

                BLL.Room bllRooms = new BLL.Room();
                bllRooms.GetRoomsByCreatorID(BLL.Member.CurrentMemberID);
                lstRooms.DataTextField = BLL.Room.ColumnNames.Name;
                lstRooms.DataValueField = BLL.Room.ColumnNames.RoomID;
                lstRooms.DataSource = bllRooms.DefaultView;
                lstRooms.DataBind();

                lblPointsBalance.Text = BLL.Member.CurrentMember.s_Credit_Point;

                _dicRoomsSpecs = new List<object>();
                _dicRoomsSpecs = bllRooms.DefaultView.Table.AsEnumerable().Select(m => new { RoomID = m[BLL.Room.ColumnNames.RoomID], SpecID = m["RoomTypeSpecID"] }).ToList();
                BindRoomsBots();

            }
        }
Exemplo n.º 16
0
        private void BindRooms()
        {
            BLL.Room rooms = new BLL.Room();
            rooms.LoadAll();

            uiGridViewRoom.DataSource = rooms.DefaultView;
            uiGridViewRoom.DataBind();
        }
Exemplo n.º 17
0
        protected void uiGridViewRoom_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int roomid = Convert.ToInt32(e.CommandArgument.ToString());
            if (e.CommandName == "DeleteRoom")
            {

                BLL.Room room = new BLL.Room();

                room.LoadByPrimaryKey(roomid);
                room.MarkAsDeleted();

                room.Save();
                BindRooms();
            }
            else if (e.CommandName == "DeleteBots")
            {
                BLL.RoomBot bots = new BLL.RoomBot();

                bots.Where.RoomID.Value = roomid;
                bots.Where.RoomID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                bots.Query.Load();

                for (int i = 0; i < bots.RowCount; i++)
                {
                    bots.MarkAsDeleted();
                    bots.MoveNext();
                }

                bots.Save();

            }
            else if (e.CommandName == "DeleteMembers")
            {
                BLL.RoomMember members = new BLL.RoomMember();

                members.Where.RoomID.Value = roomid;
                members.Where.RoomID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                members.Query.Load();

                for (int i = 0; i < members.RowCount; i++)
                {
                    members.MarkAsDeleted();
                    members.MoveNext();
                }
                members.Save();

            }

            else if (e.CommandName == "DeleteMessages")
            {
                BLL.RoomMessages msgs = new BLL.RoomMessages();

                msgs.Where.RoomID.Value = roomid;
                msgs.Where.RoomID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                msgs.Query.Load();

                for (int i = 0; i < msgs.RowCount; i++)
                {
                    msgs.MarkAsDeleted();
                    msgs.MoveNext();
                }
                msgs.Save();

            }
            else if (e.CommandName == "DeleteBannedmembers")
            {
                BLL.RoomMemberBanning bans = new BLL.RoomMemberBanning();
                bans.Where.RoomID.Value = roomid;
                bans.Where.RoomID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                bans.Query.Load();

                for (int i = 0; i < bans.RowCount; i++)
                {
                    bans.MarkAsDeleted();
                    bans.MoveNext();
                }
                bans.Save();
            }

            else if (e.CommandName == "DeleteTypes")
            {
                BLL.RoomType type = new BLL.RoomType();
                type.Where.RoomID.Value = roomid;
                type.Where.RoomID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                type.Query.Load();

                for (int i = 0; i < type.RowCount; i++)
                {
                    type.MarkAsDeleted();
                    type.MoveNext();
                }
                type.Save();
            }
        }