Example #1
0
        /// <summary>
        /// 제품타입리스트를 반환하는 메서드
        /// </summary>
        /// <returns>제품리스트 반환 </returns>
        internal DataTable proTypeList()
        {
            DataTable proTypeList = new DataTable();
            string    sp          = "Bom_JW_ProType";

            try
            {
                proTypeList = dbp.ExecuteParametersDT(sp, null);
            }
            catch (Exception)
            {
                throw;
            }
            return(proTypeList);
        }
Example #2
0
        /// <summary>
        /// 판매현황을 데이터 그리드뷰에 표현
        /// </summary>
        private void RealTiemSales()
        {
            salesList.Clear();
            dgvMainSales.DataSource = null;
            DataTable dataTable = dbp.ExecuteParametersDT("Bom_JW_MainSelect_Procedure", null);

            foreach (DataRow item in dataTable.Rows)
            {
                salesList.Add(new Cus_OrderVO
                {
                    OrderNo       = Int32.Parse(item["Cus_Order_OrderNo"].ToString()),
                    CusID         = item["Cus_ID"].ToString(),
                    OrderContants = item["Pro_Name"].ToString() + ", " + item["Cus_Order_EA"].ToString() + " 개",
                    OrderDate     = DateTime.Parse(item["Cus_Order_Date"].ToString())
                });
            }
            dgvMainSales.DataSource = salesList;
            //dgvMainSales.AutoResizeColumns();
            dgvMainSales.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;
            dgvMainSales.AutoSizeRowsMode      = DataGridViewAutoSizeRowsMode.None;
            dgvMainSales.Columns[0].Width      = 70;
            dgvMainSales.Columns[1].Width      = 80;
            dgvMainSales.Columns[3].Width      = 150;
            dgvMainSales.Columns[0].HeaderText = "주문번호";
            dgvMainSales.Columns[1].HeaderText = "고객명";
            dgvMainSales.Columns[2].HeaderText = "주문내용";
            dgvMainSales.Columns[3].HeaderText = "주문날짜";
        }
        /// <summary>
        /// 주문내역을 상세하게 보여주는 메서드
        /// </summary>
        private void SalesInfo()
        {
            DataTable dataTable = dbp.ExecuteParametersDT("Bom_JW_ProSelect2_Procedure", null);

            lblOrderNo.Text = dataTable.Rows[thisContantsIndex]["Cus_Order_OrderNo"].ToString();
            productsName    = lblCusID.Text = dataTable.Rows[thisContantsIndex]["Cus_ID"].ToString();
            lblProName.Text = dataTable.Rows[thisContantsIndex]["Pro_Name"].ToString();
            lblProEA.Text   = dataTable.Rows[thisContantsIndex]["Cus_Order_EA"].ToString() + " 개";
            int price = Int32.Parse(dataTable.Rows[thisContantsIndex]["Cus_Order_Price"].ToString());

            lblDate.Text    = (DateTime.Parse(dataTable.Rows[thisContantsIndex]["Cus_Order_Date"].ToString()).ToShortDateString()).ToString();
            lblEmpName.Text = dataTable.Rows[thisContantsIndex]["Emp_Name"].ToString();
            if (dataTable.Rows[thisContantsIndex]["Mat_No"].ToString() == "")
            {
                lblProductCount.Text = "0" + " 개";
            }
            else
            {
                lblProductCount.Text = dataTable.Rows[thisContantsIndex]["Mat_No"].ToString() + " 개";
            }

            lblPhone.Text      = dataTable.Rows[thisContantsIndex]["Cus_Phone"].ToString();
            lblAddr.Text       = dataTable.Rows[thisContantsIndex]["Cus_Addr"].ToString();
            lblOrderPrice.Text = String.Format("{0:##,##0}", price) + " 원";
        }
