Exemple #1
0
        public void RefreshStatusBar()
        {
            System.Threading.Thread t = new System.Threading.Thread(
                (delegate() {
                try
                {
                    IItemDao itemDao = GlobalData.getIDao <IItemDao>();
                    string itemcount = itemDao.CountAll().ToString() + "個の商品";
                    string sold = "売上 ¥" + itemDao.SumSellPrice().ToString("#,##0") + "- " + itemDao.CountSoldItem().ToString() + "個";

                    ControlUtil.SafelyOperated(this.statusStrip1,
                                               (MethodInvoker) delegate()
                    {
                        this.status_itemcount.Text = itemcount;
                    });

                    ControlUtil.SafelyOperated(this.statusStrip1,
                                               (MethodInvoker) delegate()
                    {
                        this.status_sold.Text = sold;
                    });
                }
                catch { }
            }));
            t.Start();
        }
Exemple #2
0
        //[Receipts]
        private void renewReceipts()
        {
            this.dataGridView1.Enabled = false;
            this.dataGridView1.Rows.Clear();

            IReceiptDao receiptDao = GlobalData.getIDao <IReceiptDao>();
            IItemDao    itemDao    = GlobalData.getIDao <IItemDao>();


            this.receiptlist = receiptDao.GetAll();

            foreach (Receipt r in this.receiptlist)
            {
                DataGridViewRow row = this.dataGridView1.Rows[this.dataGridView1.Rows.Add()];

                this.setRowValue(row, r);

                //個数 - のこす
                //row.Cells["個数"].Value = itemDao.CountReceiptItem(r.receipt_id);
            }

            dataGridView1.Sort(dataGridView1.Columns[ColumnName.hyouBan], ListSortDirection.Ascending);
            dataGridView1.Enabled = true;

            if (dataGridView1.Rows.Count > 0)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 1;
            }

            this.RefreshStatusBar();
        }
Exemple #3
0
 public void SetUp()
 {
     _itemDao     = Substitute.For <IItemDao>();
     _betDao      = Substitute.For <IBetDao>();
     _userDao     = Substitute.For <IUserDao>();
     _itemManager = SingletonManager.Instance.SetItemManager(new ItemManager(_itemDao, _userDao, _betDao));
 }
 private CatalogService()
 {
     _daoManager  = ServiceConfig.GetInstance().DaoManager;
     _categoryDao = _daoManager[typeof(ICategoryDao)] as ICategoryDao;
     _productDao  = _daoManager[typeof(IProductDao)] as IProductDao;
     _itemDao     = _daoManager[typeof(IItemDao)] as IItemDao;
 }
Exemple #5
0
        private void SellForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.Z)
            {
                if (this.privItem == null)
                {
                    return;
                }

                uint?priv_canceledsellprice = this.privItem.item_sellprice;
                this.privItem.item_sellprice     = privItemSellPrice;
                this.privItem.item_selltime      = privItemSellTime;
                this.privItem.item_sell_operator = privItemSellOperatorId;

                IItemDao idao = GlobalData.getIDao <IItemDao>();
                idao.Update(this.privItem);

                this.setItem(this.privItem);

                this.textBox_baika.Text = priv_canceledsellprice.ToString();
                this.textBox_baika.Focus();
                this.textBox_baika.SelectAll();

                this.privItem = null;
            }
        }
 public BillingService(DaoManager daoManager)
 {
     _daoManager  = daoManager;
     _itemDao     = _daoManager[typeof(IItemDao)] as IItemDao;
     _orderDao    = _daoManager[typeof(IOrderDao)] as IOrderDao;
     _sequenceDao = _daoManager[typeof(ISequenceDao)] as ISequenceDao;
 }
Exemple #7
0
 public ItemMgr(IItemDao entityDao, ICriteriaMgr criteriaMgr, IItemKitMgr itemKitMgr, ISqlHelperDao sqlHelperDao)
     : base(entityDao)
 {
     this.criteriaMgr  = criteriaMgr;
     this.itemKitMgr   = itemKitMgr;
     this.sqlHelperDao = sqlHelperDao;
 }
 public CatalogService(DaoManager daoManager)
 {
     _daoManager  = daoManager;
     _categoryDao = _daoManager[typeof(ICategoryDao)] as ICategoryDao;
     _productDao  = _daoManager[typeof(IProductDao)] as IProductDao;
     _itemDao     = _daoManager[typeof(IItemDao)] as IItemDao;
 }
