public ActionResult Create(PageBannerViewModel pageBannerModel, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(pageBannerModel));
                }

                var pageBanner = Mapper.Map <PageBannerViewModel, PageBanner>(pageBannerModel);
                _pageBannerService.Create(pageBanner);
                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.PageBanner)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                LogText.Log(string.Concat("PageBanner.Create: ", exception.Message));
                ModelState.AddModelError("", exception.Message);
                return(View(pageBannerModel));
            }
            return(action);
        }
Beispiel #2
0
 /// <summary>
 /// Set if log is on
 /// </summary>
 /// <param name="isOn"></param>
 public static void SetOn()
 {
     Debug.LogFormat("HiLog's file is here[{0}]", HiLogTextFolder);
     _logScreen = new GameObject("HiLog").AddComponent <LogScreen>();
     _logText   = new LogText();
     Application.logMessageReceivedThreaded += LogCallback;
 }
Beispiel #3
0
 private void displayLog(string str)
 {
     Dispatcher.Invoke(() => {
         LogText.Text += str + '\n';
         LogText.ScrollToEnd();
     });
 }
Beispiel #4
0
 public ActionResult Delete(string[] ids)
 {
     try
     {
         if (ids.Length != 0)
         {
             var repairs         = new List <Repair>();
             var repairGalleries = new List <RepairGallery>();
             var strArrays       = ids;
             for (var i = 0; i < strArrays.Length; i++)
             {
                 var num    = int.Parse(strArrays[i]);
                 var repair = _repairService.Get(x => x.Id == num);
                 repairGalleries.AddRange(repair.RepairGalleries.ToList());
                 repairs.Add(repair);
             }
             _galleryService.BatchDelete(repairGalleries);
             _repairService.BatchDelete(repairs);
         }
     }
     catch (Exception exception1)
     {
         var exception = exception1;
         LogText.Log(string.Concat("Repair.Delete: ", exception.Message));
     }
     return(RedirectToAction("Index"));
 }
Beispiel #5
0
 public bool StartTrain(TTrain tain)
 {
     rmode  = Runmode.Train;
     Ctrain = new Train(tain);
     LogText.Info("StartTrain", "开始训练");
     return(true);
 }
Beispiel #6
0
 /// <summary>
 /// 匹配人员坐标
 /// </summary>
 /// <param name="SubjectString"></param>
 private void MatchPerson(string SubjectString)
 {
     try
     {
         string strPosition = Regex.Match(SubjectString, "\\|[0-9]*\\|-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*").Value;
         if (!string.IsNullOrEmpty(strPosition))
         {
             FramePosition position = FramePosition.Parse(strPosition.Substring(1, strPosition.LastIndexOf("|") - 1), strPosition.Substring(strPosition.LastIndexOf("|") + 1));
             if (position != null)
             {
                 if (Rmode == Runmode.Match)
                 {
                     Cmatch?.AddPosition(position);
                 }
                 else if (rmode == Runmode.Train)
                 {
                     Ctrain?.AddPosition(position);
                 }
             }
         }
     }
     catch (ArgumentException ex)
     {
         LogText.Error("MatchPerson", ex.Message);
     }
 }
Beispiel #7
0
 private void MakeDrink()
 {
     _selectedDrink.LogDrinkMaking(LogText);
     LogText.Add($"Finished making {_selectedDrink.Name}");
     LogText.Add("------------------");
     _selectedDrink = null;
 }
Beispiel #8
0
    // =======================
    // private メソッド
    // =======================

    // =======================
    // public メソッド
    // =======================

    /**
     * {@inheritDoc}<br>
     * 攻撃側プレイヤー(atacker)のMPが魔法の消費MPに足りている場合は
     * @param attacker {@inheritDoc}
     * @param defender {@inheritDoc}
     */
    public override void Attack(Player activePlayer, List <Player> passiveMembers)
    {
        Debug.Log("Wizard Attack");

        //攻撃対象の決定
        Player passivePlayer = passiveMembers[0];

        if (passiveMembers.Count > 1)
        {
            passivePlayer = passiveMembers[UnityEngine.Random.Range(0, passiveMembers.Count - 1)];
        }

        //使用する魔法を決定する
        Magic UseMagic = this.attackMagic[UnityEngine.Random.Range(0, attackMagic.Length)];

        Debug.Log(string.Format("Wizard Attack {0}", UseMagic.GetName()));
        if (UseMagic.GetUseMP() <= this.mp)
        {
            Debug.Log("Wizard Attack 魔法使えるとき");
            UseMagic.effect(activePlayer, passivePlayer);
            return;
        }
        // 与えるダメージを求める
        LogText.AddLog(string.Format("{0} の 攻撃!", activePlayer.GetName()));
        int damage = activePlayer.CalcDamage(passivePlayer);

        // 求めたダメージを対象プレイヤーに与える
        LogText.AddLog(string.Format("{0} に {1} のダメージ!", passivePlayer.GetName(), damage));
        passivePlayer.Damage(damage);

        passivePlayer.Down();
    }
