public override string Invoke(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new Exception("Input parameter 'args' is null.");
                }

                if (args.Length != 1)
                {
                    throw new Exception("Input parameter 'args' length does not equal 1.");
                }

                string fileId = args[0];

                FileInfo fileInfo = Invoke(fileId);

                if (fileInfo == null)
                {
                    return("");
                }

                return(fileInfo.ToString());
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
        public FormUserUpdate(StatusForm statusForm, DataRow dataRow)
        {
            InitializeComponent();

            if (statusForm == StatusForm.Add)
            {
                labelTitle.Text = "Добавление записи";
            }
            else   // if (statusForm == StatusForm.Edit) || (statusForm == StatusForm.Delete)
            {
                textBoxLogin.Text         = dataRow["Login"].ToString();
                textBoxPassword.Text      = dataRow["Password"].ToString();
                textBoxAddress.Text       = dataRow["Address"].ToString();
                textBoxPhoneNumber.Text   = dataRow["PhoneNumber"].ToString();
                checkBoxSignAdmin.Checked = (bool)dataRow["SignAdmin"];

                if (statusForm == StatusForm.Edit)
                {
                    labelTitle.Text = "Корректировка записи";
                }
                else  // (statusForm == StatusForm.Edit)
                {
                    textBoxLogin.Enabled       = false;
                    textBoxAddress.Enabled     = false;
                    textBoxPhoneNumber.Enabled = false;
                    checkBoxSignAdmin.Enabled  = false;
                    labelTitle.Text            = "Удалить запись? (Ok - да, Отмена - нет)";
                }
            }
            statusFormWork = statusForm;
            dataRowWork    = dataRow;
        }
예제 #3
0
        private void setStatus(StatusForm thisFormStatus)
        {
            switch (thisFormStatus)
            {
            case StatusForm.Busy:
                gbFilePath.Enabled = false;
                gbHashType.Enabled = false;
                gbOutput.Enabled   = false;
                gbCompare.Enabled  = false;
                pbProgress.Style   = ProgressBarStyle.Marquee;
                lblStatus.Text     = "Busy..";

                break;

            case StatusForm.Ready:
                gbFilePath.Enabled = true;
                gbHashType.Enabled = true;
                gbOutput.Enabled   = true;
                gbCompare.Enabled  = true;
                pbProgress.Style   = ProgressBarStyle.Continuous;
                lblStatus.Text     = "Ready";
                break;

            default:
                break;
            }
        }
예제 #4
0
 /// <summary>
 /// Вызов панели статуса стояка
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnStatus_Click(object sender, EventArgs e)
 {
     Fetch();
     if (statusForm == null)
     {
         statusForm = new StatusForm();
     }
     statusForm.Show();
     statusForm.BringToFront();
 }
예제 #5
0
        /// <summary>
        /// 點選訊息狀態
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void messageStatus_Click(object sender, EventArgs e)
        {
            var msgForm = new StatusForm(_messgeStore)
            {
                Text = "系統訊息 (System Messages)"
            };

            msgForm.ShowDialog();
            SetStatus(SystemStatusType.SystemMsg, _messgeStore.Count.ToString());
        }
예제 #6
0
 public async Task <ActionResult <object> > Update([FromBody] StatusForm form)
 {
     try
     {
         return(await _statusService.Update(form));
     }
     catch (Exception ex)
     {
         return(new ApiResponse(ex.Message));
     }
 }
예제 #7
0
        public MessageForm(SubmitBugForm submitBugForm)
        {
            _submitBugForm = submitBugForm;
            _submitBugForm.BugBeforePost    += BugBeforePost;
            _submitBugForm.BugPosted        += BugPosted;
            _submitBugForm.BugPostingAction += BugPostingAction;

            form = new StatusForm();
            form.BtnClose.Visible = false;
            form.Hiding          += Form_Hiding;
        }
