private static List <Orderitems> EntityList(string q) { List <Orderitems> list = new List <Orderitems>(); using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Orderitems obj = new Orderitems() { Orderitems_id = redr[ORDERITEMS.ORDERITEMS_ID].ToString(), Order_id = redr[ORDERITEMS.ORDER_ID].ToString(), Order_no = redr[ORDERITEMS.ORDER_NO].ToString(), Style_id = redr[STYLE.STYLE_NO].ToString(), Style_name = redr[ORDERITEMS.STYLE_NAME].ToString(), Colours_id = redr[COLOURS.COLOURS_NAME].ToString(), Qty = redr[ORDERITEMS.QTY].ToString(), Price = ConvertTO.Decimal(redr[ORDERITEMS.PRICE].ToString()), Mrp = ConvertTO.Decimal(redr[ORDERITEMS.MRP].ToString()), Refered_id = redr[ORDERITEMS.REFERED_ID].ToString(), Locked = redr[ORDERITEMS.LOCKED].ToString(), }; list.Add(obj); } } return(list); }
public static void InsertSub(Orderitems v, DAL dalsession) { string q = " INSERT INTO " + ORDERITEMS.ORDERITEMS_TBL + " ( "; q += " " + ORDERITEMS.ORDER_ID + " \r\n "; q += "," + ORDERITEMS.ORDER_NO + " \r\n "; q += "," + ORDERITEMS.STYLE_ID + " \r\n "; q += "," + ORDERITEMS.STYLE_NAME + " \r\n "; q += "," + ORDERITEMS.COLOURS_ID + " \r\n "; q += "," + ORDERITEMS.QTY + " \r\n "; q += "," + ORDERITEMS.PRICE + " \r\n "; q += "," + ORDERITEMS.MRP + " \r\n "; q += "," + ORDERITEMS.REFERED_ID + " \r\n "; q += "," + ORDERITEMS.LOCKED + " \r\n "; q += " ) VALUES ( "; q += " @" + ORDERITEMS.ORDER_ID + "@ \r\n "; q += ", @" + ORDERITEMS.ORDER_NO + "@ \r\n "; q += ", @" + ORDERITEMS.STYLE_ID + "@ \r\n "; q += ", @" + ORDERITEMS.STYLE_NAME + "@ \r\n "; q += ", @" + ORDERITEMS.COLOURS_ID + "@ \r\n "; q += ", @" + ORDERITEMS.QTY + "@ \r\n "; q += ", @" + ORDERITEMS.PRICE + "@ \r\n "; q += ", @" + ORDERITEMS.MRP + "@ \r\n "; q += ", @" + ORDERITEMS.REFERED_ID + "@ \r\n "; q += ", @" + ORDERITEMS.LOCKED + "@ \r\n "; q += " ) \r\n "; q = AttachParams(q, v); dalsession.Execute(q); }
private static string AttachParams(string q, Orderitems v) { q = q.Replace("@" + ORDERITEMS.ORDER_ID + "@", "" + ConvertTO.SqlString(v.Order_id) + ""); q = q.Replace("@" + ORDERITEMS.ORDER_NO + "@", "" + ConvertTO.SqlString(v.Order_no) + ""); q = q.Replace("@" + ORDERITEMS.STYLE_ID + "@", "" + ConvertTO.SqlString(v.Style_id) + ""); q = q.Replace("@" + ORDERITEMS.STYLE_NAME + "@", "" + ConvertTO.SqlString(v.Style_name) + ""); q = q.Replace("@" + ORDERITEMS.COLOURS_ID + "@", "" + ConvertTO.SqlString(v.Colours_id) + ""); q = q.Replace("@" + ORDERITEMS.QTY + "@", "" + ConvertTO.SqlString(v.Qty) + ""); q = q.Replace("@" + ORDERITEMS.PRICE + "@", "" + ConvertTO.SqlDecimal(v.Price) + ""); q = q.Replace("@" + ORDERITEMS.MRP + "@", "" + ConvertTO.SqlDecimal(v.Mrp) + ""); q = q.Replace("@" + ORDERITEMS.REFERED_ID + "@", "" + ConvertTO.SqlString(v.Refered_id) + ""); q = q.Replace("@" + ORDERITEMS.LOCKED + "@", "" + ConvertTO.SqlString(v.Locked) + ""); return(q); }
public static void Insert(List <Orderitems> list, DAL dalsession) { for (int i = 0; i < list.Count; i++) { Orderitems obj = new Orderitems() { Order_id = list[i].Order_id, Order_no = list[i].Order_no, Style_id = list[i].Style_id, Style_name = list[i].Style_name, Colours_id = list[i].Colours_id, Qty = list[i].Qty, Price = list[i].Price, Mrp = list[i].Mrp, Refered_id = list[i].Refered_id, Locked = list[i].Locked }; InsertSub(obj, dalsession); } }
private List <Orderitems> Collectitems(string vId) { List <Orderitems> list = new List <Orderitems>(); for (int r = 0; r < editgrid.RowCount; r++) { Orderitems obj = new Orderitems(); if ( (editgrid[ORDERITEMS.STYLE_ID, r].Value + "") == "" || (editgrid[ORDERITEMS.QTY, r].Value + "") == "" || (editgrid[ORDERITEMS.PRICE, r].Value + "") == "" ) { //==LEAVE IT(the empty row). } else { obj.Orderitems_id = ""; obj.Order_id = vId; obj.Order_no = txt_order_no.Text; obj.Style_id = CStyle_exten.GetId_Name(editgrid[ORDERITEMS.STYLE_ID, r].Value + ""); obj.Style_name = (editgrid[ORDERITEMS.STYLE_NAME, r].Value + ""); obj.Colours_id = CColours_exten.GetId_Name(editgrid[ORDERITEMS.COLOURS_ID, r].Value + ""); obj.Qty = (editgrid[ORDERITEMS.QTY, r].Value + ""); obj.Price = ConvertTO.Decimal(editgrid[ORDERITEMS.PRICE, r].Value + ""); obj.Mrp = ConvertTO.Decimal(editgrid[ORDERITEMS.MRP, r].Value + ""); obj.Refered_id = ""; obj.Locked = Core.Unlocked; list.Add(obj); } } if (list.Count != 0) { return(list); } return(null); }