public static List <int> GetDeletedIDsAfter(long LastVersion)
        {
            BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
            v.LoadDeletedIDs(LastVersion);
            List <int> list = new List <int>();

            while (!v.EOF)
            {
                list.Add((int)v.GetColumn("ID"));
                v.MoveNext();
            }
            return(list);
        }
 public static void DeleteList(List <int> list)
 {
     BLL.ReceiptInvoiceDetail bv = new BLL.ReceiptInvoiceDetail();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
 public static List <ReceiptInvoiceDetail> GetUpdatesAfter(long?lastVersion, DateTime?lastUpdateTime)
 {
     BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(lastVersion.Value);
     }
     else if (lastUpdateTime.HasValue)
     {
         v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return(ToList(v));
 }
        public static void SaveList(List<HCMIS.Desktop.STVSyncService.STVDetail> list)
        {
            BLL.ReceiptInvoiceDetail bv = new BLL.ReceiptInvoiceDetail();
            foreach (HCMIS.Desktop.STVSyncService.STVDetail v in list)
            {
                // try to load by primary key
                BLL.ReceiptInvoice rctInvoice = new BLL.ReceiptInvoice();

                rctInvoice.LoadByAccountAndSTVNo(v.AccountID.Value, v.STVNo.Value);// ID.Value);
                bv.LoadByReceiptInvoiceID(rctInvoice.ID);
                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                    bv.ReceiptInvoiceID = rctInvoice.ID;
                    bv.ReceiptInvoiceType = rctInvoice.ReceiptInvoiceType;
                }
                // populate the contents of v on the to the database list

                if (v.ItemID.HasValue)
                    bv.ItemID = v.ItemID.Value;
                if (v.HubID.HasValue)
                    bv.HubID = v.HubID.Value;
                if (v.RequisitionNo.HasValue)
                    bv.RequisitionNo = v.RequisitionNo.Value;
                if (v.STVNo.HasValue)
                    bv.STVNo = v.STVNo.Value;
                if (v.AccountID.HasValue)
                    bv.AccountID = v.AccountID.Value;
                if (v.ManufactureID.HasValue)
                    bv.ManufactureID = v.ManufactureID.Value;
                if (v.Qty.HasValue)
                    bv.Qty = v.Qty.Value;
                if (v.Batch != "" && v.Batch != null)
                    bv.Batch = v.Batch;
                if (v.Expiry.HasValue)
                    bv.Expiry = v.Expiry.Value;
                if (v.UnitCost.HasValue)
                    bv.UnitCost = v.UnitCost.Value;
                if (v.TotalCost.HasValue)
                    bv.TotalCost = v.TotalCost.Value;
                bv.Margin = v.Margin;

                bv.Save();
            }
        }
 public static List<ReceiptInvoiceDetail> GetUpdatesAfter(long? lastVersion, DateTime? lastUpdateTime)
 {
     BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(lastVersion.Value);
     }
     else if (lastUpdateTime.HasValue)
     {
         v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return ToList(v);
 }
 public static List<int> GetDeletedIDsAfter(long LastVersion)
 {
     BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
     v.LoadDeletedIDs(LastVersion);
     List<int> list = new List<int>();
     while (!v.EOF)
     {
         list.Add((int)v.GetColumn("ID"));
         v.MoveNext();
     }
     return list;
 }
 public static List<ReceiptInvoiceDetail> GetAll()
 {
     BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
     v.LoadAll();
     return ToList(v);
 }
        public static void DeleteList(List<int> list)
        {
            BLL.ReceiptInvoiceDetail bv = new BLL.ReceiptInvoiceDetail();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
        public static void SaveList(List <HCMIS.Desktop.STVSyncService.STVDetail> list)
        {
            BLL.ReceiptInvoiceDetail bv = new BLL.ReceiptInvoiceDetail();
            foreach (HCMIS.Desktop.STVSyncService.STVDetail v in list)
            {
                // try to load by primary key
                BLL.ReceiptInvoice rctInvoice = new BLL.ReceiptInvoice();

                rctInvoice.LoadByAccountAndSTVNo(v.AccountID.Value, v.STVNo.Value);// ID.Value);
                bv.LoadByReceiptInvoiceID(rctInvoice.ID);
                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                    bv.ReceiptInvoiceID   = rctInvoice.ID;
                    bv.ReceiptInvoiceType = rctInvoice.ReceiptInvoiceType;
                }
                // populate the contents of v on the to the database list

                if (v.ItemID.HasValue)
                {
                    bv.ItemID = v.ItemID.Value;
                }
                if (v.HubID.HasValue)
                {
                    bv.HubID = v.HubID.Value;
                }
                if (v.RequisitionNo.HasValue)
                {
                    bv.RequisitionNo = v.RequisitionNo.Value;
                }
                if (v.STVNo.HasValue)
                {
                    bv.STVNo = v.STVNo.Value;
                }
                if (v.AccountID.HasValue)
                {
                    bv.AccountID = v.AccountID.Value;
                }
                if (v.ManufactureID.HasValue)
                {
                    bv.ManufactureID = v.ManufactureID.Value;
                }
                if (v.Qty.HasValue)
                {
                    bv.Qty = v.Qty.Value;
                }
                if (v.Batch != "" && v.Batch != null)
                {
                    bv.Batch = v.Batch;
                }
                if (v.Expiry.HasValue)
                {
                    bv.Expiry = v.Expiry.Value;
                }
                if (v.UnitCost.HasValue)
                {
                    bv.UnitCost = v.UnitCost.Value;
                }
                if (v.TotalCost.HasValue)
                {
                    bv.TotalCost = v.TotalCost.Value;
                }
                bv.Margin = v.Margin;

                bv.Save();
            }
        }
        public static List <ReceiptInvoiceDetail> ToList(BLL.ReceiptInvoiceDetail v)
        {
            List <ReceiptInvoiceDetail> list = new List <ReceiptInvoiceDetail>();

            while (!v.EOF)
            {
                ReceiptInvoiceDetail t = new ReceiptInvoiceDetail();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("ReceiptInvoiceID"))
                {
                    t.ReceiptInvoiceID = v.ReceiptInvoiceID;
                }
                if (!v.IsColumnNull("ItemID"))
                {
                    t.ItemID = v.ItemID;
                }
                if (!v.IsColumnNull("HubID"))
                {
                    t.HubID = v.HubID;
                }
                if (!v.IsColumnNull("RequisitionNo"))
                {
                    t.RequisitionNo = v.RequisitionNo;
                }
                if (!v.IsColumnNull("STVNo"))
                {
                    t.STVNo = v.STVNo;
                }
                if (!v.IsColumnNull("AccountID"))
                {
                    t.AccountID = v.AccountID;
                }
                if (!v.IsColumnNull("ManufactureID"))
                {
                    t.ManufactureID = v.ManufactureID;
                }
                if (!v.IsColumnNull("Qty"))
                {
                    t.Qty = v.Qty;
                }
                if (!v.IsColumnNull("Batch"))
                {
                    t.Batch = v.Batch;
                }
                if (!v.IsColumnNull("Expiry"))
                {
                    t.Expiry = v.Expiry;
                }
                if (!v.IsColumnNull("ReceiptInvoiceType"))
                {
                    t.ReceiptInvoiceType = v.ReceiptInvoiceType;
                }
                if (!v.IsColumnNull("UnitCost"))
                {
                    t.UnitCost = v.UnitCost;
                }
                if (!v.IsColumnNull("TotalCost"))
                {
                    t.TotalCost = v.TotalCost;
                }
                if (!v.IsColumnNull("Margin"))
                {
                    t.Margin = v.Margin;
                }

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
 public static List <ReceiptInvoiceDetail> GetAll()
 {
     BLL.ReceiptInvoiceDetail v = new BLL.ReceiptInvoiceDetail();
     v.LoadAll();
     return(ToList(v));
 }