Exemple #1
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;
            }
        }
Exemple #2
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("次の品番を入力してね");
            }
        }
Exemple #3
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 #4
0
        public IActionResult Put(int id, [FromBody] Item item)
        {
            var toUpdate = _itemDao.Find(id);

            if (toUpdate == null)
            {
                _itemDao.Add(item);
                return(new CreatedResult($"/api/items/{item.Id}", item));
            }

            toUpdate.Name        = item.Name;
            toUpdate.Description = item.Description;

            _itemDao.Update(toUpdate);
            return(new OkResult());
        }
Exemple #5
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 #6
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 #7
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();
        }