Esempio n. 1
0
        public void InsertDB()
        {
            수주        orderList = new 수주();
            List <수주> 수주        = DB.수주.GetAll();

            발주등록.BehindSujuListCnt = DB.수주.GetAll().Count;
            if (수주.Where(x => x.수주번호 == dgv엑셀.CurrentRow.Cells[0].Value.ToString()).ToList().Count == 0 || 수주.
                Where(x => x.수주번호2 == dgv엑셀.CurrentRow.Cells[1].Value.ToString()).Count() == 0)
            {
                orderList.수주번호   = dgv엑셀.CurrentRow.Cells[0].Value.ToString();
                orderList.수주번호2  = dgv엑셀.CurrentRow.Cells[1].Value.ToString();
                orderList.제품번호   = dgv엑셀.CurrentRow.Cells[2].Value.ToString();
                orderList.주문수량   = int.Parse(dgv엑셀.CurrentRow.Cells[3].Value.ToString());
                orderList.납품업체번호 = dgv엑셀.CurrentRow.Cells[4].Value.ToString();
                orderList.단가     = int.Parse(dgv엑셀.CurrentRow.Cells[5].Value.ToString());
                orderList.금액     = int.Parse(dgv엑셀.CurrentRow.Cells[6].Value.ToString());
                orderList.주문일    = DateTime.Parse(dgv엑셀.CurrentRow.Cells[7].Value.ToString());
                orderList.납기일    = DateTime.Parse(dgv엑셀.CurrentRow.Cells[8].Value.ToString());
                orderList.잔량     = orderList.주문수량;
                orderList.출고량    = 0;
                orderList.출고여부   = false;

                DB.수주.Insert(orderList);
                MessageBox.Show($"수주번호 {orderList.수주번호} / {orderList.수주번호2} 가 등록되엇습니다.");
                bds수주.DataSource
                    = DB.수주.조회(txb품목명.Text, txb납품업체이름.Text, firstDate, lastDate);
                dgv엑셀.CurrentRow.Cells[9].Value = null;
                Register발주();
            }

            else
            {
                MessageBox.Show("이미 등록된 수주 데이터 입니다");
            }
        }
Esempio n. 2
0
        public void UpdataData()
        {
            int       maxRow    = dgv엑셀.Rows.Count;
            수주        orderList = new 수주();
            List <수주> 수주        = DB.수주.GetAll();

            if (수주.Count != 0)
            {
                for (int j = 0; j < maxRow; j++)
                {
                    if (수주.Where(x => x.수주번호 == dgv엑셀.Rows[j].Cells[0].Value.ToString() && x.수주번호2 == dgv엑셀.Rows[j].Cells[1].Value.ToString()).Count() >= 1)
                    {
                        if (int.Parse(dgv엑셀.Rows[j].Cells[3].Value.ToString()) < int.Parse(수주.Where(x => x.수주번호 == dgv엑셀.Rows[j].Cells[0].Value.ToString() && x.수주번호2 == dgv엑셀.Rows[j].Cells[1].Value.ToString()).Select(x => x.주문수량).First().ToString()))
                        {
                            dgv엑셀.Rows[j].Cells[9].Value = "수량 감소 ".ToString();
                        }

                        if (int.Parse(dgv엑셀.Rows[j].Cells[3].Value.ToString()) > int.Parse(수주.Where(x => x.수주번호 == dgv엑셀.Rows[j].Cells[0].Value.ToString() && x.수주번호2 == dgv엑셀.Rows[j].Cells[1].Value.ToString()).Select(x => x.주문수량).First().ToString()))
                        {
                            dgv엑셀.Rows[j].Cells[9].Value = "수량 증가 ".ToString();
                        }

                        if (DateTime.Parse(dgv엑셀.Rows[j].Cells[8].Value.ToString()).Date < 수주.Where(x => x.수주번호 == dgv엑셀.Rows[j].Cells[0].Value.ToString() && x.수주번호2 == dgv엑셀.Rows[j].Cells[1].Value.ToString()).Select(x => x.납기일).First().Date)
                        {
                            dgv엑셀.Rows[j].Cells[9].Value += "납기일 당겨짐".ToString();
                        }

                        if (DateTime.Parse(dgv엑셀.Rows[j].Cells[8].Value.ToString()).Date > 수주.Where(x => x.수주번호 == dgv엑셀.Rows[j].Cells[0].Value.ToString() && x.수주번호2 == dgv엑셀.Rows[j].Cells[1].Value.ToString()).Select(x => x.납기일).First().Date)
                        {
                            dgv엑셀.Rows[j].Cells[9].Value += "납기일 늦어짐".ToString();
                        }
                    }
                    else
                    {
                        dgv엑셀.Rows[j].Cells[9].Value = "New Data".ToString();
                    }
                }
            }
            else
            {
                for (int j = 0; j < maxRow; j++)
                {
                    dgv엑셀.Rows[j].Cells[9].Value = "New Data".ToString();
                }

                return;
            }
        }
