private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) // 수정
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            else if (IsLastInsert("수정", e.RowIndex) == false)
            {
                return;
            }

            ProductPriceManageVO ManageVO = new ProductPriceManageVO
            {
                Material_Price_Code            = dgv[9, e.RowIndex].Value.ToInt(),
                Company_Name                   = dgv[0, e.RowIndex].Value.ToString(),
                Product_Name                   = dgv[1, e.RowIndex].Value.ToString(),
                Product_Information            = dgv[2, e.RowIndex].Value.ToString(),
                Material_Current_Price_String  = dgv[4, e.RowIndex].Value.ToString().Replace(" 원", "").Replace(",", ""),
                Material_Previous_Price_String = dgv[5, e.RowIndex].Value.ToString().Replace(" 원", "").Replace(",", ""),
                Start_Date = Convert.ToDateTime(dgv[6, e.RowIndex].Value),
                End_Date   = Convert.ToDateTime(dgv[7, e.RowIndex].Value),
                Note       = dgv[8, e.RowIndex].Value.ToString(),
                RankNum    = dgv[10, e.RowIndex].Value.ToInt()
            };

            SettingFormOpen(false, ManageVO);
        }
        private void SettingFormOpen(bool IsInsert, ProductPriceManageVO ManageVO = null) // 등록 / 수정에 따른 폼 open
        {
            ProductPriceDialogForm frm = new ProductPriceDialogForm(IsInsert, ManageVO, dgvList);

            if (frm.ShowDialog() == DialogResult.OK) // 정상적으로 실행 후 종료된 경우
            {
                ReviewDGV();                         // 데이터 갱신!!
            }
        }
Ejemplo n.º 3
0
        public bool UpsertMaterialPrice(ProductPriceManageVO UpsertData)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    conn.Open();

                    // 로그인이 완성되면 회사 정보를 WHERE에 반드시 추가할 것
                    object EndDate;
                    string sql = @"SP_MATERIAL_PRICE_UPSERT";


                    if ((object)UpsertData.End_Date == null)
                    {
                        EndDate = DBNull.Value;
                    }

                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@P_Material_Price_Code", UpsertData.Material_Price_Code);
                        cmd.Parameters.AddWithValue("@P_COMPANY_ID", UpsertData.Company_ID);
                        cmd.Parameters.AddWithValue("@P_Product_ID", UpsertData.Product_ID);
                        cmd.Parameters.AddWithValue("@P_Material_Current_Price", UpsertData.Material_Current_Price);
                        cmd.Parameters.AddWithValue("@P_material_previous_price", UpsertData.Material_Previous_Price);
                        cmd.Parameters.AddWithValue("@P_start_date", UpsertData.Start_Date);
                        //cmd.Parameters.AddWithValue("@P_end_date", UpsertData.End_Date);
                        cmd.Parameters.AddWithValue("@P_note", UpsertData.Note);
                        cmd.Parameters.AddWithValue("@P_CATEGORY", UpsertData.Category);

                        int result = cmd.ExecuteNonQuery();

                        if (result > 0)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        public ProductPriceDialogForm(bool IsInsert, ProductPriceManageVO ManageVO = null, List <ProductPriceManageVO> dgvList = null)
        {
            InitializeComponent();
            this.isInsert = IsInsert;
            this.dgvList  = dgvList;

            if (!IsInsert)
            {
                this.Text     = message = "수정";
                this.ManageVO = ManageVO;
            }
            else
            {
                this.Text = message = "등록";
            }
        }
        private void UpsertSettings(int Code, string Category)
        {
            if (MessageBox.Show($"정말로 {message}하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            ProductPriceManageVO vo = new ProductPriceManageVO
            {
                // Update 목록 수정할 것
                Material_Price_Code     = Code,
                Company_ID              = cboCompany.SelectedValue.ToInt(),
                Product_ID              = cboProduct.SelectedValue.ToInt(),
                Material_Previous_Price = txtPreviousPrice.Text.Replace(",", "").Replace("-", "").ToInt(),
                Material_Current_Price  = txtCurrentPrice.Text.Replace(",", "").ToInt(),
                Start_Date              = dtpStartDate.Value,

                Category = Category
            };

            if (txtNote.TextLength < 1)
            {
                vo.Note = "";
            }
            else
            {
                vo.Note = txtNote.Text;
            }

            if (pdsv.UpsertMaterialPrice(vo) == true)
            {
                MessageBox.Show($"{message}이 완료되었습니다.");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 6
0
 public bool UpsertMaterialPrice(ProductPriceManageVO insertData)
 {
     return(dac.UpsertMaterialPrice(insertData));
 }
Ejemplo n.º 7
0
 public bool InsertMaterialPrice(ProductPriceManageVO InsertData)
 {
     return(dac.InsertMaterialPrice(InsertData));
 }
Ejemplo n.º 8
0
 public bool InsertMaterialPrice(ProductPriceManageVO insertData)
 {
     throw new NotImplementedException();
 }