예제 #1
0
                    public static ByUserShift Create(UserShift shift)
                    {
                        var ret = new ByUserShift();

                        ret.Shift = shift;
                        return(ret);
                    }
예제 #2
0
            public UserShift ToUserShift()
            {
                UserShift inst = new UserShift();

                this.AssignTo(inst); // set all properties to new instance.
                return(inst);
            }
예제 #3
0
 public static List <LanePayment> Search(UserShift shift)
 {
     if (null == shift)
     {
         return(new List <LanePayment>());
     }
     lock (sync)
     {
         string cmd = string.Empty;
         cmd += "SELECT LanePayment.* ";
         cmd += "     , TSB.TSBNameEN, TSB.TSBNameTH ";
         cmd += "     , PlazaGroup.PlazaGroupNameEN, PlazaGroup.PlazaGroupNameTH, PlazaGroup.Direction ";
         cmd += "     , Plaza.PlazaNameEN, Plaza.PlazaNameTH ";
         cmd += "     , Lane.LaneNo ";
         cmd += "     , User.FullNameEN, User.FullNameTH ";
         cmd += "     , Payment.PaymentNameEN, User.PaymentNameTH ";
         cmd += "  FROM LanePayment, TSB, PlazaGroup, Plaza, Lane, User, Payment ";
         cmd += " WHERE PlazaGroup.TSBId = TSB.TSBId ";
         cmd += "   AND Plaza.TSBId = TSB.TSBId ";
         cmd += "   AND Plaza.PlazaGroupId = PlazaGroup.PlazaGroupId ";
         cmd += "   AND Lane.TSBId = TSB.TSBId ";
         cmd += "   AND Lane.PlazaGroupId = PlazaGroup.PlazaGroupId ";
         cmd += "   AND Lane.PlazaId = Plaza.PlazaId ";
         cmd += "   AND LanePayment.TSBId = TSB.TSBId ";
         cmd += "   AND LanePayment.PlazaGroupId = PlazaGroup.PlazaGroupId ";
         cmd += "   AND LanePayment.PlazaId = Plaza.PlazaId ";
         cmd += "   AND LanePayment.LaneId = Lane.LaneId ";
         cmd += "   AND LanePayment.UserId = User.UserId ";
         cmd += "   AND LanePayment.PaymentId = Payment.PaymentId ";
         cmd += "   AND LanePayment.Begin >= ? ";
         cmd += "   AND LanePayment.End <= ? ";
         return(NQuery.Query <FKs>(cmd, shift.Begin, shift.End,
                                   DateTime.MinValue).ToList <LanePayment>());
     }
 }
예제 #4
0
                public static PlazaShift Create(UserShift shift, PlazaGroup plazaGroup)
                {
                    var ret = new PlazaShift();

                    ret.Shift      = shift;
                    ret.PlazaGroup = plazaGroup;
                    return(ret);
                }
예제 #5
0
                    public static ByUserShift Create(UserShift shift, PlazaGroup plazaGroup,
                                                     DateTime revenueDate)
                    {
                        var ret = new ByUserShift();

                        ret.Shift       = shift;
                        ret.PlazaGroup  = plazaGroup;
                        ret.RevenueDate = revenueDate;
                        return(ret);
                    }
예제 #6
0
        public static UserShiftRevenue CreatePlazaRevenue(UserShift shift, PlazaGroup plazaGroup)
        {
            if (null == shift || null == plazaGroup)
            {
                return(null);
            }
            UserShiftRevenue inst = new UserShiftRevenue();

            plazaGroup.AssignTo(inst);
            shift.AssignTo(inst);
            return(inst);
        }
