private void updateInfoToolStripMenuItem_Click(object sender, EventArgs e) { if (lv.SelectedItems.Count > 0) { Member mem, sel = new Member(); //MessageBox.Show(lv.SelectedItems[0].SubItems[1].Text); sel.memid = lv.SelectedItems[0].SubItems[1].Text; mem= sel.SELECT_BY_ID(); mem.GET_IMAGE_BY_ID(); if (mem != null) { pnlops.Controls.Clear(); mem_update c = new mem_update(); c.mem = mem; c.Width = pnlops.Width; pnlops.Height = c.Height; pnlops.Controls.Add(c); } } }
private void btnsave_Click(object sender, EventArgs e) { Member m = new Member(); m.memid = txtid.Text; m.fullname = txtlname.Text + ", " + txtfname.Text + " " + txtmname.Text; m.gender = cbogender.Text; m.birthdate = dtBday.Value; m.contactno = txtcontactno.Text; m.address = txtaddress.Text; m.occupation = txtoccupation.Text; m.status = "ACTIVE"; //STATUS = ACTIVE, STAFF, WITHDRAWN m.typeofmembership = cbomembershiptype.Text; // REGULAR, ASSOCIATE m.email = txtemail.Text; m.tinno = txttinno.Text; if (pbEmpPic.Image != null) { long filesize; MemoryStream mstream = new MemoryStream(); pbEmpPic.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg); Byte[] arrImage = mstream.GetBuffer(); filesize = mstream.Length; m.pic = arrImage; } if(m.save()){ MessageBox.Show("Successful", "Saving...", MessageBoxButtons.OK,MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); this.Parent.Height = 0; this.Parent.Controls.Clear(); this.Dispose(); } else{ Logger.WriteErrorLog(db.err.ToString()); MessageBox.Show("Error : " + db.err.ToString() , "Saving...", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void btnFilter_Click(object sender, EventArgs e) { Member mem = new Member(); m.Load_Searched_MembersInListView(lv, txtname.Text); }
private void btnMigrate_Click(object sender, EventArgs e) { DataTable dt = dTable; dtmigrated = dt.Clone(); dtmigrated.Rows.Clear(); foreach (DataRow row in dt.Rows) { Member m = new Member(); m.memid = row["Membership_Registry_Number"].ToString(); m.fullname = row["Name of Member"].ToString(); m.address = row["Address"].ToString(); m.email = row["Email"].ToString(); m.acceptance_date = Convert.ToDateTime(row["Acceptance_Date"].ToString()); m.contactno = row["Contact_No"].ToString(); m.occupation = row["Occupation"].ToString(); m.status = "ACTIVE"; //STATUS = ACTIVE, STAFF, WITHDRAWN m.typeofmembership = "REGULAR"; // REGULAR, ASSOCIATE if (m.save()) { System.Diagnostics.Debug.WriteLine(m.memid + "-" + m.fullname + " -->Record Saved"); } else { System.Diagnostics.Debug.WriteLine("Error :" + db.err.Message); } } bs = new BindingSource(); bs.DataSource = dtmigrated; }
private void cboMem_SelectedIndexChanged(object sender, EventArgs e) { txtinterest.Text = ""; txtinterest_amort.Text = ""; txtprincipal.Text = ""; txtprincipal_amort.Text = ""; txttotal_amort.Text = ""; cbocollection_day.Text = ""; cbopayment_mode.Text = ""; txtinterest.Text = ""; cboamortization_period.Text = ""; MAXIMUM_ALLOWED_LOAN = 0; lbmembersdata.Items.Clear(); lblatestloan.Items.Clear(); cboComaker.Text = ""; pbcomaker.Image = null; lblcomaker.Text = ""; lblcomaker.BackColor = Color.Transparent; lbcomakersdata.Items.Clear(); lbcomakerslatestloan.Items.Clear(); if (cboMem.Text != "") { String[] c = cboMem.Text.ToString().Split('-'); String id = c[c.Length-2] + "-" + c[c.Length-1]; Member m2 = new Member(); //MessageBox.Show(id); m2.memid = id; applicant = m2.SELECT_BY_ID(); m2.GET_IMAGE_BY_ID(); lblmem.Text = applicant.fullname.ToString().ToUpper() + " - " + applicant.occupation.ToString(); Member_Capital mc = new Member_Capital(); mc.memid = applicant.memid; decimal cbu = mc.GET_CURRENT_PAID_UP_CAPITAL(); lbmembersdata.Items.Add("MEMBER'S VERIFICATION DATA"); lbmembersdata.Items.Add("MEMBER SINCE : " + applicant.acceptance_date.ToShortDateString()); lbmembersdata.Items.Add("MEMBER STANDING : " + applicant.standing); lbmembersdata.Items.Add("CBU AS OF " + DateTime.Now.ToShortDateString() + " : PhP " + cbu.ToString("#,##0.00")); l.empid = applicant.memid; Loan applicant_latest_loan = l.GET_LATEST_LOAN("MICRO"); PREV_LOAN = applicant_latest_loan; // GET THE LATEST MICRO LOAN OF A MEMBER lblatestloan.Items.Add("LATEST MICRO LOAN"); LATEST_MICRO_LOAN = (applicant_latest_loan != null) ? applicant_latest_loan.principal : 0; if (LATEST_MICRO_LOAN != 0) { lblatestloan.Items.Add("APPLICATION NO : " + applicant_latest_loan.application_no); lblatestloan.Items.Add("PRINCIPAL : PhP " + applicant_latest_loan.principal.ToString("#,##0.00")); lblatestloan.Items.Add("INTEREST : PhP " + applicant_latest_loan.interest.ToString("#,##0.00")); lblatestloan.Items.Add("MONTHLY AMORTIZATION: PhP " + (applicant_latest_loan.amortization_on_interest + applicant_latest_loan.amortization_on_principal).ToString("#,##0.00")); lblatestloan.Items.Add("BALANCE: ---(under development)---"); } else { lblatestloan.Items.Add("Nothing found..."); } //lblmemdata2.Text = "CAPITAL BUILD-UP :" +cbu.ToString("#,##0.00"); if (cbu >= MINIMUM_SHARED_CAPITAL_TO_AVAIL_LOAN) { lbmembersdata.Items.Add("PASSED THE MINIMUM : " + MINIMUM_SHARED_CAPITAL_TO_AVAIL_LOAN.ToString("#,##0.00") + " SHARE TO AVAIL LOAN"); lblmem.BackColor = Color.Green; //subtract minimum shared capital from the CBU //then get the 60% -- because 60% of (CBU-MINIMUM_SHARED_CAPITAL) is the //LOANABLE_AMOUNT MAXIMUM_ALLOWED_LOAN = (cbu - MINIMUM_SHARED_CAPITAL) * PERCENTAGE_TOGET_LOANABLE_AMOUNT; lbmembersdata.Items.Add("MAX LOANABLE AMOUNT : PhP " + MAXIMUM_ALLOWED_LOAN.ToString("#,##0.00")); } else { lbmembersdata.Items.Add("DID NOT PASSED THE MINIMUM : " + MINIMUM_SHARED_CAPITAL_TO_AVAIL_LOAN.ToString("#,##0.00") + " SHARE TO AVAIL LOAN"); lblmem.BackColor = Color.Red; } if (m2.pic != null) { MemoryStream ms = new MemoryStream(m2.pic); pb.Image = Image.FromStream(ms); pb.SizeMode = PictureBoxSizeMode.Zoom; } else { pb.Image = Properties.Resources.noimagefound; pb.SizeMode = PictureBoxSizeMode.Zoom; } } }
public Member SELECT_BY_ID() { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); db.SET_COMMAND_PARAMS(cmd, "MEMBER_SELECT_BY_ID"); cmd.Parameters.AddWithValue("_memid", memid); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); try { if (dt != null) { if (dt.Rows.Count > 0) { Member e = new Member(); foreach (DataRow r in dt.Rows) { e.memid = r["memid"].ToString(); e.fullname = r["fullname"].ToString(); e.address = r["address"].ToString(); e.contactno = r["contactno"].ToString(); e.status = r["status_"].ToString(); e.typeofmembership = r["typeofmembership"].ToString(); e.occupation = r["occupation"].ToString(); e.email = r["email"].ToString(); e.acceptance_date = Convert.ToDateTime(r["acceptance_date"].ToString()); e.address = r["address"].ToString(); e.tinno = r["tinno"].ToString(); } return e; } else { return null; } } else { return null; } } catch (Exception err) { Logger.WriteErrorLog("ERROR ON MEMBERS_SELECT_BY_ID MODULE :" + err.Message); return null; } }
public void Load_Searched_MembersInListView(ListView lv, String input) { Member e = new Member(); DataTable dt = new DataTable(); dt = e.SELECT_BY_NAME(input); lv.Items.Clear(); if (dt != null) { int ctr = 1; foreach (DataRow r in dt.Rows) { ListViewItem li = new ListViewItem(); li.Text = ctr.ToString(); li.SubItems.Add(r["memid"].ToString()); li.SubItems.Add(r["fullname"].ToString()); li.SubItems.Add(r["address"].ToString()); li.SubItems.Add(r["contactno"].ToString()); Member_Standing ms = new Member_Standing(); ms.memid = r["memid"].ToString(); li.SubItems.Add(ms.STANDING); li.BackColor = (ms.STANDING == "MIGS") ? Color.GreenYellow : Color.Red; lv.Items.Add(li); ctr++; } } }
public void LoadRegularMembers(ComboBox cbo) { Member e = new Member(); DataTable dt = new DataTable(); dt = e.SELECT_REGULAR(); if (dt != null) { foreach (DataRow r in dt.Rows) { cbo.Items.Add(r["fullname"] + "-" + r["memid"]); } } }