예제 #8
0
        private void SetStatusForm()
        {
            if (_matricula == 0)
            {
                _statusForm  = StatusForm.stfNew;
                _funcionario = new Funcionario();
            }
            else
            {
                _statusForm  = StatusForm.stfEdit;
                _funcionario = _dalFuncionario.BuscarPorMatricula(_matricula);
            }

            btnExcluir.Enabled = (_statusForm != StatusForm.stfNew);
            SetStatusObject();
        }
        public override string Invoke(string[] args)
        {
            try
            {
                Invoke();

                return("");
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
예제 #10
0
        private void simpleButtonServices_Click(object sender, EventArgs e)
        {
            var sp = DevExpressHelper.GetSelectedRecord <SalePoint>(gridViewSalePoints);

            if (sp != null)
            {
                try
                {
                    var clientService = Protocol.CreateClientProxy(sp.IP);
                    StatusForm.Show(this, sp, clientService.GetServicesStatus());
                }
                catch (Exception ex)
                {
                    ErrorHelper.ShowError <ErrorForm>(null, ex);
                }
            }
        }
예제 #11
0
        public async Task <ActionResult <object> > Create([FromBody] StatusForm form)
        {
            try
            {
                var model = new Status
                {
                    Name = form.Name,
                    Code = form.Code
                };
                _context.Status.Add(model);
                await _context.SaveChangesAsync();

                return(new ApiResponse());
            }
            catch (Exception ex)
            {
                return(new ApiResponse(ex.Message));
            }
        }
예제 #12
0
        public FileInfo Invoke(string parentId, string title, bool isFolder)
        {
            try
            {
                if (isFolder)
                {
                    return(Invoke(parentId, title, DriveService.MimeType.Folder));
                }
                return(Invoke(parentId, title, null));
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
예제 #13
0
        public IHttpActionResult PutOrder(int id, StatusForm statusForm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!OrderExists(id))
            {
                return(NotFound());
            }

            // Get the order from db
            Order order = db.Orders.Find(id);

            if (statusForm.status == "Cancelled" || statusForm.status == "Delivered")
            {
                // Set delivery exec of the order as active
                order.DeliveryExecutive.IsActive = true;
            }
            var orderItems = order.OrderDetails.ToList();

            foreach (var item in orderItems)
            {
                var pizzaStockItem = (from p in db.PizzaStocks.ToList()
                                      where p.pizzaId == item.Pizza.id
                                      select p).First();

                pizzaStockItem.quantity += item.quantity;

                db.MarkAsModified(pizzaStockItem);
            }

            order.status = statusForm.status;

            // db.MarkAsModified(order);

            db.SaveChanges();


            return(Ok(order));
        }
예제 #14
0
        public StatusWriter(StatusForm statusForm)
        {
            var scoreHealthRegex = new Regex(@"^You have (\d*)\((\d*)\) hit(, (\d*)\((\d*)\) (saidin|saidar|dark power))? and (-?\d*)\((\d*)\) movement points.$", RegexOptions.Compiled);

            var enemyColors = new Regex(@"\*\\x1B\[3(6|5|1)m([^ ]*)\\x1B\[0m\*", RegexOptions.Compiled);

            Store.ParsedOutput.Subscribe((outputs) => {
                foreach (var output in outputs)
                {
                    if (output.Type == ParsedOutputType.Raw)
                    {
                        foreach (var line in output.Lines)
                        {
                            if (scoreHealthRegex.IsMatch(line))
                            {
                                statusForm.WriteToOutput(line + "\n", MudColors.ForegroundColor);
                            }
                            if (enemyColors.IsMatch(line))
                            {
                                // todo: this is inefficient
                                statusForm.WriteToOutput(FormatDecodedText.Format(ControlCharacterEncoder.Decode(line + "\n")));
                            }
                        }
                    }
                    else if (output.Type == ParsedOutputType.Status)
                    {
                        statusForm.WriteToOutput(output.Lines[0] + "\n", MudColors.ForegroundColor);
                    }
                    else if (output.Type == ParsedOutputType.Room)
                    {
                        foreach (var line in output.Creatures)
                        {
                            if (enemyColors.IsMatch(line))
                            {
                                // todo: this is inefficient
                                statusForm.WriteToOutput(FormatDecodedText.Format(ControlCharacterEncoder.Decode(line + "\n")));
                            }
                        }
                    }
                }
            });
        }
예제 #15
0
 public void SetMessageError(ref ToolStripStatusLabel tssRef, bool visible, string message, StatusForm? sttFrm)
 {
     switch (sttFrm)
     {
         case StatusForm.Success :
             tssRef.BackColor = Color.Lime;
             tssRef.ForeColor = Color.Black;
             break;
         case StatusForm.Info:
             tssRef.BackColor = Color.LightYellow;
             tssRef.ForeColor = Color.Black;
             break;
         case StatusForm.Error:
             tssRef.BackColor = Color.Firebrick;
             tssRef.ForeColor = Color.White;
             break;
     }
     tssRef.Text = message;
     tssRef.Visible = visible;
 }
        public override string Invoke(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new Exception("Input parameter 'args' is null.");
                }

                if (args.Length != 2 && args.Length != 3)
                {
                    throw new Exception("Input parameter 'args' length does not equal 2 or 3.");
                }

                string fileId   = args[0];
                string title    = args[1];
                string mimeType = null;

                if (args.Length > 2)
                {
                    mimeType = args[2];
                }

                FileInfo fileInfo = Invoke(fileId, title, mimeType);

                if (fileInfo == null)
                {
                    return("");
                }

                return(fileInfo.ToString());
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
예제 #17
0
        public async Task <ActionResult <object> > Update([FromBody] StatusForm form)
        {
            try
            {
                var status = await _context.Status.FirstOrDefaultAsync(x => x.Code == form.Code);

                if (status == null)
                {
                    return(new ApiResponse("Không tìm thấy status này!!"));
                }
                status.Name = form.Name;
                _context.Status.Update(status);
                await _context.SaveChangesAsync();

                return(new ApiResponse());
            }
            catch (Exception ex)
            {
                return(new ApiResponse(ex.Message));
            }
        }
예제 #18
0
        public void Analyze()
        {
            PrepareForExecute();

            string plan;
            var    errors = new ErrorList();

            try
            {
                using (var statusForm = new StatusForm(Strings.ProcessingQuery))
                {
                    DateTime startTime = DateTime.Now;
                    try
                    {
                        var paramsValue = new DataParams();
                        paramsValue.Add(DataParam.Create(Dataphoria.UtilityProcess, "AQuery", GetTextToExecute()));
                        plan = ((DAE.Runtime.Data.Scalar)Dataphoria.EvaluateQuery("ShowPlan(AQuery)", paramsValue)).AsString;
                    }
                    finally
                    {
                        TimeSpan elapsed = DateTime.Now - startTime;
                        _executionTimeStatus.Text = elapsed.ToString();
                    }
                }
            }
            catch (Exception exception)
            {
                errors.Add(exception);
                ProcessErrors(errors);
                SetStatus(Strings.ScriptAnalyzeFailed);
                return;
            }

            SetStatus(Strings.ScriptAnalyzeSuccessful);

            var analyzer = (Analyzer.Analyzer)Dataphoria.OpenDesigner(Dataphoria.GetDefaultDesigner("pla"), null);

            analyzer.LoadPlan(plan);
        }
예제 #19
0
        public override string Invoke(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new Exception("Input parameter 'args' is null.");
                }

                if (args.Length < 1)
                {
                    throw new Exception("Input parameter 'args' length is less than 1.");
                }

                string        parentId = args[0];
                List <string> ids      = GetFileIds(args, 1);

                List <string> movedIds = Invoke(parentId, ids);

                if (movedIds == null)
                {
                    return("");
                }

                string result = GetFileIdsAsXml(movedIds);

                return(result);
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
예제 #20
0
        public override string Invoke(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new Exception("Input parameter 'args' is null.");
                }

                if (args.Length < 2)
                {
                    throw new Exception("Input parameter 'args' length is less than 2.");
                }

                List <string> ids = GetFileIds(args, 0);

                List <string> untrashedIds = Invoke(ids);

                if (untrashedIds == null)
                {
                    return("");
                }

                string result = GetFileIdsAsXml(untrashedIds);

                return(result);
            }
            catch (Exception exception)
            {
                StatusForm.Exception(exception);

                Log.Error(exception);

                return(null);
            }
        }
예제 #21
0
    private void itmExtractAll_Click(System.Object sender, System.EventArgs e)
    {
        //Prompt for save filename
        FolderBrowserDialog dialog = new FolderBrowserDialog();
        if (dialog.ShowDialog() != DialogResult.OK) return;

        //Get Atari disk directory
        List<DirectoryEntry> files = fileSystem.DiskDirectory();

        //Create status display form
        StatusForm status = new StatusForm();
        status.Title = "Extracting files";
        status.Show();

        // Extract each file
        string err = "";
        bool hasError = false;
        foreach (DirectoryEntry sourceFile in files)
        {

            status.Message = String.Format("Extracting {0}...", sourceFile.FileName);
            status.Refresh();
            err = ExtractFile(sourceFile.FileName, string.Format("{0}\\{1}", dialog.SelectedPath, sourceFile.FileName));

            // Display extract errors
            if (err != "")
            {
                status.AddError(err);
                hasError = true;
            }
        }

        // If there are no errors close the status box
        if (!hasError) status.Close();
    }
 /// <summary>
 /// 點選訊息狀態
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void messageStatus_Click(object sender, EventArgs e)
 {
     var msgForm = new StatusForm(_messgeStore) { Text = "系統訊息 (System Messages)" };
     msgForm.ShowDialog();
     SetStatus(SystemStatusType.SystemMsg, _messgeStore.Count.ToString());
 }
예제 #23
0
 private void SetStatusForm(StatusForm pStatusForm)
 {
     _statusForm = pStatusForm;
 }
예제 #24
0
            public Google.Apis.Drive.v2.DriveService Init(string applicationName,
                                                          string clientIdentifier,
                                                          string clientSecret,
                                                          string[] scope,
                                                          bool logout,
                                                          string refreshTokenFolder)
            {
                StatusForm.ShowDialog();

                try
                {
                    _refreshTokenFilePath = refreshTokenFolder;

                    string fileDataStorePath = _refreshTokenFilePath;
                    if (FileExists(fileDataStorePath))
                    {
                        DateTime lastFileWriteTime = GetFileLastWriteTime(fileDataStorePath);

                        if (lastFileWriteTime < new DateTime(2014, 8, 22))
                        {
                            DeleteFile(fileDataStorePath);
                        }
                    }

                    if (logout)
                    {
                        try
                        {
                            if (DirectoryExists(fileDataStorePath))
                            {
                                string[] fileDataStoreFiles = System.IO.Directory.GetFiles(fileDataStorePath,
                                                                                           "Google.Apis.Auth.OAuth2.Responses.*");

                                foreach (string fileDataStoreFile in fileDataStoreFiles)
                                {
                                    DeleteFile(fileDataStoreFile);
                                }
                            }

                            LoginForm.Logout();
                        }
                        catch (Exception exception)
                        {
                            Log.Error(String.Format("Authenticator.Logout - Deleting token file. {0}", exception.Message));
                        }
                    }

                    var clientSecrets = new Google.Apis.Auth.OAuth2.ClientSecrets
                    {
                        ClientId     = clientIdentifier,
                        ClientSecret = clientSecret
                    };

                    _fileDataStore = new EncryptedFileDataStore(refreshTokenFolder);

                    System.Threading.Tasks.Task <Google.Apis.Auth.OAuth2.UserCredential> task = null;

                    try
                    {
                        task = Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.AuthorizeAsync(
                            clientSecrets,
                            scope,
                            System.Environment.UserName,
                            System.Threading.CancellationToken.None,
                            _fileDataStore);

                        task.Wait();
                    }
                    catch (Exception exception)
                    {
                        throw new LogException("GoogleWebAuthorizationBroker.AuthorizeAsync - " + exception.Message, false, false);
                    }

                    _userCredential = task.Result;

                    var initializer = new BaseClientService.Initializer
                    {
                        HttpClientInitializer = _userCredential,
                        ApplicationName       = applicationName
                    };

                    _driveService = new Google.Apis.Drive.v2.DriveService(initializer);

                    UpdateAboutData(_driveService);

                    return(_driveService);
                }
                catch (Exception exception)
                {
                    Log.Error(exception);

                    return(null);
                }
                finally
                {
                    StatusForm.CloseDialog();
                }
            }
예제 #25
0
 /// <summary>
 /// 显示进度窗口
 /// </summary>
 /// <param name="title">进度窗口的标题</param>
 /// <param name="desc">进度窗口的描述</param>
 /// <param name="max">最大进度值</param>
 /// <param name="value">当前进度值</param>
 public void ShowStatus(string title, string desc, int max = 100, int value = 0)
 {
     StatusForm.Style = Style;
     StatusForm.Show(title, desc, max, value);
 }
 public GuiMessageRecipient()
 {
     messageForm = new StatusForm();
     messageForm.Show();
 }
예제 #27
0
        public void Prepare()
        {
            _resultPanel.Clear();
            PrepareForExecute();

            var result = new StringBuilder();

            var errors = new ErrorList();

            try
            {
                using (var statusForm = new StatusForm(Strings.ProcessingQuery))
                {
                    bool attemptExecute = true;
                    try
                    {
                        DateTime startTime = DateTime.Now;
                        try
                        {
                            IServerScript  script;
                            IServerProcess process =
                                DataSession.ServerSession.StartProcess(
                                    new ProcessInfo(DataSession.ServerSession.SessionInfo));
                            try
                            {
                                script = process.PrepareScript(GetTextToExecute());
                                try
                                {
                                    if (ScriptExecutionUtility.ConvertParserErrors(script.Messages, errors))
                                    {
                                        foreach (IServerBatch batch in script.Batches)
                                        {
                                            if (batch.IsExpression())
                                            {
                                                IServerExpressionPlan plan = batch.PrepareExpression(null);
                                                try
                                                {
                                                    attemptExecute &=
                                                        ScriptExecutionUtility.ConvertCompilerErrors(plan.Messages,
                                                                                                     errors);
                                                    if (attemptExecute)
                                                    {
                                                        result.AppendFormat
                                                        (
                                                            Strings.PrepareSuccessful,
                                                            new object[]
                                                        {
                                                            plan.PlanStatistics.PrepareTime.ToString(),
                                                            plan.PlanStatistics.CompileTime.ToString(),
                                                            plan.PlanStatistics.OptimizeTime.ToString(),
                                                            plan.PlanStatistics.BindingTime.ToString()
                                                        }
                                                        );
                                                        result.Append("\r\n");
                                                    }
                                                }
                                                finally
                                                {
                                                    batch.UnprepareExpression(plan);
                                                }
                                            }
                                            else
                                            {
                                                IServerStatementPlan plan = batch.PrepareStatement(null);
                                                try
                                                {
                                                    attemptExecute &=
                                                        ScriptExecutionUtility.ConvertCompilerErrors(plan.Messages,
                                                                                                     errors);
                                                    if (attemptExecute)
                                                    {
                                                        result.AppendFormat
                                                        (
                                                            Strings.PrepareSuccessful,
                                                            new object[]
                                                        {
                                                            plan.PlanStatistics.PrepareTime.ToString(),
                                                            plan.PlanStatistics.CompileTime.ToString(),
                                                            plan.PlanStatistics.OptimizeTime.ToString(),
                                                            plan.PlanStatistics.BindingTime.ToString()
                                                        }
                                                        );
                                                        result.Append("\r\n");
                                                    }
                                                }
                                                finally
                                                {
                                                    batch.UnprepareStatement(plan);
                                                }
                                            }

                                            AppendResultPanel(result.ToString());
                                            result.Length = 0;
                                        }
                                    }
                                }
                                finally
                                {
                                    process.UnprepareScript(script);
                                }
                            }
                            finally
                            {
                                DataSession.ServerSession.StopProcess(process);
                            }
                        }
                        finally
                        {
                            TimeSpan elapsed = DateTime.Now - startTime;
                            _executionTimeStatus.Text = elapsed.ToString();
                        }

                        if (attemptExecute)
                        {
                            SetStatus(Strings.ScriptPrepareSuccessful);
                        }
                        else
                        {
                            SetStatus(Strings.ScriptPrepareFailed);
                        }
                    }
                    catch (Exception exception)
                    {
                        SetStatus(Strings.ScriptFailed);
                        errors.Add(exception);
                    }
                }
            }
            finally
            {
                ProcessErrors(errors);
            }
        }
예제 #28
0
        private void btnStatus_Click(object sender, EventArgs e)
        {
            StatusForm statusForm = new StatusForm();

            statusForm.Show();
        }
예제 #29
0
        private void Execute(ExportType exportType, string fileName)
        {
            // Make sure our server is connected...
            Dataphoria.EnsureServerConnection();

            using (var statusForm = new StatusForm(Strings.Exporting))
            {
                using (var connection = new DAEConnection())
                {
                    if (DesignerID == "SQL")
                    {
                        SwitchToSQL();
                    }
                    try
                    {
                        using (var adapter = new DAEDataAdapter(GetTextToExecute(), connection))
                        {
                            using (var dataSet = new DataSet())
                            {
                                var process =
                                    DataSession.ServerSession.StartProcess(new ProcessInfo(DataSession.ServerSession.SessionInfo));
                                try
                                {
                                    connection.Open(DataSession.Server, DataSession.ServerSession, process);
                                    try
                                    {
                                        switch (exportType)
                                        {
                                        case ExportType.Data:
                                            adapter.Fill(dataSet);
                                            dataSet.WriteXml(fileName, XmlWriteMode.IgnoreSchema);
                                            break;

                                        case ExportType.Schema:
                                            adapter.FillSchema(dataSet, SchemaType.Source);
                                            dataSet.WriteXmlSchema(fileName);
                                            break;

                                        default:
                                            adapter.Fill(dataSet);
                                            dataSet.WriteXml(fileName, XmlWriteMode.WriteSchema);
                                            break;
                                        }
                                    }
                                    finally
                                    {
                                        connection.Close();
                                    }
                                }
                                finally
                                {
                                    DataSession.ServerSession.StopProcess(process);
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (DesignerID == "SQL")
                        {
                            SwitchFromSQL();
                        }
                    }
                }
            }
        }
        public override string Invoke(string[] args)
        {
            try
            {
                if (args == null)
                {
                    throw new Exception("Input parameter 'args' is null.");
                }

                if (args.Length != 5)
                {
                    throw new Exception("Input parameter 'args' length does not equal 5.");
                }

                string fileId           = args[0];
                bool   ignoreTrash      = true;
                bool   updateCachedData = false;
                bool   getChildren      = true;
                bool   ignoreError      = true;

                if (args[1] == "0" || args[1].ToLower() == "false")
                {
                    ignoreTrash = false;
                }

                if (args[2] == "1" || args[2].ToLower() == "true")
                {
                    updateCachedData = true;
                }

                if (args[3] == "0" || args[3].ToLower() == "false")
                {
                    getChildren = false;
                }

                if (args[4] == "0" || args[4].ToLower() == "false")
                {
                    ignoreError = false;
                }

                FileInfo fileInfo = null;

                try
                {
                    fileInfo = Invoke(fileId, ignoreTrash, updateCachedData, getChildren);

                    if (fileInfo == null)
                    {
                        return("");
                    }
                }
                catch (Exception exception)
                {
                    if (!ignoreError)
                    {
                        StatusForm.Exception(exception);
                    }

                    throw exception;
                }

                return(fileInfo.ToString());
            }
            catch (Exception exception)
            {
                Log.Error(exception);
                return(null);
            }
        }