Ejemplo n.º 1
0
        /// <summary>
        /// 获取阅览室中的座位分布以及使用情况
        /// </summary>
        /// <param name="roomNum">阅览室编号</param>
        /// <returns></returns>
        public static SeatLayout GetRoomSeatLayOut(string roomNum)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                SeatLayout layout = seatService.GetRoomSeatLayOut(roomNum);
                return(layout);
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write("获取阅览室座位分布遇到错误:" + ex.Message);
                return(null);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加新的进出记录
        /// </summary>
        /// <param name="model"></param>
        public static HandleResult AddEnterOutLog(EnterOutLogInfo model, ref int newLogId)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                HandleResult result = seatService.AddEnterOutLogInfo(model, ref newLogId);
                return(result);
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write("添加进出记录遇到错误:" + ex.Message);
                return(HandleResult.Failed);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
Ejemplo n.º 3
0
        public JsonResult Delete(string id)
        {
            var obj = new tblVehicleGroup();

            //var listCardGroup = _tblCardGroupService.GetAllByVehicleGroupId(id);
            //if (listCardGroup.Any())
            //{
            //    var re = new Result();
            //    re.ErrorCode = 500;
            //    re.Message = "Nhóm xe đang được sử dụng trong nhóm thẻ. Không thể xóa!";
            //    re.Success = false;

            //    return Json(re, JsonRequestBehavior.AllowGet);
            //}

            var result = _tblVehicleGroupService.DeleteById(id, ref obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.VehicleGroupID.ToString(), obj.VehicleGroupName, "tblVehicleGroup", ConstField.ParkingCode, ActionConfigO.Delete);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 /// <summary>
 /// 获取可预约阅览室的座位
 /// </summary>
 /// <param name="date"></param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public List <AJM_ReadingRoom> GetBesapeakRoomList(string date, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetCanBespeakRoomInfo(date);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取可预约的阅览室列表失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         List <AJM_ReadingRoom> ajmReadingRooms = JSONSerializer.Deserialize <List <AJM_ReadingRoom> >(ajmResult.Msg);
         return(ajmReadingRooms);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取可预约的阅览室列表失败:{0}", ex.Message));
         return(null);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取违规记录
 /// </summary>
 /// <param name="studentNo">用户学号</param>
 /// <param name="pageIndex">页编码</param>
 /// <param name="pageSize">每页数目</param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public List <AJM_ViolationRecordsLogInfo> GetViolationLog(string studentNo, int pageIndex, int pageSize, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetViolationLog(studentNo, pageIndex, pageSize);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取违规记录失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         List <AJM_ViolationRecordsLogInfo> ajmViolationRecordsLogInfos = JSONSerializer.Deserialize <List <AJM_ViolationRecordsLogInfo> >(ajmResult.Msg);
         return(ajmViolationRecordsLogInfos);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取违规记录失败:{0}", ex.Message));
         return(null);
     }
 }
