private void btnSave_Click(object sender, EventArgs e) { double tmpPal; MemoryStream ms = new MemoryStream(); try { mbr.LastName = last_NameTextBox.Text; mbr.FirstName = first_NameTextBox.Text; mbr.BirthDate = birth_DateDateTimePicker.Value; mbr.Email = email_AddressTextBox.Text; mbr.UserName = website_UsernamesTextBox.Text; if (!double.TryParse(palTextBox.Text, out tmpPal)) { tmpPal = 0; } mbr.Pal = tmpPal; mbr.PalExpDate = pal_Exp_DateDateTimePicker.Value; mbr.MemberTypeID = 11; mbr.Walk = cboWalk.Text; mbr.SectionFlag = _Sections.Mask; mbr.Card = int.Parse(txtCardNumber.Text); mbr.Notes = txtNotes.Text; mbr.SwipeCard = chkSwipe.Checked; mbr.Cell = txtCell.Text; mbr.CardMade = chkCardMade.Checked; if (Badge.Image != null) { Badge.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); mbr.BadgeImage = ms.ToArray(); ms.Dispose(); string imagesFiled = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "images"); if (!Directory.Exists(imagesFiled)) { Directory.CreateDirectory(imagesFiled); } if (mbr.Card > 0) { Badge.Image.Save(string.Format(@"{0}\{1}.jpg", imagesFiled, mbr.Card.ToString())); } } mbr.Save(); frmMember frmM = (frmMember)Application.OpenForms[Application.OpenForms.Count - 2]; frmM.MemberRecord.refreshCards(); DataView dvExtraCards = new DataView(frmM.MemberRecord.ExtraCards); dvExtraCards.RowFilter = "Deleted = False AND Promote = False"; frmM.dgExtraCards.DataSource = dvExtraCards; this.Close(); this.Dispose(); } catch (Exception ex) { ErrorLogger.Log("Error trying to Save the Member", ex, true); } }
public void newMember() { frmMember frm = new frmMember(-1, -1); frm.MdiParent = this; frm.Show(); }
private void dgExtraCards_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == dgExtraCards.Columns["colDelete"].Index) { if (MessageBox.Show("This will delete the Extra Card permanently when you click Save", "Delete Extra Card", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { mbr.ExtraCards.Rows[e.RowIndex]["Deleted"] = true; } } else if (e.ColumnIndex == dgExtraCards.Columns["colPromote"].Index) { int ID = int.Parse(dgExtraCards["ID", e.RowIndex].Value.ToString()); frmMember frm = new frmMember(ID, mbr.ID); frm.Show(); } else if (e.ColumnIndex == dgExtraCards.Columns["colEdit"].Index) { int ID = int.Parse(dgExtraCards["ID", e.RowIndex].Value.ToString()); frmMember frm = new frmMember(ID, -1); frm.IsExtra = true; frm.Show(); } } catch (Exception ex) { ErrorLogger.Log("Error trying to modify an Extra Card", ex, true); } this.Refresh(); }
public void editMember(int memberId) { frmMember frm = new frmMember(memberId, -1); frm.MdiParent = this; frm.Show(); }