public Doctor(string name, string surname, string jmbg, char gender, string phoneNumber, string email, DateTime birthday, string username, string password, ResidentialAddress address, DoctorType doctorType, bool isDeleted = false) : base(name, surname, jmbg, gender, phoneNumber, email, birthday, username, password, address, isDeleted)
 {
     this.doctorType = doctorType;
     Vacations       = new List <Vacation>();
     DaysOfVacation  = 25;
     WorkHours       = new WorkHours();
 }
Esempio n. 2
0
        public IHttpContext workhourEdit(IHttpContext context, string workhourId)
        {
            try
            {
                if (!context.token().hasPermission("workhour.write"))
                {
                    context.Response.StatusCode = HttpStatusCode.NotFound;
                    context.Response.SendResponse("");
                    return(context);
                }
                ValidationBuilder    valBuilder = new ValidationBuilder();
                ValidationCollection valCollection;
                string[]             valArray =
                {
                    "name=StartTime, isRequired=,isTime=",
                    "name=EndTime, isRequired=,isTime=",
                };

                valCollection = valBuilder.build(valArray);
                WorkHours workhour = BaseController.getUserInput <WorkHours>(context, valCollection);
                workhour.Id = uint.Parse(workhourId);
                WorkHours.edit(uint.Parse(context.Request.PathParameters["id"]), workhour);
                context.Response.SendResponse("");
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = HttpStatusCode.InternalServerError;
                context.Response.SendResponse(ex.Message);
            }

            return(context);
        }
        public void CreateJobPostDBTest()
        {
            //Arrange
            DbCompany dbCompany = new DbCompany();
            Company   company   = new Company("*****@*****.**", "hellopassword");

            company.Id = 1;
            WorkHours workHours = new WorkHours();

            workHours.Id = 1;
            JobCategory jobCategory = new JobCategory();

            jobCategory.Id = 1;


            string   iDate   = "05/05/2018";
            DateTime oDate   = Convert.ToDateTime(iDate);
            JobPost  jobPost = new JobPost(1, "Test job1", "Et job for dig", DateTime.Now, oDate, "Wc Vasker", workHours, "Her", company, jobCategory);



            //Act
            //bool inserted = dbCompany.createJobPost(jobPost);

            //Assert
            // Assert.IsTrue(inserted);
        }
