public Boolean update() { string qryStringMember; qryStringMember = "UPDATE tbl_repair set " + "customer_name=@customer_name, " + "contact_no=@contact_no, " + "item_name=@item_name, issue=@issue, " + "imei=@imei, downpayment=@downpayment, " + "repair_price=@repair_price, status=@status, " + "store_representative=@store_representative " + "WHERE repair_id=@repair_id"; try { Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql); Connect.CmSql.Parameters.AddWithValue("@customer_name", CustomerName.Trim()); Connect.CmSql.Parameters.AddWithValue("@contact_no", ContactNo.Trim()); Connect.CmSql.Parameters.AddWithValue("@item_name", ItemName.Trim()); Connect.CmSql.Parameters.AddWithValue("@issue", Issue.Trim()); Connect.CmSql.Parameters.AddWithValue("@imei", Imei); Connect.CmSql.Parameters.AddWithValue("@downpayment", Downpayment); Connect.CmSql.Parameters.AddWithValue("@repair_price", RepairPrice); Connect.CmSql.Parameters.AddWithValue("@status", Status.Trim()); Connect.CmSql.Parameters.AddWithValue("@store_representative", StoreRepresentative); Connect.CmSql.Parameters.AddWithValue("@repair_id", RepairId); Trans = Connect.CnSql.BeginTransaction(); Connect.CmSql.Transaction = Trans; Connect.CmSql.ExecuteNonQuery(); Trans.Commit(); return(true); } catch (MySqlException e) { XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } finally { Connect.CnSql.Close(); Connect.CnSql.Dispose(); Connect.CmSql.Dispose(); Connect.CmSql = null; Connect.DrSql = null; } return(false); }
public Boolean update() { string qryStringMember; qryStringMember = "UPDATE tbl_order set " + "ordered_item=@ordered_item, " + "additional_info=@additional_info, " + "customer_name=@customer_name, contact_no=@contact_no, " + "downpayment=@downpayment, order_price=@order_price " + "WHERE order_id=@order_id"; try { Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql); Connect.CmSql.Parameters.AddWithValue("@ordered_item", OrderItem.Trim()); Connect.CmSql.Parameters.AddWithValue("@additional_info", AdditionalInfo.Trim()); Connect.CmSql.Parameters.AddWithValue("@customer_name", CustomerName.Trim()); Connect.CmSql.Parameters.AddWithValue("@contact_no", ContactNo.Trim()); Connect.CmSql.Parameters.AddWithValue("@downpayment", Downpayment); Connect.CmSql.Parameters.AddWithValue("@order_price", OrderPrice); Connect.CmSql.Parameters.AddWithValue("@order_id", OrderId); Trans = Connect.CnSql.BeginTransaction(); Connect.CmSql.Transaction = Trans; Connect.CmSql.ExecuteNonQuery(); Trans.Commit(); return(true); } catch (MySqlException e) { XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } finally { Connect.CnSql.Close(); Connect.CnSql.Dispose(); Connect.CmSql.Dispose(); Connect.CmSql = null; Connect.DrSql = null; } return(false); }
public Boolean add() { string qryStringMember; qryStringMember = "Insert into tbl_repair (customer_name, contact_no, item_name, issue, imei, downpayment, repair_price, status, store_representative, date_added) VALUES (@customer_name, @contact_no, @item_name, @issue, @imei, @downpayment, @repair_price, @status, @store_representative, NOW())"; try { Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql); Connect.CmSql.Parameters.AddWithValue("@customer_name", CustomerName.Trim()); Connect.CmSql.Parameters.AddWithValue("@contact_no", ContactNo.Trim()); Connect.CmSql.Parameters.AddWithValue("@item_name", ItemName.Trim()); Connect.CmSql.Parameters.AddWithValue("@issue", Issue.Trim()); Connect.CmSql.Parameters.AddWithValue("@imei", Imei.Trim()); Connect.CmSql.Parameters.AddWithValue("@downpayment", Downpayment); Connect.CmSql.Parameters.AddWithValue("@repair_price", RepairPrice); Connect.CmSql.Parameters.AddWithValue("@status", Status.Trim()); Connect.CmSql.Parameters.AddWithValue("@store_representative", StoreRepresentative); Trans = Connect.CnSql.BeginTransaction(); Connect.CmSql.Transaction = Trans; Connect.CmSql.ExecuteNonQuery(); Trans.Commit(); return(true); } catch (MySqlException e) { XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } finally { Connect.CnSql.Close(); Connect.CnSql.Dispose(); Connect.CmSql.Dispose(); Connect.CmSql = null; Connect.DrSql = null; } return(false); }
public Boolean add() { string qryStringMember; qryStringMember = "Insert into tbl_supplier (supplier_name, representative, contact, email, address, date_added) VALUES (@supplier_name, @representative, @contact, @email, @address, NOW())"; try { Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql); Connect.CmSql.Parameters.AddWithValue("@supplier_name", SupplierName.Trim()); Connect.CmSql.Parameters.AddWithValue("@representative", Representative.Trim()); Connect.CmSql.Parameters.AddWithValue("@contact", ContactNo.Trim()); Connect.CmSql.Parameters.AddWithValue("@email", Email.Trim()); Connect.CmSql.Parameters.AddWithValue("@address", Address.Trim()); Trans = Connect.CnSql.BeginTransaction(); Connect.CmSql.Transaction = Trans; Connect.CmSql.ExecuteNonQuery(); Trans.Commit(); return(true); } catch (MySqlException e) { XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } finally { Connect.CnSql.Close(); Connect.CnSql.Dispose(); Connect.CmSql.Dispose(); Connect.CmSql = null; Connect.DrSql = null; } return(false); }
public Boolean add() { string qryStringMember; if (ImagePath.Equals("")) { qryStringMember = "Insert into tbl_users (name, contact_no, email, username, password, user_level, date_added) " + " VALUES (@name, @contact_no, @email, @username, @password, @user_level, NOW())"; } else { qryStringMember = "Insert into tbl_users (name, contact_no, email, username, password, user_level, user_image, date_added) " + " VALUES (@name, @contact_no, @email, @username, @password, @user_level, @user_image, NOW())"; } try { if (!ImagePath.Equals("") && !ImagePath.Equals("Remove")) { fs = new FileStream(ImagePath, FileMode.Open, FileAccess.Read); br = new BinaryReader(fs); ImageData = br.ReadBytes((int)fs.Length); br.Close(); fs.Close(); } Connect.CnSql = new MySqlConnection(Connect.ConnStr); Connect.CnSql.Open(); Connect.CmSql = new MySqlCommand(qryStringMember, Connect.CnSql); Connect.CmSql.Parameters.AddWithValue("@name", Name.Trim()); Connect.CmSql.Parameters.AddWithValue("@contact_no", ContactNo.Trim()); Connect.CmSql.Parameters.AddWithValue("@username", Username.Trim()); Connect.CmSql.Parameters.AddWithValue("@password", Password); Connect.CmSql.Parameters.AddWithValue("@email", Email.Trim()); Connect.CmSql.Parameters.AddWithValue("@user_level", UserLevel); if (!ImagePath.Equals("") && !ImagePath.Equals("Remove")) { Connect.CmSql.Parameters.AddWithValue("@user_image", ImageData); } else if (ImagePath.Equals("Remove")) { Connect.CmSql.Parameters.AddWithValue("@user_image", null); } Trans = Connect.CnSql.BeginTransaction(); Connect.CmSql.Transaction = Trans; Connect.CmSql.ExecuteNonQuery(); Trans.Commit(); return(true); } catch (MySqlException e) { XtraMessageBox.Show(e.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trans.Rollback(); } finally { Connect.CnSql.Close(); Connect.CnSql.Dispose(); Connect.CmSql.Dispose(); Connect.CmSql = null; Connect.DrSql = null; } return(false); }