Exemple #1
0
        private void btn_Regist_Pro_Click(object sender, EventArgs e)
        {
            try
            {
                M_Product pr = new M_Product()
                {
                    MaID          = int.Parse(textB_MakerID_Pro.Text),
                    PrName        = textB_ProName_Pro.Text,
                    Price         = int.Parse(textB_Pri_Pro.Text),
                    PrJCode       = textB_JAN_Pro.Text,
                    PrSafetyStock = int.Parse(textB_SSQ_Pro.Text),
                    ScID          = int.Parse(textB_SCID_Pro.Text),
                    PrModelNumber = int.Parse(textB_Mnumber_Pro.Text),
                    PrColor       = textB_Color_Pro.Text,
                    PrReleaseDate = dtp_RelDate_Pro.Value,
                    PrFlag        = checkB_Del_Pro.Checked ? 1 : 0,
                };
                SalesManagement_DevContext context = new SalesManagement_DevContext();
                context.M_Products.Add(pr);
                context.SaveChanges();
                context.Dispose();

                MessageBox.Show("登録が完了しました。", "登録完了",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private bool GetValidDataAtSyukkoUpdate()
        {
            int id = int.Parse(txt_PrID.Text);

            using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
            {
                var result = dbContext.T_Stocks
                             .Where(s => s.PrID == id).ToArray();
                foreach (var item in result)
                {
                    int stquntity = item.StQuantity - int.Parse(txt_ChQuantity.Text);

                    var regStock = new T_Stock()
                    {
                        StID       = item.StID,
                        PrID       = item.PrID,
                        StQuantity = stquntity,
                        StFlag     = item.StFlag
                    };
                    // 注文情報の登録
                    var errorMessage = _St.PutStock(regStock);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return(false);
                    }
                }
                return(true);
            }
        }
Exemple #3
0
 private bool loginauthor()
 {
     using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
     {
         var loresult = dbContext.M_Employees
                        .Where(e => e.EmID == transfer_int)
                        .ToArray();
         foreach (var item in loresult)
         {
             txt_loginSoID.Text = (item.SoID).ToString();
             txt_loginEmID.Text = (item.EmID).ToString();
         }
         return(true);
     }
 }
        private void btn_CleateDabase_Click(object sender, EventArgs e)
        {
            //データベースの生成を行います.
            //再度実行する場合には,必ずデータベースの削除をしてから実行してください.

            //役職マスタを生成するサンプル(1件目に管理者を追加する例)
            M_Position FirstPosition = new M_Position()
            {
                PoName = "管理者"
            };
            SalesManagement_DevContext context = new SalesManagement_DevContext();

            context.SaveChanges();
            context.Dispose();

            MessageBox.Show("テーブル作成完了");
        }
        private void btn_commit_FLG_Click(object sender, EventArgs e)
        {
            // 確定可否
            if (DialogResult.OK != MessageBox.Show(this, "確定してよろしいですか", "確定可否", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                return;
            }
            //出荷情報を更新する
            int id = int.Parse(txt_ShID.Text);

            using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
            {
                var result = dbContext.T_Shipments
                             .Where(s => s.ShID == id).ToArray();
                foreach (var item in result)
                {
                    var regShipment = new T_Shipment()
                    {
                        ShID         = item.ShID,
                        EmID         = transfer_int,
                        ClID         = item.ClID,
                        SoID         = item.SoID,
                        OrID         = item.OrID,
                        ShFinishDate = DateTime.Now,
                        ShStateFlag  = 1,
                        ShFlag       = item.ShFlag,
                        ShHidden     = item.ShHidden
                    };
                    // 注文情報の登録
                    var errorMessage = _Sh.PutShipment(regShipment);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                    return;
                }
            }
        }
Exemple #6
0
        private void btn_commit_FLG_Click(object sender, EventArgs e)
        {
            // 確定可否
            if (DialogResult.OK != MessageBox.Show(this, "確定してよろしいですか", "確定可否", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                return;
            }
            //入荷情報を出荷テーブルに送る
            int id = int.Parse(txt_ArID.Text);

            using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
            {
                var result = dbContext.T_Arrivals
                             .Where(c => c.ArID == id).ToArray();
                foreach (var item in result)
                {
                    var regShipment = new T_Shipment()
                    {
                        EmID         = null,
                        ClID         = item.ClID,
                        SoID         = item.SoID,
                        OrID         = item.OrID,
                        ShFinishDate = null,
                        ShStateFlag  = 0,
                        ShFlag       = 0,
                        ShHidden     = ""
                    };
                    // 入荷情報の登録
                    var errorMessage = _Sh.PostT_Shipment(regShipment);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                }
                int id2      = int.Parse(txt_OrID.Text);
                var syresult = dbContext.T_Shipments
                               .Where(s => s.OrID == id2)
                               .ToArray();
                foreach (var item in syresult)
                {
                    var regShipmentDetail = new T_ShipmentDetail()
                    {
                        ShID        = item.ShID,
                        PrID        = int.Parse(txt_PrID.Text),
                        ShDquantity = int.Parse(txt_ArQuantity.Text)
                    };
                    // 注文情報の登録
                    var errorMessage = _Sh.PostT_ShipmentDetail(regShipmentDetail);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                }
                foreach (var item in result)
                {
                    var regArrival = new T_Arrival()
                    {
                        ArID        = item.ArID,
                        SoID        = item.SoID,
                        EmID        = transfer_int,
                        ClID        = item.ClID,
                        OrID        = item.OrID,
                        ArDate      = DateTime.Now,
                        ArStateFlag = 1,
                        ArFlag      = item.ArFlag,
                        ArHidden    = item.ArHidden
                    };
                    // 注文情報の登録
                    var errorMessage = _Ar.PutArrival(regArrival);
                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                }
                //// 画面更新
                fncAllSelect();
                txt_ArID.Focus();
                return;
            }
        }
Exemple #7
0
        private bool Get_Syukko_Data_AtRegistration()
        {
            // 確定可否
            if (DialogResult.OK != MessageBox.Show(this, "確定してよろしいですか", "確定可否", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                return(false);
            }
            //注文情報を出庫テーブルに送る
            int id = int.Parse(txt_ChID.Text);

            using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
            {
                var result = dbContext.T_Chumons
                             .Where(c => c.ChID == id).ToArray();
                foreach (var item in result)
                {
                    var regSyukko = new T_Syukko()
                    {
                        EmID        = null,
                        ClID        = item.ClID,
                        SoID        = item.SoID,
                        OrID        = item.OrID,
                        SyDate      = null,
                        SyStateFlag = 0,
                        SyFlag      = 0,
                        SyHidden    = ""
                    };
                    // 注文情報の登録
                    var errorMessage = _Sy.PostT_Syukko(regSyukko);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return(false);
                    }
                }
                int id2      = int.Parse(txt_OrID.Text);
                var syresult = dbContext.T_Syukkos
                               .Where(s => s.OrID == id2)
                               .ToArray();
                foreach (var item in syresult)
                {
                    var regSyukkoDetail = new T_SyukkoDetail()
                    {
                        SyID       = item.SyID,
                        PrID       = int.Parse(txt_PrID.Text),
                        SyQuantity = int.Parse(txt_ChQuantity.Text)
                    };
                    // 注文情報の登録
                    var errorMessage = _Sy.PostT_SyukkoDetail(regSyukkoDetail);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return(false);
                    }
                }
                foreach (var item in result)
                {
                    var regChumon = new T_Chumon()
                    {
                        ChID        = item.ChID,
                        SoID        = item.SoID,
                        EmID        = transfer_int,
                        ClID        = item.ClID,
                        OrID        = item.OrID,
                        ChDate      = DateTime.Now,
                        ChStateFlag = 1,
                        ChFlag      = item.ChFlag,
                        ChHidden    = item.ChHidden
                    };
                    // 注文情報の登録
                    var errorMessage = _Ch.PutChumon(regChumon);
                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return(false);
                    }
                }
                //// 画面更新
                fncAllSelect();
                txt_ChID.Focus();
                return(true);
            }
        }
Exemple #8
0
        private void btn_commit_FLG_Click(object sender, EventArgs e)
        {
            // 確定可否
            if (DialogResult.OK != MessageBox.Show(this, "確定してよろしいですか", "確定可否", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                return;
            }

            //出庫情報を入荷テーブルに送る
            using (SalesManagement_DevContext dbContext = new SalesManagement_DevContext())
            {
                int id     = int.Parse(txt_SyID.Text);
                var result = dbContext.T_Syukkos
                             .Where(s => s.SyID == id).ToArray();
                foreach (var item in result)
                {
                    var regArrival = new T_Arrival()
                    {
                        EmID        = null,
                        ClID        = item.ClID,
                        SoID        = item.SoID,
                        OrID        = item.OrID,
                        ArDate      = null,
                        ArStateFlag = 0,
                        ArFlag      = 0,
                        ArHidden    = ""
                    };
                    // 入荷情報の登録
                    var errorMessage = _Ar.PostT_Arrival(regArrival);

                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                }
                //出庫詳細情報を入荷詳細テーブルに送る
                int id2      = int.Parse(txt_OrID.Text);
                var syresult = dbContext.T_Arrivals
                               .Where(a => a.ArID == id2)
                               .ToArray();
                foreach (var item in syresult)
                {
                    var regArrivalDetail = new T_ArrivalDetail()
                    {
                        ArID       = item.ArID,
                        PrID       = int.Parse(txt_PrID.Text),
                        ArQuantity = int.Parse(txt_SyQuantity.Text)
                    };
                    // 注文情報の登録
                    var errorMessage2 = _Ar.PostT_ArrivalDetail(regArrivalDetail);
                    if (errorMessage2 != string.Empty)
                    {
                        MessageBox.Show(errorMessage2);
                        return;
                    }
                }
                //出庫情報を更新
                foreach (var item in result)
                {
                    var regSyukko = new T_Syukko()
                    {
                        SyID        = item.SyID,
                        EmID        = transfer_int,
                        ClID        = item.ClID,
                        SoID        = item.SoID,
                        OrID        = item.OrID,
                        SyDate      = DateTime.Now,
                        SyStateFlag = 1,
                        SyFlag      = item.SyFlag,
                        SyHidden    = item.SyHidden
                    };
                    // 注文情報の登録
                    var errorMessage = _Sy.PutSyukko(regSyukko);
                    if (errorMessage != string.Empty)
                    {
                        MessageBox.Show(errorMessage);
                        return;
                    }
                }
                //// 画面更新
                fncAllSelect();
                txt_SyID.Focus();
                return;
            }
        }