예제 #7
0
        public static UserShiftRevenue GetPlazaRevenue(UserShift shift, PlazaGroup plazaGroup)
        {
            lock (sync)
            {
                if (null == shift || null == plazaGroup)
                {
                    return(null);
                }
                string cmd = string.Empty;

                /*
                 * cmd += "SELECT UserShiftRevenue.* ";
                 * cmd += "     , TSB.TSBNameEN, TSB.TSBNameTH ";
                 * cmd += "     , PlazaGroup.PlazaGroupNameEN, PlazaGroup.PlazaGroupNameTH, PlazaGroup.Direction ";
                 * cmd += "     , Plaza.PlazaNameEN, Plaza.PlazaNameTH ";
                 * cmd += "     , Shift.ShiftNameEN, Shift.ShiftNameTH ";
                 * cmd += "     , User.FullNameEN, User.FullNameTH ";
                 * cmd += "  FROM UserShiftRevenue, TSB, PlazaGroup, Plaza, Shift, User, UserShift ";
                 * cmd += " WHERE PlazaGroup.TSBId = TSB.TSBId ";
                 * cmd += "   AND Plaza.TSBId = TSB.TSBId ";
                 * cmd += "   AND Plaza.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                 * cmd += "   AND UserShift.ShiftId = Shift.ShiftId ";
                 * cmd += "   AND UserShift.UserId = User.UserId ";
                 * cmd += "   AND UserShiftRevenue.TSBId = TSB.TSBId ";
                 * cmd += "   AND UserShiftRevenue.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                 * cmd += "   AND UserShiftRevenue.PlazaId = Plaza.PlazaId ";
                 * cmd += "   AND UserShiftRevenue.ShiftId = Shift.ShiftId ";
                 * cmd += "   AND UserShiftRevenue.UserId = User.UserId ";
                 * cmd += "   AND UserShiftRevenue.UserShiftId = ? ";
                 * cmd += "   AND UserShiftRevenue.PlazaGroupId = ? ";
                 */
                cmd += "SELECT UserShiftRevenue.* ";
                cmd += "     , TSB.TSBNameEN, TSB.TSBNameTH ";
                cmd += "     , PlazaGroup.PlazaGroupNameEN, PlazaGroup.PlazaGroupNameTH, PlazaGroup.Direction ";
                cmd += "     , Shift.ShiftNameEN, Shift.ShiftNameTH ";
                cmd += "     , User.FullNameEN, User.FullNameTH ";
                cmd += "  FROM UserShiftRevenue, TSB, PlazaGroup, Shift, User, UserShift ";
                cmd += " WHERE PlazaGroup.TSBId = TSB.TSBId ";
                cmd += "   AND UserShift.ShiftId = Shift.ShiftId ";
                cmd += "   AND UserShift.UserId = User.UserId ";
                cmd += "   AND UserShiftRevenue.TSBId = TSB.TSBId ";
                cmd += "   AND UserShiftRevenue.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                cmd += "   AND UserShiftRevenue.ShiftId = Shift.ShiftId ";
                cmd += "   AND UserShiftRevenue.UserId = User.UserId ";
                cmd += "   AND UserShiftRevenue.UserShiftId = ? ";
                cmd += "   AND UserShiftRevenue.PlazaGroupId = ? ";
                var ret = NQuery.Query <FKs>(cmd, shift.UserShiftId,
                                             plazaGroup.PlazaGroupId).FirstOrDefault();
                return((null != ret) ? ret.ToUserShiftRevenue() : null);
            }
        }
예제 #8
0
        /// <summary>
        /// Search.
        /// </summary>
        /// <param name="shift">The User Shift instance.</param>
        /// <returns>Returns List of LaneAttendance.</returns>
        public static NDbResult <List <LaneAttendance> > Search(UserShift shift)
        {
            var result          = new NDbResult <List <LaneAttendance> >();
            SQLiteConnection db = Default;

            if (null == db)
            {
                result.DbConenctFailed();
                return(result);
            }
            if (null == shift)
            {
                result.ParameterIsNull();
                return(result);
            }
            lock (sync)
            {
                MethodBase med = MethodBase.GetCurrentMethod();
                try
                {
                    string cmd = string.Empty;
                    cmd += "SELECT * ";
                    cmd += "  FROM LaneAttendanceView ";
                    cmd += " WHERE UserId = ? ";
                    cmd += "   AND (Begin >= ? AND Begin <= ?) ";
                    cmd += "   AND (   (End >= ? AND End <= ?) " +
                           "           OR  End = ?)";
                    cmd += " ORDER BY UserId, Begin";

                    DateTime end  = (shift.End == DateTime.MinValue) ? DateTime.Now : shift.End;
                    var      rets = NQuery.Query <FKs>(cmd,
                                                       shift.UserId,
                                                       shift.Begin, end,
                                                       shift.Begin, end,
                                                       DateTime.MinValue).ToList();
                    var results = rets.ToModels();
                    result.Success(results);
                }
                catch (Exception ex)
                {
                    med.Err(ex);
                    result.Error(ex);
                }
                return(result);
            }
        }