Beispiel #9
0
        public ActionResult Edit(BrandViewModel model, string returnUrl)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(model));
                }

                var modelMap = Mapper.Map <BrandViewModel, Brand>(model);
                _brandService.Update(modelMap);

                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Brand)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    return(RedirectToAction("Index"));
                }

                return(Redirect(returnUrl));
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("Brand.Create: ", ex.Message));

                return(View(model));
            }
        }
Beispiel #10
0
        public void ReadPort()
        {
            while (true)
            {
                try
                {
                    if (CurrentPort.IsOpen)
                    {
                        int count = CurrentPort.BytesToRead;

                        if (count > 0)
                        {
                            byte[] ByteArray = new byte[count];
                            CurrentPort.Read(ByteArray, 0, count);

                            string text = Encoding.UTF8.GetString(ByteArray);
                            if (LogText.Length > 100)
                            {
                                LogText = LogText.Substring(80, 20);
                            }
                            LogText += text;
                        }
                    }
                }
                catch { }
            }
        }
Beispiel #11
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var menuLinks =
                        from id in ids
                        select _menuLinkService.GetMenu(int.Parse(id));

                    _menuLinkService.BatchDelete(menuLinks);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("MenuLink.Delete: ", ex.Message));
                ModelState.AddModelError("", ex.Message);
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(AttributeValueViewModel attributeValue, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(attributeValue));
                }

                var attributeValue1 = Mapper.Map <AttributeValueViewModel, AttributeValue>(attributeValue);
                _attributeValueService.Create(attributeValue1);
                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.AttributeValue)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                LogText.Log(string.Concat("District.Create: ", exception.Message));
                return(View(attributeValue));
            }
            return(action);
        }
Beispiel #13
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            ftpserver = new FtpServer();
            Configuration.instance = ftpserver;
            logmethod = new LogText(onLog);
            ftpserver.OnConsoleWriteLine += Ftpserver_OnConsoleWriteLine;
            onLog("Load Configurations:\r\n" + Configuration.InterpreteConfigurations(Configuration.GetConfigurations()));
            System.Net.Sockets.SocketError code;
            if (!ftpserver.Start(out code))
            {
                switch (code)
                {
                case System.Net.Sockets.SocketError.AddressAlreadyInUse:
                    MessageBox.Show("当前的FTP端口已被占用,请检查是否有已开启的FTP服务器,或者更换端口号后重启服务器。", "开启服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                default:
                    MessageBox.Show("无法开启服务器,请检查日志", "开启服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }
            }
            btnNewUser.Enabled = true;
            loadUserList();
            if (WriteLogToFile)
            {
                String logpath = Path.GetFullPath(string.Format("ftptrace-{0:yyyy\\-MM\\-dd\\-HH\\-mm\\-ss\\-fff}.log", DateTime.Now));
                logFileStream = new FileStream(logpath, FileMode.Append, FileAccess.Write);
                foreach (String before in logs)
                {
                    writeLogLine(before);
                }
            }
        }
Beispiel #14
0
        private void LogText_TextChanged(object sender, EventArgs e)
        {
            int i = LogText.SelectionStart;

            Page[currentPage] = LogText.Text;
            LogText.SelectAll();
            LogText.SelectionFont = new Font(LogText.Font.FontFamily, LogText.Font.Size, LogText.Font.Style);
            LogText.DeselectAll();
            LogText.SelectionStart = i;
            writtenLetters++;
            if (writtenLetters == 25 && autoSave)
            {
                writtenLetters = 0;
                string backcolor = LogText.BackColor.R + "@" + LogText.BackColor.G + "@" + LogText.BackColor.B;
                string forecolor = LogText.ForeColor.R + "@" + LogText.ForeColor.G + "@" + LogText.ForeColor.B;
                int[]  style     = new int[3];
                if (LogText.Font.Bold)
                {
                    style[0] = 1;
                }
                if (LogText.Font.Italic)
                {
                    style[1] = 1;
                }
                if (LogText.Font.Underline)
                {
                    style[2] = 1;
                }
                LogOperations.saveTheLog(parentForm.activeUser, header.Text, Page, backcolor, forecolor, LogText.Font.FontFamily.Name, Convert.ToInt32(LogText.Font.Size), style, alig);
            }
        }
Beispiel #15
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    foreach (var id in ids)
                    {
                        var userId  = Guid.Parse(id);
                        var objUser = (from user in ids select UserManager.FindById(userId)).FirstOrDefault();

                        //Task<IList<UserLoginInfo>> loginInfo = _userLoginStore.GetLoginsAsync(objUser);
                        //_userLoginStore.RemoveLoginAsync(objUser, loginInfo);

                        var lstUserRole = UserManager.GetRoles(userId);
                        UserManager.RemoveFromRoles(userId, lstUserRole.ToArray());
                        UserManager.Update(objUser);
                        UserManager.Delete(objUser);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("Post.Delete: ", ex.Message));
            }
            return(RedirectToAction("Index"));
        }
