コード例 #1
0
        public static List <ItemUnit> ToList(BLL.ItemUnit v)
        {
            List <ItemUnit> list = new List <ItemUnit>();

            while (!v.EOF)
            {
                ItemUnit t = new ItemUnit();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("ItemID"))
                {
                    t.ItemID = v.ItemID;
                }
                if (!v.IsColumnNull("QtyPerUnit"))
                {
                    t.QtyPerUnit = v.QtyPerUnit;
                }
                if (!v.IsColumnNull("Text"))
                {
                    t.Text = v.Text;
                }

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
コード例 #2
0
 public static void DeleteList(List <int> list)
 {
     BLL.ItemUnit bv = new BLL.ItemUnit();
     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
     }
 }
コード例 #3
0
        public static void DeleteList(List<int> list)
        {
            BLL.ItemUnit bv = new BLL.ItemUnit();
            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

            }
        }
コード例 #4
0
        public static void SaveList(List <HCMIS.Desktop.DirectoryServices.ItemUnitWithUnitDetail> list)
        {
            BLL.ItemUnit bv = new BLL.ItemUnit();
            foreach (HCMIS.Desktop.DirectoryServices.ItemUnitWithUnitDetail v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID);

                // Since the new strategy is to have a QtyPerUnit as 1
                // this code will make sure that new entries are set to 1
                bool isNew = false;
                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                    isNew = true;
                }
                // populate the contents of v on the to the database list
                bv.ID = v.ID;
                if (v.ItemID.HasValue)
                {
                    bv.ItemID = v.ItemID.Value;
                }

                if (isNew || (!isNew && bv.QtyPerUnit == 1))
                {
                    bv.QtyPerUnit = 1;
                }
                else
                {
                    bv.QtyPerUnit = v.QtyPerUnit;
                }

                if (v.Text != "" && v.Text != null)
                {
                    bv.Text = v.Text;
                }

                bv.Save();
            }
        }
コード例 #5
0
        public static void SaveList(List<HCMIS.Desktop.DirectoryServices.ItemUnitWithUnitDetail> list)
        {
            BLL.ItemUnit bv = new BLL.ItemUnit();
            foreach (HCMIS.Desktop.DirectoryServices.ItemUnitWithUnitDetail v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID);

                // Since the new strategy is to have a QtyPerUnit as 1
                // this code will make sure that new entries are set to 1
                bool isNew = false;
                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                    isNew = true;
                }
                // populate the contents of v on the to the database list
                bv.ID = v.ID;
                if (v.ItemID.HasValue)
                    bv.ItemID = v.ItemID.Value;

                if (isNew || (!isNew && bv.QtyPerUnit == 1))
                {
                    bv.QtyPerUnit = 1;
                }else
                {
                    bv.QtyPerUnit = v.QtyPerUnit;
                }

                if (v.Text != "" && v.Text != null)
                    bv.Text = v.Text;

                bv.Save();
            }
        }