public static TSBCouponTransaction GetInitial(TSB tsb)
        {
            if (null == tsb)
            {
                return(null);
            }
            lock (sync)
            {
                string cmd = string.Empty;
                cmd += "SELECT TSBCouponTransaction.* ";
                cmd += "     , TSB.TSBNameEN, TSB.TSBNameTH ";
                cmd += "  FROM TSBCouponTransaction, TSB ";
                cmd += " WHERE TSBCouponTransaction.TSBId = TSB.TSBId ";
                cmd += "   AND TSBCouponTransaction.TSBId = ? ";
                cmd += "   AND TSBCouponTransaction.TransactionType = ? ";

                var ret = NQuery.Query <FKs>(cmd,
                                             tsb.TSBId, TransactionTypes.Initial).FirstOrDefault();
                TSBCouponTransaction inst;
                if (null == ret)
                {
                    inst = Create();
                    tsb.AssignTo(inst);
                    inst.TransactionType = TransactionTypes.Initial;
                }
                else
                {
                    inst = ret.ToTSBCouponTransaction();
                }
                return(inst);
            }
        }
Пример #2
0
        public static LanePayment Create(Lane lane, User collector,
                                         Payment payment, DateTime date, decimal amount)
        {
            LanePayment inst = Create();
            TSB         tsb  = TSB.GetCurrent();

            if (null != tsb)
            {
                tsb.AssignTo(inst);
            }
            if (null != lane)
            {
                lane.AssignTo(inst);
            }
            if (null != collector)
            {
                collector.AssignTo(inst);
            }
            if (null != payment)
            {
                payment.AssignTo(inst);
            }
            inst.PaymentDate = date;
            inst.Amount      = amount;
            return(inst);
        }
Пример #3
0
        public static UserShift Create(Shift shift, User supervisor)
        {
            UserShift inst = Create();
            TSB       tsb  = TSB.GetCurrent();

            if (null != tsb)
            {
                tsb.AssignTo(inst);
            }
            if (null != shift)
            {
                shift.AssignTo(inst);
            }
            if (null != supervisor)
            {
                supervisor.AssignTo(inst);
            }
            return(inst);
        }
Пример #4
0
        public static LaneAttendance Create(Lane lane, User supervisor)
        {
            LaneAttendance inst = Create();
            TSB            tsb  = TSB.GetCurrent();

            if (null != tsb)
            {
                tsb.AssignTo(inst);
            }
            if (null != lane)
            {
                lane.AssignTo(inst);
            }
            if (null != supervisor)
            {
                supervisor.AssignTo(inst);
            }
            return(inst);
        }