Exemple #9
0
        private void RefreshRemain()
        {
            System.Threading.Thread t = new System.Threading.Thread(delegate()
            {
                IItemDao itDao = GlobalData.getIDao <IItemDao>();
                UInt32 cnt;

                cnt = itDao.CountNeedKansaItem_NotFlagged();

                ControlUtil.SafelyOperated(this.textBox_remain, (MethodInvoker) delegate()
                {
                    this.textBox_remain.Text = cnt.ToString();
                });

                UInt32 allcnt;
                allcnt = itDao.CountNeedKansaItem();

                ControlUtil.SafelyOperated(this.textBox_allkansa, (MethodInvoker) delegate()
                {
                    this.textBox_allkansa.Text = allcnt.ToString();
                });

                UInt32 sum;
                sum = itDao.SumNeedKansaItem_SellPrice();
                ControlUtil.SafelyOperated(this.textBox_sum, (MethodInvoker) delegate()
                {
                    this.textBox_sum.Text = sum.ToString("#,##0");
                });
            });

            t.IsBackground = true;
            t.Start();
        }
Exemple #10
0
 public ItemMgr(IItemDao entityDao, ICriteriaMgr criteriaMgr, IItemKitMgr itemKitMgr, ISqlHelperDao sqlHelperDao)
     : base(entityDao)
 {
     this.criteriaMgr = criteriaMgr;
     this.itemKitMgr = itemKitMgr;
     this.sqlHelperDao = sqlHelperDao;
 }
Exemple #11
0
        private void textBox_baika_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.curItem == null)
                {
                    return;
                }
                string s = this.textBox_baika.Text;

                uint baika;
                if (s == "-")
                {
                    baika = curItem.item_tagprice;
                }
                else
                {
                    if (!uint.TryParse(s, out baika))
                    {
                        this.textBox_baika_err();
                        return;
                    }
                    if (baika > 999999)
                    {
                        this.textBox_baika_err();
                        return;
                    }
                }

                if (curItem.item_sellprice.HasValue && curItem.item_sellprice.Value == baika)
                {
                }
                else
                {
                    privItem               = curItem;
                    privItemSellPrice      = curItem.item_sellprice;
                    privItemSellTime       = curItem.item_selltime;
                    privItemSellOperatorId = curItem.item_sell_operator;

                    curItem.item_sellprice     = baika;
                    curItem.item_selltime      = DateTime.Now;
                    curItem.item_sell_operator = this.nowOperator.operator_id;


                    Item i = curItem;
                    System.Threading.Thread t = new System.Threading.Thread(
                        delegate(object item)
                    {
                        IItemDao idao = GlobalData.getIDao <IItemDao>();
                        idao.Update((Item)item);
                    }
                        );
                    t.Start(i);
                }

                this.textBox_ban_err("次の品番を入力してね");
            }
        }
        public ItemController(IItemDao dao)
        {
            Dao     = dao;
            _items  = new Dictionary <int, ItemDefinition>();
            Dimmers = new Dictionary <int, DimmerData>();

            ReloadTemplates();
            ReloadHandlers();
        }
 public AddItemView(IItemDao p_itemDao)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     m_presenter = new AddItemPresenter(this, p_itemDao);
     //
     // TODO: Add constructor code after the InitializeComponent() call.
     //
 }
        public AddItemPresenter(IAddItemView p_view, IItemDao p_itemDao)
        {
            m_view = p_view;
            m_itemDao = p_itemDao;

            ItemDataEntity itemDataEntity = new ItemDataEntity();
            ItemViewModel itemViewModel = new ItemViewModel(itemDataEntity);

            m_itemCategoryDao = new ItemCategoryDao();
            m_itemGenericDao = new ItemGenericDao();

            m_viewModel = itemViewModel;
            m_view.ShowItem(m_viewModel);
        }
