Exemple #1
0
 private void btnTinhtoan_Click(object sender, EventArgs e)
 {
     try
     {
         dem = 0;
         string  macp        = cbMaCP.SelectedValue.ToString();
         Cophieu cpSelected  = LoadCpFromCb(macp);
         string  idcty       = cpSelected.IdCongty.ToString();
         Congty  ctySelected = LoadCtyFromCb(idcty);
         double  cpmua       = Convert.ToDouble(txtCPMua.Text);
         double  lncc        = cpSelected.Cotuc * cpSelected.GiaCP * cpmua - Convert.ToDouble(txtVonDT.Text);
         txtLNCC.Text = lncc.ToString();
         string kl1 = "*Từ chỉ tiêu LNCC của NĐT => ";
         if (lncc < 0)
         {
             kl1 += "Cổ phiếu đang không sinh lợi nhuận" + Environment.NewLine;
             dem -= 1;
         }
         else
         {
             kl1 += "Cổ phiếu đang sinh lợi nhuận" + Environment.NewLine;
             dem += 1;
         }
         TinhToanChiSo(cpSelected, ctySelected, cpmua);
         txtKetLuan.Text = kl1 + Thongtinhotro();
         string keep = Decision[2].ToString();
         string sold = Decision[3].ToString();
         Quyetdinh(keep, sold);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #2
0
        Congty LoadCtyFromCb(string idcty)
        {
            string    sql2        = "select * from congty where IDcongty=" + idcty;
            DataTable table2      = DataProvider.Instance.ExecuteQuery(sql2);
            DataRow   row2        = table2.Rows[0];
            Congty    ctySelected = new Congty(row2);

            return(ctySelected);
        }
Exemple #3
0
 private void btnTinhtoan2_Click(object sender, EventArgs e)
 {
     txtLNCC.Text = "";
     try
     {
         dem = 0;
         string  macp        = cbMaCP.SelectedValue.ToString();
         Cophieu cpSelected  = LoadCpFromCb(macp);
         string  idcty       = cpSelected.IdCongty.ToString();
         Congty  ctySelected = LoadCtyFromCb(idcty);
         double  cpmua       = Convert.ToDouble(txtCPmuaDudinh.Text);
         TinhToanChiSo(cpSelected, ctySelected, cpmua);
         txtKetLuan.Text = Thongtinhotro();
         string keep = Decision[0].ToString();
         string sold = Decision[1].ToString();
         Quyetdinh(keep, sold);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #4
0
 void TinhToanChiSo(Cophieu cpSelected, Congty ctySelected, double cpmua)
 {
     try
     {
         double ct  = ctySelected.LNST * cpSelected.Cotuc / cpmua;
         double eps = (ctySelected.LNST - ct) / ctySelected.LuongCP;
         txtEPS.Text = eps.ToString();
         double pe = 0.0f;
         if (eps != 0)
         {
             pe         = cpSelected.GiaCP / eps;
             txtPE.Text = pe.ToString();
         }
         double roa = ctySelected.LNST / ctySelected.TongTS;
         txtROA.Text = roa.ToString();
         double roe = ctySelected.LNST / ctySelected.VonCSH;
         txtROE.Text = roe.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }