public clsSizeCodePriceList GetSizeCodePriceList(clsSizeCodePriceList Sinfo) { clsSizeCodePriceList lst = new clsSizeCodePriceList(); using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_GetSizeCodePriceList")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@ProjectID", Sinfo.strProjectID); cmd.Parameters.AddWithValue("@BlockID", Sinfo.strBlockID); cmd.Parameters.AddWithValue("@SizeCode", Sinfo.strSizeCode); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if (lst.dPrice != null) { lst.dPrice = Convert.ToDecimal(reader["Price"].ToString()); } else if (lst.dPrice == null || lst.dPrice == 0) { lst.dPrice = Convert.ToDecimal("0.00"); } } conn.Close(); } } return(lst); }
public clsSizeCodePriceList GetPriceBySizeCode(string sizecode) { clsSizeCodePriceList info = new clsSizeCodePriceList(); using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_PriceBySizeCode")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@SizeCode", sizecode); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { info.dPrice = Convert.ToDecimal(reader["Price"]); } conn.Close(); } } return(info); }
public bool AddSizeCodePriceList(clsSizeCodePriceList info) { int st = 0; try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); { using (SqlCommand cmd = new SqlCommand("TMR_USP_AddSizeCodePriceList")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@ProjectID", info.strProjectID); cmd.Parameters.AddWithValue("@BlockID", info.strBlockID); cmd.Parameters.AddWithValue("@SizeCode", info.strSizeCode); cmd.Parameters.AddWithValue("@Price", info.dPrice); cmd.Parameters.AddWithValue("@Fk_RevaluationID", info.Fk_RevaluationID); cmd.Parameters.AddWithValue("@id", info.id); st = cmd.ExecuteNonQuery(); } } conn.Close(); } } catch (Exception ex) { } if (st > 0) { return(true); } else { return(false); } }