Esempio n. 1
0
        public IList <Entity.line> CountMoney(Entity.line line)
        {
            //得到上机记录的数据
            Factory.Factory     fact      = new Factory.Factory();
            IDal.IQueryline     QueryLine = fact.IqueryLine();
            IList <Entity.line> Lline     = QueryLine.select(line);

            //得到basicdate的数据
            Factory.Factory          factBasic      = new Factory.Factory();
            IDal.IqueryBasicdate     QueryBasicDate = factBasic.IqueryBasicDate();
            IList <Entity.BasicData> LbasicDate     = QueryBasicDate.select(basicDate);

            //计算时间差
            int      ConsumeTime;
            int      ConsumeMoney;
            TimeSpan date = Lline[0].OffDate - Lline[0].LoginDate;
            TimeSpan time = Lline[0].OffTime - Lline[0].LoginTime;
            int      min  = Convert.ToInt16(date.TotalMinutes) + Convert.ToInt16(time.TotalMinutes);

            //比较准备时间
            if (min < LbasicDate[0].PreparyTime)
            {
                ConsumeTime = 0;
            }
            else
            {
                if ((min - LbasicDate[0].PreparyTime) < 30)
                {
                    ConsumeTime = 30;
                }
                else
                {
                    ConsumeTime = min - LbasicDate[0].PreparyTime;
                }
            }
            //计算钱
            if (Lline[0].Status == "固定用户")
            {
                ConsumeMoney = LbasicDate[0].Rate / 2 * (ConsumeTime / 30);
            }

            else
            {
                //if (Lline[0].Status == "临时用户")
                ConsumeMoney = LbasicDate[0].TmpRate / 2 * (ConsumeTime / 30);
            }
            //将金额放入line表中,同时显示到窗体上。
            line.ConsumeMoney = ConsumeMoney;
            line.ConsumeTime  = ConsumeTime;
            line.Money        = (Convert.ToInt16(line.Money) - (Convert.ToInt16(ConsumeMoney)));

            Factory.Factory factLineMoney = new Factory.Factory();
            IDal.IAddLine   AddLineMoney  = factLineMoney.addLine();
            AddLineMoney.IaddLineOffMoney(line);

            IList <Entity.line> lineAll = QueryLine.select(line);

            return(lineAll);
        }
Esempio n. 2
0
        public IList <Entity.BasicData> queryBasicDate(Entity.BasicData basicDate)
        {
            Factory.Factory          fact           = new Factory.Factory();
            IDal.IqueryBasicdate     QuerybasicDate = fact.IqueryBasicDate();
            IList <Entity.BasicData> LbasicDate     = QuerybasicDate.select(basicDate);

            return(LbasicDate);
        }