public bool UpdateWithMaxMin(joinBLL u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(myconnstrng); try { String sql = @"UPDATE tbl_join SET " + JoinQty + "=@join_qty," + JoinMax + "=@join_max," + JoinMin + "=@join_min," + JoinUpdatedDate + "=@join_updated_date," + JoinUpdatedBy + "=@join_updated_by" + " WHERE join_parent_code=@join_parent_code AND join_child_code=@join_child_code"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@join_parent_code", u.join_parent_code); cmd.Parameters.AddWithValue("@join_child_code", u.join_child_code); cmd.Parameters.AddWithValue("@join_qty", u.join_qty); cmd.Parameters.AddWithValue("@join_max", u.join_max); cmd.Parameters.AddWithValue("@join_min", u.join_min); cmd.Parameters.AddWithValue("@join_updated_date", u.join_updated_date); cmd.Parameters.AddWithValue("@join_updated_by", u.join_updated_by); conn.Open(); int rows = cmd.ExecuteNonQuery(); //if the query is executed successfully then the rows' value = 0 if (rows > 0) { //query successful isSuccess = true; } else { //Query falled isSuccess = false; } } catch (Exception ex) { Module.Tool tool = new Module.Tool(); tool.saveToText(ex); } finally { conn.Close(); } return(isSuccess); }
public bool InsertWithMaxMin(joinBLL u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(myconnstrng); try { String sql = "INSERT INTO tbl_join (join_parent_code, join_child_code, join_qty,join_max,join_min,join_added_date, join_added_by) VALUES ( @join_parent_code, @join_child_code, @join_qty, @join_max, @join_min, @join_added_date, @join_added_by)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@join_parent_code", u.join_parent_code); cmd.Parameters.AddWithValue("@join_child_code", u.join_child_code); cmd.Parameters.AddWithValue("@join_qty", u.join_qty); cmd.Parameters.AddWithValue("@join_max", u.join_max); cmd.Parameters.AddWithValue("@join_min", u.join_min); cmd.Parameters.AddWithValue("@join_added_date", u.join_added_date); cmd.Parameters.AddWithValue("@join_added_by", u.join_added_by); conn.Open(); int rows = cmd.ExecuteNonQuery(); //if the query is executed successfully then the rows' value = 0 if (rows > 0) { //query successful isSuccess = true; } else { //Query falled isSuccess = false; } } catch (Exception ex) { Module.Tool tool = new Module.Tool(); tool.saveToText(ex); } finally { conn.Close(); } return(isSuccess); }
public frmJoinEdit(joinBLL u, bool closeAfterSave) { closeAfter = closeAfterSave; InitializeComponent(); uJoin = u; loadItemCategoryData(); cmbParentName.Text = tool.getItemName(u.join_parent_code); cmbParentCode.Text = u.join_parent_code; cmbChildCat.Text = dalItem.getCatName(u.join_child_code); cmbChildName.Text = tool.getItemName(u.join_child_code); cmbChildCode.Text = u.join_child_code; txtChildQty.Text = u.join_qty.ToString(); txtMax.Text = u.join_max.ToString(); txtMin.Text = u.join_min.ToString(); updateTestName(); }
public bool itemDelete(joinBLL u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(myconnstrng); try { String sql = "DELETE FROM tbl_join WHERE join_parent_code=@join_parent_code OR join_child_code=@join_child_code"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@join_parent_code", u.join_parent_code); cmd.Parameters.AddWithValue("@join_child_code", u.join_child_code); conn.Open(); int rows = cmd.ExecuteNonQuery(); //if the query is executed successfully then the rows' value = 0 if (rows > 0) { //query successful isSuccess = true; } else { //Query falled isSuccess = false; } } catch (Exception ex) { Module.Tool tool = new Module.Tool(); tool.saveToText(ex); } finally { conn.Close(); } return(isSuccess); }