private void BtnSave_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtCode.Text) && !string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(cbbType.Text)) { Item_MasterVO item = new Item_MasterVO() { Item_Code = txtCode.Text.Trim(), Item_Name = txtName.Text.Trim(), Item_Name_Eng = txteng.Text, Item_Name_Eng_Alias = txtengAs.Text.Trim(), Item_Type = cbbType.Text.Trim(), Item_Spec = txtSpec.Text.Trim(), Item_Unit = nudunit.Text.Trim(), Item_Stock = nudStock.Value, PrdQty_Per_Hour = nudhour.Value, PrdQTy_Per_Batch = nudbatch.Value, Cavity = int.Parse(nudcavity.Value.ToString().Trim()), Line_Per_Qty = int.Parse(nudlinper.Value.ToString().Trim()), Shot_Per_Qty = int.Parse(nudshotper.Value.ToString().Trim()), Dry_GV_Qty = int.Parse(nuddrgdv.Value.ToString().Trim()), Heat_GV_Qty = int.Parse(nudheatgv.Value.ToString().Trim()), Level_1 = cbbLevel_1.SelectedValue.ToString().Trim(), Level_2 = cbbLevel_2.SelectedValue.ToString().Trim(), Level_3 = cbbLevel_3.SelectedValue.ToString().Trim(), Level_4 = cbbLevel_4.SelectedValue.ToString().Trim(), Level_5 = cbbLevel_5.SelectedValue.ToString().Trim(), Ins_Date = Convert.ToDateTime(lblDay.Text.Trim()), Ins_Emp = lblManager.Text.Trim(), }; if (itemservice.InsertUpdateAllItem_Master(item)) { this.Close(); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("저장 실패", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show("필수 항목을 입력해주세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception err) { MessageBox.Show("db 오류 저장 실패" + err.Message, "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); Program.Log.WriteError(err.Message); } }
/// <summary> /// 품목정보 수정 캐비티, 성형, shot수 mds_sds_002 /// </summary> /// <param name="id"></param> /// <param name="pwd"></param> /// <returns></returns> public bool InsertUpdateAllItem_Master(Item_MasterVO item) { try { using (SqlCommand comm = new SqlCommand()) { comm.Connection = new SqlConnection(Connstr); comm.CommandText = "InsertUpdateAllItem_Master"; comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("@Item_Code", item.Item_Code); comm.Parameters.AddWithValue("@Item_Name", item.Item_Name); comm.Parameters.AddWithValue("@Item_Name_Eng", item.Item_Name_Eng); comm.Parameters.AddWithValue("@Item_Name_Eng_Alias", item.Item_Name_Eng_Alias); comm.Parameters.AddWithValue("@Item_Type", item.Item_Type); comm.Parameters.AddWithValue("@Item_Spec", item.Item_Spec); comm.Parameters.AddWithValue("@Item_Unit", item.Item_Unit); comm.Parameters.AddWithValue("@Level_1", item.Level_1); comm.Parameters.AddWithValue("@Level_2", item.Level_2); comm.Parameters.AddWithValue("@Level_3", item.Level_3); comm.Parameters.AddWithValue("@Level_4", item.Level_4); comm.Parameters.AddWithValue("@Level_5", item.Level_5); comm.Parameters.AddWithValue("@Item_Stock", item.Item_Stock); comm.Parameters.AddWithValue("@PrdQty_Per_Hour", item.PrdQty_Per_Hour); comm.Parameters.AddWithValue("@PrdQTy_Per_Batch", item.PrdQTy_Per_Batch); comm.Parameters.AddWithValue("@Cavity", item.Cavity); comm.Parameters.AddWithValue("@Line_Per_Qty", item.Line_Per_Qty); comm.Parameters.AddWithValue("@Shot_Per_Qty", item.Shot_Per_Qty); comm.Parameters.AddWithValue("@Dry_GV_Qty", item.Dry_GV_Qty); comm.Parameters.AddWithValue("@Heat_GV_Qty", item.Heat_GV_Qty); comm.Parameters.AddWithValue("@Ins_Date", item.Ins_Date); comm.Parameters.AddWithValue("@Ins_Emp", item.Ins_Emp); comm.Connection.Open(); int result = comm.ExecuteNonQuery(); comm.Connection.Close(); if (result > 0) { return(true); } else { return(false); } } } catch (Exception) { throw; } }
public bool InsertUpdateAllItem_Master(Item_MasterVO item) { return(DAC.InsertUpdateAllItem_Master(item)); }