예제 #9
0
        public static List <LaneAttendance> Search(UserShift shift)
        {
            if (null == shift)
            {
                return(new List <LaneAttendance>());
            }
            lock (sync)
            {
                string cmd = string.Empty;

                cmd += "SELECT LaneAttendance.* ";
                cmd += "     , TSB.TSBNameEN, TSB.TSBNameTH ";
                cmd += "     , PlazaGroup.PlazaGroupNameEN, PlazaGroup.PlazaGroupNameTH, PlazaGroup.Direction ";
                cmd += "     , Plaza.PlazaNameEN, Plaza.PlazaNameTH ";
                cmd += "     , Lane.LaneNo ";
                cmd += "     , User.FullNameEN, User.FullNameTH ";
                cmd += "  FROM LaneAttendance, TSB, PlazaGroup, Plaza, Lane, User ";
                cmd += " WHERE PlazaGroup.TSBId = TSB.TSBId ";
                cmd += "   AND Plaza.TSBId = TSB.TSBId ";
                cmd += "   AND Plaza.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                cmd += "   AND Lane.TSBId = TSB.TSBId ";
                cmd += "   AND Lane.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                cmd += "   AND Lane.PlazaId = Plaza.PlazaId ";
                cmd += "   AND LaneAttendance.TSBId = TSB.TSBId ";
                cmd += "   AND LaneAttendance.PlazaGroupId = PlazaGroup.PlazaGroupId ";
                cmd += "   AND LaneAttendance.PlazaId = Plaza.PlazaId ";
                cmd += "   AND LaneAttendance.LaneId = Lane.LaneId ";
                cmd += "   AND LaneAttendance.UserId = User.UserId ";
                cmd += "   AND LaneAttendance.UserId = ? ";
                cmd += "   AND (LaneAttendance.Begin >= ? AND LaneAttendance.Begin <= ?)";
                cmd += "   AND ((LaneAttendance.End >= ? AND LaneAttendance.End <= ?) " +
                       "        OR  LaneAttendance.End = ?)";

                DateTime end = (shift.End == DateTime.MinValue) ? DateTime.Now : shift.End;

                return(NQuery.Query <FKs>(cmd,
                                          shift.UserId,
                                          shift.Begin, end,
                                          shift.Begin, end,
                                          DateTime.MinValue).ToList <LaneAttendance>());
            }
        }
예제 #10
0
        /// <summary>
        /// Create Plaza Revenue.
        /// </summary>
        /// <param name="shift">The UserShift instance.</param>
        /// <param name="plazaGroup">The PlazaGroup instance.</param>
        /// <returns>Returns UserShiftRevenue instance.</returns>
        public static NDbResult <UserShiftRevenue> CreatePlazaRevenue(
            UserShift shift, PlazaGroup plazaGroup)
        {
            var result = new NDbResult <UserShiftRevenue>();

            if (null == shift || null == plazaGroup)
            {
                result.ParameterIsNull();
                result.data = null;
            }
            else
            {
                UserShiftRevenue inst = Create();
                plazaGroup.AssignTo(inst);
                shift.AssignTo(inst);
                result.data = inst;
                result.Success();
            }
            return(result);
        }
예제 #11
0
        /// <summary>
        /// Gets Plaza Revenue.
        /// </summary>
        /// <param name="shift">The Shift instance.</param>
        /// <param name="plazaGroup">The PlazaGroup instance.</param>
        /// <returns>Returns UserShiftRevenue instance.</returns>
        public static NDbResult <UserShiftRevenue> GetPlazaRevenue(
            UserShift shift, PlazaGroup plazaGroup)
        {
            var result          = new NDbResult <UserShiftRevenue>();
            SQLiteConnection db = Default;

            if (null == db)
            {
                result.DbConenctFailed();
                return(result);
            }
            if (null == shift || null == plazaGroup)
            {
                result.ParameterIsNull();
                return(result);
            }
            lock (sync)
            {
                MethodBase med = MethodBase.GetCurrentMethod();
                try
                {
                    string cmd = string.Empty;
                    cmd += "SELECT * ";
                    cmd += "  FROM UserShiftRevenueView ";
                    cmd += " WHERE UserShiftId = ? ";
                    cmd += "   AND PlazaGroupId = ? ";
                    var ret = NQuery.Query <FKs>(cmd,
                                                 shift.UserShiftId, plazaGroup.PlazaGroupId).FirstOrDefault();
                    result.data = (null != ret) ? ret.ToModel() : null;
                    result.Success();
                }
                catch (Exception ex)
                {
                    med.Err(ex);
                    result.Error(ex);
                }
                return(result);
            }
        }
예제 #12
0
        /// <summary>
        /// Search.
        /// </summary>
        /// <param name="shift">The UserShift instance.</param>
        /// <returns>Returns List of LanePayment.</returns>
        public static NDbResult <List <LanePayment> > Search(UserShift shift)
        {
            var result          = new NDbResult <List <LanePayment> >();
            SQLiteConnection db = Default;

            if (null == db)
            {
                result.DbConenctFailed();
                return(result);
            }
            if (null == shift)
            {
                result.ParameterIsNull();
                return(result);
            }
            lock (sync)
            {
                MethodBase med = MethodBase.GetCurrentMethod();
                try
                {
                    string cmd = string.Empty;
                    cmd += "SELECT * ";
                    cmd += "  FROM LanePaymentView ";
                    cmd += " WHERE Begin >= ? ";
                    cmd += "   AND End <= ? ";

                    var rets = NQuery.Query <FKs>(cmd, shift.Begin, shift.End,
                                                  DateTime.MinValue).ToList();
                    var results = rets.ToModels();
                    result.Success(results);
                }
                catch (Exception ex)
                {
                    med.Err(ex);
                    result.Error(ex);
                }
                return(result);
            }
        }