Ejemplo n.º 6
0
    /// <summary>
    /// 更新理赔信息
    /// </summary>
    /// <param name="oPModel"></param>
    /// <returns></returns>
    public string SetCompensateInfo(CompensateModel oPModel, string OrderPath, string OrderTemplate)
    {
        string ret = Config.Fail;

        try
        {
            ret = cDAL.SetCompensateInfo(oPModel);
            int  Id   = 0;
            bool flag = Int32.TryParse(ret, out Id);
            if (flag && Id > 0)
            {
                string _orderPath     = OrderPath + oPModel.CompensateNo + ".html";
                string _orderTemplate = OrderTemplate + "CompensateTemplate.html";
                CompensateOrder(oPModel, _orderPath, _orderTemplate);
                return(Config.Success);
            }
        }
        catch (Exception ex)
        {
            WriteLog.WriteExceptionLog("BLL.CompensateBLL.SetCompensateInfo()", ex);
            return(Config.ExceptionMsg);
        }
        return(ret);
    }
 /// <summary>
 /// 获取座位预约的信息
 /// </summary>
 /// <param name="seatNo"></param>
 /// <param name="roomNo"></param>
 /// <param name="bespeakTime"></param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public AJM_SeatBespeakInfo GetSeatBespeakInfo(string seatNo, string roomNo, string bespeakTime, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetRandomSeat(roomNo);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取预约座位信息失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         AJM_SeatBespeakInfo ajmSeat = JSONSerializer.Deserialize <AJM_SeatBespeakInfo>(ajmResult.Msg);
         return(ajmSeat);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取预约座位信息失败:{0}", ex.Message));
         return(null);
     }
 }
        /// <summary>
        /// 获取全部阅览室的当前的使用状态(在座人数,是否开馆等)
        /// </summary>
        /// <returns></returns>
        public string GetAllRoomNowState()
        {
            AJM_HandleResult result = new AJM_HandleResult();

            try
            {
                //获取阅览室座位使用状态
                Dictionary <string, ReadingRoomSeatUsedState> roomSeatUsedStates = SeatManageDateService.GetRoomSeatUsedStateV5(null);
                List <AJM_ReadingRoomState> ajmReadingRoomStates = new List <AJM_ReadingRoomState>();
                foreach (ReadingRoomSeatUsedState seatUsedState in roomSeatUsedStates.Values)
                {
                    AJM_ReadingRoomState ajmReadingRoomState = new AJM_ReadingRoomState();
                    ajmReadingRoomState.RoomName = seatUsedState.RoomName;
                    ajmReadingRoomState.RoomNo   = seatUsedState.RoomNum;
                    List <string> listNum = new List <string>();
                    listNum.Add(seatUsedState.RoomNum);
                    ReadingRoomInfo readingRoomInfo = SeatManageDateService.GetReadingRoomInfo(listNum)[0];
                    ajmReadingRoomState.OpenCloseState     = readingRoomInfo.Setting.ReadingRoomOpenState(DateTime.Now).ToString();
                    ajmReadingRoomState.SeatAmount_All     = seatUsedState.SeatAmountAll;
                    ajmReadingRoomState.SeatAmount_Used    = seatUsedState.SeatAmountUsed;
                    ajmReadingRoomState.SeatAmount_Bespeak = seatUsedState.SeatBookingCount;
                    ajmReadingRoomState.SeatAmount_Last    = ajmReadingRoomState.SeatAmount_All - ajmReadingRoomState.SeatAmount_Used - ajmReadingRoomState.SeatAmount_Bespeak + seatUsedState.SeatTemUseCount;
                    ajmReadingRoomStates.Add(ajmReadingRoomState);
                }
                result.Result = true;
                result.Msg    = JSONSerializer.Serialize(ajmReadingRoomStates);
                return(JSONSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("获取阅览室使用状态遇到异常:{0}", ex.Message));
                result.Result = false;
                result.Msg    = "获取阅览室使用状态执行遇到异常!";
                return(JSONSerializer.Serialize(result));
            }
        }
 /// <summary>
 /// 获取常用座位
 /// </summary>
 /// <param name="studentNo">学号</param>
 /// <param name="seatCount">获取的座位数目</param>
 /// <param name="dayCount">统计的天数</param>
 /// <returns></returns>
 public List <AJM_Seat> GetOftenSeat(string studentNo, int seatCount, int dayCount, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetOftenSeat(studentNo, seatCount, dayCount);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取常坐座位失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         List <AJM_Seat> ajmSeats = JSONSerializer.Deserialize <List <AJM_Seat> >(ajmResult.Msg);
         return(ajmSeats);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取常坐座位失败:{0}", ex.Message));
         return(null);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 发送请求

        /// </summary>
        /// <param name="url">Url地址</param>
        /// <param name="method">方法(post或get)</param>
        /// <param name="method">数据类型</param>
        /// <param name="requestData">数据</param>
        public static string SendPostHttpRequestForMedia(string url, string requestData)
        {
            try
            {
                WebRequest request = (WebRequest)HttpWebRequest.Create(url);
                request.Method = "POST";
                byte[] postBytes = null;
                request.ContentType   = "application / x - www - form - urlencoded";
                postBytes             = Encoding.UTF8.GetBytes(requestData);
                request.ContentLength = postBytes.Length;
                using (Stream outstream = request.GetRequestStream())
                {
                    outstream.Write(postBytes, 0, postBytes.Length);
                }
                string result = string.Empty;
                using (WebResponse response = request.GetResponse())
                {
                    if (response != null)
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                            {
                                result = reader.ReadToEnd();
                            }
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                WriteLog.EventLog("SendPostHttpRequestForMedia:" + ex.Message);
                return(string.Empty);
            }
        }
        public ActionResult Create(Kztek.Model.Models.tblLockerController obj, bool SaveAndCountinue = false)
        {
            //Danh sách sử dụng
            ViewBag.Lines = GetLineList();

            ViewBag.urlValue = url ?? Request.Url.PathAndQuery;

            //Kiểm tra
            if (!ModelState.IsValid)
            {
                return(View(obj));
            }

            //Gán giá trị
            obj.Id = Guid.NewGuid().ToString();

            //Thực hiện thêm mới
            var result = _tblLockerControllerService.Create(obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.ControllerName, "tblLockerController", ConstField.LockerCode, ActionConfigO.Create);

                if (SaveAndCountinue)
                {
                    TempData["Success"] = result.Message;
                    return(RedirectToAction("Create"));
                }

                return(Redirect(url));
            }
            else
            {
                return(View(obj));
            }
        }
Ejemplo n.º 12
0
        public static List <Order> GetOrder(string orderInsideID, string orderExternalID, string productID, string productName, string targetAccount, string reChargeAccount, DateTime startTime, DateTime endTime, int Status = -1)
        {
            try
            {
                using (DCLEntities dcl = new DCLEntities())
                {
                    var result = dcl.Order.Where(p => p.OrderInsideID.Contains(orderInsideID) && p.OrderExternalID.Contains(orderExternalID) &&
                                                 p.ProductID.Contains(productID) && p.ProductName.Contains(productName) && p.TargetAccount.Contains(targetAccount) &&
                                                 p.ChargeAccountInfo.Contains(reChargeAccount) && p.StartDatetime > startTime && p.StartDatetime < endTime);
                    if (Status != -1)
                    {
                        result = result.Where(p => (p.RechargeStatus != null && p.RechargeStatus == Status));
                    }

                    return(result.ToList());
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("系统订单号:" + orderInsideID + ",商户订单号:" + orderExternalID + ",异常场信息[GetOrder]:" + ex.Message + ex.Source, LogPathFile.Exception);

                return(null);
            }
        }
        public static FileSliceInfo GetFileSliceInfo(string fileName, SeatManageSubsystem system)
        {
            IFileTransportService fileTransport = WcfAccessProxy.AMS_ServiceProxy.CreateChannelFileTransportService();
            bool isError = false;

            try
            {
                return(fileTransport.GetFilesSliceInfo(fileName, system));
            }
            catch (Exception ex)
            {
                isError = true;
                WriteLog.Write(string.Format("获取文件片段信息失败,异常信息:{0}", ex.Message));
                throw ex;
                //return null;
            }
            finally
            {
                ICommunicationObject ICommObjectService = fileTransport as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 文件下载断点续传
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="Offset"></param>
        /// <returns></returns>
        public static FileSliceInfo FileDownLoad(FileSliceInfo file, SeatManageSubsystem system)
        {
            IFileTransportService fileTransport = WcfAccessProxy.AMS_ServiceProxy.CreateChannelFileTransportService();
            bool isError = false;

            try
            {
                file.Data = fileTransport.FileDownLoad(file.Name, file.Offset, system);
                return(file);
            }
            catch (Exception ex)
            {
                isError = true;
                WriteLog.Write(string.Format("文件下载出错,异常信息:{0}", ex.Message));
                throw;
            }
            finally
            {
                ICommunicationObject ICommObjectService = fileTransport as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// 转发socket消息 ,
 /// </summary>
 /// <param name="uid">请求的目标ID。</param>
 /// <param name="msg">如果msg类型为Request,即客户端请求学校,需要转发给学校。否则为学校响应客户端的请求。</param>
 private void RelaySocketMsg(string uid, SocketMsgBase msg)
 {
     try
     {
         msg.Sender = uid;
         if (schoolNums.ContainsKey(msg.Target))
         {
             server.Send(schoolNums[msg.Target], ByteSerializer.ObjectToByte(msg));
             Console.WriteLine("{0:M} {1:t}:转发给目标{2},地址为:{3}", DateTime.Now, DateTime.Now, msg.Target, schoolNums[msg.Target]);
         }
         else
         {
             if (msg is SocketRequest)
             {
                 Console.WriteLine("{0:M} {1:t}:请求的目标{2}不存在", DateTime.Now, DateTime.Now, msg.Target);
                 SocketResponse response = new SocketResponse();
                 response.SubSystem  = msg.SubSystem;
                 response.MethodName = msg.MethodName;
                 response.Sender     = response.Target;
                 response.Target     = response.Sender;
                 response.ErrorMsg   = "学校没有连接";
                 server.Send(uid, ByteSerializer.ObjectToByte(response));
             }
             else if (msg is SocketResponse)
             {
                 // Console.WriteLine("消息回复给{0}", msg.Target);
                 Console.WriteLine("{0:M} {1:t}:消息回复给{2}", DateTime.Now, DateTime.Now, msg.Target);
                 server.Send(msg.Target, ByteSerializer.ObjectToByte(msg));
             }
         }
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("RelaySocketMsg执行遇到异常:{0},异常来自:{1}", ex.Message, ex.Source));
     }
 }
Ejemplo n.º 16
0
    /// <summary>
    /// 管理员登录
    /// </summary>
    /// <param name="Admin"></param>
    /// <param name="Password"></param>
    /// <returns></returns>
    public bool AdminLogin(string AdminName, string AdminPassword, out AdminModel oAModel)
    {
        bool IsLogin = false;

        oAModel = null;
        try
        {
            oAModel = ad.AdminLogin(AdminName, AdminPassword);
            if (oAModel != null)
            {
                List <RoleModel> oRModel = rd.GetRoleList(oAModel.RoleId);
                if (oRModel != null && oRModel.Count > 0)
                {
                    oAModel.Role = oRModel[0];
                }
                IsLogin = true;
            }
        }
        catch (Exception ex)
        {
            WriteLog.WriteExceptionLog("ZB.BLL.Authorization.AdminBLL.AdminLogin()", ex);
        }
        return(IsLogin);
    }
Ejemplo n.º 17
0
        public override void OnExitLevel()
        {
            WriteLog.Info("Saving groups...");
            database.SaveGroups();

            if (!ConfigValues.SettingsMutex)
            {
                // Save xlr stats
                if (ConfigValues.settings_enable_xlrstats)
                {
                    WriteLog.Info("Saving xlrstats...");
                    xlr_database.Save(this);
                }

                WriteLog.Info("Saving PersonalPlayerDvars...");
                // Save FilmTweak settings
                UTILS_PersonalPlayerDvars_save(PersonalPlayerDvars);

                ConfigValues.SettingsMutex = false;
            }

            MAIN_ResetSpawnAction();
            base.OnExitLevel();
        }
Ejemplo n.º 18
0
        public string SubmitOrder(Order order, string str = null)
        {
            CookieContainer coockie = new CookieContainer();

            if (order.ProductID == "20815")
            {
                str = setPostDate2(order);
            }
            else
            {
                if (string.IsNullOrEmpty(str))
                {
                    str = setPostDate(order);
                }
            }

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " ZhiXin 提交参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString_utf8(submitUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " ZhiXin 提交返回:" + result, LogPathFile.Recharge.ToString());

            return(result);
        }
Ejemplo n.º 19
0
        public void updateDgview(List <HUNHENOWVIEW1> info, DataGridView Dgview)
        {
            String time = DateTime.Now.ToLongTimeString();

            if (Dgview.InvokeRequired)
            {
                Dgview.Invoke(new HandleDelegate1(updateDgview), new Object[] { info, Dgview });
            }
            else
            {
                try
                {
                    Dgview.DataSource     = new List <HUNHENOWVIEW1>();
                    Dgview.DataSource     = info;
                    btnNowPoke.Enabled    = true;
                    DgvNowView.Visible    = true;
                    gbox_waitting.Visible = false;
                }
                catch (Exception ex)
                {
                    WriteLog.GetLog().Write("数据绑定时" + ex.InnerException.Message.ToString());
                }
            }
        }
Ejemplo n.º 20
0
        public void SNIPE_OnServerStart()
        {
            WriteLog.Info("Initializing isnipe settings...");
            SNIPE_InitCommands();
            PlayerActuallySpawned += SNIPE_OnPlayerSpawn;
            OnPlayerDamageEvent   += SNIPE_PeriodicChecks;
            PlayerConnected       += SNIPE_OnPlayerConnect;

            if (ConfigValues.ISNIPE_SETTINGS.ANTIKNIFE)
            {
                DisableKnife();
                WriteLog.Info("Knife auto-disabled.");
            }

            AfterDelay(5000, () =>
            {
                if (Call <string>("getdvar", "g_gametype") == "infect")
                {
                    EnableKnife();
                }
            });

            WriteLog.Info("Done initializing isnipe settings.");
        }
 /// <summary>
 /// 获取阅览室布局图
 /// </summary>
 /// <param name="roomNo">阅览室编号</param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public AJM_SeatLayout GetRoomSeatLayout(string roomNo, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetRoomSeatLayout(roomNo);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取全部阅览室的当前的使用状态失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         AJM_SeatLayout ajmSeatLayout = JSONSerializer.Deserialize <AJM_SeatLayout>(ajmResult.Msg);
         return(ajmSeatLayout);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取全部阅览室的当前的使用状态失败:{0}", ex.Message));
         return(null);
     }
 }
Ejemplo n.º 22
0
 // GET: Doctor
 public ActionResult Index()
 {
     try
     {
         if (Session["userModel"] != null)
         {
             return(View());
         }
         else
         {
             return(RedirectToAction("Login", "MainPage"));
         }
     }
     catch (Exception ex)
     {
         WriteLog write   = new WriteLog();
         string   message = ex.Message;
         write.WriteLogMessage(message);
         string strMsg = UDBusiness.IngnoreSpecialCharacter(message);
         string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
         Response.Write(script);
         return(RedirectToAction("Login", "MainPage"));
     }
 }
        /// <summary>
        /// 根据阅览室编号列表获取阅览室列表
        /// </summary>
        /// <param name="roomNums">编号列表</param>
        /// <returns></returns>
        public static List <ReadingRoomInfo> GetReadingRooms(List <string> roomNums)
        {
            IWCFService.ISeatManageService SeatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                List <ReadingRoomInfo> rooms = SeatService.GetReadingRoomInfo(roomNums);
                return(rooms);
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write(ex.Message);
                return(new List <ReadingRoomInfo>());
            }
            finally
            {
                ICommunicationObject ICommObjectService = SeatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
Ejemplo n.º 24
0
    protected override bool AuthorizeCore(HttpContextBase httpContext)
    {
        bool result;

        try
        {
            Authentication authentication = new Authentication(httpContext);
            if (authentication.isAuthentication)
            {
                string value = (string)httpContext.Session["UserName"];
                if (string.IsNullOrEmpty(value))
                {
                    authentication.isAuthentication = false;
                }
            }
            result = authentication.isAuthentication;
        }
        catch (Exception ex)
        {
            WriteLog.writeToLogFile(ex);
            result = false;
        }
        return(result);
    }
 /// <summary>
 /// 获取全部阅览室的当前的使用状态(在座人数,是否开馆等)
 /// </summary>
 /// <returns></returns>
 public List <AJM_ReadingRoomState> GetAllRoomNowState(string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetAllRoomNowState();
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取全部阅览室的当前的使用状态失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         List <AJM_ReadingRoomState> ajmReadingRoomStates = JSONSerializer.Deserialize <List <AJM_ReadingRoomState> >(ajmResult.Msg);
         return(ajmReadingRoomStates);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取全部阅览室的当前的使用状态失败:{0}", ex.Message));
         return(null);
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 获取服务器时间
        /// </summary>
        /// <returns></returns>
        private static DateTime serviceDatetime()
        {
            IWCFService.ISeatManageService service = SeatManage.WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                return(service.GetServerDateTime());
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write(string.Format("获取服务器时间出错:{0}", ex.Message));
                //return DateTime.Now;
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = service as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
 /// <summary>
 /// 获取单个阅览室开闭状态
 /// </summary>
 /// <param name="roomNo"></param>
 /// <param name="datetime"></param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public AJM_ReadingRoomState GetSingleRoomOpenState(string roomNo, string datetime, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetAllRoomNowState();
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取单个阅览室的当前的开闭状态失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         AJM_ReadingRoomState ajmReadingRoomState = JSONSerializer.Deserialize <AJM_ReadingRoomState>(ajmResult.Msg);
         return(ajmReadingRoomState);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取单个阅览室的当前的开闭状态失败:{0}", ex.Message));
         return(null);
     }
 }
        public ActionResult Create(BM_ApartmentUse obj, bool SaveAndCountinue = false, string key = "")
        {
            ViewBag.keyValue = key;

            //Kiểm tra
            if (!ModelState.IsValid)
            {
                return(View(obj));
            }


            //Gán giá trị
            obj.Id          = Guid.NewGuid().ToString();
            obj.DateCreated = DateTime.UtcNow;

            //Thực hiện thêm mới
            var result = _BM_ApartmentUseService.Create(obj);

            if (result.isSuccess)
            {
                WriteLog.Write(result, GetCurrentUser.GetUser(), obj.Id.ToString(), obj.Name, "BM_ApartmentUse", ConstField.ResidentCode, ActionConfigO.Create);

                if (SaveAndCountinue)
                {
                    TempData["Success"] = result.Message;
                    return(RedirectToAction("Create", new { key = key }));
                }

                return(RedirectToAction("Index", new { key = key }));
            }
            else
            {
                ModelState.AddModelError("", result.Message);
                return(View(obj));
            }
        }
 /// <summary>
 /// 获取阅览室可预约的座位
 /// </summary>
 /// <param name="roomNo">阅览室编号</param>
 /// <param name="bespeakTime"></param>
 /// <returns></returns>
 public List <AJM_BespeakSeat> GetRoomBesapeakSeat(string roomNo, string bespeakTime, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetRoomBesapeakState(roomNo, bespeakTime);
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取阅览室的可预约座位失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         List <AJM_BespeakSeat> ajmBespeakSeats = JSONSerializer.Deserialize <List <AJM_BespeakSeat> >(ajmResult.Msg);
         return(ajmBespeakSeats);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取阅览室的可预约座位失败:{0}", ex.Message));
         throw ex;
     }
 }
Ejemplo n.º 30
0
        private static void SendPrintProcess(object printCommand)
        {
            //Declare and instantiate a new process component.
            Process cmdProcess = new Process();

            try
            {
                //ExceptionMngr.WriteEventLog(batFile + " "+ printCommand);

                //Do not receive an event when the process exits.
                cmdProcess.EnableRaisingEvents       = false;
                cmdProcess.StartInfo.UseShellExecute = false;
                cmdProcess.StartInfo.FileName        = batFile;
                cmdProcess.StartInfo.Arguments       = printCommand.ToString();
                cmdProcess.StartInfo.CreateNoWindow  = true;
                cmdProcess.Start();
                cmdProcess.WaitForExit();
                cmdProcess.Close();
            }
            catch (Exception ex) {
                //ExceptionMngr.WriteEvent("SendPrintProcess: " + printCommand, ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business);
                ExceptionMngr.WriteEventLog(WriteLog.GetTechMessage(ex));
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// redirecte the log to file
 /// </summary>
 /// <param name="fileName"></param>
 public static void LogToFile(string fileName)
 {
     logFileName = fileName;
     WriteLogFunc = WriteLogFile;
 }
Ejemplo n.º 32
0
 private void LogEntry()
 {
     //call the WriteLog class and pass the scan and permission
     //to the class to be written to the log
     WriteLog log = new WriteLog(scan, Permission);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// redirecte the log to file
 /// </summary>
 public static void LogToFile()
 {
     WriteLogFunc = WriteLogFile;
 }
Ejemplo n.º 34
0
        public void logWrite(string clog)
        {
            try
            {
                clog = string.Format("[{0}]{1}\r\n",DateTime.Now.ToString(),clog);
                
                if (Log.logBox.InvokeRequired)
                {
                    WriteLog writelog = new WriteLog(Log.logBox.AppendText);

                    Invoke(writelog, clog);
                }
                else Log.logBox.AppendText(clog);

                logFileWrite(clog);
            }
            catch (Exception e)
            {
                
            }
        }
Ejemplo n.º 35
0
 /// <summary>
 /// redirecte the log to console window
 /// </summary>
 public static void LogToConsole()
 {
     WriteLogFunc = WriteLogConsole;
 }
Ejemplo n.º 36
0
        /// <summary>
        /// 自动阅知
        /// </summary>
        /// <param name="resPath"></param>
        /// <param name="contents"></param>
        public void Backup()
        {
            try
            {
                string s = "";
                string t = "";
                if (DateTime.Now.Month.ToString().Length == 1)
                {
                    s = "0";//补0
                }
                if (DateTime.Now.Day.ToString().Length == 1)
                {
                    t = "0";//补0
                }
                string date = DateTime.Now.Year.ToString().Substring(2) + s + DateTime.Now.Month.ToString() + t + DateTime.Now.Day.ToString();

                string dirPath = HttpRuntime.AppDomainAppPath + "Log\\AutoBackup\\";
                string fileName = "Log" + date + ".txt";
                if (!File.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath);
                }

                B_OldToNew backup = new B_OldToNew();
                int i=backup.DataTranslate();
                if (i > 0)
                {
                    string contents = "执行自动迁移旧数据 " + DateTime.Now.ToString() + "\r\n";
                    File.AppendAllText(dirPath + fileName, contents, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                WriteLog writelog = new WriteLog();
                writelog.WriteErrLog("AutoBackup",DateTime.Now.ToString()+ex.ToString());
                throw ex;
            }
        }
Ejemplo n.º 37
0
        public void logWrite(string clog)
        {
            try
            {
                clog += "( " + DateTime.Now.ToString() + ")" + "\r\n";

                if (Log.logBox.InvokeRequired)
                {
                    WriteLog writelog = new WriteLog(Log.logBox.AppendText);

                    Invoke(writelog, clog);
                }
                else Log.logBox.AppendText(clog);

                logFileWrite(clog);
            }
            catch (Exception e)
            {

            }
        }