Example #1
0
        public Inventory(int id)
        {
            try
            {
                InventoryProvider pr = new InventoryProvider();
                DataSet ds = pr.getById(id);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    this.id = int.Parse(ds.Tables[0].Rows[0]["id_inventory"].ToString());
                    this.del = bool.Parse(ds.Tables[0].Rows[0]["del"].ToString());
                    this.guid = ds.Tables[0].Rows[0]["guid"].ToString();
                    if(ds.Tables[0].Rows[0]["inventory_date"].ToString() != "")
                        this.date = DateTime.Parse(ds.Tables[0].Rows[0]["inventory_date"].ToString());
                    this.usr = new Photoland.Security.User.UserInfo();
                    this.usr.Id_user = int.Parse(ds.Tables[0].Rows[0]["inventory_user"].ToString());

                    this.body = InventoryBody.getInventoryBodyByInventoryId(id);

                }
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        public static List<Inventory> getList()
        {
            List<Inventory> lst = new List<Inventory>();
            try
            {
                InventoryProvider pr = new InventoryProvider();
                DataSet ds = pr.GetList();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Inventory o = new Inventory();
                    o.id = int.Parse(ds.Tables[0].Rows[i]["id_inventory"].ToString());
                    o.del = bool.Parse(ds.Tables[0].Rows[i]["del"].ToString());
                    o.guid = ds.Tables[0].Rows[i]["guid"].ToString();
                    if (ds.Tables[0].Rows[i]["inventory_date"].ToString() != "")
                        o.date = DateTime.Parse(ds.Tables[0].Rows[i]["inventory_date"].ToString());
                    o.usr = new Photoland.Security.User.UserInfo();
                    o.usr.Id_user = int.Parse(ds.Tables[0].Rows[i]["inventory_user"].ToString());
                    // не правильно, но старые объекты не стал переписывать :) пятница!
                    UserProvider upr = new UserProvider();
                    o.usr.Name = upr.getNameById(o.usr.Id_user);

                    lst.Add(o);
                }
            }
            catch (Exception ex)
            {
            }
            return lst;
        }