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

            q += " WHERE " + CREDITNOTEITEMS.CREDITNOTEITEMS_TBL + "." + CREDITNOTE.CREDITNOTE_ID + "  = '" + id + "' \r\n";
            q += " ORDER BY  " + CREDITNOTEITEMS.CREDITNOTEITEMS_TBL + "." + CREDITNOTEITEMS.CREDITNOTEITEMS_ID + ";\r\n";

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

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Creditnoteitems obj = new Creditnoteitems()
                    {
                        Creditnoteitems_id = redr[CREDITNOTEITEMS.CREDITNOTEITEMS_ID].ToString(),
                        Creditnote_id      = redr[CREDITNOTEITEMS.CREDITNOTE_ID].ToString(),
                        Po_no        = redr[CREDITNOTEITEMS.PO_NO].ToString(),
                        Dc_no        = redr[CREDITNOTEITEMS.DC_NO].ToString(),
                        Product_id   = redr[CREDITNOTEITEMS.PRODUCT_ID].ToString(),
                        Sizes_id     = redr[CREDITNOTEITEMS.SIZES_ID].ToString(),
                        Qty          = redr[CREDITNOTEITEMS.QTY].ToString(),
                        Price        = ConvertTO.Decimal(redr[CREDITNOTEITEMS.PRICE].ToString()),
                        Cgst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.CGST_PERCENT].ToString()),
                        Sgst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.SGST_PERCENT].ToString()),
                        Igst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.IGST_PERCENT].ToString()),
                        Refered_id   = redr[CREDITNOTEITEMS.REFERED_ID].ToString(),
                        Locked       = redr[CREDITNOTEITEMS.LOCKED].ToString(),
                    };

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

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Creditnoteitems obj = new Creditnoteitems()
                    {
                        Creditnoteitems_id = redr[CREDITNOTEITEMS.CREDITNOTEITEMS_ID].ToString(),
                        Creditnote_id      = redr[CREDITNOTEITEMS.CREDITNOTE_ID].ToString(),
                        Po_no        = redr[CREDITNOTEITEMS.PO_NO].ToString(),
                        Dc_no        = redr[CREDITNOTEITEMS.DC_NO].ToString(),
                        Product_id   = redr[PRODUCT.PRODUCT_NAME].ToString(),
                        Sizes_id     = redr[SIZES.SIZES_NAME].ToString(),
                        Colours_id   = redr[COLOURS.COLOURS_NAME].ToString(),
                        Qty          = redr[CREDITNOTEITEMS.QTY].ToString(),
                        Price        = ConvertTO.Decimal(redr[CREDITNOTEITEMS.PRICE].ToString()),
                        Cgst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.CGST_PERCENT].ToString()),
                        Sgst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.SGST_PERCENT].ToString()),
                        Igst_percent = ConvertTO.Decimal(redr[CREDITNOTEITEMS.IGST_PERCENT].ToString()),
                        Refered_id   = redr[CREDITNOTEITEMS.REFERED_ID].ToString(),
                        Locked       = redr[CREDITNOTEITEMS.LOCKED].ToString(),
                    };

                    list.Add(obj);
                }
            }
            return(list);
        }
