protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        //Response.Write(Request.Form["test"]);
        Person user = (Person)Session["User"];
        PeriodDB perdb = new PeriodDB();
        Period per = perdb.getPeriod(Convert.ToInt32(this.month), Convert.ToInt32(this.year));

        if (this.employees != null)
        {

            DepartmentList department_list = new DepartmentList();
            List<Department> departments = department_list.getDepartments(employees);

            foreach (Department dep in departments)
            {
                EmployeeList emp_list = new EmployeeList();
                List<Employee> emps = null;//// emp_list.getEmployeesOfDepartment(dep.DepartmentID, employees);
                EmployeeComparerByPostASC cmpByPostASC = new EmployeeComparerByPostASC();
                emps.Sort(cmpByPostASC);
                foreach (Employee em in emps)
                {
                    EmployeeList emplist = new EmployeeList();
                    List<TimekeeperHours> current = null;//emplist.getEmployeesTimekeeperHours(em);
                    List<HRHours> hr_current = null;/// emplist.getEmployeesHRHours(em);

                    for (int i = 1; i <= count_days; i++)
                    {
                        string textbox_id = "tb" + dep.DepartmentID + em.PostID + em.EmployeeID + i.ToString();
                        //string hr_id = "hr" + dep.DepartmentID + em.EmployeeID + i.ToString();

                        Date dt = new Date();
                        SQLDB db = new SQLDB();

                        string hour = Request.Form[textbox_id];
                        //string overhour = Request.Form[hr_id];

                        TimekeeperHours th = current.Find(delegate(TimekeeperHours ht) { return ht.Day == i.ToString(); });

                        decimal h = -1;
                        string sym = "";

                        if ((hour != "") && (hour != null))
                        {
                            if (HasSymbols(hour))
                            {
                                if (th == null)
                                    db.insertTimekeeperHoursAndSymbols(em.EmployeeID, em.StartPeriod, em.BeginDate, em.EndDate, h, hour, user.TabNum, dep.DepartmentID, em.PostID, i.ToString(), month, year, per.PeriodID);
                                else
                                    if (!th.Symbols.Equals(hour))
                                        db.updateTimekeeperHoursAndSymbols(user.TabNum, h, hour, th.ID);
                            }
                            else
                            {
                                h = Convert.ToDecimal(hour);

                                if (th == null)
                                    db.insertTimekeeperHoursAndSymbols(em.EmployeeID, em.StartPeriod, em.BeginDate, em.EndDate, h, sym, user.TabNum, dep.DepartmentID, em.PostID, i.ToString(), month, year, per.PeriodID);
                                else
                                    if (th.Hours != h)
                                        db.updateTimekeeperHoursAndSymbols(user.TabNum, h, sym, th.ID);
                            }
                        }

                        if ((hour == "") && (th != null)) db.deleteTimekeeperHours(th.ID);

                    }
                }

            }
        }

        EncryptedQueryString QueryString = new EncryptedQueryString();
        QueryString.Add("month", period.SelectedItem.Value);
        QueryString.Add("role", role);
        //Server.Transfer("TimeTable.aspx?data=" + QueryString.ToString());
        //Response.Redirect("Tabel.aspx?data=" + QueryString.ToString());
    }