Beispiel #16
0
        public void MustCorrectlyForwardCalls()
        {
            var exception       = new Exception();
            var loggerMock      = new Mock <ILogger>();
            var logObserverMock = new Mock <ILogObserver>();
            var logText         = new LogText("Log text");
            var sut             = new ModuleLogger(loggerMock.Object, nameof(ModuleLoggerTests));

            loggerMock.SetupGet(l => l.LogLevel).Returns(LogLevel.Error);

            sut.LogLevel = LogLevel.Debug;
            sut.Debug("Debug");
            sut.Info("Info");
            sut.Warn("Warning");
            sut.Error("Error");
            sut.Error("Error", exception);
            sut.Log("Raw text");
            sut.Subscribe(logObserverMock.Object);
            sut.Unsubscribe(logObserverMock.Object);
            sut.GetLog();

            loggerMock.VerifySet(l => l.LogLevel = LogLevel.Debug, Times.Once);
            loggerMock.Verify(l => l.Debug($"[{nameof(ModuleLoggerTests)}] Debug"), Times.Once);
            loggerMock.Verify(l => l.Info($"[{nameof(ModuleLoggerTests)}] Info"), Times.Once);
            loggerMock.Verify(l => l.Warn($"[{nameof(ModuleLoggerTests)}] Warning"), Times.Once);
            loggerMock.Verify(l => l.Error($"[{nameof(ModuleLoggerTests)}] Error"), Times.Once);
            loggerMock.Verify(l => l.Error($"[{nameof(ModuleLoggerTests)}] Error", exception), Times.Once);
            loggerMock.Verify(l => l.Log("Raw text"), Times.Once);
            loggerMock.Verify(l => l.Subscribe(logObserverMock.Object), Times.Once);
            loggerMock.Verify(l => l.Unsubscribe(logObserverMock.Object), Times.Once);
            loggerMock.Verify(l => l.GetLog(), Times.Once);

            Assert.AreEqual(LogLevel.Error, sut.LogLevel);
        }
