How can i pass this method from another form to other
public class arka_data
{
public int NR { get; set; }
public int BARKODI { get; set; }
public string EMERTIMI { get; set; }
public int SASIA {get;set;}
public float CMIMI {get;set;}
public float TVSH { get; set; }
public float TOTAL { get; set; }
public float NENTOTALI { get; set; }
public float ZBRITJA { get; set; }
public float TOTALI { get; set; }
public DateTime KOHA { get; set; }
public string KASIERI { get; set; }
public string KLIENTI { get; set; }
public float VLERAETVSH { get; set; }
public float VLERAPATVSH { get; set; }
public int NRATIKUJVE { get; set; }
public float TOTALIPCS { get; set; }
public float VLERATVSHTOTAL { get; set; }
{
public int NR { get; set; }
public int BARKODI { get; set; }
public string EMERTIMI { get; set; }
public int SASIA {get;set;}
public float CMIMI {get;set;}
public float TVSH { get; set; }
public float TOTAL { get; set; }
public float NENTOTALI { get; set; }
public float ZBRITJA { get; set; }
public float TOTALI { get; set; }
public DateTime KOHA { get; set; }
public string KASIERI { get; set; }
public string KLIENTI { get; set; }
public float VLERAETVSH { get; set; }
public float VLERAPATVSH { get; set; }
public int NRATIKUJVE { get; set; }
public float TOTALIPCS { get; set; }
public float VLERATVSHTOTAL { get; set; }
}
public void mbushe()
{
arka_data dta = new arka_data();
for (int i = 0; i < dataTable.Rows.Count; i++)
{
dta.NR = int.Parse(txtnrfatures.Text);
dta.VLERATVSHTOTAL = float.Parse( textBox1.Text);
dta.BARKODI = int.Parse(dataTable.Rows[i][0].ToString());
dta.EMERTIMI = dataTable.Rows[i][1].ToString();
dta.SASIA = int.Parse(dataTable.Rows[i][2].ToString());
dta.CMIMI = int.Parse(dataTable.Rows[i][3].ToString());
dta.TVSH = int.Parse(dataTable.Rows[i][4].ToString());
dta.NENTOTALI = float.Parse(txttotali.Text);
dta.ZBRITJA = float.Parse(txtzbritja.Text);
dta.TOTALI = float.Parse(totali.Text);
dta.KOHA = DateTime.Now;
dta.KASIERI = lbluser.Text;
dta.KLIENTI = cmbklienti.Text;
dta.VLERAETVSH = float.Parse(dataTable.Rows[i][7].ToString());
dta.VLERAPATVSH = float.Parse(dataTable.Rows[i][6].ToString());
dta.NRATIKUJVE = int.Parse(lblnumri.Text);
dta.TOTALIPCS = float.Parse(dataTable.Rows[i][5].ToString());
}
The idea it that this class handle the data from form one , and use it(insert it into sql) on form two . How should I pass the object in another form, or how should I refer it. Also another question is the class populated correctly (fromtextbox, labels and datagridview )
Amit GuptaPosted May 26, 2020, 10:23 AM
Lm MartinessPosted May 26, 2020, 10:05 AM
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
cmd.Parameters.Add(new SqlParameter("@klienti", cmbklienti.Text));
cmd.Parameters.Add(new SqlParameter("@pagesa", faturimi));
cmd.Parameters.Add(new SqlParameter("@nentotali", txttotali.Text));
cmd.Parameters.Add(new SqlParameter("@zbritje", txtzbritja.Text));
cmd.Parameters.Add(new SqlParameter("@totali", totali.Text));
cmd.Parameters.Add(new SqlParameter("@vleratvsh", textBox1.Text));
cmd.Parameters.Add(new SqlParameter("@nrartikujve", lblnumri.Text));
cmd.Parameters.Add(new SqlParameter("@kasieri", lbluser.Text));
cmd.Parameters.Add(new SqlParameter("@koha", DateTime.Now));
cmd.Parameters.Add(new SqlParameter("@barkodi", row.Cells[0].Value));
cmd.Parameters.Add(new SqlParameter("@emertimi", row.Cells[1].Value));
cmd.Parameters.Add(new SqlParameter("@sasia", row.Cells[2].Value));
cmd.Parameters.Add(new SqlParameter("@tvsh", row.Cells[4].Value));
cmd.Parameters.Add(new SqlParameter("@cmimi", row.Cells[3].Value));
cmd.Parameters.Add(new SqlParameter("@totalipcs", row.Cells[5].Value));
cmd.Parameters.Add(new SqlParameter("@vlerapatvshpcs", row.Cells[6].Value));
cmd.Parameters.Add(new SqlParameter("@vleraetvshpcs", row.Cells[7].Value));
Amit GuptaPosted May 26, 2020, 9:55 AM
Lm MartinessPosted May 26, 2020, 7:54 AM
{
arka_data dta = new arka_data();
for (int i = 0; i < dataTable.Rows.Count; i++)
{......}
Amit GuptaPosted May 26, 2020, 6:58 AM
{
arka_data dta = new arka_data();
for (int i = 0; i < dataTable.Rows.Count; i++)
{......}