private List <QReceiptitems> Collectitems(string vId) { List <QReceiptitems> list = new List <QReceiptitems>(); for (int r = 0; r < editgrid.RowCount; r++) { QReceiptitems obj = new QReceiptitems(); if ( (editgrid[QRECEIPTITEMS.QRECEIPT_AMOUNT, r].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { obj.Qreceiptitems_id = ""; obj.Qreceipt_id = vId; obj.Qreceipt_by = (editgrid[QRECEIPTITEMS.QRECEIPT_BY, r].Value + ""); obj.Quotation_no = (editgrid[QRECEIPTITEMS.QUOTATION_NO, r].Value + ""); obj.Quotation_amount = ConvertTO.Decimal(editgrid[QRECEIPTITEMS.QUOTATION_AMOUNT, r].Value + ""); obj.Qreceipt_amount = ConvertTO.Decimal(editgrid[QRECEIPTITEMS.QRECEIPT_AMOUNT, r].Value + ""); list.Add(obj); } } if (list.Count != 0) { return(list); } return(null); }
private static string AttachParams(string q, QReceiptitems v) { q = q.Replace("@" + QRECEIPTITEMS.QRECEIPT_ID + "@", "" + ConvertTO.SqlString(v.Qreceipt_id) + ""); q = q.Replace("@" + QRECEIPTITEMS.QRECEIPT_BY + "@", "" + ConvertTO.SqlString(v.Qreceipt_by) + ""); q = q.Replace("@" + QRECEIPTITEMS.QUOTATION_NO + "@", "" + ConvertTO.SqlString(v.Quotation_no) + ""); q = q.Replace("@" + QRECEIPTITEMS.QUOTATION_AMOUNT + "@", "" + ConvertTO.SqlString(v.Quotation_amount + "")); q = q.Replace("@" + QRECEIPTITEMS.QRECEIPT_AMOUNT + "@", "" + ConvertTO.SqlString(v.Qreceipt_amount + "")); return(q); }
public static void Insert(List <QReceiptitems> list, DAL dalsession) { for (int i = 0; i < list.Count; i++) { QReceiptitems obj = new QReceiptitems() { Qreceipt_id = list[i].Qreceipt_id, Qreceipt_by = list[i].Qreceipt_by, Quotation_no = list[i].Quotation_no, Quotation_amount = list[i].Quotation_amount, Qreceipt_amount = list[i].Qreceipt_amount }; InsertSub(obj, dalsession); } }
public static void InsertSub(QReceiptitems v, DAL dalsession) { string q = " INSERT INTO " + QRECEIPTITEMS.QRECEIPTITEMS_TBL + " ( "; q += " " + QRECEIPTITEMS.QRECEIPT_ID + " \r\n "; q += "," + QRECEIPTITEMS.QRECEIPT_BY + " \r\n "; q += "," + QRECEIPTITEMS.QUOTATION_NO + " \r\n "; q += "," + QRECEIPTITEMS.QUOTATION_AMOUNT + " \r\n "; q += "," + QRECEIPTITEMS.QRECEIPT_AMOUNT + " \r\n "; q += " ) VALUES ( "; q += " @" + QRECEIPTITEMS.QRECEIPT_ID + "@ \r\n "; q += ", @" + QRECEIPTITEMS.QRECEIPT_BY + "@ \r\n "; q += ", @" + QRECEIPTITEMS.QUOTATION_NO + "@ \r\n "; q += ", @" + QRECEIPTITEMS.QUOTATION_AMOUNT + "@ \r\n "; q += ", @" + QRECEIPTITEMS.QRECEIPT_AMOUNT + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private static List <QReceiptitems> EntityList(string q) { List <QReceiptitems> list = new List <QReceiptitems>(); using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { QReceiptitems obj = new QReceiptitems() { Qreceiptitems_id = redr[QRECEIPTITEMS.QRECEIPTITEMS_ID].ToString(), Qreceipt_id = redr[QRECEIPTITEMS.QRECEIPT_ID].ToString(), Qreceipt_by = redr[QRECEIPTITEMS.QRECEIPT_BY].ToString(), Quotation_no = redr[QRECEIPTITEMS.QUOTATION_NO].ToString(), Quotation_amount = ConvertTO.Decimal(redr[QRECEIPTITEMS.QUOTATION_AMOUNT].ToString()), Qreceipt_amount = ConvertTO.Decimal(redr[QRECEIPTITEMS.QRECEIPT_AMOUNT].ToString()), }; list.Add(obj); } } return(list); }