/// <summary> /// Function to Update values in Bom Table /// </summary> /// <param name="bominfo"></param> public void BomEdit(BomInfo bominfo) { try { SPBom.BomEdit(bominfo); } catch (Exception ex) { MessageBox.Show("BOMBll3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values to Bom Table /// </summary> /// <param name="bominfo"></param> public void BomAdd(BomInfo bominfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BomAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam.Value = bominfo.ProductId; sprmparam = sccmd.Parameters.Add("@rowmaterialId", SqlDbType.Decimal); sprmparam.Value = bominfo.RowmaterialId; sprmparam = sccmd.Parameters.Add("@quantity", SqlDbType.Decimal); sprmparam.Value = bominfo.Quantity; sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam.Value = bominfo.UnitId; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = bominfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = bominfo.Extra2; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = bominfo.ExtraDate; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from Bom Table based on the parameter /// </summary> /// <param name="bomId"></param> /// <returns></returns> public BomInfo BomView(decimal bomId) { BomInfo bominfo = new BomInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BomView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@bomId", SqlDbType.Decimal); sprmparam.Value = bomId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { bominfo.BomId = decimal.Parse(sdrreader[0].ToString()); bominfo.ProductId = decimal.Parse(sdrreader[1].ToString()); bominfo.RowmaterialId = decimal.Parse(sdrreader[2].ToString()); bominfo.Quantity = decimal.Parse(sdrreader[3].ToString()); bominfo.UnitId = decimal.Parse(sdrreader[4].ToString()); bominfo.Extra1 = sdrreader[5].ToString(); bominfo.Extra2 = sdrreader[6].ToString(); bominfo.ExtraDate = DateTime.Parse(sdrreader[7].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return bominfo; }
/// <summary> /// Function to insert values to Bom Table /// </summary> /// <param name="bominfo"></param> /// <param name="decId"></param> public void BomFromDatatable(BomInfo bominfo, decimal decId) { try { SPBom.BomFromDatatable(bominfo, decId); } catch (Exception ex) { MessageBox.Show("BOMBll2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get particular values from Bom Table based on the parameter /// </summary> /// <param name="bomId"></param> /// <returns></returns> public BomInfo BomView(decimal bomId) { BomInfo bominfo = new BomInfo(); try { bominfo = SPBom.BomView(bomId); } catch (Exception ex) { MessageBox.Show("BOMBll5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return bominfo; }