Exemple #1
0
        public string ToText()
        {
            string result = Name.ToString() + "\r\n";

            result += Annoucement.ToString() + "\r\n";
            result += Meaning.ToString() + "\r\n";
            result += AddTime.ToString() + "\r\n";
            result += ToProficiencyString(Proficiency) + "\r\n";
            return(result);
        }
        public async Task <ActionResult> PublishTime(
            PublishTimeJson payload)
        {
            var getHost = new GetHandle(
                sub: GetUserId(),
                handle: payload.Handle
                );
            var foundHost = (await _db.Submit(_creds, getHost))
                            .SingleOrDefault();

            if (foundHost == null)
            {
                return(NotFound());
            }

            var getConflict = new PublishedTimeConflict(
                sub: GetUserId(),
                start: payload.Start,
                end: payload.End
                );
            var conflict = (await _db.Submit(_creds, getConflict))
                           .SingleOrDefault();

            if (conflict != null)
            {
                return(Conflict());
            }

            var addTime = new AddTime(
                sub: GetUserId(),
                t: new PublishedTime(
                    start: payload.Start,
                    end: payload.End,
                    hostHandle: payload.Handle,
                    record: payload.Name
                    )
                );
            var r = await _db.SubmitCommand(_creds, addTime);

            if (r == 1)
            {
                return(Created($"times/{payload.Start}", payload));
            }
            else
            {
                _log.LogWarning($"Failed to insert time for {payload.Handle}/{payload.Start}");
                return(BadRequest());
            }
        }
        /// <summary>
        /// 来自数据库的数据构造
        /// </summary>
        public void LoadFromDb(IDataReader reader)
        {
            for (int i = 0; i < reader.FieldCount; i++)
            {
                switch (reader.GetName(i).ToLower())
                {
                case "id":
                    ID = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["id"]);
                    break;

                case "name":
                    Name = reader.IsDBNull(i) ? "" : reader["name"].ToString();
                    break;

                case "isrealtime":
                    IsRealtime = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["isrealtime"]);
                    break;

                case "pid":
                    PID = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["pid"]);
                    break;

                case "cid":
                    CID = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["cid"]);
                    break;

                case "softid":
                    SoftID = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["SoftID"]);
                    break;

                case "modulus1":
                    Modulus1 = reader.IsDBNull(i) ? 0 : Convert.ToDecimal(reader["modulus1"]);
                    break;

                case "modulus2":
                    Modulus2 = reader.IsDBNull(i) ? 0 : Convert.ToDecimal(reader["modulus2"]);
                    break;

                case "reporttype":
                    ReportType = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["reporttype"]);
                    break;

                case "modulus_shanzhai":
                    //-1表示继承 0表示关闭 1 表示开启
                    Modulus_Shanzhai = reader.IsDBNull(i) ? -1 : Convert.ToInt32(reader["modulus_shanzhai"]);
                    break;

                case "minviewtime":
                    MinViewTime = reader.IsDBNull(i) ? DateTime.MinValue : Convert.ToDateTime(reader["minviewtime"]);
                    break;

                case "showtype":
                    ShowType = reader.IsDBNull(i) ? 0 : Convert.ToInt32(reader["showtype"]);
                    break;

                case "promotemodename":
                    PromoteModeName = reader.IsDBNull(i) ? "" : reader["promotemodename"].ToString();
                    break;

                case "channeltypename":
                    ChannelTypeName = reader.IsDBNull(i) ? "" : reader["channeltypename"].ToString();
                    break;

                case "firstlevelchannelcatename":
                    FirstLevelChannelCateName = reader.IsDBNull(i)
                                                        ? ""
                                                        : reader["firstlevelchannelcatename"].ToString();
                    break;

                case "secondlevelchannelcatename":
                    SecondLevelChannelCateName = reader.IsDBNull(i)
                                                         ? ""
                                                         : reader["secondlevelchannelcatename"].ToString();
                    break;

                case "exchangetypename":
                    ExchangeTypeName = reader.IsDBNull(i) ? "" : reader["exchangetypename"].ToString();
                    break;

                case "cooperationmodename":
                    CooperationModeName = reader.IsDBNull(i) ? "" : reader["cooperationmodename"].ToString();
                    break;

                case "cooperateidname":
                    CooperateIDName = reader.IsDBNull(i) ? "" : reader["cooperateidname"].ToString();
                    break;

                case "channeladminidname":
                    ChannelAdminIDName = reader.IsDBNull(i) ? "" : reader["channeladminidname"].ToString();
                    break;

                case "addtime":
                    AddTime = reader.IsDBNull(i) ? DateTime.MinValue : Convert.ToDateTime(reader["addtime"]);
                    break;
                }
            }
            AddTimeString = AddTime == DateTime.MinValue ? "默认" : AddTime.ToString("yyyy-MM-dd HH:mm:ss");
        }