Example #4
0
        /// <summary>
        /// 모든 상품 출력 프로시져
        /// </summary>
        /// <returns></returns>
        internal List <Products> SelectPro()
        {
            List <Products> proLst = new List <Products>();
            string          sp     = "Bom_Pro_View_Procedure";

            SqlParameter[] sqlParameters = null;
            DataTable      dt            = con.ExecuteParametersDT(sp, sqlParameters);

            foreach (DataRow item in dt.Rows)
            {
                proLst.Add(new Products {
                    Pro_No    = Int32.Parse(item["Pro_No"].ToString()),
                    Pro_Name  = item["Pro_Name"].ToString(),
                    Mat_No    = Int32.Parse(item["Mat_No"].ToString()),
                    Pro_Price = Int32.Parse(item["Pro_Price"].ToString())
                });
            }
            return(proLst);
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sp">프로시저 이름</param>
        /// <param name="search">조회할 변수</param>
        /// <param name="search2">조회할 변수</param>
        /// <param name="parameter1">파라메터 변수1</param>
        /// <param name="parameter2">파라메터 변수2</param>
        /// <returns>조회한 데이터리스트 반환</returns>
        public List <SalesVO> SalesSelect(string sp, string search, string search2, string parameter1, string parameter2)
        {
            List <SalesVO> salesList      = new List <SalesVO>();
            int            parameterCount = 1;

            if (search2 != "") // 두개의 입력값 있을시 배열의 크기를 증가시킴
            {
                parameterCount++;
            }
            SqlParameter[] sqlParameters = new SqlParameter[parameterCount];

            if (search == "" && parameter1 == "")
            {
                sqlParameters = null;
            }
            else
            {
                sqlParameters[0] = new SqlParameter(parameter1, search);
            }
            if (search2 != "")
            {
                sqlParameters[1] = new SqlParameter(parameter2, search2);
            }
            DataTable dateTable = dbp.ExecuteParametersDT(sp, sqlParameters);

            foreach (DataRow item in dateTable.Rows)
            {
                salesList.Add(new SalesVO()
                {
                    OrderNo       = Int32.Parse(item["Cus_Order_OrderNo"].ToString()),
                    CusID         = item["Cus_ID"].ToString(),
                    EmpID         = item["Emp_Name"].ToString(),
                    Pro_No        = item["Pro_Name"].ToString(),
                    Price         = Int32.Parse(item["Cus_Order_Price"].ToString()),
                    Ea            = Int32.Parse(item["Cus_Order_EA"].ToString()),
                    OrderDate     = DateTime.Parse(item["Cus_Order_Date"].ToString()),
                    OrderComplete = item["Com_Type"].ToString(),
                });
            }
            return(salesList);
        }
Example #6
0
 public DataTable ProSelectFromMat()
 {
     try
     {
         string sp = "Materials_Type_Product_Select_Procedure";
         return(dp.ExecuteParametersDT(sp, null));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #7
0
        /// <summary>
        /// 매출 정보를 반환하는 메서드
        /// </summary>
        /// <param name="startDate">조회할 시작날짜</param>
        /// <param name="endDate">조회할 마지막날짜</param>
        /// <returns>매출정보 반환</returns>
        internal List <RevenueVO> Revenue(string startDate, string endDate)
        {
            RevenueList1.Clear();
            string sp = "Bom_JW_Revenue";

            SqlParameter[] sqlParameter = new SqlParameter[2];
            sqlParameter[0] = new SqlParameter("@startDate", startDate);
            sqlParameter[1] = new SqlParameter("@endDate", endDate);

            dt = dbp.ExecuteParametersDT(sp, sqlParameter);

            foreach (DataRow item in dt.Rows)
            {
                RevenueList1.Add(new RevenueVO
                {
                    OrderNo    = Int32.Parse(item["Cus_Order_No"].ToString()),
                    OrderDate  = DateTime.Parse(item["Cus_Order_Date"].ToString()),
                    OrderPrice = String.Format("{0:##,##0}", Int32.Parse(item["Cus_Order_Price"].ToString())) + " 원"
                });
            }
            return(RevenueList1);
        }
Example #8
0
        public string DateInsert1()
        {
            int year  = 0;
            int month = 0;
            int day   = 0;


            DateTime dt;
            Random   rd = new Random();

            DBProcessor dbp             = new DBProcessor(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString);
            int         cusno           = 0;
            int         empno           = 0;
            int         prono           = 0;
            int         cusorderorderno = 0;
            string      date            = null;
            int         price           = 0;
            int         ea = 0;

            string sp1 = "DataInsertProPrice";

            SqlParameter[] sqlParameter1 = new SqlParameter[1];
            string         sp2           = "DataInsert";

            SqlParameter[] sqlParameters2 = new SqlParameter[8];
            int            errorCheck     = 0;

            for (int i = 0; i < 50; i++) // >> 버튼 한번클릭마다 인트 i = 0 초기값을 올려줘야함
            {
                try
                {
                    errorCheck++;
                    price = 0;
                    prono = new Random().Next(24, 28);
                    ea    = new Random().Next(1, 4);
                    year  = rd.Next(2019, (int)DateTime.Today.Year + 1);
                    month = rd.Next(1, 3);
                    day   = rd.Next(1, 28);
                    date  = month.ToString() + "/" + day.ToString() + "/" + year.ToString();
                    dt    = DateTime.Parse(date);
                    /////////////////////////////////////////////////////////////////////////////
                    sqlParameter1[0] = new SqlParameter("@pro_No", prono);
                    //dbp.ExecuteParametersDT(sp1, sqlParameter1);
                    foreach (DataRow item in dbp.ExecuteParametersDT(sp1, sqlParameter1).Rows)
                    {
                        price = Int32.Parse(item["Pro_Price"].ToString()) * ea;
                    }
                    //////////////////////////////////////////////////////////////////////////////////
                    sqlParameters2[0] = new SqlParameter("@cus_No", 10);                      //5~9번 있음
                    sqlParameters2[1] = new SqlParameter("@emp_No", new Random().Next(1, 5)); //4명
                    sqlParameters2[2] = new SqlParameter("@pro_No", prono);                   //6개
                    sqlParameters2[3] = new SqlParameter("@cus_Order_OrderNo", i + 1047);     // >> 버튼 한번클릭마다 인트 i = 0 초기값을 올려줘야함
                    sqlParameters2[4] = new SqlParameter("@cus_Order_Date", dt);
                    sqlParameters2[5] = new SqlParameter("@cus_OrderComplete", 2);            //2번고정
                    sqlParameters2[6] = new SqlParameter("@cus_Order_Price", price);
                    sqlParameters2[7] = new SqlParameter("@cus_Order_EA", ea);
                    dbp.ExecuteParameters(sp2, sqlParameters2);
                }
                catch (Exception)
                {
                    return(errorCheck.ToString() + "번째에서 멈춤");
                }
            }
            return("완료");
        }
Example #9
0
        public DataTable SelectOrderList()
        {
            string sp = "Offerer_Order_List_View_Procedure";

            return(dp.ExecuteParametersDT(sp, null));
        }
Example #10
0
 public DataTable SelectMat(string sp)
 {
     return(dp.ExecuteParametersDT(sp, null));
 }
Example #11
0
        /// <summary>
        /// 넘겨받은 준문정보로 출하지시서 폼의 내용을 표시
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Shipment_Load(object sender, EventArgs e)
        {
            dgvProList.Font = new Font("맑은고딕", 9);

            if (this.orderNo != 0)
            {
                string         sp            = "Bom_JW_Shipment_Procedure";
                SqlParameter[] sqlParameters = new SqlParameter[1];
                sqlParameters[0] = new SqlParameter("@OrderNo", orderNo);
                DataTable dt = dbp.ExecuteParametersDT(sp, sqlParameters);


                foreach (DataRow item in dt.Rows)
                {
                    lblOrderNo.Text = item["Cus_Order_OrderNO"].ToString();
                    lblDate.Text    = DateTime.Parse(item["Cus_Order_Date"].ToString()).ToShortDateString().ToString();
                    lblCus.Text     = item["Cus_ID"].ToString();
                    lblEmp.Text     = item["Emp_Name"].ToString();
                    lblPhone.Text   = item["Cus_Phone"].ToString();
                    lblAddr.Text    = item["Cus_Addr"].ToString();

                    ProList.Add(new ShipmentVO
                    {
                        ProName        = item["Pro_Name"].ToString(),
                        ProEa          = Int32.Parse(item["Cus_Order_EA"].ToString()),
                        ProPrice       = String.Format("{0:##,##0}", item["Cus_Order_Price"]) + " 원",
                        ResidualAmount = Int32.Parse(item["RemainingAmount"].ToString())
                    });
                }
                lblShipDate.Text               = DateTime.Now.AddDays(2).ToShortDateString();
                dgvProList.DataSource          = null;
                dgvProList.DataSource          = ProList;
                dgvProList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dgvProList.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.None;

                dgvProList.Columns[0].Width      = 200;
                dgvProList.Columns[1].Width      = 40;
                dgvProList.Columns[2].Width      = 90;
                dgvProList.Columns[3].Width      = 90;
                dgvProList.Columns[0].HeaderText = "제품명";
                dgvProList.Columns[1].HeaderText = "개수";
                dgvProList.Columns[2].HeaderText = "가격";
                dgvProList.Columns[3].HeaderText = "잔여량";

                DataGridViewDisableButtonColumn column1 =
                    new DataGridViewDisableButtonColumn();

                column1.Name = "발주";
                dgvProList.Columns.Add(column1);

                for (int i = 0; i < dgvProList.RowCount; i++)
                {
                    dgvProList.Rows[i].Cells["발주"].Value =
                        "소요량 확인";
                }

                dgvProList.CellClick += DgvProList_CellClick;

                this.Controls.Add(dgvProList);
                for (int i = 0; i < dgvProList.Rows.Count; i++)
                {
                    if (Int32.Parse(dgvProList.Rows[i].Cells["ProEa"].Value.ToString()) < Int32.Parse(dgvProList.Rows[i].Cells["residualAmount"].Value.ToString()))
                    {
                        DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dgvProList.Rows[i].Cells["발주"];
                        buttonCell.Enabled = false;
                        dgvProList.Invalidate();
                    }
                }
            }
            if (lblOrderNo.Text != "")
            {
                btnPath.Enabled = btnConfirm.Enabled = true;
            }
        }