コード例 #1
0
        public Relation GetRelation(Malfunction mal)
        {
            var r1 = (from a in Relations
                      where a.MalfunctionCode == mal.MalfunctionCode
                      select a).FirstOrDefault();

            return(r1);
        }
コード例 #2
0
        private void btnRegist_Click(object sender, EventArgs e)
        {
            if (cbxType.SelectedValue is int ts && cbxShop.SelectedValue is int ss && cbxState.SelectedValue is int es && cbxZaiko.SelectedValue is ZaikoTypes zt)
            {
                Malfunction mar;

                if (ts == 0)
                {
                    MessageBox.Show(this, "種別を選択してください。", "ハードウェア管理");
                    return;
                }

                if (es == 0)
                {
                    MessageBox.Show(this, "状態を選択してください。", "ハードウェア管理");
                    return;
                }

                if (Malfunction == null)
                {
                    mar = new Malfunction();
                    mar.MalfunctionCode = DBAccessor.Instance.MaxUniqueNumber <DBObject.Malfunction>() + 1;
                    mar.InsertTime      = DateTime.Now;
                }
                else
                {
                    mar = Malfunction;
                }

                mar.ShopCode      = ss;
                mar.ItemTypeCode  = ts;
                mar.ItemStateCode = es;
                mar.Name          = txtItemName.Text;
                mar.ModelNo       = txtModelNo.Text;
                mar.Zaiko         = zt;
                mar.UpdateTime    = DateTime.Now;

                DBAccessor.Instance.Malfunctions = DBAccessor.Instance.UpsertJson <Malfunction, DBObject.Malfunction>(mar);

                if (Relation != null)
                {
                    Relation.MalfunctionCode = mar.MalfunctionCode;

                    DBAccessor.Instance.Relations = DBAccessor.Instance.UpsertJson <Relation, DBObject.Relation>(Relation);
                }

                MessageBox.Show(this, "登録しました", "ハードウェア管理");
                this.Visible = false;

                var form = new FormReportTest(mar);
                form.Show();
            }
        }
コード例 #3
0
        public CollectSchedule GetCollectSchedule(Malfunction malfunction)
        {
            var r1 = (from a in Relations
                      where a.MalfunctionCode == malfunction.MalfunctionCode
                      select a).FirstOrDefault();

            if (r1 == null)
            {
                return(null);
            }

            var r2 = (from b in CollectSchedules
                      where b.RelationCode == r1.RelationCode
                      select b).FirstOrDefault();

            return(r2);
        }
コード例 #4
0
 public void SetResult(Malfunction mal)
 {
     Malfunction                 = mal;
     txtMalfunctionCode.Text     = Malfunction.MalfunctionCode.ToString();
     btnMalfunctionClear.Enabled = Malfunction != null;
 }