Beispiel #17
0
        public NotifySrvInfoItem(NotifySrvInfo info, bool delCrlf = true)
        {
            Time     = info.time.ToString("yyyy\\/MM\\/dd HH\\:mm\\:ss.fff");
            TimeView = info.time.ToString("yyyy\\/MM\\/dd(ddd) HH\\:mm\\:ss.fff");
            var notifyID = (UpdateNotifyItem)info.notifyID;

            Title = notifyID == UpdateNotifyItem.PreRecStart ? "予約録画開始準備" :
                    notifyID == UpdateNotifyItem.RecStart ? "録画開始" :
                    notifyID == UpdateNotifyItem.RecEnd ? "録画終了" :
                    notifyID == UpdateNotifyItem.RecTuijyu ? "追従発生" :
                    notifyID == UpdateNotifyItem.ChgTuijyu ? "番組変更" :
                    notifyID == UpdateNotifyItem.PreEpgCapStart ? "EPG取得" :
                    notifyID == UpdateNotifyItem.EpgCapStart ? "EPG取得" :
                    notifyID == UpdateNotifyItem.EpgCapEnd ? "EPG取得" : info.notifyID.ToString();
            LogText = notifyID == UpdateNotifyItem.EpgCapStart ? "開始" :
                      notifyID == UpdateNotifyItem.EpgCapEnd ? "終了" : info.param4;
            if (delCrlf == true)
            {
                LogText = LogText.Replace("\r\n↓\r\n", "  →  ");
            }
            if (delCrlf == true)
            {
                LogText = LogText.Replace("\r\n", "  ");
            }
            keyID = (ulong)this.ToString().GetHashCode();
        }
Beispiel #18
0
    public void OnClick()
    {
        if (gm.isPaused)
        {
            return;
        }

        bool exception = false;

        if (QuantityControlOn)
        {
            exception = QuantityControlEnd();
        }
        if (exception == true)
        {
            return;
        }

        if (gm.Money() < DaramCost * DaramAmount)
        {
            LogText.WriteLog("돈이 부족합니다.");
            return;
        }
        GameManager.gm.ChangeMoneyInRound(-DaramCost * DaramAmount);
        Create(DaramAmount);
    }
 public ActionResult Approved(string[] ids, int value)
 {
     try
     {
         if (ids.Length != 0)
         {
             var strArrays = ids;
             for (var i = 0; i < strArrays.Length; i++)
             {
                 var num         = int.Parse(strArrays[i]);
                 var landingPage = _landingPageService.Get(x => x.Id == num);
                 landingPage.Status = 3;
                 _landingPageService.Update(landingPage);
             }
             Response.Cookies.Add(new HttpCookie("system_message", MessageUI.UpdateSuccess));
         }
     }
     catch (Exception exception1)
     {
         var exception = exception1;
         Response.Cookies.Add(new HttpCookie("system_message", "Cập nhật không thành công."));
         LogText.Log(string.Concat("ContactInfor.Delete: ", exception.Message));
     }
     return(RedirectToAction("Index"));
 }
Beispiel #20
0
 private void GuestLeaves(Puben pub, PubSettings userPubSettings)
 {
     pub.dirtyGlasses.itemCollection.Add(pub.dirtyGlass);
     LogText?.Invoke($"{Name} leaves the bar", this);
     pub.chairs.itemBag.Add(pub.chair);
     pub.guestsInPub--;
 }
Beispiel #21
0
        public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.IsAny())
                {
                    var idTest = from id in ids select id;
                    var aa     = idTest.FirstOrDefault();

                    var genericControls =
                        from id in ids
                        select _gCService.GetById(int.Parse(id));

                    _gCService.BatchDelete(genericControls);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var localizedProperties
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));

                        _localizedPropertyService.BatchDelete(localizedProperties);
                    }
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("GenericControl --> Delete: ", ex.Message));
                ModelState.AddModelError("", ex.Message);
            }

            return(RedirectToAction("Index"));
        }