Exemple #4
0
        ///// <summary>
        ///// 操作类型
        ///// </summary>
        //public EnterOutLogType OperationType
        //{
        //    get { return _operationType; }
        //    set { _operationType = value; }
        //}
        ///// <summary>
        ///// 最后时间
        ///// </summary>
        //public DateTime LastDate
        //{
        //    get { return _lastDate; }
        //    set { _lastDate = value; }
        //}


        /// <summary>
        /// 转换成Url请求参数格式
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            //string str = "SchoolNum=" + SchoolNum + "&StudentNo=" + StudentNum + "&MsgType=" + MsgType.ToString()+"&Time=" + AddTime.ToString("yyyy-MM-dd HH:mm:ss");

            //switch (MsgType)
            //{
            //    case MsgPushType.AdminOperation:str+"&Operator=管理员"+ Operator
            //}

            //SchoolNum=&StudentNo=&MsgType=&Room=&SeatNo=&AddTime=&EndTime=&Days=VRType=&Msg=;
            string str = "SchoolNum=" + SchoolNum + "&StudentNo=" + StudentNum + "&MsgType=" + MsgType.ToString() + "&Room=" + RoomName + "&SeatNo=" + SeatNum + "&AddTime=" + AddTime.ToString("yyyy-MM-dd HH:mm:ss");

            string enddate = "";
            string days    = "";

            if (MsgType == MsgPushType.EnterBlack)
            {
                enddate = IsAutoLeaveBlack ? LeaveDate.ToString("yyyy-MM-dd HH:mm:ss") : "管理员手动释放";
                days    = IsAutoLeaveBlack ? (LeaveDate - AddTime).Days.ToString() : "N/A";
            }
            if (MsgType == MsgPushType.LeaveVrBlack)
            {
                days = (LeaveDate - AddTime).Days.ToString();
            }
            string VRType = "";

            if (MsgType == MsgPushType.EnterVR || MsgType == MsgPushType.LeaveVrBlack && VrType != ViolationRecordsType.None)
            {
                switch (VrType)
                {
                case ViolationRecordsType.BookingTimeOut:
                    VRType = "预约超时";
                    break;

                case ViolationRecordsType.CancelWaitByAdmin:
                    VRType = "被管理员取消等待";
                    break;

                case ViolationRecordsType.LeaveByAdmin:
                    VRType = "被管理员释放座位";
                    break;

                case ViolationRecordsType.LeaveNotReadCard:
                    VRType = "离开没有释放座位";
                    break;

                case ViolationRecordsType.SeatOutTime:
                    VRType = "在座超时";
                    break;

                case ViolationRecordsType.ShortLeaveByAdminOutTime:
                    VRType = "被管理员设置暂离超时";
                    break;

                case ViolationRecordsType.ShortLeaveByReaderOutTime:
                    VRType = "被其他读者设置暂离超时";
                    break;

                case ViolationRecordsType.ShortLeaveByServiceOutTime:
                    VRType = "暂离超时";
                    break;

                case ViolationRecordsType.ShortLeaveOutTime:
                    VRType = "暂离超时";
                    break;
                }
            }


            return(str + "&EndTime=" + enddate + "&Days=" + days + "VRType=" + VRType + "&Msg=" + Message);
        }
Exemple #5
0
 private void ekleToolStripMenuItem4_Click(object sender, EventArgs e)
 {
     frm = new AddTime();
     frm.Show();
     frm.addComboBox("HnS");
 }