Exemplo n.º 1
0
 public void AddDefaultStatus()
 {
     if (_site.SiteStatuses.Count == 0)
     {
         SiteStatus Defaultstatus = new SiteStatus();
         Defaultstatus.OpenedFrom = DateTime.Now;
         Defaultstatus.Site = _site;
         _site.SiteStatuses.Add(Defaultstatus);
     }
 }
Exemplo n.º 2
0
        private void lbtOpen_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmInput frm = new FrmInput(DateTime.Now, "Opening Date");
            frm.ShowDialog();

            if (frm.DialogResult == DialogResult.OK)
            {
                SiteStatus ss = new SiteStatus();
                ss.OpenedFrom = frm.GetDateTimeValue();
                _site.SiteStatuses.Add(ss);
                //DataRepository.SaveOrUpdateSite(_site);
                PopStatus();

                if (OnDataUsageEdit != null)
                {
                    OnDataUsageEdit(this, new EventArgs());
                }
            }
        }
Exemplo n.º 3
0
        private void butSave_Click(object sender, EventArgs e)
        {
            int count = 0;
            int error = 0;
            try
            {
                foreach (SiteImportData rd in _rdata)
                {
                    if (!rd.IsExist && !rd.HasError)
                    {
                        ForlabSite site = new ForlabSite();

                        site.Region = rd.Region;
                        site.SiteName = rd.SiteName;
                        site.SiteLevel = rd.SiteLevel;
                        site.SiteCategory = rd.Category;
                        site.WorkingDays = rd.WorkingDays;
                        site.CD4TestingDaysPerMonth = rd.Cd4Td;
                        site.ChemistryTestingDaysPerMonth = rd.ChemTd;
                        site.HematologyTestingDaysPerMonth = rd.HemaTd;
                        site.ViralLoadTestingDaysPerMonth = rd.ViralTd;
                        site.OtherTestingDaysPerMonth = rd.OtherTd;
                        SiteStatus ss = new SiteStatus();
                        ss.OpenedFrom = rd.OpeningDate != null ? rd.OpeningDate.Value : DateTime.Now;
                        site.SiteStatuses.Add(ss);
                        count++;
                        DataRepository.SaveOrUpdateSite(site);

                    }
                    else { error++; }

                }
                MessageBox.Show(count + " Sites are imported and saved successfully." + Environment.NewLine + error + " Sites Failed.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();

            }
            catch
            {
                MessageBox.Show("Error: Unable to import Site data.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DataRepository.CloseSession();

            }
        }