예제 #1
0
        private void BtnShowCompany_Click(object sender, EventArgs e)
        {
            string company = txtBoxCompany.Text;

            if (string.IsNullOrWhiteSpace(txtBoxCompany.Text))
            {
                try
                {
                    dGVERP.DataSource = WebController.SelectAllCompany().Select(o => new { o.Name, o.Description }).ToList();
                }
                catch (Exception x)
                {
                    StatusLbl.ShowMessage(x.Message);
                }
            }
            else
            {
                try
                {
                    dGVERP.DataSource = WebController.GetCompany(company).Select(o => new { o.Name, o.Description }).ToList();
                }
                catch (Exception x)
                {
                    StatusLbl.ShowMessage(x.Message);
                }
            }
        }
예제 #2
0
        private void BtnUpdateCompany_Click(object sender, EventArgs e)
        {
            string name = txtBoxCompany.Text;
            string desc = txtBoxCompanyDescription.Text;

            if (string.IsNullOrWhiteSpace(txtBoxCompanyDescription.Text) || string.IsNullOrWhiteSpace(txtBoxCompany.Text))
            {
                StatusLbl.ShowMessage("You need to fill both name and description");
            }
            else
            {
                try
                {
                    WebController.UpdateCompany(name, desc);
                    dGVERP.DataSource             = WebController.GetCompany(name).Select(o => new { o.Name, o.Description }).ToList();
                    txtBoxCompany.Text            = "";
                    txtBoxCompanyDescription.Text = "";
                    StatusLbl.ShowStatus("Update success!");
                }
                catch (Exception x)
                {
                    StatusLbl.ShowMessage(x.Message);
                }
            }
        }
예제 #3
0
        private void BtnDeleteCompany_Click(object sender, EventArgs e)
        {
            string companyName = txtBoxCompany.Text;

            if (companyName != null)
            {
                DialogResult dr = MessageBox.Show("You will permanently remove the company from the database", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == DialogResult.Yes)
                {
                    try
                    {
                        WebController.RemoveCompany(companyName);
                        dGVERP.DataSource             = null;
                        txtBoxCompany.Text            = "";
                        txtBoxCompanyDescription.Text = "";
                        StatusLbl.ShowStatus("Company deleted!");
                    }
                    catch (Exception x)
                    {
                        StatusLbl.ShowMessage(x.Message);
                    }
                }
                else
                {
                    StatusLbl.ShowMessage("Delete cancelled");
                }
            }
        }
예제 #4
0
 public void SetStatus(string statusText)
 {
     if (StatusLbl.InvokeRequired)
     {
         StatusLbl.Invoke(new Action(() => { StatusLbl.Text = statusText; }));
         return;
     }
     StatusLbl.Text = statusText;
 }
예제 #5
0
 private void BtnShowPlayers_Click(object sender, EventArgs e)
 {
     dataGridGetAllPlayers.DataSource = null;
     try
     {
         dataGridGetAllPlayers.DataSource = WebController.GetAllPlayers();
     }
     catch (Exception x)
     {
         StatusLbl.ShowMessage(x.Message);
     }
 }
예제 #6
0
 public void UpdateStatusLbl(Color myColor)
 {
     if (StatusLbl.InvokeRequired)
     {
         StatusLbl.BeginInvoke(new Action(() =>
         {
             StatusLbl.BackColor = myColor;
         }));
     }
     else
     {
         StatusLbl.BackColor = myColor;
     }
 }
예제 #7
0
파일: UpdateFrm.cs 프로젝트: Prixm/Tanji
        private async void DownloadBtn_Click(object sender, EventArgs e)
        {
            try
            {
                IsDownloading = true;
                Cursor        = Cursors.WaitCursor;

                DownloadBtn.Enabled     =
                    ReleasesTxt.Enabled = false;

                using (var webClient = new WebClient())
                {
                    webClient.Proxy = null;
                    StatusLbl.SetDotAnimation("Downloading");
                    byte[] tanjiZip = await webClient.DownloadDataTaskAsync(DownloadUrl);

                    BringToFront();
                    StatusLbl.StopDotAnimation("Extracting...");
                    if (TanjiDirectoryDlg.ShowDialog() != DialogResult.OK)
                    {
                        StatusLbl.StopDotAnimation("Standing By...");
                        return;
                    }

                    using (var tanjiStream = new MemoryStream(tanjiZip))
                        using (var tanjiArchive = new ZipArchive(tanjiStream))
                        {
                            foreach (var tanjiFile in tanjiArchive.Entries)
                            {
                                StatusLbl.SetDotAnimation("Extracting {0}", tanjiFile.Name);

                                string saveAs = Path.Combine(TanjiDirectoryDlg.SelectedPath, tanjiFile.Name);
                                tanjiFile.ExtractToFile(saveAs, true);
                            }
                        }
                }
            }
            finally
            {
                IsDownloading = false;
                Cursor        = Cursors.Default;

                DownloadBtn.Enabled     =
                    ReleasesTxt.Enabled = true;

                StatusLbl.StopDotAnimation("Standing By...");
            }
        }