Beispiel #22
0
        private void PayDrink(bool payWithCard, double insertedMoney = 0)
        {
            if (_selectedDrink != null && payWithCard)
            {
                insertedMoney = _cashOnCards[SelectedPaymentCardUsername];
                if (RemainingPriceToPay <= insertedMoney)
                {
                    _cashOnCards[SelectedPaymentCardUsername] = insertedMoney - RemainingPriceToPay;
                    RemainingPriceToPay = 0;
                }
                else // Pay what you can, fill up with coins later.
                {
                    _cashOnCards[SelectedPaymentCardUsername] = 0;

                    RemainingPriceToPay -= insertedMoney;
                }
                LogText.Add($"Inserted {insertedMoney.ToString("C", CultureInfo.CurrentCulture)}, Remaining: {RemainingPriceToPay.ToString("C", CultureInfo.CurrentCulture)}.");
                RaisePropertyChanged(() => PaymentCardRemainingAmount);
            }
            else if (_selectedDrink != null && !payWithCard)
            {
                RemainingPriceToPay = Math.Max(Math.Round(RemainingPriceToPay - insertedMoney, 2), 0);
                LogText.Add($"Inserted {insertedMoney.ToString("C", CultureInfo.CurrentCulture)}, Remaining: {RemainingPriceToPay.ToString("C", CultureInfo.CurrentCulture)}.");
            }

            if (_selectedDrink != null && RemainingPriceToPay == 0)
            {
                _selectedDrink.LogDrinkMaking(LogText);
                LogText.Add("------------------");
                _selectedDrink = null;
            }
        }
        public ActionResult Create(GenericControlValueViewModel model, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(model));
                }

                var modelMap = Mapper.Map <GenericControlValueViewModel, GenericControlValue>(model);
                _genericControlValueService.Create(modelMap);

                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.CreateSuccess, FormUI.Name)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("GenericControlValue.Create: ", ex.Message));

                return(View(model));
            }

            return(action);
        }
 private void ClearLog_Click(object sender, RoutedEventArgs e)
 {
     LogText.Dispatcher.Invoke(new Action(() =>
     {
         LogText.Clear();
     }));
 }
Beispiel #25
0
        /// <summary>
        /// Inserts a log into a text file
        /// </summary>
        /// <param name="logText"></param>
        public static void LogMessage(ref LogText logText)
        {
            if (logText == null) return;

            //get root of log folder
            var folder = ConfigurationManager.AppSettings["folder"].ToString();

            //if this folder don't exists, it create.
            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);

            //get file
            var date = DateTime.Now.ToString("ddMMyyyy");
            var file = string.Format(ConfigurationManager.AppSettings["file"].ToString(), date);
            var rootLog = Path.Combine(folder, file);

            //create the file if that don't exists.
            if (!File.Exists(rootLog))
            {
                var fileCreate = File.Create(rootLog);
                fileCreate.Close();
            }

            //write log
            using (StreamWriter writer = File.AppendText(rootLog))
            {
                writer.WriteLine(DateTime.Now.ToShortTimeString());
                writer.WriteLine(logText.MessageTypeText + ": " + logText.Message);
                writer.WriteLine("-----------------------------------------------");
            }
        }
Beispiel #26
0
    void ConnectServer()
    {
        if (onConnect)
        {
            return;
        }

        HostData[] datas = MasterServer.PollHostList();
        LogText.AddLog("datas " + datas);
        if (datas.Length > 0)
        {
            LogText.AddLog("datas.Length " + datas.Length);

            HostData data = datas [0];
            LogText.AddLog("ip:(" + data.ip + ") port(" + data.port + ")");

            if (data != null)
            {
                Network.Connect(data);
                onConnect = true;

                LogText.AddLog("Connect to server!");
            }
        }
    }
Beispiel #27
0
 private void logMessage(string pMsg)
 {
     if (!LogText.IsDisposed)
     {
         LogText.AppendText($"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}  {pMsg}\r\n");
     }
 }
Beispiel #28
0
    void Update()
    {
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            LogText.AddLog("斷線中");
            ConnectServer();
        }
        if (Network.peerType == NetworkPeerType.Client)
        {
            LogText.AddLog("與SERVER保持連線中1");
        }
        if (Network.peerType == NetworkPeerType.Connecting)
        {
            LogText.AddLog("與SERVER保持連線中2");
        }

        LogText.AddLog("touchCount:(" + Input.touchCount + ")");

        if (Input.touchCount == 1)
        {
            onConnect = false;
            ConnectServer();
        }

        if (Input.touchCount == 2)
        {
            MasterServer.ClearHostList();
            MasterServer.RequestHostList("CardBoard");
        }
    }
Beispiel #29
0
        public JsonResult Update(string param)
        {
            try
            {
                //var data = JsonConvert.DeserializeObject<GenericControlValueResponseCollection>(param);

                //foreach (GenericControlValueItem item in data.GenericControlValueItem)
                //{
                //    //Get data
                //    GenericControlValueItem model = _genericControlValueItemService.Get((GenericControlValueItem x) => x.Id == item.Id && x.EntityId == item.EntityId);

                //    if (model != null)
                //    {
                //       // model = new GenericControlValueItem();
                //        model.ColorHex = item.ColorHex;
                //        model.EntityId = entityId;

                //        _genericControlValueItemService.Create(model);
                //    }
                //}
            }
            catch (Exception exception)
            {
                LogText.Log(string.Concat("District.Edit: ", exception.Message));
            }
            var jsonResult = Json(new { success = true }, JsonRequestBehavior.AllowGet);

            return(jsonResult);
        }
