Пример #1
0
        public decimal anadromikaCalcLogoKatigorias(Oplitis myOplitis)
        {
            Katigoria myKatigoria = new Katigoria();
            Change    myChange    = new Change();
            BLayer    myBlayer    = new BLayer();

            myKatigoria = myBlayer.get_diafora_posou(myOplitis);
            decimal poso = myKatigoria.katDiafora;

            myChange = myBlayer.getChangeById(myOplitis);
            DateTime isxysMetabolis = myChange.changeIsxysDate;
            DateTime metaboliDate   = myChange.changeDate;
            int      monthIsxys     = isxysMetabolis.Month;
            int      monthMetaboli  = metaboliDate.Month;
            int      diafora        = monthMetaboli - monthIsxys;
            decimal  anadromika     = poso * diafora;

            return(anadromika);
        }
Пример #2
0
        protected void RadioButtonListMisthodType_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLayer myBlayer = new BLayer();

            PanelAnadromika.Visible = false;
            if (RadioButtonListMisthodType.SelectedValue == "1")
            {
                if (!string.IsNullOrEmpty(katigoria.Text))
                {
                    Oplitis anotherOplitis = new Oplitis();
                    anotherOplitis.id = Convert.ToInt32(aa.Text);
                    Katigoria myKatigoria = new Katigoria();
                    myKatigoria       = myBlayer.get_Katigoria_By_Id(anotherOplitis);
                    posoPliromis.Text = myKatigoria.katPliroteo.ToString();
                    DateTime mydatetime = new DateTime();
                    mydatetime           = DateTime.Now;
                    priromiDate.Text     = mydatetime.Day.ToString() + "/" + mydatetime.Month.ToString() + "/" + mydatetime.Year.ToString();
                    priromiDate.ReadOnly = true;
                }
            }
            else if (RadioButtonListMisthodType.SelectedValue == "2")
            {
                if (!string.IsNullOrEmpty(katigoria.Text))
                {
                    int     year;
                    Oplitis anotherOplitis = new Oplitis();
                    anotherOplitis.id = Convert.ToInt32(aa.Text);
                    Katigoria myKatigoria = new Katigoria();
                    myKatigoria       = myBlayer.get_Katigoria_By_Id(anotherOplitis);;
                    posoPliromis.Text = myKatigoria.katDXmas.ToString();
                    year = DateTime.Now.Year;
                    DateTime mydatetime = new DateTime(year, 12, 16);
                    priromiDate.Text     = mydatetime.Day.ToString() + "/" + mydatetime.Month.ToString() + "/" + mydatetime.Year.ToString();
                    priromiDate.ReadOnly = false;
                }
            }
            else if (RadioButtonListMisthodType.SelectedValue == "3")
            {
                if (!string.IsNullOrEmpty(katigoria.Text))
                {
                    Oplitis anotherOplitis = new Oplitis();
                    anotherOplitis.id = Convert.ToInt32(aa.Text);
                    Katigoria myKatigoria = new Katigoria();
                    myKatigoria          = myBlayer.get_Katigoria_By_Id(anotherOplitis);;
                    posoPliromis.Text    = myKatigoria.katDPasxa.ToString();
                    priromiDate.ReadOnly = false;
                }
            }
            else if (RadioButtonListMisthodType.SelectedValue == "4")
            {
                PanelAnadromika.Visible = true;
                error2.Visible          = false;
                priromiDate.ReadOnly    = true;
                try
                {
                    if (!string.IsNullOrEmpty(katigoria.Text))
                    {
                        Oplitis myOplitis = new Oplitis();
                        myOplitis.id = Convert.ToInt32(aa.Text);
                        Katigoria category = myBlayer.get_diafora_posou(myOplitis);
                        currentKatigoria.Text = category.newKatName;
                        oldKatigoria.Text     = category.oldKatName;
                        Change myChange = myBlayer.getChangeById(myOplitis);
                        if (myChange.changeId == 0)
                        {
                            isxysKatigorias.Text        = string.Empty;
                            metaboliDate.Text           = string.Empty;
                            error2.Visible              = true;
                            error2.Text                 = "Ο επιλεγμένος οπλίτης δεν έχει καμία μεταβολή!";
                            anadromikaCalculate.Visible = false;
                        }
                        else if (currentKatigoria.Text == oldKatigoria.Text)
                        {
                            isxysKatigorias.Text        = string.Empty;
                            metaboliDate.Text           = string.Empty;
                            error2.Visible              = true;
                            error2.Text                 = "Ο επιλεγμένος οπλίτης δεν δικαιούται αναδρομικά!";
                            anadromikaCalculate.Visible = false;
                        }
                        else
                        {
                            isxysKatigorias.Text = myChange.changeIsxysDate.ToString();
                            metaboliDate.Text    = myChange.changeDate.ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    error.Visible = true;
                    error.Text    = ex.Message.ToString();
                }
            }
        }