Exemple #15
0
        private void button_teisei_Click(object sender, EventArgs e)
        {
            if (this.curItem == null)
            {
                return;
            }

            string def;

            if (this.curItem.item_sellprice.HasValue)
            {
                def = this.curItem.item_sellprice.ToString();
            }
            else
            {
                def = "未売却";
            }

            while (true)
            {
                string       res;
                DialogResult dres = InputBox.ShowIntDialog("修正後の売価を入力してください\n商品名: " + this.curItem.item_name, "売価修正", def, out res);

                if (dres == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    uint baika;
                    if (!uint.TryParse(res, out baika))
                    {
                        def = "不正な文字列です";
                        continue;
                    }

                    IItemDao itDao = GlobalData.getIDao <IItemDao>();
                    this.curItem.item_sellprice     = baika;
                    this.curItem.item_selltime      = DateTime.Now;
                    this.curItem.item_sell_operator = this.nowOperator.operator_id;
                    itDao.Update(this.curItem);

                    this.DoKansaItem(itDao.GetItemById(curItem.item_id).First());
                    this.label_error.Text = "金額訂正が完了しました";

                    return;
                }
            }
        }
Exemple #16
0
        private void button_mibai_Click(object sender, EventArgs e)
        {
            if (curItem == null)
            {
                return;
            }

            curItem.item_sellprice = null;
            curItem.item_selltime  = null;

            IItemDao idao = GlobalData.getIDao <IItemDao>();

            idao.Update(curItem);

            this.DoKansaItem(idao.GetItemById(curItem.item_id).First());
            this.label_error.Text = "商品を未売却にしました";
        }
Exemple #17
0
        public void RefreshData()
        {
            IItemDao    iDao  = GlobalData.getIDao <IItemDao>();
            List <Item> items = iDao.GetAll();

            this.itemGroup = (from i in items
                              group i by i.item__Receipt.getSellerString())
                             .OrderByDescending(g => this.countHenpinItems(g));

            this.dataGridView1.Rows.Clear();
            foreach (var g in this.itemGroup)
            {
                DataGridViewRow row = this.dataGridView1.Rows[this.dataGridView1.Rows.Add()];
                this.setRowValue(row, g);
            }

            this.dataGridView1.VirtualMode = true;
            this.dataGridView1.VirtualMode = false;
            this.dataGridView1.Enabled     = true;
            this.dataGridView1.Focus();
        }
Exemple #18
0
        private void button_mibai_Click(object sender, EventArgs e)
        {
            if (curItem == null)
            {
                return;
            }

            privItem               = curItem;
            privItemSellPrice      = curItem.item_sellprice;
            privItemSellTime       = curItem.item_selltime;
            privItemSellOperatorId = curItem.item_sell_operator;

            curItem.item_sellprice = null;
            curItem.item_selltime  = null;

            IItemDao idao = GlobalData.getIDao <IItemDao>();

            idao.Update(curItem);

            this.textBox_ban_err("次の品番を入力してね");
        }
Exemple #19
0
        private void textBox_ban_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string s = this.textBox_ban.Text;
                if (s == null)
                {
                    return;
                }

                uint shinaBan;

                if (Globals.TryParseBarcode(s, out shinaBan))
                {
                }
                else
                {
                    if (!uint.TryParse(this.textBox_ban.Text, out shinaBan))
                    {
                        this.textBox_ban_err("不明な文字列です");
                        return;
                    }
                }

                if (!(0 <= shinaBan && shinaBan <= 999999))
                {
                    this.textBox_ban_err("不正な品番です");
                }

                IItemDao    itemDao = GlobalData.getIDao <IItemDao>();
                List <Item> its     = itemDao.GetItemById(shinaBan);
                if (its.Count == 0)
                {
                    this.textBox_ban_err("品番に該当する商品がありません");
                    return;
                }

                this.DoKansaItem(its[0]);
            }
        }