Esempio n. 3
0
        private void btn삭제_Click(object sender, EventArgs e)
        {
            수주 orderList = dgv수주.CurrentRow.DataBoundItem as 수주;

            if (orderList == null)
            {
                return;
            }

            DialogResult result = MessageBox.Show("삭제 하시겠습니까?", "알림",
                                                  MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result == DialogResult.OK)
            {
                DB.수주.Delete(orderList);

                MessageBox.Show("삭제하였습니다", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information);
                bds수주.DataSource = DB.수주.GetAll();
            }
        }
Esempio n. 4
0
        private void btn변경_Click(object sender, EventArgs e)
        {
            수주 orderList = new 수주();

            DialogResult result = MessageBox.Show("변경 하기겠습니까?", "알림",
                                                  MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result == DialogResult.OK)
            {
                orderList.수주번호   = dgv엑셀.CurrentRow.Cells[0].Value.ToString();
                orderList.수주번호2  = dgv엑셀.CurrentRow.Cells[1].Value.ToString();
                orderList.제품번호   = int.Parse(dgv엑셀.CurrentRow.Cells[2].Value.ToString());
                orderList.주문수량   = int.Parse(dgv엑셀.CurrentRow.Cells[3].Value.ToString());
                orderList.납품업체번호 = int.Parse(dgv엑셀.CurrentRow.Cells[4].Value.ToString());
                orderList.주문일    = int.Parse(dgv엑셀.CurrentRow.Cells[5].Value.ToString());
                orderList.납기일    = int.Parse(dgv엑셀.CurrentRow.Cells[6].Value.ToString());
                DB.수주.Update(orderList);

                MessageBox.Show("변경하였습니다", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information);
                bds수주.DataSource = DB.수주.GetAll();
            }
        }
Esempio n. 5
0
        public void InsertDB()
        {
            int       maxRow    = dgv엑셀.Rows.Count;
            List <수주> 수주        = DB.수주.GetAll();
            수주        orderList = new 수주();

            for (int j = 0; j < maxRow; j++)
            {
                string Superkey = dgv엑셀.Rows[j].Cells[0].Value.ToString() + dgv엑셀.Rows[j].Cells[1].Value.ToString();
                int    cnt      = 0;
                for (int i = 0; i < 수주.Count; i++)
                {
                    string DBSuperKey =
                        dgv엑셀.Rows[i].Cells[0].Value.ToString() + dgv엑셀.Rows[i].Cells[1].Value.ToString();

                    if (Superkey != DBSuperKey)
                    {
                        cnt++;
                        if (cnt == 수주.Count)
                        {
                            orderList.수주번호   = dgv엑셀[0, j].Value.ToString();
                            orderList.수주번호2  = dgv엑셀[1, j].Value.ToString();
                            orderList.제품번호   = int.Parse(dgv엑셀[2, j].Value.ToString());
                            orderList.주문수량   = int.Parse(dgv엑셀[3, j].Value.ToString());
                            orderList.납품업체번호 = int.Parse(dgv엑셀[4, j].Value.ToString());
                            orderList.주문일    = int.Parse(dgv엑셀[5, j].Value.ToString());
                            orderList.납기일    = int.Parse(dgv엑셀[6, j].Value.ToString());

                            DB.수주.Insert(orderList);
                            cnt = 0;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                foreach (var item in 수주)
                {
                    string DBSuperKey = item.수주번호 + item.수주번호2;

                    if (Superkey == DBSuperKey)
                    {
                        if (int.Parse(dgv엑셀.Rows[j].Cells[3].Value.ToString()) < item.주문수량)
                        {
                            dgv엑셀.Rows[j].Cells[7].Value = "다운";
                        }

                        else if (int.Parse(dgv엑셀.Rows[j].Cells[3].Value.ToString()) > item.주문수량)
                        {
                            dgv엑셀.Rows[j].Cells[7].Value = "업";
                        }


                        if (int.Parse(dgv엑셀.Rows[j].Cells[6].Value.ToString()) < item.납기일)
                        {
                            dgv엑셀.Rows[j].Cells[8].Value = "빨라짐";
                        }

                        else if (int.Parse(dgv엑셀.Rows[j].Cells[6].Value.ToString()) > item.납기일)
                        {
                            dgv엑셀.Rows[j].Cells[8].Value = "늦어짐";
                        }

                        break;
                    }
                }
            }
        }