Esempio n. 4
0
        public ActionResult CreateJobPost(string Title, string Description, DateTime StartDate, DateTime EndDate, string JobTitle, int WorkHours, string Address, Company Company, int JobCategory)
        {
            WorkHours workHours = new WorkHours {
                Id = WorkHours
            };

            CompanyServiceReference.JobCategory jobCategory = new CompanyServiceReference.JobCategory {
                Id = JobCategory
            };
            Company company = Session["company"] as Company;
            JobPost jobPost = new JobPost
            {
                Title       = Title,
                Description = Description,
                StartDate   = StartDate.Date,
                EndDate     = EndDate.Date,
                JobTitle    = JobTitle,
                workHours   = workHours,
                Address     = Address,
                company     = company,
                jobCategory = jobCategory
            };

            try
            {
                client.CreateJobPost(jobPost);
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Inialization of the data
        /// </summary>
        public void Init()
        {
            WorkHours z = new WorkHours(TimeSpan.Zero, TimeSpan.Zero);

            AddNanny(new Nanny(123451234, "Mor", "Cohen", new DateTime(1994, 12, 2), "Jerusalem, Israel", 8, 24, 100, new bool[] { true, false, false, true, false, false },
                               new WorkHours[6] {
                new WorkHours(TimeSpan.Zero, new TimeSpan(23, 0, 0)), z, z, new WorkHours(new TimeSpan(1, 0, 0), new TimeSpan(23, 0, 0)), z, z
            },
                               27, 1500, "054-1231234", true, 2, 2, true, true, "Very good nanny"));
            AddNanny(new Nanny(398734128, "Miri", "Factor", new DateTime(1995, 3, 23), "Ben Zakai 25, Rishon LeTsiyon, Israel", 1, 3, 36, new bool[] { false, false, true, false, false, true },
                               new WorkHours[6] {
                z, z, new WorkHours(new TimeSpan(12, 0, 0), new TimeSpan(20, 0, 0)), z, z, new WorkHours(new TimeSpan(10, 0, 0), new TimeSpan(15, 0, 0))
            },
                               29, 2300, "057-3453535", true, 5, 3, true, false));
            AddMother(new Mother(274857123, "Galia", "Nagar", "pinkhas zekharya 24, rishon lezion, israel", "rishon lezion, israel", new bool[] { true, false, false, true, false, false },
                                 new WorkHours[6] {
                new WorkHours(new TimeSpan(15, 0, 0), new TimeSpan(20, 0, 0)), z, z, new WorkHours(new TimeSpan(15, 0, 0), new TimeSpan(18, 0, 0)), z, z
            },
                                 false, "032-2345674"));
            AddMother(new Mother(123123123, "Shoshy", "Smith", "Rabbi Meir Street 12, Tel Aviv-Yafo, Israel", null, new bool[] { false, false, true, false, true, true },
                                 new WorkHours[6] {
                z, z, new WorkHours(new TimeSpan(10, 0, 0), new TimeSpan(15, 0, 0)), z, new WorkHours(new TimeSpan(18, 0, 0), new TimeSpan(22, 0, 0)), new WorkHours(new TimeSpan(10, 0, 0), new TimeSpan(15, 0, 0))
            },
                                 true, "03-9582615"));
            AddChild(new Child(234875912, 274857123, "Gili", new DateTime(2012, 4, 15), true, "Need a lot of tzumy"));
            AddChild(new Child(829347234, 123123123, "RL", new DateTime(2017, 2, 24)));
            AddChild(new Child(546987244, 123123123, "BD", new DateTime(2017, 9, 29)));
            AddContract(new Contract(123451234, 234875912, 274857123, new DateTime(2018, 2, 1), new DateTime(2018, 6, 1), true));
        }
Esempio n. 6
0
        public static async Task <string> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage Request, TraceWriter log, ExecutionContext context)
        {
            try
            {
                // Get request body
                dynamic requestData = await Request.Content.ReadAsAsync <object>();

                //var objectIdentifier = data.userContext.Principal.FindFirst(ObjectIdentifierType).Value;
                Helpers.HelperMethods helperMethods  = new Helpers.HelperMethods(context);
                TimezoneHelper        timezoneHelper = new TimezoneHelper(helperMethods.getTimeTrackerOptions());
                var    editedHours    = requestData.data;
                string userIdentifier = Request.Headers.Authorization.Parameter.ToString();

                WorkHours           workHours           = editedHours.ToObject <WorkHours>();
                WorkHoursRepository workHoursRepository = helperMethods.GetWorkHoursRepository(userIdentifier);
                await workHoursRepository.SaveItemAsync(workHours);

                return("Procesed");
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null?ex.InnerException.ToString() : ex.Message;

                log.Info(message + " occurred in SaveHoursByDate : " + DateTime.Now);
                return(message);
            }
        }
Esempio n. 7
0
        public RetrieveResponse <WorkHours> RetrieveWorkHours(IDbConnection connection, RetrieveRequest request)
        {
            var entity = new MyRepository().Retrieve(connection, request);

            var workDaysFlds = CabinetWorkDaysRow.Fields;

            var cabinetWorkDays =
                connection.List <CabinetWorkDaysRow>(workDaysFlds.CabinetId ==
                                                     entity.Entity.CabinetId.Value).Select(x => x.WeekDayId);

            var model = new WorkHours
            {
                start = TimeSpan.FromMinutes(entity.Entity.WorkHoursStart ?? 420).ToString(@"hh\:mm"),
                end   = TimeSpan.FromMinutes(entity.Entity.WorkHoursEnd ?? 1200).ToString(@"hh\:mm"),
            };

            model.workDays = new List <Int32> {
                1, 2, 3, 4, 5
            }.ToJson();

            if (cabinetWorkDays.Any())
            {
                model.workDays = cabinetWorkDays.OrderBy(s => s).ToJson();
            }

            var response = new RetrieveResponse <WorkHours>();

            response.Entity = model;

            return(response);
        }
Esempio n. 8
0
        public static WorkHours HoursToday()
        {
            WorkHours wh         = new WorkHours();
            double    hoursToday = 0;
            string    logType    = "System";

            //use this if your are are running the app on the server
            EventLog ev = new EventLog(logType, System.Environment.MachineName);

            //use this if you are running the app remotely
            // EventLog ev = new EventLog(logType, "[youservername]");

            if (ev.Entries.Count <= 0)
            {
                Console.WriteLine("No Event Logs in the Log :" + logType);
            }

            // Loop through the event log records.
            for (int i = ev.Entries.Count - 1; i >= 0; i--)
            {
                EventLogEntry CurrentEntry = ev.Entries[i];

                if (CurrentEntry.InstanceId == 30 && CurrentEntry.TimeGenerated.Date == DateTime.Today)
                {
                    var whhours =
                        Math.Round((DateTime.Now - CurrentEntry.TimeGenerated).TotalHours * 2,
                                   MidpointRounding.AwayFromZero) / 2;
                    wh.Hours     = whhours.ToString();
                    wh.StartTime = RoundToNearest(CurrentEntry.TimeGenerated, TimeSpan.FromMinutes(15));
                    wh.EndTime   = wh.StartTime.AddHours(whhours);
                }
            }
            ev.Close();
            return(wh);
        }
Esempio n. 9
0
        public int saveWorkingHours(WorkHours day)
        {
            int count = 0;

            try
            {
                String Query = "UPDATE college_db.workingDays SET startTime='" + day.Start_Time + "', endTime = '" + day.End_Time + "' WHERE dayOfTheWeek = '" + day.Day_of_the_Week + "';";


                MySqlConnection con = new MySqlConnection(DBConnection.ConnectionString);


                MySqlCommand cmd = new MySqlCommand(Query, con);



                con.Open();
                count = cmd.ExecuteNonQuery();

                con.Close();
            }
            catch (Exception ex)
            {
            }

            return(count);
        }
Esempio n. 10
0
        public async Task InsertWorkHoursAsync(WorkHours workHours)
        {
            try
            {
                using (var connection = new NpgsqlConnection(Configuration.GetConnectionString("AppDbContext")))
                {
                    connection.Open();

                    using (var insert = new NpgsqlCommand(
                               "INSERT INTO \"VendorWorkHours\" (\"ID\", \"VendorID\", \"IsWorking\", \"Day\", \"OpenTime\", \"CloseTime\")" +
                               "VALUES (DEFAULT, @VendorID, @IsWorking, @Day, @OpentTime, @CloseTime)", connection))
                    {
                        insert.Parameters.AddWithValue("@VendorID", workHours.VendorID);
                        insert.Parameters.AddWithValue("@IsWorking", workHours.IsWorking);
                        insert.Parameters.AddWithValue("@Day", workHours.Day);
                        insert.Parameters.AddWithValue("@OpentTime", workHours.OpenTime);
                        insert.Parameters.AddWithValue("@CloseTime", workHours.CloseTime);

                        insert.ExecuteNonQuery();
                    }
                }
            }

            catch (NpgsqlException e)
            {
                await e.ExceptionSender();
            }
        }
Esempio n. 11
0
        private void AddWorkStatus(object sender, RoutedEventArgs e)
        {
            if (EmployeeIDBox.Text.Length == 0 || monthBox.Text.Length == 0 || yearBox.Text.Length == 0 || MaxHoursBox.Text.Length == 0 || ActualHoursBox.Text.Length == 0 || MaxSalaryBox.Text.Length == 0)
            {
                MessageBox.Show("Fill all fields!");
            }
            else
            {
                using (AccountingSystemContext repository = new AccountingSystemContext())
                {
                    Months currentMonth       = (Months)Enum.Parse(typeof(Months), monthBox.Text);
                    int    currentEmployeeId  = Int32.Parse(EmployeeIDBox.Text);
                    int    currentYear        = Int32.Parse(yearBox.Text);
                    int    currentMaxHours    = Int32.Parse(MaxHoursBox.Text);
                    int    currentMaxSalary   = Int32.Parse(MaxSalaryBox.Text);
                    int    currentActualHours = Int32.Parse(ActualHoursBox.Text);
                    var    currentEmployee    = repository.Employees.First(x => x.ID == currentEmployeeId);
                    currentWorkHours = new WorkHours(currentEmployee, currentMonth, currentYear, currentMaxHours, currentMaxSalary, currentActualHours);
                    repository.WorkHourses.Add(currentWorkHours);

                    repository.SaveChanges();
                }
                ActualSalaryBlock.Text = currentWorkHours.ActualSalary.ToString();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// clone nanny
        /// </summary>
        /// <returns>clone nanny object</returns>
        public Nanny Clone()
        {
            Nanny nanny = (Nanny)MemberwiseClone();

            nanny.IsWork    = (bool[])IsWork.Clone();
            nanny.WorkHours = (TimeSpan[][])WorkHours.Clone();
            return(nanny);
        }
Esempio n. 13
0
        public List <WorkHours> getWorkingHours()
        {
            List <WorkHours> workDays = new List <WorkHours>();

            try
            {
                string          Query = "SELECT * FROM college_db.workingDays;";
                MySqlConnection con   = new MySqlConnection(DBConnection.ConnectionString);

                MySqlCommand    cmd = new MySqlCommand(Query, con);
                MySqlDataReader myReader;
                con.Open();
                myReader = cmd.ExecuteReader();
                List <WorkHours> weekdayArray = new List <WorkHours>();

                while (myReader.Read())
                {
                    WorkHours day = new WorkHours();

                    day.Day_of_the_Week = myReader["dayOfTheWeek"].ToString();
                    day.Start_Time      = myReader["startTime"].ToString();
                    day.End_Time        = myReader["endTime"].ToString();

                    weekdayArray.Add(day);
                }

                con.Close();


                var daysOfWeek = weekdayArray.ToArray().Select(str => str.Day_of_the_Week.ToDayOfWeek()).OrderBy(dow => dow);

                foreach (var day in daysOfWeek)
                {
                    WorkHours workDay = new WorkHours();

                    workDay.Day_of_the_Week = day.ToString();

                    foreach (WorkHours days in weekdayArray)
                    {
                        if (day.ToString() == days.Day_of_the_Week)
                        {
                            workDay.Start_Time = days.Start_Time;
                            workDay.End_Time   = days.End_Time;
                            break;
                        }
                    }



                    workDays.Add(workDay);
                }
            }
            catch (Exception ex)
            {
            }

            return(workDays);
        }
Esempio n. 14
0
 /// <summary>
 /// Default for Nanny
 /// </summary>
 public Nanny()
 {
     hoursOnDay = new WorkHours[6];
     for (int i = 0; i < 6; i++)
     {
         hoursOnDay[i] = new WorkHours();
     }
     birthdate = DateTime.Now.AddYears(-18);
     workOnDay = new bool[6];
 }
        public int SaveWorkingHours(WorkHours day)
        {
            int count = 0;

            try
            {
                DBConnection.OpenConnection();
                SqlCommand cmd  = new SqlCommand(CommonConstants.QUERY_SAVE_WORK_HOURS, DBConnection.DatabaseConnection);
                SqlCommand cmd2 = new SqlCommand(CommonConstants.QUERY_REMOVE_TIMESLOTS_BY_DAY, DBConnection.DatabaseConnection);


                cmd.Parameters.AddWithValue(CommonConstants.PARAMETER_START_TIME, day.GetStart_Time());
                cmd.Parameters.AddWithValue(CommonConstants.PARAMETER_END_TIME, day.GetEnd_Time());
                cmd.Parameters.AddWithValue(CommonConstants.PARAMETER_DAY_OF_THE_WEEK, day.GetDay_of_the_Week());

                cmd2.Parameters.AddWithValue(CommonConstants.PARAMETER_DAY_OF_THE_WEEK, day.GetDay_of_the_Week());


                count = cmd.ExecuteNonQuery();


                int count2 = cmd2.ExecuteNonQuery();

                if (count2 == -1 || count == -1)
                {
                    count = -1;
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Console.WriteLine(ex);
                    DBConnection.CloseConnection();
                }
                catch (Exception)
                {
                    throw;
                }
                return(-1);
            }
            finally
            {
                try
                {
                    DBConnection.CloseConnection();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(count);
        }
Esempio n. 16
0
 public async Task AddWorkHoursAsync(WorkHours workHours)
 {
     try
     {
         _context.VendorWorkHours.Add(workHours);
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateException e)
     {
         await e.ExceptionSender();
     }
 }
Esempio n. 17
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (daysListBox.SelectedItem == null)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Please Enter Required Fields", "Validation Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;

                DateTime startTime = DateTime.Parse(startTimePicker.Value.ToString());
                DateTime endTime   = DateTime.Parse(endTimePicker.Value.ToLongTimeString());



                if (startTime.Hour >= endTime.Hour)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("Please Enter Valid Working Hours", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    Cursor.Current = Cursors.WaitCursor;

                    WorkHours day = new WorkHours();

                    day.SetDay_of_the_Week(daysListBox.SelectedItem.ToString());

                    day.SetStart_Time(startTimePicker.Value.ToLongTimeString());
                    day.SetEnd_Time(endTimePicker.Value.ToLongTimeString());

                    Console.WriteLine(day.GetStart_Time());

                    int count = cntrl.SaveWorkingHours(day);

                    Cursor.Current = Cursors.Default;

                    if (count != -1)
                    {
                        MessageBox.Show("Working Hours Saved SuccessFully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Error Occurred", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    Cursor.Current = Cursors.WaitCursor;
                    LoadData();
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Esempio n. 18
0
 public async Task ChangeWorkHoursAsync(WorkHours workHours)
 {
     try
     {
         var row = _context.VendorWorkHours.FirstOrDefault(x => x.VendorID == workHours.VendorID && x.Day == workHours.Day);
         workHours.SetWorkHours(row);
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateException e)
     {
         await e.ExceptionSender();
     }
 }
Esempio n. 19
0
        public static bool Working(this WorkHours obj, DateTime from, DateTime to)
        {
            var working = true;

            if (obj != null)
            {
                var today = obj?.WholeWeek?[from.DayOfWeek];
                if (today != null)
                {
                    working = today.StartTime.Hour <from.Hour && today.EndTime.Hour> from.Hour;
                }
            }
            return(obj.IsWorking && working);
        }
Esempio n. 20
0
        public static WorkHours ToNormalWorkHovers(this GoogleApi.Entities.Places.Details.Response.OpeningHours p, Venue venue)
        {
            if (p == null)
            {
                return(null);
            }
            var vh = new WorkHours(null, p.OpenNow, venue);

            vh.WorkTimes = (from _ in p.Periods
                            let start = DateTime.MinValue.AddHours((double)(Convert.ToInt32(_.Open?.Time ?? "0") / 100)).AddMinutes((double)(Convert.ToInt32(_.Open?.Time ?? "0") % 100))
                                        let end = DateTime.MinValue.AddHours((double)(Convert.ToInt32(_.Close?.Time ?? "0") / 100)).AddMinutes((double)(Convert.ToInt32(_.Close?.Time ?? "0") % 100))
                                                  select new WorkTime(start, end, vh)).ToList();
            return(vh);
        }
        public WorkHours GetWorkHoursByDay(string day)
        {
            WorkHours workHours = new WorkHours();

            try
            {
                workHours.SetDay_of_the_Week(day);

                DBConnection.OpenConnection();
                SqlCommand cmd = new SqlCommand(CommonConstants.QUERY_GET_START_AND_END_TIME_BY_DAY, DBConnection.DatabaseConnection);
                cmd.Parameters.AddWithValue(CommonConstants.PARAMETER_DAY_OF_THE_WEEK, workHours.GetDay_of_the_Week());

                SqlDataReader myReader = cmd.ExecuteReader();

                while (myReader.Read())
                {
                    workHours.SetStart_Time(myReader[CommonConstants.COLUMN_START_TIME].ToString());
                    workHours.SetEnd_Time(myReader[CommonConstants.COLUMN_END_TIME].ToString());
                }

                myReader.Close();
            }
            catch (Exception ex)
            {
                try
                {
                    Console.WriteLine(ex);
                    DBConnection.CloseConnection();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            finally
            {
                try
                {
                    DBConnection.CloseConnection();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(workHours);
        }
Esempio n. 22
0
        WorkHours[] convertWorkHours(XElement x)
        {
            WorkHours[] wh = new WorkHours[6];
            int         i  = 0;

            foreach (var item in x.Elements())
            {
                TimeSpan start = TimeSpan.Parse(item.Element("StartHour").Value);
                TimeSpan end   = TimeSpan.Parse(item.Element("EndHour").Value);
                bool     day   = Convert.ToBoolean(item.Element("DayWork").Value);
                wh[i] = new WorkHours(start, end, day);
                i++;
            }

            return(wh);
        }
Esempio n. 23
0
        public string SaveWorksheet()
        {
            // Save worksheet in Database
            worksheetRepository.Update(GetWorksheet());

            //After saving to the database, create a PDF and return its path to view.
            BuildPDF buildPDF = new BuildPDF();

            buildPDF.InsertNewLine(24f, BuildPDF.TextAlignment.Center, "Arbejdsseddel nr.: " + WorksheetID);
            buildPDF.InsertNewLine(16f, "  ");
            buildPDF.InsertNewLine(16f, "Kundeinformationer: ");
            buildPDF.InsertNewSplitLine(14f, Customer.Name.FullName, "Startdato: " + StartDate.ToShortDateString());
            buildPDF.InsertNewSplitLine(14f, Customer.Address.Street, "Starttid: " + StartTime);
            buildPDF.InsertNewSplitLine(14f, Customer.Address.ZIPcode + " " + Customer.Address.City, "Slutdato: " + EndDate.ToShortDateString());
            buildPDF.InsertNewSplitLine(14f, "Tel. nr.: " + Customer.PhoneNumber, "Sluttid: " + EndTime);
            buildPDF.InsertNewSplitLine(14f, "Email: " + Customer.Email, "");
            buildPDF.InsertNewSplitLine(14f, "Kundenr.: " + Customer.ID, "Arbejdssted: " + Workplace);
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Ønskes udført: ");
            buildPDF.InsertNewTextBlock(14f, BuildPDF.TextAlignment.Left, WorkDescription);
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Tilknyttede montører: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "MedarbejderID", "Navn", "Kvalifikation"
            },
                                    AssignedEmployees.AsEnumerable()
                                    );
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Udførte arbejdstimer: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "MedarbejderID", "Navn", "Antal timer", "Type", "Dato"
            },
                                    WorkHours.AsEnumerable()
                                    );
            buildPDF.InsertNewLine(24f, "");
            buildPDF.InsertNewLine(16f, "Brugte materialer: ");
            buildPDF.InsertNewTable(14f, 2,
                                    new List <string> {
                "Varenummer", "Type", "Beskrivelse"
            },
                                    Materials.AsEnumerable()
                                    );

            return(buildPDF.Save("Arbejdsseddel_" + WorksheetID + ".pdf"));
        }
Esempio n. 24
0
        /// <summary>
        /// Проверяет будет ли одобрена премия, а также даёт полную информацию по этому вопрпосу.
        /// </summary>
        /// <param name="profession"> Объект перечисления, с которым нужно сравнить отработанные часы </param>
        /// <param name="hours"> Отработанные часы </param>
        /// <returns> Информация о работе определённого сотрудника (должность, рабочий норматив, отработааные часы, одобрена ли премия) </returns>
        static string AskForBonus(WorkHours profession, int hours)
        {
            string message = "";

            switch (profession)
            {
            case WorkHours.Administrator:
                message = "Администратор";
                break;

            case WorkHours.Assistant:
                message = "Консультант";
                break;

            case WorkHours.Cleaner:
                message = "Тех.персонал";
                break;

            case WorkHours.Guard:
                message = "Охранник";
                break;

            case WorkHours.Manager:
                message = "Управляющий";
                break;

            case WorkHours.Merchandiser:
                message = "Мерчендайзер";
                break;

            case WorkHours.Seller:
                message = "Продавец";
                break;
            }

            if (hours > (int)profession)
            {
                message += $" \tПоложено часов: {(int)profession} \tОтработанно часов: {hours} \tПремия: Одобрено\n";
            }
            else
            {
                message += $" \tПоложено часов: {(int)profession} \tОтработанно часов: {hours} \tПремия: Неодобрено\n";
            }

            return(message);
        }
Esempio n. 25
0
 public IHttpContext workhourDelete(IHttpContext context, string workhourId)
 {
     try
     {
         if (!context.token().hasPermission("workhour.write"))
         {
             context.Response.StatusCode = HttpStatusCode.NotFound;
             context.Response.SendResponse("");
             return(context);
         }
         WorkHours.delete(uint.Parse(workhourId));
         context.Response.SendResponse("");
     }
     catch (Exception ex)
     {
         context.Response.StatusCode = HttpStatusCode.InternalServerError;
         context.Response.SendResponse(ex.Message);
     }
     return(context);
 }
Esempio n. 26
0
        public IHttpContext workhourGet(IHttpContext context, string workhourId)
        {
            try
            {
                if (!context.token().hasPermission("workhour.read"))
                {
                    context.Response.StatusCode = HttpStatusCode.NotFound;
                    context.Response.SendResponse("");
                    return(context);
                }
                WorkHours wrkhrs = WorkHours.get(uint.Parse(workhourId));

                context.Response.SendResponse(JsonConvert.SerializeObject(wrkhrs));
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = HttpStatusCode.InternalServerError;
                context.Response.SendResponse(ex.Message);
            }
            return(context);
        }
Esempio n. 27
0
        public IHttpContext workhourList(IHttpContext context)
        {
            try
            {
                if (!context.token().hasPermission("workhour.read"))
                {
                    context.Response.StatusCode = HttpStatusCode.NotFound;
                    context.Response.SendResponse("");
                    return(context);
                }
                var data = context.Request.QueryString;

                var workhours = WorkHours.list();

                context.Response.SendResponse(JsonConvert.SerializeObject(workhours));
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = HttpStatusCode.InternalServerError;
                context.Response.SendResponse(ex.Message);
            }
            return(context);
        }
Esempio n. 28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            WorkHours day = new WorkHours();

            day.Day_of_the_Week = daysListBox.SelectedItem.ToString();

            day.Start_Time = startTimePicker.Value.ToShortTimeString();
            day.End_Time   = endTimePicker.Value.ToShortTimeString();

            Console.WriteLine(day.Start_Time);

            int count = cntrl.saveWorkingHours(day);

            if (count != -1)
            {
                MessageBox.Show("Working Hours Saved SuccessFully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Error Occurred", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            loadData();
        }
Esempio n. 29
0
 /// <summary>
 /// Updates the given WorkHours object in the database.
 /// </summary>
 /// <param name="obj"></param>
 public void UpdateWorkHours(WorkHours obj)
 {
     workHoursCtr.Update(obj);
 }
Esempio n. 30
0
 /// <summary>
 /// Creates the given WorkHours object in the database.
 /// </summary>
 /// <param name="obj"></param>
 public void CreateWorkHours(WorkHours obj)
 {
     workHoursCtr.Create(obj);
 }