protected void CalculateKatigoria_Click(object sender, EventArgs e)
        {
            BLayer         myBlayer   = new BLayer();
            Dikaiologitika fermenaDik = new Dikaiologitika();

            try
            {
                foreach (ListItem li in DikaiologitikaListBox.Items)
                {
                    fermenaDik.id = Convert.ToInt32(li.Value);
                    fd.Add(fermenaDik);
                }

                for (int i = 0; i < fd.Count; i++)
                {
                    fermenaDik = fd[i];
                    myBlayer.add_Fermena_Dikaiologitika(fermenaDik);
                }

                Katigoria myKatigoria = myBlayer.get_Katigoria_From_Dikaiologitika();
                newKatigoria.Text = myKatigoria.katPerigrafi.ToString();
                katalogisteo.Text = myKatigoria.katKatalogisteo.ToString();
                kratiseis.Text    = myKatigoria.katKratiseis.ToString();
                pliroteo.Text     = myKatigoria.katPliroteo.ToString();
                dx.Text           = myKatigoria.katDXmas.ToString();
                dp.Text           = myKatigoria.katDPasxa.ToString();
            }

            catch (Exception ex)
            {
                errorMessage.Visible = true;
                errorMessage.Text    = ex.Message.ToString();
            }
        }
Beispiel #2
0
        public List <Katigoria> getMoney()
        {
            Dal              myDal    = new Dal();
            DataTable        dt       = new DataTable();
            List <Katigoria> category = new List <Katigoria>();
            SqlDataReader    mSq      = myDal.getMoney();

            if (mSq.HasRows)
            {
                dt.Load(mSq);
            }
            foreach (DataRow dr in dt.Rows)
            {
                Katigoria myKatigoria = new Katigoria();
                myKatigoria.katId           = Convert.ToInt32(dr["kat_id"].ToString());
                myKatigoria.katPerigrafi    = dr["kat_name"].ToString();
                myKatigoria.katKatalogisteo = Convert.ToDecimal(dr["kat_katalogisteo"].ToString());
                myKatigoria.katKratiseis    = Convert.ToDecimal(dr["kat_kratiseis"].ToString());
                myKatigoria.katPliroteo     = Convert.ToDecimal(dr["kat_pliroteo"].ToString());
                myKatigoria.katDXmas        = Convert.ToDecimal(dr["kat_dx"].ToString());
                myKatigoria.katDPasxa       = Convert.ToDecimal(dr["kat_dp"].ToString());
                category.Add(myKatigoria);
            }
            return(category);
        }
Beispiel #3
0
        protected void TotalOplitis_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                BLayer myBlayer = new BLayer();
                int    row      = Convert.ToInt32(e.CommandArgument);
                int    id       = Convert.ToInt32(TotalOplitis.DataKeys[row].Values["op_id"].ToString());
                otherOplitis.id           = id;
                aa.Text                   = id.ToString();
                lastPaymentsPanel.Visible = true;

                SqlDataReader myDtr = myBlayer.get_last_payment(otherOplitis);
                LastPayments.DataSource = myDtr;
                LastPayments.DataBind();

                SqlDataReader myDtr1 = myBlayer.get_last_updated_oplitis_dik(otherOplitis);
                BulletedListDik.DataSource = myDtr1;
                BulletedListDik.DataBind();

                Katigoria myKatigoria = new Katigoria();
                myKatigoria       = myBlayer.get_Katigoria_By_Id(otherOplitis);
                katigoria.Text    = myKatigoria.katPerigrafi.ToString();
                katalogisteo.Text = myKatigoria.katKatalogisteo.ToString();
                kratiseis.Text    = myKatigoria.katKratiseis.ToString();
                pliroteo.Text     = myKatigoria.katPliroteo.ToString();
                dp.Text           = myKatigoria.katDPasxa.ToString();
                dx.Text           = myKatigoria.katDXmas.ToString();

                RadioButtonListMisthodType.Enabled = true;
                posoPliromis.Enabled = true;
                RadioButtonListMisthodType.SelectedIndex = -1;
                posoPliromis.Text       = string.Empty;
                currentKatigoria.Text   = string.Empty;
                oldKatigoria.Text       = string.Empty;
                isxysKatigorias.Text    = string.Empty;
                metaboliDate.Text       = string.Empty;
                anadromika.Text         = string.Empty;
                PanelAnadromika.Visible = false;
                anaforaPliromis.Visible = false;


                panelApousias.Visible          = false;
                panelAllagiKatigorias.Visible  = false;
                logosAnadromikon.SelectedIndex = -1;
                lastPliromiDate.Text           = string.Empty;
                currentDate.Text = string.Empty;
            }
        }
Beispiel #4
0
        public decimal anadromikaCalcLogoApousias(Oplitis myOplitis)
        {
            BLayer    myBlayer = new BLayer();
            Katigoria category = new Katigoria();

            category = myBlayer.get_Katigoria_By_Id(myOplitis);
            decimal poso      = category.katPliroteo;
            Pliromi myPliromi = new Pliromi();

            myPliromi = myBlayer.get_Last_Pliromi_By_Opid(myOplitis);
            DateTime lastPayDate = myPliromi.PayDay;
            DateTime currentDate = DateTime.Now;
            int      diafora     = currentDate.Month - lastPayDate.Month;
            decimal  anadromika  = diafora * poso;

            return(anadromika);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        public Katigoria get_diafora_posou(Oplitis myOplitis)
        {
            Dal           myDal       = new Dal();
            Katigoria     myKatigoria = new Katigoria();
            SqlDataReader dr          = myDal.getDiaforaPosou(myOplitis);
            DataTable     dt          = new DataTable();

            if (dr.HasRows)
            {
                dt.Load(dr);
            }
            foreach (DataRow row in dt.Rows)
            {
                myKatigoria.katDiafora     = Convert.ToDecimal(row["diafora"].ToString());
                myKatigoria.katPliroteoNew = Convert.ToDecimal(row["katPliroteo_new"].ToString());
                myKatigoria.katPliroteoOld = Convert.ToDecimal(row["katPliroteo_old"].ToString());
                myKatigoria.newKatName     = row["katName_new"].ToString();
                myKatigoria.oldKatName     = row["katName_old"].ToString();
            }
            return(myKatigoria);
        }
Beispiel #7
0
        public Katigoria get_Katigoria_From_Dikaiologitika()
        {
            Dal           myDal       = new Dal();
            Katigoria     myKatigoria = new Katigoria();
            DataTable     dt          = new DataTable();
            SqlDataReader dr          = myDal.getDikaiologitikaFromKatigoria();

            if (dr.HasRows)
            {
                dt.Load(dr);
            }
            foreach (DataRow row in dt.Rows)
            {
                myKatigoria.katPerigrafi    = row["kat_name"].ToString();
                myKatigoria.katKatalogisteo = Convert.ToDecimal(row["kat_katalogisteo"].ToString());
                myKatigoria.katKratiseis    = Convert.ToDecimal(row["kat_kratiseis"].ToString());
                myKatigoria.katPliroteo     = Convert.ToDecimal(row["kat_pliroteo"].ToString());
                myKatigoria.katDXmas        = Convert.ToDecimal(row["kat_dx"].ToString());
                myKatigoria.katDPasxa       = Convert.ToDecimal(row["kat_dp"].ToString());
            }
            return(myKatigoria);
        }
Beispiel #8
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();
                }
            }
        }