Beispiel #1
0
        public List <OfficialShift> Get(string mahrozet)
        {
            string []     arr    = mahrozet.Split('|');
            int           Unitid = Convert.ToInt32(arr[2]);
            OfficialShift OS     = new OfficialShift();

            return(OS.GetEmptyOfficial(Unitid, arr[0], arr[1]));
        }
Beispiel #2
0
 public void PutCheckHours([FromBody] OfficialShift o, string idbefore)
 {
     o.PutMish(idbefore);
 }
Beispiel #3
0
        // PUT api/<controller>/5

        public void Put([FromBody] OfficialShift OS)
        {
            OS.UpdateOfficialShift();
        }
Beispiel #4
0
 public bool Post([FromBody] OfficialShift o)
 {
     return(o.CheckLongBreak());
 }
Beispiel #5
0
        // POST api/<controller>
        public void Post([FromBody] List <OfficialShift> OffShiftArr)
        {
            OfficialShift OS = new OfficialShift();

            OS.InsertOffShift(OffShiftArr);
        }
Beispiel #6
0
        public List <OfficialShift> GeAllunits(int unit, string id)
        {
            OfficialShift OS = new OfficialShift();

            return(OS.getShiftFromAllOrgan(unit, id));
        }
Beispiel #7
0
        public List <OfficialShift> GetWorkSchdual(int unit)
        {
            OfficialShift OS = new OfficialShift();

            return(OS.GetWorkSchdual(unit));
        }
Beispiel #8
0
        public List <OfficialShift> Get(DateTime start, DateTime end, int unit)
        {
            OfficialShift OS = new OfficialShift();

            return(OS.GetallShifts(start, end, unit));
        }
Beispiel #9
0
        public List <OfficialShift> Get(int Unitid)
        {
            OfficialShift OS = new OfficialShift();

            return(OS.GetOS(Unitid));
        }
Beispiel #10
0
        public User GuideInfo(string Userid, bool preprdness)
        {
            User              Os            = new User();
            double            extra         = 0;
            double            normal        = 0;
            SqlConnection     con           = null;
            List <Constraint> ConstList     = getConstraintM();
            float             RegularShift  = ConstList[6].ConstraintValue;
            float             SpeNightShift = ConstList[7].ConstraintValue;

            try
            {
                string sMonth = DateTime.Now.ToString("MM");
                string year   = DateTime.Today.Year.ToString();

                con = connect("DBConnectionString");

                String        selectSTR = "select * from OfficialShift_2020 where UserId = " + Userid + " and ShiftDate > '" + year + "-" + sMonth + "-" + "01'";
                SqlCommand    cmd       = new SqlCommand(selectSTR, con);
                SqlDataReader dr        = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    OfficialShift OffiS = new OfficialShift();
                    OffiS.Shifttype = (string)dr["ShiftType"];
                    TimeSpan myTimeSpan = ((dr).GetTimeSpan(dr.GetOrdinal("StartShift")));
                    OffiS.Startshifthour = new DateTime(myTimeSpan.Ticks);
                    myTimeSpan           = ((dr).GetTimeSpan(dr.GetOrdinal("EndShift")));
                    OffiS.Endshifthour   = new DateTime(myTimeSpan.Ticks);
                    TimeSpan interval = OffiS.Endshifthour - OffiS.Startshifthour;
                    double   x        = interval.TotalHours;
                    if (preprdness == true && OffiS.Shifttype == "לילה")
                    {
                        double x1 = 0.0;
                        if (x < 0)
                        {
                            x1 = x + 24.0;
                        }
                        else if (x > 0)
                        {
                            x1 = x;
                        }
                        if (x1 > SpeNightShift)
                        {
                            normal += SpeNightShift;
                            extra  += x1 - SpeNightShift;
                        }
                        else
                        {
                            normal += x1;
                            extra  += 0.0;
                        }
                    }
                    else
                    {
                        if (x > RegularShift)
                        {
                            normal += RegularShift;
                            extra  += x - RegularShift;
                        }
                        else
                        {
                            normal += x;
                            extra  += 0.0;
                        }
                    }
                    Os.MonthlyHours      = normal;
                    Os.MonthlyExtraHours = extra;
                }
                return(Os);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }