Ejemplo n.º 1
0
        internal static Dictionary<int, ShopRegion> GetShopRegions20(List<int> ids)
        {
            Dictionary<int, ShopRegion> dic = new Dictionary<int, ShopRegion>();

             if (ids != null && ids.Count > 0)
             {
                 SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Shop_region_Get20",
                delegate(IParameterSet parameters)
                {
                    int maxCount = ids.Count > 20 ? 20 : ids.Count;
                    for (int i = 0; i < maxCount; i++)
                    {
                        parameters.AddWithValue("@tid" + (i + 1).ToString(), ids[i]);
                    }
                },
                delegate(IRecord record)
                {
                    ShopRegion m = new ShopRegion();
                    m.Id = record.GetInt32OrDefault(0, 0);
                    m.Name = record.GetStringOrEmpty(1);
                    m.ParentId = record.GetInt32OrDefault(2, 0);
                    m.TransferPrice = record.GetDouble(3);
                    m.TransferPrice1 = record.GetDouble(4);
                    m.TransferPrice2 = record.GetDouble(5);

                    if (!dic.ContainsKey(m.Id))
                        dic.Add(m.Id, m);
                }
            );
             }

             return dic;
        }
Ejemplo n.º 2
0
        internal static ShopRegion GetShopRegion(int id)
        {
            ShopRegion m = new ShopRegion(id);
            if (id > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                        Database.GetDatabase(JaneDefine.DBInstanceName),
                     "dbo.Shop_region_Get",
                     delegate(IRecord record)
                     {
                         m.Id = record.GetInt32OrDefault(0, 0);
                         m.Name = record.GetStringOrEmpty(1);
                         m.ParentId = record.GetInt32OrDefault(2,0);
                         m.TransferPrice = record.GetDouble(3);
                         m.TransferPrice1 = record.GetDouble(4);
                         m.TransferPrice2 = record.GetDouble(5);

                     },
                     id);
            }
            return m;
        }
Ejemplo n.º 3
0
 public int SetShopRegion(ShopRegion item)
 {
     return JaneShopRegionDao.SetShopRegion(item);
 }
Ejemplo n.º 4
0
        internal static int SetShopRegion(ShopRegion item)
        {
            if (item == null) return -1;

            SafeProcedure.ExecuteNonQuery(
             Database.GetDatabase(JaneDefine.DBInstanceName),
             "dbo.Shop_region_Set",
             delegate(IParameterSet parameters)
             {
                 parameters.AddWithValue("@id", item.Id);
                 parameters.AddWithValue("@Name", item.Name);
                 parameters.AddWithValue("@ParentId", item.ParentId);
                 parameters.AddWithValue("@TransferPrice", item.TransferPrice);
                 parameters.AddWithValue("@TransferPrice1", item.TransferPrice1);
                 parameters.AddWithValue("@TransferPrice2", item.TransferPrice2);
                   parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);

             },
             delegate(IParameterSet outputParameters)
             {
                 item.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
             });

            return item.Id;
        }
Ejemplo n.º 5
0
 internal static void MapList(IRecord record, List<ShopRegion> list)
 {
     ShopRegion m = new ShopRegion();
     m.Id = record.GetInt32OrDefault(0, 0);
     m.Name = record.GetStringOrEmpty(1);
     m.ParentId = record.GetInt32OrDefault(2, 0);
     m.TransferPrice = record.GetDouble(3);
     m.TransferPrice1 = record.GetDouble(4);
     m.TransferPrice2 = record.GetDouble(5);
     list.Add(m);
 }