Beispiel #30
0
        public ActionResult Edit(ProvinceViewModel provinceView, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(provinceView));
                }

                var province = Mapper.Map <ProvinceViewModel, Province>(provinceView);
                _provinceService.Update(province);
                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.Provinces)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                LogText.Log(string.Concat("MailSetting.Create: ", exception.Message));
                return(View(provinceView));
            }
            return(action);
        }
Beispiel #31
0
        void SetupObservables()
        {
            MessageListViewModel.GetPropertyValues(m => m.SelectedMessage)
            .Throttle(TimeSpan.FromMilliseconds(200), TaskPoolScheduler.Default)
            .ObserveOnDispatcher()
            .Subscribe(
                m =>
                MessageDetailViewModel.LoadMessageEntry(MessageListViewModel.SelectedMessage));

            Observable.FromEventPattern <EventHandler, EventArgs>(h => new EventHandler(h),
                                                                  h => _logClientSinkQueue.LogEvent += h,
                                                                  h => _logClientSinkQueue.LogEvent -= h).ObserveOnDispatcher().Subscribe(o =>
            {
                foreach (var e in _logClientSinkQueue.GetLastEvents().ToList())
                {
                    LogText = LogText.Replace("<body>",
                                              "<body>" + string.Join(" ", RenderLogEventParts(e)));
                }
            });

            this.GetPropertyValues(m => m.IsLogOpen)
            .ObserveOnDispatcher()
            .Subscribe(m =>
            {
                MessageListViewModel.IsLoading   = m;
                MessageDetailViewModel.IsLoading = m;
            });
        }
Beispiel #32
0
        /// <summary>
        /// SeleccionarOpcionLog
        /// </summary>
        private static void SeleccionarOpcionLog()
        {
            Console.WriteLine("SELECCIONE UNA OPCIÓN");
            Console.WriteLine("----------------------");
            Console.WriteLine(" ");
            Console.WriteLine("1: Grabará el LOG en la Base de Datos");
            Console.WriteLine("2: Grabará el LOG en la un archivo de texto");
            Console.WriteLine("3: Mostrará el LOG en la pantalla");
            Console.WriteLine(" ");
            Console.WriteLine("Ingrese un Número: ");

            var ingreso = Console.ReadLine();
            if (ingreso == "1")
            {
                var logSql = new LogSQL { Message = "this is a error message ", MessageTypeText = EnumMessage.MessageType.Error.ToString() };
                JobLogger.LogMessage(ref logSql);
                Console.WriteLine(" ");
                Console.WriteLine("Se ingresó el Log en la BD.");
            }
            else if (ingreso == "2")
            {
                var logText = new LogText { Message = "this is a warning message ", MessageTypeText = EnumMessage.MessageType.Warning.ToString() };
                JobLogger.LogMessage(ref logText);
                Console.WriteLine(" ");
                Console.WriteLine("Se ingresó el Log en el archivo de texto.");
            }
            else if (ingreso == "3")
            {
                var logConsole = new LogConsole { Message = "this is a message ", MessageType = ((int)EnumMessage.MessageType.Error) };
                JobLogger.LogMessage(ref logConsole);
                Console.WriteLine(" ");
            }
            else
            {
                Console.WriteLine("No selecciono un valor de la lista.");
            }

            Console.ReadLine();
        }
Beispiel #33
-1
    private void Start()
    {
        logText = GameObject.Find ("LogText").GetComponent<LogText> ();

        if (isLocalPlayer) {
            System.Func<string, string> witName =
                (str) => "[" + userName + "] " + str + "@" + System.DateTime.Now;
            GameObject.Find ("HelloButton").GetComponent<Button> ()
                .onClick.AddListener (() => TransmitNewLine (witName ("Hello")));
            GameObject.Find ("GoodbyeButton").GetComponent<Button> ()
                .onClick.AddListener (() => TransmitNewLine (witName ("Goodbye")));

            TransmitUserName ();
        }
    }