Пример #3
0
        public static void InsertSub(Creditnoteitems v, DAL dalsession)
        {
            string q = " INSERT INTO " + CREDITNOTEITEMS.CREDITNOTEITEMS_TBL + " ( ";

            q += " " + CREDITNOTEITEMS.CREDITNOTE_ID + " \r\n ";
            q += "," + CREDITNOTEITEMS.PO_NO + " \r\n ";
            q += "," + CREDITNOTEITEMS.DC_NO + " \r\n ";
            q += "," + CREDITNOTEITEMS.PRODUCT_ID + " \r\n ";
            q += "," + CREDITNOTEITEMS.SIZES_ID + " \r\n ";
            q += "," + CREDITNOTEITEMS.COLOURS_ID + " \r\n ";
            q += "," + CREDITNOTEITEMS.QTY + " \r\n ";
            q += "," + CREDITNOTEITEMS.PRICE + " \r\n ";
            q += "," + CREDITNOTEITEMS.CGST_PERCENT + " \r\n ";
            q += "," + CREDITNOTEITEMS.SGST_PERCENT + " \r\n ";
            q += "," + CREDITNOTEITEMS.IGST_PERCENT + " \r\n ";
            q += "," + CREDITNOTEITEMS.REFERED_ID + " \r\n ";
            q += "," + CREDITNOTEITEMS.LOCKED + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + CREDITNOTEITEMS.CREDITNOTE_ID + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.PO_NO + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.DC_NO + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.PRODUCT_ID + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.SIZES_ID + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.COLOURS_ID + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.QTY + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.PRICE + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.CGST_PERCENT + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.SGST_PERCENT + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.IGST_PERCENT + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.REFERED_ID + "@ \r\n ";
            q += ", @" + CREDITNOTEITEMS.LOCKED + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Пример #4
0
 private static string AttachParams(string q, Creditnoteitems v)
 {
     q = q.Replace("@" + CREDITNOTEITEMS.CREDITNOTE_ID + "@", "" + ConvertTO.SqlString(v.Creditnote_id) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.PO_NO + "@", "" + ConvertTO.SqlString(v.Po_no) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.DC_NO + "@", "" + ConvertTO.SqlString(v.Dc_no) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.PRODUCT_ID + "@", "" + ConvertTO.SqlString(v.Product_id) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.SIZES_ID + "@", "" + ConvertTO.SqlString(v.Sizes_id) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.COLOURS_ID + "@", "" + ConvertTO.SqlString(v.Colours_id) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.QTY + "@", "" + ConvertTO.SqlString(v.Qty) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.PRICE + "@", "" + ConvertTO.SqlString((v.Price) + ""));
     q = q.Replace("@" + CREDITNOTEITEMS.CGST_PERCENT + "@", "" + ConvertTO.SqlString((v.Cgst_percent) + ""));
     q = q.Replace("@" + CREDITNOTEITEMS.SGST_PERCENT + "@", "" + ConvertTO.SqlString((v.Sgst_percent) + ""));
     q = q.Replace("@" + CREDITNOTEITEMS.IGST_PERCENT + "@", "" + ConvertTO.SqlString((v.Igst_percent) + ""));
     q = q.Replace("@" + CREDITNOTEITEMS.REFERED_ID + "@", "" + ConvertTO.SqlString(v.Refered_id) + "");
     q = q.Replace("@" + CREDITNOTEITEMS.LOCKED + "@", "" + ConvertTO.SqlString(v.Locked) + "");
     return(q);
 }
Пример #5
0
 public static void Insert(List <Creditnoteitems> list, DAL dalsession)
 {
     for (int i = 0; i < list.Count; i++)
     {
         Creditnoteitems obj = new Creditnoteitems()
         {
             Creditnote_id = list[i].Creditnote_id,
             Po_no         = list[i].Po_no,
             Dc_no         = list[i].Dc_no,
             Product_id    = list[i].Product_id,
             Sizes_id      = list[i].Sizes_id,
             Colours_id    = list[i].Colours_id,
             Qty           = list[i].Qty,
             Price         = list[i].Price,
             Cgst_percent  = list[i].Cgst_percent,
             Sgst_percent  = list[i].Sgst_percent,
             Igst_percent  = list[i].Igst_percent,
             Refered_id    = list[i].Refered_id,
             Locked        = list[i].Locked
         };
         InsertSub(obj, dalsession);
     }
 }
Пример #6
0
        private List <Creditnoteitems> Collectitems(string vId)
        {
            List <Creditnoteitems> list = new List <Creditnoteitems>();

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

                if (
                    (editgrid[CREDITNOTEITEMS.PRODUCT_ID, r].Value + "") == "" ||
                    (editgrid[CREDITNOTEITEMS.QTY, r].Value + "") == "" ||
                    (editgrid[CREDITNOTEITEMS.PRICE, r].Value + "") == ""
                    )
                {
                    //==LEAVE IT(the empty row).
                }
                else
                {
                    obj.Creditnoteitems_id = "";
                    obj.Creditnote_id      = vId;

                    if (Customised.WithPo == true)
                    {
                        obj.Po_no = Checks.Escape(editgrid[CREDITNOTEITEMS.PO_NO, r].Value + "");
                    }
                    else
                    {
                        obj.Po_no = "0";
                    }

                    if (Customised.WithDc == true)
                    {
                        obj.Dc_no = Checks.Escape(editgrid[CREDITNOTEITEMS.DC_NO, r].Value + "");
                    }
                    else
                    {
                        obj.Dc_no = "0";
                    }

                    obj.Product_id = CProduct_exten.GetId_Name(Checks.Escape(editgrid[CREDITNOTEITEMS.PRODUCT_ID, r].Value + ""));

                    if (Customised.WithSizes == true)
                    {
                        obj.Sizes_id = CSizes_exten.GetId_Name(editgrid[CREDITNOTEITEMS.SIZES_ID, r].Value + "");
                    }
                    else
                    {
                        obj.Sizes_id = "1";
                    }

                    if (Customised.WithColours == true)
                    {
                        obj.Colours_id = CColours_exten.GetId_Name(editgrid[CREDITNOTEITEMS.COLOURS_ID, r].Value + "");
                    }
                    else
                    {
                        obj.Colours_id = "1";
                    }


                    obj.Qty          = (editgrid[CREDITNOTEITEMS.QTY, r].Value + "");
                    obj.Price        = ConvertTO.Decimal(editgrid[CREDITNOTEITEMS.PRICE, r].Value + "");
                    obj.Cgst_percent = ConvertTO.Decimal(editgrid[CREDITNOTEITEMS.CGST_PERCENT, r].Value + "");
                    obj.Sgst_percent = ConvertTO.Decimal(editgrid[CREDITNOTEITEMS.SGST_PERCENT, r].Value + "");
                    obj.Igst_percent = ConvertTO.Decimal(editgrid[CREDITNOTEITEMS.IGST_PERCENT, r].Value + "");
                    obj.Refered_id   = "";
                    obj.Locked       = Core.Unlocked;

                    list.Add(obj);
                }
            }

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

            return(null);
        }