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();
                }
            }
        }
示例#2
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();
            }
        }