Exemple #20
0
        public void SetUp()
        {
            _collection     = Substitute.For <IMongoCollection <User> >();
            _collectionItem = Substitute.For <IMongoCollection <Item> >();
            _database       = Substitute.For <IMongoDatabase>();
            _userDao        = new UserDao(_database, _collection);
            _itemDao        = Substitute.For <IItemDao>();
            _user           = new User
            {
                Email = "test", Password = "******", Username = "******", Id = new ObjectId("5c06f4b43cd1d72a48b44237"),
                TotalPointsUsedToBet = 40, Point = 100
            };
            _items = new List <Item>();
            for (var i = 0; i < 2; i++)
            {
                var item = new Item();
                item.Type = Item.Life;
                _items.Add(item);
            }

            for (var i = 0; i < 2; i++)
            {
                var item = new Item();
                item.Type = Item.Bomb;
                _items.Add(item);
            }

            for (var i = 0; i < 2; i++)
            {
                var item = new Item();
                item.Type = Item.Key;
                _items.Add(item);
            }

            _user.Items = _items;
        }
Exemple #21
0
 public ItemManager(IItemDao itemDao = null, IUserDao userDao = null, IBetDao betDao = null)
 {
     _itemDao = itemDao ?? SingletonDao.Instance.ItemDao;
     _userDao = userDao ?? SingletonDao.Instance.UserDao;
     _betDao  = betDao ?? SingletonDao.Instance.BetDao;
 }
Exemple #22
0
 public ItemService(IItemDao dao, ISystemDao systemDao, ITypeDao typeDao)
 {
     this.dao       = dao;
     this.systemDao = systemDao;
     this.typeDao   = typeDao;
 }
Exemple #23
0
 public ItemService(Character character)
 {
     _itemDao   = new ItemDao();
     _character = character;
 }
Exemple #24
0
 public void SetUp()
 {
     _database       = Substitute.For <IMongoDatabase>();
     _collectionItem = Substitute.For <IMongoCollection <Item> >();
     _itemDao        = new ItemDao(_database, _collectionItem);
 }
Exemple #25
0
        public IItemDao SetItemDao(IItemDao itemDao)
        {
            var dynamicCompetitionDaoProxy = new Proxy <IItemDao>(itemDao);

            return(ItemDao = dynamicCompetitionDaoProxy.GetTransparentProxy() as IItemDao);
        }
Exemple #26
0
 public ItemService(Character character, IItemDao itemDao)
 {
     _itemDao   = itemDao;
     _character = character;
 }
Exemple #27
0
 public ItemBaseMgr(IItemDao entityDao)
 {
     this.entityDao = entityDao;
 }
