Esempio n. 1
0
        protected void hrhistory_Click(object sender, CommandEventArgs e)
        {
            //Page.Validate();
            if (Page.IsValid)
            {
                string from = OdTextBox.Text;
                string to   = DoTextBox.Text;

                DataTable dt2 = PolaczenieSQL.find_HistoryHR(from, to, e.CommandArgument.ToString());
                GridViewHistoryHR.DataSource = dt2;
                GridViewHistoryHR.DataBind();

                if (e.CommandArgument.ToString() == "team" || e.CommandArgument.ToString() == "newyear")
                {
                    GridViewHistoryHR.Columns[0].Visible = true;
                    GridViewHistoryHR.Columns[1].Visible = true;
                    GridViewHistoryHR.Columns[2].Visible = true;
                    GridViewHistoryHR.Columns[3].Visible = true;
                    GridViewHistoryHR.Columns[4].Visible = true;
                    GridViewHistoryHR.Columns[5].Visible = true;
                    GridViewHistoryHR.Columns[6].Visible = true;
                    GridViewHistoryHR.Columns[7].Visible = false;
                }
                else
                {
                    GridViewHistoryHR.Columns[0].Visible = true;
                    GridViewHistoryHR.Columns[1].Visible = true;
                    GridViewHistoryHR.Columns[2].Visible = true;
                    GridViewHistoryHR.Columns[3].Visible = true;
                    GridViewHistoryHR.Columns[4].Visible = true;
                    GridViewHistoryHR.Columns[5].Visible = true;
                    GridViewHistoryHR.Columns[6].Visible = true;
                    GridViewHistoryHR.Columns[7].Visible = true;
                }

                foreach (GridViewRow row in GridViewHistoryHR.Rows)
                {
                    row.Height = 40;
                }

                switch (e.CommandArgument.ToString())
                {
                case "team":
                    LabelOperation.Text = "TEAMS OPERATIONS";
                    break;

                case "functions":
                    LabelOperation.Text = "PERSON FUNCTION OPERATIONS";
                    break;

                case "newyear":
                    LabelOperation.Text = "NEW YEAR OPERATIONS";
                    break;

                default:
                    LabelOperation.Text = "PERSONAL OPERATIONS";
                    break;
                }
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int todayy = DateTime.Today.Year;
                LabelYear.Text = "Holidays " + todayy.ToString();
                List <int> years = new List <int>(new int[] { todayy - 1, todayy, todayy + 1 });
                RepeaterYears.DataSource = years;
                RepeaterYears.DataBind();
                DataTable dt = PolaczenieSQL.find_swieta(todayy);
                GridViewSwieta.Columns[0].Visible = true;
                GridViewSwieta.Columns[1].Visible = true;
                GridViewSwieta.Columns[2].Visible = true;
                GridViewSwieta.Columns[3].Visible = true;
                GridViewSwieta.DataSource         = dt;
                GridViewSwieta.DataBind();
                GridViewSwieta.Columns[3].Visible = false;

                LabelOperation.Text = "PERSONAL OPERATIONS";

                string to   = DateTime.Today.ToShortDateString();
                string from = DateTime.Today.AddDays(-30).ToShortDateString();

                OdTextBox.Text = from;
                DoTextBox.Text = to;

                DataTable dt2 = PolaczenieSQL.find_HistoryHR(from, to, "personal");
                GridViewHistoryHR.DataSource = dt2;
                GridViewHistoryHR.DataBind();


                foreach (GridViewRow row in GridViewHistoryHR.Rows)
                {
                    row.Height = 40;
                }

                GridViewHistoryHR.Columns[0].Visible = true;
                GridViewHistoryHR.Columns[1].Visible = true;
                GridViewHistoryHR.Columns[2].Visible = true;
                GridViewHistoryHR.Columns[3].Visible = true;
                GridViewHistoryHR.Columns[4].Visible = true;
                GridViewHistoryHR.Columns[5].Visible = true;
                GridViewHistoryHR.Columns[6].Visible = true;
                GridViewHistoryHR.Columns[7].Visible = true;

                string   calculation_date = PolaczenieSQL.calculationdate();
                DateTime myTime1          = DateTime.Today;
                DateTime myTime2          = DateTime.Today.AddDays(-1);
                if (calculation_date != string.Empty)
                {
                    myTime2 = DateTime.Parse(calculation_date);
                    //this.date_od = DateTime.ParseExact(odtext, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                }
                TimeSpan span               = myTime1 - myTime2;
                int      totalnumber        = Convert.ToInt16(span.TotalDays);
                string   calculation_string = "";

                if (totalnumber < 0)
                {
                    calculation_string             = "No action occure in past";
                    LabelLastCalculation.Text      = calculation_string;
                    LabelLastCalculation.ForeColor = Color.Gray;
                }
                else if (totalnumber >= 0 && totalnumber < 365)
                {
                    calculation_string             = "Last action: " + myTime2.ToShortDateString() + "; " + totalnumber + " days ago";
                    LabelLastCalculation.Text      = calculation_string;
                    LabelLastCalculation.ForeColor = Color.DarkGreen;
                }
                else
                {
                    calculation_string             = "Last action: " + myTime2.ToShortDateString() + "; " + totalnumber + " days ago";
                    LabelLastCalculation.Text      = calculation_string;
                    LabelLastCalculation.ForeColor = Color.Crimson;
                }
            }
            else
            {
                string menager1 = Request.Form[DateTextBox.UniqueID];
                DateTextBox.Text = menager1;
                string date1 = Request.Form[NameTextBox.UniqueID];
                NameTextBox.Text = date1;
                string dateod = Request.Form[OdTextBox.UniqueID];
                OdTextBox.Text = dateod;
                string datedo = Request.Form[DoTextBox.UniqueID];
                DoTextBox.Text = datedo;
            }

            if (Request.QueryString["holidaydeleted"] != null)
            {
                string usersdelete = Request.QueryString["holidaydeleted"];
                info_label.Text    = "Święto z dnia " + usersdelete + " zostało usunięte z listy";
                info_label.Visible = true;
            }
        }