예제 #8
0
        private void BtnAddCompany_Click(object sender, EventArgs e)
        {
            string text = txtBoxCompany.Text;
            string desc = txtBoxCompanyDescription.Text;

            try
            {
                if (string.IsNullOrWhiteSpace(txtBoxCompany.Text) || string.IsNullOrWhiteSpace(txtBoxCompanyDescription.Text))
                {
                    StatusLbl.ShowMessage("You need to fill both name and description");
                }
                else
                {
                    WebController.AddCompany(text, desc);
                    txtBoxCompany.Text            = "";
                    txtBoxCompanyDescription.Text = "";
                }
            }catch (Exception p)
            {
                StatusLbl.ShowMessage(p.Message + text);
            }
        }
예제 #9
0
        private void OpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog
            {
                Filter = "txt files (*.txt)|*.txt"
            };

            if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txtBox.Text = "";

                string strFilePath = openFile.InitialDirectory + openFile.FileName;
                try
                {
                    string fileText = WebController.OpenFile(strFilePath);
                    txtBox.Text = fileText;
                }
                catch (Exception x)
                {
                    StatusLbl.ShowMessage(x.Message);
                }
            }
        }
예제 #10
0
        private void BtnSelectERP_Click(object sender, EventArgs e)
        {
            dGVERP.DataSource = null;
            if (cBoxERP.SelectedIndex > -1)
            {
                try
                {
                    switch (cBoxERP.SelectedIndex)
                    {
                    case 0:
                        dGVERP.DataSource = WebController.getMetaKeys();
                        break;

                    case 1:
                        dGVERP.DataSource = WebController.getMetaIndexes();
                        break;

                    case 2:
                        dGVERP.DataSource = WebController.getMetaTablesConstraints();
                        break;

                    case 3:
                        dGVERP.DataSource = WebController.getMetaTables();
                        break;

                    case 4:
                        dGVERP.DataSource = WebController.getMetaTables2();
                        break;

                    case 5:
                        dGVERP.DataSource = WebController.GetMetaColumns();
                        break;

                    case 6:
                        dGVERP.DataSource = WebController.GetMetaColumns2();
                        break;

                    case 7:
                        dGVERP.DataSource = WebController.GetAllEmployees().Select(o => new
                                                                                   { o.First_Name, o.Job_Title, o.City }).ToList();
                        break;

                    case 8:
                        dGVERP.DataSource = WebController.GetMetaColumns();
                        break;

                    case 9:
                        dGVERP.DataSource = WebController.GetEmployeeRelatives();
                        break;

                    case 10:
                        dGVERP.DataSource = WebController.GetEmployeeAbsence().Select(o => new { o.Employee_No_, o.Cause_of_Absence_Code, o.Description, From_Date = o.From_Date.ToString() }).ToList();
                        break;

                    case 11:
                        dGVERP.DataSource = WebController.GetMostSick();
                        break;

                    case 12:
                        dGVERP.DataSource = WebController.GetAllEmployeeAbsence().Select(o => new { o.Entry_No_, o.Employee_No_, o.Cause_of_Absence_Code }).ToList();
                        break;

                    case 13:
                        dGVERP.DataSource = WebController.GetAllPortalSetup().Select(o => new { o.Config_TP_Group_Capt_ID, o.Config_Tool_Pane_Caption, o.Search_Tool_Pane_Caption }).ToList();
                        break;

                    case 14:
                        dGVERP.DataSource = WebController.GetAllQualification().Select(o => new { o.Description, o.Qualification_Code, o.Institution_Company }).ToList();
                        break;
                    }
                }catch (Exception x)
                {
                    StatusLbl.ShowMessage(x.Message);
                }
            }
        }