Exemple #28
0
        private void kaedeOutput(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName         = GlobalData.Instance.data.companyName + ".kae";
            sfd.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            sfd.Filter           = "楓ちゃん萌え萌え filez (*.kae)|*.kae";
            sfd.RestoreDirectory = true;

            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            bool zaikouAsOB = false;

            if (MessageBox.Show("在校生の氏名データを残しますか?\n" +
                                "はい・・・全員をOBとして扱います\n" +
                                "いいえ・・・在校生は年組番号で出力します", "在校生の扱い", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                zaikouAsOB = true;
            }


            const string kae_header       = "Kaede chan moemoe software by 51st. ennichi han";
            const int    kae_file_version = 1003;
            const int    kae_version      = 1005; //kaede_rg005

            IItemDao    itemDao = GlobalData.getIDao <IItemDao>();
            List <Item> items   = itemDao.GetAll();

            Dictionary <string, int> exSellers = new  Dictionary <string, int>();
            int exnum = 1;

            foreach (Item it in items)
            {
                if (it.item__Receipt.receipt_seller == Receipt.seller_DONATE ||
                    it.item__Receipt.receipt_seller == Receipt.seller_LAGACY)
                {
                    continue;
                }

                if (it.item__Receipt.receipt_seller == Receipt.seller_EXT || zaikouAsOB)
                {
                    string exname = it.item__Receipt.getSellerString();
                    if (!exSellers.ContainsKey(exname))
                    {
                        exSellers.Add(exname, exnum);
                        exnum++;
                    }
                }
            }

            try
            {
                using (Stream fs = sfd.OpenFile())
                {
                    BinaryWriter bw = new BinaryWriter(fs);

                    bw.Write(Encoding.ASCII.GetBytes(kae_header));
                    bw.Write(kae_file_version);
                    bw.Write(kae_version);

                    //OB
                    bw.Write(exSellers.Count);
                    foreach (var exs in exSellers)
                    {
                        bw.WriteStringSJIS(exs.Key);
                    }

                    //teacher
                    bw.Write(0);

                    //genre
                    bw.Write(0);

                    //shape
                    bw.Write(0);

                    //item
                    bw.Write(items.Count);

                    foreach (Item it in items)
                    {
                        //ID
                        bw.Write((Int32)it.item_id);


                        //Seller
                        Int32 seller;

                        string sellerstr = it.item__Receipt.receipt_seller;

                        switch (sellerstr)
                        {
                        case Receipt.seller_LAGACY:
                        {
                            seller = 0x30000000;
                            break;
                        }

                        case Receipt.seller_DONATE:
                        {
                            seller = 0x40000000;
                            break;
                        }

                        default:
                        {
                            if (sellerstr == Receipt.seller_EXT || zaikouAsOB)
                            {
                                seller = 0x10000000 + exSellers[it.item__Receipt.getSellerString()];
                                break;
                            }

                            int    nen  = int.Parse(sellerstr.Substring(0, 1));
                            string kumi = sellerstr.Substring(1, 1);
                            int    kumi_i;
                            if (Globals.isChugaku(kumi))
                            {
                                kumi_i = Globals.getChugakuClassNum(kumi);
                            }
                            else
                            {
                                nen   += 3;
                                kumi_i = int.Parse(kumi);
                            }
                            int ban = int.Parse(sellerstr.Substring(2, 2));

                            seller = 0x01000000 * nen + 0x00100000 * kumi_i + ban;
                            break;
                        }
                        }

                        bw.Write(seller);

                        bw.WriteStringSJIS(it.item_name);
                        bw.WriteStringSJIS(it.item_comment);

                        bw.Write(it.item_tagprice);
                        bw.Write(it.item_sellprice.ToKaedeInt());

                        //Genre
                        bw.Write((Int16)0);
                        bw.Write((Int16)0);
                        bw.Write((Int16)0);
                        //Shape
                        bw.Write((Int16)0);

                        //is_sold
                        bw.Write(it.item_sellprice.HasValue.ToKaedeBool());
                        //is_returned
                        bw.Write((SByte)0);
                        //to_be_return
                        bw.Write(it.item_return.ToKaedeBool());
                        //to_be_discount
                        bw.Write(it.item_tataki.ToKaedeBool());

                        if (it.item_receipt_time.HasValue)
                        {
                            bw.Write(it.item_receipt_time.Value.ToUnixTime());
                        }
                        else if (it.item__Receipt.receipt_time.HasValue)
                        {
                            bw.Write(it.item__Receipt.receipt_time.Value.ToUnixTime());
                        }
                        else
                        {
                            bw.Write((UInt32)0);
                        }

                        if (it.item_selltime.HasValue)
                        {
                            bw.Write(it.item_selltime.Value.ToUnixTime());
                        }
                        else
                        {
                            bw.Write((UInt32)0);
                        }

                        //Item_scheduled_date
                        bw.Write((SByte)0);
                        //is_by_auction
                        bw.Write((SByte)0);

                        //refund_rate
                        bw.Write((Int32)(-1));
                    }

                    //cash
                    bw.Write((Int32)888);

                    //refund_rate
                    bw.Write((Int32)100);

                    bw.Flush();
                    fs.Close();
                }

                uint[] crcTable = new uint[256];
                for (uint n = 0; n < 256; n++)
                {
                    uint c = n;
                    for (uint k = 0; k < 8; k++)
                    {
                        if ((c & 1) != 0)
                        {
                            c = 0xedb88320U ^ (c >> 1);
                        }
                        else
                        {
                            c = c >> 1;
                        }
                    }
                    crcTable[n] = c;
                }

                using (FileStream fs = new FileStream(sfd.FileName, FileMode.Open, FileAccess.ReadWrite))
                {
                    uint not_crc = 0xffffffff;

                    BinaryReader br = new BinaryReader(fs);

                    while (fs.Position < fs.Length)
                    {
                        byte data = br.ReadByte();
                        not_crc = crcTable[((not_crc) ^ (data)) & 0xff] ^ ((not_crc) >> 8);
                    }


                    BinaryWriter bw = new BinaryWriter(fs);
                    bw.Write(~not_crc);
                    bw.Flush();


                    fs.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("kaeファイルの作成エラー: " + ex.Message);
                return;
            }

            MessageBox.Show("楓ちゃん形式での出力が完了しました。");
        }
Exemple #29
0
 public ItemsController(IItemDao itemDao)
 {
     _itemDao = itemDao;
 }
Exemple #30
0
        private void DoKansaItem(Item it)
        {
            this.curItem = it;

            this.textBox_ban.Text = it.item_id.ToString();

            this.textBox_name.BackColor = SystemColors.Control;
            this.textBox_name.Text      = it.item_name;
            this.textBox_teika.Text     = it.item_tagprice.ToString("#,##0");
            this.textBox_nebiki.Text    = it.item_return /*FIXME*/ ? "×" : "○";

            if (it.item_sellprice.HasValue)
            {
                if (it.item_sellprice.Value == it.item_tagprice)
                {
                    this.textBox_baika.Text = "-- " + it.item_sellprice.Value.ToString();
                }
                else
                {
                    this.textBox_baika.Text = it.item_sellprice.Value.ToString();
                }

                if (it.item_sell__Operator != null)
                {
                    this.textBox_sellop.Text = it.item_sell__Operator.operator_name;
                }
                else
                {
                    this.textBox_sellop.Text = "不明";
                }

                this.textBox_selltime.Text = Globals.getTimeString(it.item_selltime);

                this.button_mibai.Enabled    = true;
                this.button_teisei.Enabled   = true;
                this.textBox_baika.BackColor = SystemColors.Control;


                if (it.item_kansa_end.HasValue)
                {
                    //監査済み
                    this.label_error.Text    = "監査対象ではありません。本日の販売ではない可能性が。";
                    this.label_error.Visible = true;
                }
                else
                {
                    if (this.GetKansaFlag(it).HasValue)
                    {
                        IOperatorDao    opDao = GlobalData.getIDao <IOperatorDao>();
                        List <Operator> lop   = opDao.GetById(this.GetKansaFlag(it).Value);

                        if (lop.Count() == 0)
                        {
                            this.label_error.Text = "だれかが既に監査したようです";
                        }
                        else
                        {
                            this.label_error.Text = lop[0].operator_name + " が既に監査しています";
                        }

                        this.label_error.Visible = true;
                    }
                    else
                    {
                        System.Threading.Thread t = new System.Threading.Thread(
                            delegate(object item)
                        {
                            Item itemmm = (Item)item;
                            this.SetKansaFlag(itemmm, this.nowOperator.operator_id);

                            IItemDao idao = GlobalData.getIDao <IItemDao>();
                            idao.Update(itemmm);
                        }
                            );

                        t.IsBackground = true;
                        t.Start(it);

                        this.label_error.Text = "監査しました。次の品番を入力してね";

                        this.RefreshRemain();
                    }
                }
            }
            else
            {
                this.button_teisei.Enabled   = true;
                this.button_mibai.Enabled    = false;
                this.textBox_baika.Text      = "未売却";
                this.textBox_baika.BackColor = Color.LightPink;
                this.textBox_sellop.Text     = null;
                this.textBox_selltime.Text   = null;

                this.label_error.Text    = "未売却の商品は監査できません";
                this.label_error.Visible = true;
            }

            this.textBox_ban.Focus();
            this.textBox_ban.SelectAll();
        }
Exemple #31
0
 public ItemBaseMgr(IItemDao entityDao)
 {
     this.entityDao = entityDao;
 }