private void txtMembership_TextChanged(object sender, EventArgs e) { String mobile = textBoxMobile.Text; if (mobile == "") { memberList.Rows.Clear(); } MemberShipModel member = new MemberShipModel(); dynamic members = member.where (member, "mobile like '%" + mobile + "%'"); if (members.Count > 0) { memberList.Rows.Clear(); String status = "In Active"; foreach (var mem in members) { if (mem.is_active) { status = "Active"; } memberList.Rows.Add(mem.id, mem.name, mem.email, mem.mobile, mem.address, Math.Round(mem.point, 2), status); } } else { memberList.Rows.Clear(); } }
private void memberList_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && this.invoice != null) { int SelectedRow = memberList.SelectedRows[0].Index; dynamic cellValue = memberList.Rows[SelectedRow].Cells["Point"].Value; if (memberList.SelectedRows[0].Index < memberList.Rows.Count - 1) { DialogResult result = MessageDialog.Show("Membership Selection!", " Do you want to select this member?", "member"); if (result == DialogResult.Yes) { double point = Convert.ToDouble(Convert.ToString(cellValue)); double sumOfPoint = point + (total_price / 100); dynamic cellValueOfId = memberList.Rows[SelectedRow].Cells["Id"].Value; String id = Convert.ToString(cellValueOfId); MemberShipModel memberShipModel = new MemberShipModel(); memberShipModel.update_attributeForSingleRow(memberShipModel, "point", sumOfPoint, id); memberShipModel.update_attributeForSingleRow(memberShipModel, "last_point", point, id); this.invoice.point = sumOfPoint; this.invoice.lastPoint = point; ActivityLogModel log = new ActivityLogModel(); log.model = "membership"; log.action = "update"; log.date = DateTime.Now.ToString("yyyy-MM-dd"); log.ref_id = id; log.department_id = DepartmentSettings.DepartmentId; log.create(log); this.Close(); } } else { MessageBox.Show("please select a row"); } } }
public static string invoiceData(dynamic log_invoice) { string json = ""; MemberShipModel member = new MemberShipModel(); dynamic membership = member.find(member, log_invoice.ref_id); if (membership != null) { dynamic dataObject = new ExpandoObject(); dataObject.id = log_invoice.id; dataObject.key = log_invoice.action; dataObject.trackable_id = membership.id; dataObject.trackable_type = log_invoice.model; if (log_invoice.action != "delete") { dynamic data = new ExpandoObject(); data.point = membership.point; data.last_point = membership.last_point; dataObject.data = data; } json = JsonConvert.SerializeObject(dataObject); } return(json); }