Пример #1
0
        private void CheckLastUpdateDate()
        {
            toolStripLblLastBackupDays.Visible = false;
            if (File.Exists(jsonMailUpdateDataPath) && new FileInfo(jsonMailUpdateDataPath).Length > 0)
            {
                List <UpdateMail> updateMails = new List <UpdateMail>();
                updateMails = DataListing.ReadBackupInfo(jsonMailUpdateDataPath, updateMails);
                var lastUpdate    = updateMails[0].LastUpdateDate.Value;
                var updateDate    = updateMails[0].UpdateDate.ToString();
                var nowDate       = DateTime.Parse(DateTime.Now.ToString("dd-MM-yyyy"));
                var remainingDate = (nowDate - lastUpdate).TotalDays;
                if (remainingDate > 0)
                {
                    toolStripLblLastBackupDays.Text      = "Son Yedekleme " + remainingDate + " Gün Önce Yapıldı.";
                    ıconToolStripBtnBackupManual.Visible = true;
                    toolStripLblLastBackupDays.Visible   = true;
                }

                if (remainingDate > 7 && CheckInternetControl() && Hakediş.Properties.Settings.Default.isAnyUpdate == false && lastUpdate != null)
                {
                    DialogResult dialog = new DialogResult();
                    dialog = MessageBox.Show($"Verileriniz En Son {remainingDate} Gün Önce Yedeklendi. \rVerilerinizi Yedeklemek İstersiniz ?", "Veri Yedeklemesi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialog == DialogResult.Yes)
                    {
                        BackupData(updateDate);
                    }
                    else
                    {
                        toolStripBtnBackup.Visible = true;
                    }
                }
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #2
0
 private void WorkOrderReportForm_Load(object sender, EventArgs e)
 {
     workOrders = DataListing.ReadWorkOrderJson(jsonWorkOrderPath, workOrders);
     payments   = DataListing.ReadPaymentJson(jsonPaymentPath, payments);
     //dataGridView1.DataSource = workOrders;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #3
0
 public void ReadJson()
 {
     try
     {
         workOrders = DataListing.ReadWorkOrderJson(jsonWorkOrderDataPath, workOrders);
     }
     catch (Exception)
     {
     }
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #4
0
        public void ReadWorkOrderJson()
        {
            try
            {
                if (File.Exists(jsonWorkOrderDataPath) && new FileInfo(jsonWorkOrderDataPath).Length > 0)
                {
                    workOrders = DataListing.ReadWorkOrderJson(jsonWorkOrderDataPath, workOrders);
                    List <WorkOrder> currentWorkOrders = new List <WorkOrder>();
                    currentWorkOrders.AddRange(workOrders);
                    currentWorkOrders = currentWorkOrders.Where(x => x.ExpiredDate == null).ToList();
                    isDoneWorkOrders  = workOrders.Where(x => x.ExpiredDate != null).ToList();
                    if (checkedFilter)
                    {
                        dataGridView1.DataSource = workOrders.OrderBy(x => x.StartingDate).ToList();
                    }
                    else
                    {
                        dataGridView1.DataSource = currentWorkOrders.OrderBy(x => x.StartingDate).ToList();
                    }
                    dataGridView1.Columns[0].Visible = true;
                    dataGridView1.Columns[2].Visible = false;
                    DataTableColumnNameChange.ChangeDataGridHeader(dataGridView1, "İş Adı", "Açıklama", "Başlangıç Tarihi", "Bitirme Tarihi", "Teslim Tarihi", "Adam/Gün");
                    dataGridView1.Columns[3].DefaultCellStyle.Format = "dd/MM/yyyy";
                    dataGridView1.Columns[4].DefaultCellStyle.Format = "dd/MM/yyyy";
                    dataGridView1.Columns[5].DefaultCellStyle.Format = "dd/MM/yyyy";
                }
                if (File.Exists(jsonPaymentsDataPath) && new FileInfo(jsonPaymentsDataPath).Length > 0)
                {
                    payments = DataListing.ReadPaymentJson(jsonPaymentsDataPath, payments);
                    payments.Reverse();
                    dataGridView2.DataSource = payments;
                    DataTableColumnNameChange.ChangeDataGridHeader(dataGridView2, "Ödeme Adı", "Ödenen Gün", "Ödeme Tarihi");
                    dataGridView2.Columns[0].Visible = false;
                    dataGridView2.Columns[3].DefaultCellStyle.Format = "dd/MM/yyyy";
                }
                if (File.Exists(jsonPaymentsDataPath) || File.Exists(jsonWorkOrderDataPath))
                {
                    CalculatePayments(isDoneWorkOrders, payments);
                }

                CheckDataGridEmpty();
            }
            catch (Exception)
            {
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Пример #5
0
 private void AddNewWorkOrder_Load(object sender, EventArgs e)
 {
     this.MaximumSize = new Size(252, 541);
     workOrders       = DataListing.ReadWorkOrderJson(jsonWorkOrderDataPath, workOrders);
     if (workOrders.Count > 0)
     {
         for (int i = workOrders.Count - 1; i < workOrders.Count; i++)
         {
             idIndex = workOrders[i].ID + 1;
         }
     }
     else
     {
         idIndex = 0;
     }
 }
Пример #6
0
 private void AddNewPaymentForm_Load(object sender, EventArgs e)
 {
     this.MaximumSize = new Size(267, 268);
     payments         = DataListing.ReadPaymentJson(jsonPaymentsDataPath, payments);
     if (payments.Count > 0)
     {
         for (int i = payments.Count - 1; i < payments.Count; i++)
         {
             idIndex = payments[i].ID + 1;
         }
     }
     else
     {
         idIndex = 0;
     }
 }
Пример #7
0
 private void UpdatePaymentForm_Load(object sender, EventArgs e)
 {
     this.MaximumSize = new Size(263, 252);
     try
     {
         //ReadJson();
         payments                = DataListing.ReadPaymentJson(jsonPaymentsDataPath, payments);
         txtUpdateName.Text      = name;
         txtUpdatePayForDay.Text = pay.ToString();
         dateTimePayment.Value   = paymentDate;
     }
     catch (Exception)
     {
     }
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #8
0
 private void BackUpDataFileItem()
 {
     if (File.Exists(jsonMailUpdateDataPath) && new FileInfo(jsonMailUpdateDataPath).Length > 0)
     {
         List <UpdateMail> updateMails = new List <UpdateMail>();
         updateMails = DataListing.ReadBackupInfo(jsonMailUpdateDataPath, updateMails);
         comboBoxSelectUpdateDay.SelectedItem = updateMails[0].UpdateDate;
         maskedtxtUsername.Text = updateMails[0].UserName;
         maskedTxtPass.Text     = updateMails[0].Password;
         maskedTxtToEmail.Text  = updateMails[0].ToEmail;
     }
     else
     {
         btnAutoUpdate.PerformClick();
     }
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #9
0
 private void ManualBackupData()
 {
     try
     {
         List <UpdateMail> updateMails = new List <UpdateMail>();
         updateMails = DataListing.ReadBackupInfo(jsonMailUpdateDataPath, updateMails);
         var date = updateMails[0].UpdateDate.ToString();
         toolStripProgressBarBackup.Visible = true;
         timerBackupStat.Enabled            = true;
         BackupData(date);
     }
     catch (Exception)
     {
         throw;
     }
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #10
0
 public void BackupData(string DateNow)
 {
     try
     {
         if (CheckInternetControl() && File.Exists(jsonMailUpdateDataPath) && new FileInfo(jsonMailUpdateDataPath).Length > 0)
         {
             List <UpdateMail> updateMails = new List <UpdateMail>();
             updateMails = DataListing.ReadBackupInfo(jsonMailUpdateDataPath, updateMails);
             var      date           = updateMails[0].UpdateDate.ToString();
             DateTime?lastUpdateDate = updateMails[0].LastUpdateDate.Value;
             var      nowDate        = DateTime.Parse(DateTime.Now.ToString("dd-MM-yyyy"));
             if (DateNow == date && Hakediş.Properties.Settings.Default.isAnyUpdate == false && lastUpdateDate != nowDate)
             {
                 var toEmail = updateMails[0].ToEmail;//Göndermek İstediğin Email Girişi
                 var email   = updateMails[0].UserName;
                 var pass    = updateMails[0].Password;
                 var body    = DateTime.Now.ToString() + " Yedeklemesi " + Environment.NewLine + Application.CompanyName + " " + Application.ProductName + " App";
                 var subject = "Hakediş " + DateTime.Now.ToString() + " Yedek Veri Güncellemesi";
                 if (ConnectAndSendMail.Email_Send(toEmail, body, subject, email, pass, jsonWorkOrderDataPath, jsonPaymentsDataPath))
                 {
                     Hakediş.Properties.Settings.Default.isAnyUpdate = true;
                     updateMails[0].LastUpdateDate = DateTime.Parse(DateTime.Now.ToString("dd-MM-yyyy"));
                     var json = Newtonsoft.Json.JsonConvert.SerializeObject(updateMails);
                     File.WriteAllText(jsonMailUpdateDataPath, json);
                     ıconToolStripBtnBackupManual.Visible = false;
                     toolStripLblLastBackupDays.Visible   = false;
                 }
             }
             else
             {
                 Hakediş.Properties.Settings.Default.isAnyUpdate = false;
                 Hakediş.Properties.Settings.Default.Save();
                 Hakediş.Properties.Settings.Default.Reload();
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Пример #11
0
 public void ReadUserConfigData()
 {
     try
     {
         if (File.Exists(jsonUserConfigPathFile) && new FileInfo(jsonUserConfigPathFile).Length > 0)
         {
             List <User> users = new List <User>();
             users = DataListing.ReadUserConfig(jsonUserConfigPathFile, users);
             calculateParameterNum = users[0].CalculateParameter;
             userTypeString        = users[0].Usertype.ToString();
         }
         GC.Collect();
         GC.WaitForPendingFinalizers();
     }
     catch (Exception)
     {
         throw;
     }
 }