Esempio n. 1
0
        public shop_daily_sale alter_shop_daily_sale()
        {
            try
            {
                shop_daily_sale prev_shop_daily_sale = db.shop_daily_sales.SingleOrDefault(a => a.id == shop_daily_sale.id);

                prev_shop_daily_sale.balance     = shop_daily_sale.balance;
                prev_shop_daily_sale.cancelled   = shop_daily_sale.cancelled;
                prev_shop_daily_sale.commision   = shop_daily_sale.commision;
                prev_shop_daily_sale.date        = shop_daily_sale.date;
                prev_shop_daily_sale.date_posted = shop_daily_sale.date_posted;
                prev_shop_daily_sale.islocked    = shop_daily_sale.islocked;
                prev_shop_daily_sale.isverified  = shop_daily_sale.isverified;
                prev_shop_daily_sale.net_balance = shop_daily_sale.net_balance;
                prev_shop_daily_sale.posted_by   = shop_daily_sale.posted_by;
                prev_shop_daily_sale.sales       = shop_daily_sale.sales;
                prev_shop_daily_sale.shop        = shop_daily_sale.shop;
                prev_shop_daily_sale.stake       = shop_daily_sale.stake;
                prev_shop_daily_sale.winnings    = shop_daily_sale.winnings;


                db.SubmitChanges();
                return(shop_daily_sale);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 2
0
 public shop_daily_sale find_shop_daily_sale_By_AppId(string Appid)
 {
     try
     {
         shop_daily_sale = db.shop_daily_sales.SingleOrDefault(a => a.app_id == Appid);
         return(shop_daily_sale);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 3
0
 public shop_daily_sale find_shop_daily_sale_By_ID(int id)
 {
     try
     {
         shop_daily_sale = db.shop_daily_sales.SingleOrDefault(a => a.id == id);
         return(shop_daily_sale);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 4
0
 public shop_daily_sale delete_shop_daily_sale()
 {
     try
     {
         shop_daily_sale prev_shop_daily_sale = db.shop_daily_sales.SingleOrDefault(a => a.id == shop_daily_sale.id);
         db.shop_daily_sales.DeleteOnSubmit(prev_shop_daily_sale);
         return(shop_daily_sale);
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public void computeSales()
        {
            if (hasMasterSale())
            {
                mstake          = (decimal)mastersales.Sum(a => a.stake);
                msales          = (decimal)mastersales.Sum(a => a.sales);
                mwinnings       = (decimal)mastersales.Sum(a => a.winnings);
                mcancelled      = (decimal)mastersales.Sum(a => a.cancelled);
                mbalance        = (decimal)mastersales.Sum(a => a.balance);
                mcommision      = (decimal)mastersales.Sum(a => a.commision);
                mnetbalance     = (decimal)mastersales.Sum(a => a.net_balance);
                msingle_sales   = (decimal)mastersales.Sum(a => a.single_stake_sales);
                msingle_comm    = (decimal)mastersales.Sum(a => a.single_stake_commision);
                mmulti_sales    = msales - msingle_sales;
                mmulti_comm     = mcommision - msingle_comm;
                msingle_percent = (decimal)mastersales.Average(a => a.single_stake_percent);
            }
            else
            {
                msales = mwinnings = mcancelled = mbalance = mcommision = mnetbalance = mstake = Decimal.Zero;
            }
            if (hasShopSale())
            {
                sstake      = (decimal)shopsales.Sum(a => a.stake);
                ssales      = (decimal)shopsales.Sum(a => a.sales);
                swinnings   = (decimal)shopsales.Sum(a => a.winnings);
                scancelled  = (decimal)shopsales.Sum(a => a.cancelled);
                sbalance    = (decimal)shopsales.Sum(a => a.balance);
                scommision  = (decimal)shopsales.Sum(a => a.commision);
                snetbalance = (decimal)shopsales.Sum(a => a.net_balance);
            }
            else
            {
                ssales = swinnings = scancelled = sbalance = scommision = snetbalance = sstake = Decimal.Zero;
            }

            _combinedshopsales = new shop_daily_sale
            {
                stake       = sstake,
                sales       = ssales,
                winnings    = swinnings,
                cancelled   = scancelled,
                balance     = sbalance,
                commision   = scommision,
                net_balance = snetbalance,
                shop1       = shop
            };

            _combinedmastersales = new master_luckyballs_sale
            {
                stake                  = mstake,
                sales                  = msales,
                winnings               = mwinnings,
                cancelled              = mcancelled,
                balance                = mbalance,
                commision              = mcommision,
                net_balance            = mnetbalance,
                shop1                  = shop,
                single_stake_commision = msingle_comm,
                single_stake_percent   = msingle_percent,
                single_stake_sales     = msingle_sales
            };

            cstake      = Decimal.Subtract(mstake, sstake);
            csales      = Decimal.Subtract(msales, ssales);
            cwinnings   = Decimal.Subtract(mwinnings, swinnings);
            ccancelled  = Decimal.Subtract(mcancelled, scancelled);
            cbalance    = Decimal.Subtract(mbalance, sbalance);
            ccommision  = Decimal.Subtract(mcommision, scommision);
            cnetbalance = Decimal.Subtract(mnetbalance, snetbalance);


            _combinedsale = new master_luckyballs_sale
            {
                stake                  = cstake,
                sales                  = csales,
                winnings               = cwinnings,
                cancelled              = ccancelled,
                balance                = cbalance,
                commision              = ccommision,
                net_balance            = cnetbalance,
                shop1                  = _shop,
                single_stake_commision = msingle_comm,
                single_stake_percent   = msingle_percent,
                single_stake_sales     = msingle_sales
            };
            //_combinedmastersales.shop1.shop_code
        }
Esempio n. 6
0
 public shop_daily_sale_crud(shop_daily_sale shop_daily_sale_)
 {
     this.shop_daily_sale_ = shop_daily_sale_;
 }