public void set_customPayments_from_paymentmethod() { cls_CustomPayments custompayment = new cls_CustomPayments(); string sql = @"SELECT `SyncId` AS `Payment Id`, `name` AS `Payment Name`, `field1` AS 'Field 1', `field2` AS 'Field 2', `field3` AS 'Field 3', `field4` AS 'Field 4', `field5` AS 'Field 5', `field6` AS 'Field 6' FROM `paymentmethod` WHERE `SyncId` >= 100 ORDER BY `SyncId`" ; DataTable DT = mySQLFunc.getdb(sql); if (DT == null) { return; } if (DT.Rows.Count <= 0) { return; } else { foreach (DataRow DR in DT.Rows) { custompayment = new cls_CustomPayments(); custompayment.set_custompayments_by_DataRow(DR); list_customPayment.Add(custompayment); } } }
private void SelectCustomPayment() { if (dgvCustomPayments.SelectedRows.Count <= 0) { return; } cls_CustomPayments custompayments = list_customPayment[dgvCustomPayments.SelectedRows[0].Index]; lblPaymentId.Text = custompayments.get_paymentwid(); lblPaymentMethodName.Text = custompayments.get_name(); ClearCustomPaymentInformation(); if (custompayments.get_field1() != "") { lblField1.Text = custompayments.get_field1(); lblField1.Visible = true; txtField1.Visible = true; } else { lblField1.Visible = false; txtField1.Visible = false; } if (custompayments.get_field2() != "") { lblField2.Text = custompayments.get_field2(); lblField2.Visible = true; txtField2.Visible = true; } else { lblField2.Visible = false; txtField2.Visible = false; } if (custompayments.get_field3() != "") { lblField3.Text = custompayments.get_field3(); lblField3.Visible = true; txtField3.Visible = true; } else { lblField3.Visible = false; txtField3.Visible = false; } if (custompayments.get_field4() != "") { lblField4.Text = custompayments.get_field4(); lblField4.Visible = true; txtField4.Visible = true; } else { lblField4.Visible = false; txtField4.Visible = false; } if (custompayments.get_field5() != "") { lblField5.Text = custompayments.get_field5(); lblField5.Visible = true; txtField5.Visible = true; } else { lblField5.Visible = false; txtField5.Visible = false; } if (custompayments.get_field6() != "") { lblField6.Text = custompayments.get_field6(); lblField6.Visible = true; txtField6.Visible = true; } else { lblField6.Visible = false; txtField6.Visible = false; } }