public bool UpdateProduct(ProductInfoVO pro) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = new SqlConnection(this.ConnectionString); cmd.CommandText = "SP_ProductUpdate"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Pro_Name", pro.Pro_Name); cmd.Parameters.AddWithValue("@Pro_Code", pro.Pro_Code); cmd.Parameters.AddWithValue("@Pro_Price", pro.Pro_Price); cmd.Parameters.AddWithValue("@Pro_Date", (object)pro.Pro_Date ?? DBNull.Value); cmd.Parameters.AddWithValue("@Pro_DateEnd", (object)pro.Pro_DateEnd ?? DBNull.Value); cmd.Parameters.AddWithValue("@Pro_Count", pro.Pro_Count); cmd.Parameters.AddWithValue("@Pro_Image", pro.Pro_Image); cmd.Parameters.AddWithValue("@Pro_Note", pro.Pro_Note); cmd.Connection.Open(); var rowsAffected = cmd.ExecuteNonQuery(); cmd.Connection.Close(); return(rowsAffected > 0); } }
/// <summary> /// 특정 카테고리ID에 해당하는 제품목록 조회 /// </summary> /// <param name="categoryID">카테고리ID</param> /// <returns>카테고리ID에 해당하는 제품목록 조회</returns> public bool RegisterProduct(ProductInfoVO pro) { int iRowAffect = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = new SqlConnection(this.ConnectionString); cmd.CommandText = "SP_ProductInsert"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Pro_Name", pro.Pro_Name); cmd.Parameters.AddWithValue("@Pro_Code", pro.Pro_Code); cmd.Parameters.AddWithValue("@Pro_Price", pro.Pro_Price); cmd.Parameters.AddWithValue("@Pro_Date", (object)pro.Pro_Date ?? DBNull.Value); cmd.Parameters.AddWithValue("@Pro_DateEnd", (object)pro.Pro_DateEnd ?? DBNull.Value); cmd.Parameters.AddWithValue("@Pro_Count", pro.Pro_Count); cmd.Parameters.AddWithValue("@Pro_Image", pro.Pro_Image); cmd.Parameters.AddWithValue("@Pro_Note", pro.Pro_Note); cmd.Connection.Open(); iRowAffect = cmd.ExecuteNonQuery(); cmd.Connection.Close(); } } catch (SqlException e) { throw; } return(iRowAffect > 0); }
public override bool Insert(ProductInfoVO m) { CodeCommand command = new CodeCommand(); command.CommandText = INSERT; command.Parameters.Add(new SqlParameter() { ParameterName = "@Name", Value = ParameterHelper.ConvertValue(m.Name) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@Desc", Value = ParameterHelper.ConvertValue(m.Desc) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AdId", Value = ParameterHelper.ConvertValue(m.AdId) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@Price", Value = ParameterHelper.ConvertValue(m.Price) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AttrText", Value = ParameterHelper.ConvertValue(m.AttrText) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AttrStyle", Value = ParameterHelper.ConvertValue(m.AttrStyle) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@IsState", Value = ParameterHelper.ConvertValue(m.IsState) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@IsDelete", Value = ParameterHelper.ConvertValue(m.IsDelete) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@CreateUserId", Value = ParameterHelper.ConvertValue(m.CreateUserId) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@CreateDate", Value = ParameterHelper.ConvertValue(m.CreateDate) }); int result = DbProxyFactory.Instance.Proxy.ExecuteNonQuery(command); if (result >= 1) { return(true); } return(false); }
public override int InsertIdentityId(ProductInfoVO m) { CodeCommand command = new CodeCommand(); command.CommandText = INSERT + "; select @@Identity"; command.Parameters.Add(new SqlParameter() { ParameterName = "@Name", Value = ParameterHelper.ConvertValue(m.Name) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@Desc", Value = ParameterHelper.ConvertValue(m.Desc) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AdId", Value = ParameterHelper.ConvertValue(m.AdId) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@Price", Value = ParameterHelper.ConvertValue(m.Price) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AttrText", Value = ParameterHelper.ConvertValue(m.AttrText) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@AttrStyle", Value = ParameterHelper.ConvertValue(m.AttrStyle) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@IsState", Value = ParameterHelper.ConvertValue(m.IsState) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@IsDelete", Value = ParameterHelper.ConvertValue(m.IsDelete) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@CreateUserId", Value = ParameterHelper.ConvertValue(m.CreateUserId) }); command.Parameters.Add(new SqlParameter() { ParameterName = "@CreateDate", Value = ParameterHelper.ConvertValue(m.CreateDate) }); var result = DbProxyFactory.Instance.Proxy.ExecuteScalar(command); return(int.Parse(result.ToString())); }
protected void btnSave_Click(object sender, EventArgs e) { ProductInfoVO info = new ProductInfoVO(); info.AdId = int.Parse(ddlAd.SelectedValue); info.AttrStyle = ""; info.AttrText = txtAttr.Text; info.Desc = txtDesc.Text; info.Name = txtName.Text; info.Price = int.Parse(txtPrice.Text); info.CreateDate = DateTime.Now; info.CreateUserId = Account.UserId; ProductInfoBLL.Instance.Add(info); Response.Redirect("/Accounts/Order/ProductList.aspx"); }
private void btnProInsert_Click(object sender, EventArgs e) { try { if (this.ValidateRegistration()) { ProductInfoVO pro = new ProductInfoVO(); pro.Pro_Name = txtProName.Text.Trim(); pro.Pro_Price = txtProPrice.Text.Trim(); pro.Pro_Code = txtProCode.Text.Trim(); //pro.ProductDate = txtDate.Text; //pro.ProductDateEnd = txtEndDate.Text;//유통기한 조정필요 pro.Pro_Count = Convert.ToInt32(cboQuantity.Text); pro.Pro_Note = txtNotes.Text.Trim(); //이미지 => byte[] 변환 VO 속성에 저장 FileStream fs = new FileStream(pbxImage.ImageLocation, FileMode.Open, FileAccess.Read); byte[] bImage = new byte[fs.Length]; fs.Read(bImage, 0, (int)fs.Length); pro.Pro_Image = bImage; Service.ProductService ser = new Service.ProductService(); bool bResult = ser.RegisterProduct(pro); if (bResult) { MessageBox.Show("성공적으로 등록 되었습니다!."); } else { MessageBox.Show("신규 등록 중 오류가 발생했습니다. 다시시도하여 주십시오."); } } else { this.ShowErrorMessage(this.errorMessage, "신규 등록 에러"); } } catch (Exception err) { this.ShowErrorMessage(err); } }
private void btnUpdate_Click(object sender, EventArgs e) { if (lblProCode.Text.Length < 1) { return; } try { ProductInfoVO pro = new ProductInfoVO(); pro.Pro_Name = txtName.Text.Trim(); pro.Pro_Count = Convert.ToInt32(cboEA.SelectedValue); pro.Pro_Price = txtPrice.Text.Trim(); //pro.ProductDate = dtpDate.Value.ToShortDateString(); //pro.ProductDateEnd = dtpEndDate.Value.ToShortDateString(); pro.Pro_Note = txtNote.Text.Trim(); pro.Pro_Image = ImageToByte(pbxImagechange.Image); ProductService service = new ProductService(); bool bResult = service.UpdateProduct(pro); if (bResult) { //LoadData(); //ClearControls(); MessageBox.Show("성공적으로 수정되었습니다"); } else { MessageBox.Show("수정 중 오류가 발생하였습니다. 다시 시도하여 주십시오."); } } catch (Exception ex) { this.ShowErrorMessage(ex); } }
public override string GetOtherConditionByModel(ProductInfoVO m) { return(""); }
public override string GetOrderByModel(ProductInfoVO m) { return(""); }
public bool UpdateProduct(ProductInfoVO pro) { ProductOrderDAC dac = new ProductOrderDAC(); return(dac.UpdateProduct(pro)); }
public bool RegisterProduct(ProductInfoVO pro) { ProductOrderDAC dac = new ProductOrderDAC(); return(dac.RegisterProduct(pro)); }