public static List <Quotationitems> FK_withoutJoin(string id, DAL DAL)
        {
            string q = " SELECT * FROM " + QUOTATIONITEMS.QUOTATIONITEMS_TBL + " \r\n";

            q += " WHERE " + QUOTATIONITEMS.QUOTATIONITEMS_TBL + "." + QUOTATION.QUOTATION_ID + "  = '" + id + "' \r\n";
            q += " ORDER BY  " + QUOTATIONITEMS.QUOTATIONITEMS_TBL + "." + QUOTATIONITEMS.QUOTATIONITEMS_ID + ";\r\n";

            List <Quotationitems> list = new List <Quotationitems>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Quotationitems obj = new Quotationitems()
                    {
                        Quotationitems_id = redr[QUOTATIONITEMS.QUOTATIONITEMS_ID].ToString(),
                        Quotation_id      = redr[QUOTATIONITEMS.QUOTATION_ID].ToString(),
                        Product_id        = redr[QUOTATIONITEMS.PRODUCT_ID].ToString(),
                        Sizes_id          = redr[QUOTATIONITEMS.SIZES_ID].ToString(),
                        Qty        = redr[QUOTATIONITEMS.QTY].ToString(),
                        Price      = ConvertTO.Decimal(redr[QUOTATIONITEMS.PRICE].ToString()),
                        Refered_id = redr[QUOTATIONITEMS.REFERED_ID].ToString(),
                        Locked     = redr[QUOTATIONITEMS.LOCKED].ToString(),
                    };

                    list.Add(obj);
                }
            }
            return(list);
        }
        private static List <Quotationitems> EntityList(string q)
        {
            List <Quotationitems> list = new List <Quotationitems>();

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Quotationitems obj = new Quotationitems()
                    {
                        Quotationitems_id = redr[QUOTATIONITEMS.QUOTATIONITEMS_ID].ToString(),
                        Quotation_id      = redr[QUOTATIONITEMS.QUOTATION_ID].ToString(),
                        Product_id        = redr[PRODUCT.PRODUCT_NAME].ToString(),
                        Sizes_id          = redr[SIZES.SIZES_NAME].ToString(),
                        Qty        = redr[QUOTATIONITEMS.QTY].ToString(),
                        Price      = ConvertTO.Decimal(redr[QUOTATIONITEMS.PRICE].ToString()),
                        Refered_id = redr[QUOTATIONITEMS.REFERED_ID].ToString(),
                        Locked     = redr[QUOTATIONITEMS.LOCKED].ToString(),
                    };

                    list.Add(obj);
                }
            }
            return(list);
        }
Beispiel #3
0
 private static string AttachParams(string q, Quotationitems v)
 {
     q = q.Replace("@" + QUOTATIONITEMS.QUOTATION_ID + "@", "" + ConvertTO.SqlString(v.Quotation_id) + "");
     q = q.Replace("@" + QUOTATIONITEMS.PRODUCT_ID + "@", "" + ConvertTO.SqlString(v.Product_id) + "");
     q = q.Replace("@" + QUOTATIONITEMS.SIZES_ID + "@", "" + ConvertTO.SqlString(v.Sizes_id) + "");
     q = q.Replace("@" + QUOTATIONITEMS.QTY + "@", "" + ConvertTO.SqlString(v.Qty) + "");
     q = q.Replace("@" + QUOTATIONITEMS.PRICE + "@", "" + ConvertTO.SqlString((v.Price) + ""));
     q = q.Replace("@" + QUOTATIONITEMS.REFERED_ID + "@", "" + ConvertTO.SqlString(v.Refered_id) + "");
     q = q.Replace("@" + QUOTATIONITEMS.LOCKED + "@", "" + ConvertTO.SqlString(v.Locked) + "");
     return(q);
 }
Beispiel #4
0
 public static void Insert(List <Quotationitems> list, DAL dalsession)
 {
     for (int i = 0; i < list.Count; i++)
     {
         Quotationitems obj = new Quotationitems()
         {
             Quotation_id = list[i].Quotation_id,
             Product_id   = list[i].Product_id,
             Sizes_id     = list[i].Sizes_id,
             Qty          = list[i].Qty,
             Price        = list[i].Price,
             Refered_id   = list[i].Refered_id,
             Locked       = list[i].Locked
         };
         InsertSub(obj, dalsession);
     }
 }
Beispiel #5
0
        private List <Quotationitems> Collectitems(string vId)
        {
            List <Quotationitems> list = new List <Quotationitems>();

            for (int r = 0; r < editgrid.RowCount; r++)
            {
                Quotationitems obj = new Quotationitems();

                if (
                    (editgrid[QUOTATIONITEMS.PRODUCT_ID, r].Value + "") == "" ||
                    (editgrid[QUOTATIONITEMS.QTY, r].Value + "") == "" ||
                    (editgrid[QUOTATIONITEMS.PRICE, r].Value + "") == ""
                    )
                {
                    //==LEAVE IT(the empty row).
                }
                else
                {
                    obj.Quotationitems_id = "";
                    obj.Quotation_id      = vId;
                    obj.Product_id        = CProduct_exten.GetId_Name(Checks.Escape(editgrid[QUOTATIONITEMS.PRODUCT_ID, r].Value + ""));
                    obj.Sizes_id          = CSizes_exten.GetId_Name(editgrid[QUOTATIONITEMS.SIZES_ID, r].Value + "");
                    obj.Qty        = (editgrid[QUOTATIONITEMS.QTY, r].Value + "");
                    obj.Price      = ConvertTO.Decimal(editgrid[QUOTATIONITEMS.PRICE, r].Value + "");
                    obj.Refered_id = "";
                    obj.Locked     = Core.Unlocked;

                    list.Add(obj);
                }
            }

            if (list.Count != 0)
            {
                return(list);
            }

            return(null);
        }
Beispiel #6
0
        public static void InsertSub(Quotationitems v, DAL dalsession)
        {
            string q = " INSERT INTO " + QUOTATIONITEMS.QUOTATIONITEMS_TBL + " ( ";

            q += " " + QUOTATIONITEMS.QUOTATION_ID + " \r\n ";
            q += "," + QUOTATIONITEMS.PRODUCT_ID + " \r\n ";
            q += "," + QUOTATIONITEMS.SIZES_ID + " \r\n ";
            q += "," + QUOTATIONITEMS.QTY + " \r\n ";
            q += "," + QUOTATIONITEMS.PRICE + " \r\n ";
            q += "," + QUOTATIONITEMS.REFERED_ID + " \r\n ";
            q += "," + QUOTATIONITEMS.LOCKED + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + QUOTATIONITEMS.QUOTATION_ID + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.PRODUCT_ID + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.SIZES_ID + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.QTY + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.PRICE + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.REFERED_ID + "@ \r\n ";
            q += ", @" + QUOTATIONITEMS.LOCKED + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }