Esempio n. 1
0
 static public ShopItem AddShopItem(ShopItem shop)
 {
     if (false == App.AppVariables.g_dataprovider.IsItemExistsInShop(shop.ItemIndex, shop.ShopItemID))
     {
         return App.AppVariables.g_dataprovider.AddShopItem(shop);
     }
     else
         return null;
 }
Esempio n. 2
0
 public ShopItem Clone()
 {
     ShopItem shop = new ShopItem();
     shop.ShopItemID = m_shopItemID;
     shop.CountLimit = m_countLimit;
     shop.ItemIndex = m_itemIndex;
     shop.Price = m_price;
     shop.RandSeed = m_randSeed;
     shop.RECID= m_recid;
     shop.ReputeLevel = m_reputeLevel;
     shop.ShopTemplateID = m_shopTemplateID;
     shop.TabType = m_tabType;
     shop.SortIndex = m_sortIndex;
     return shop;
 }
Esempio n. 3
0
 public void UpdateItem(ShopItem newitem)
 {
     if (this.Count <= 0) return;
     ShopItem shop = null;
     for (int i = 0; i < this.Count; i++)
     {
         shop = (ShopItem)this[i];
         if (shop.ItemIndex == newitem.ItemIndex)
         {
             shop.ShopItemID = newitem.ShopItemID;
             shop.CountLimit = newitem.CountLimit;
             shop.Price = newitem.Price;
             shop.RandSeed = newitem.RandSeed;
             shop.ReputeLevel = newitem.ReputeLevel;
             shop.ShopTemplateID = newitem.ShopTemplateID;
             shop.TabType = newitem.TabType;
             shop.SortIndex = newitem.SortIndex;
             this[i] = shop;
             break;
         }
     }
 }
Esempio n. 4
0
        private void _doDrop(DataRowView view)
        {
            if (null == m_shopitems) return;
            //不能加入相同的记录
            foreach (ShopItem item in m_shopitems)
            {
                if (item.ItemIndex == (int)view["物件标识"])
                {
                    return;
                }
            }

            ShopItem shop = new ShopItem();
            shop.ShopItemID = -1;
            shop.CountLimit = "-1";
            shop.ItemIndex = (int)view["物件标识"];
            shop.Price = 0;
            shop.RandSeed = "1";
            shop.RECID = -1;
            shop.ReputeLevel = "1";
            shop.ShopTemplateID = Int32.Parse(lblShopID.Text);
            shop.SortIndex = dgvShopItems.Rows.Count;//排序号
            if (null != m_itemcategories && m_itemcategories.Count > 0)
            {
                ItemCategory itemcategory = (ItemCategory)m_itemcategories[0];
                shop.TabType = itemcategory.CategoryName;
            }
            m_shopitems.Add(shop);
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells[2].Selected = true;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells[1].Value = lblShopID.Text;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["物件标识"].Value = view["物件标识"];
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["物件名称"].Value = view["物件名称"];
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["随机种子"].Value = shop.RandSeed;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["最大数目"].Value = shop.CountLimit;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["声望等级"].Value = shop.ReputeLevel;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["价格"].Value = shop.Price;
            dgvShopItems.Rows[dgvShopItems.Rows.Count - 1].Cells["排列序号"].Value = shop.SortIndex;

            this._initShopItems(Int32.Parse(lblShopID.Text), false);
            try
            {
                dgvShopItems.Rows[dgvShopItems.Rows.Count - 2].Cells[2].Selected = true;
            }
            catch { }
            m_isDirty = true;//设置全局修改标志位
        }
Esempio n. 5
0
 /// <summary>
 /// 将显示的数据记录转换为对象
 /// </summary>
 /// <param name="rowidx"></param>
 /// <returns></returns>
 private ShopItem _buildShopItemFromView(int rowidx)
 {
     ShopItem shop = new ShopItem();
     shop.ShopItemID = Convert.ToInt32(dgvShopItems.Rows[rowidx].Cells["ShopItemID"].Value);
     shop.CountLimit = dgvShopItems.Rows[rowidx].Cells["最大数目"].Value.ToString();
     shop.ItemIndex = Convert.ToInt32(dgvShopItems.Rows[rowidx].Cells["物件标识"].Value);
     shop.Price = Convert.ToInt32(dgvShopItems.Rows[rowidx].Cells["价格"].Value);
     shop.RandSeed = dgvShopItems.Rows[rowidx].Cells["随机种子"].Value.ToString();
     shop.ReputeLevel = dgvShopItems.Rows[rowidx].Cells["声望等级"].Value.ToString();
     shop.ShopTemplateID = Convert.ToInt32(dgvShopItems.Rows[rowidx].Cells["商店模板标识"].Value);
     shop.TabType = dgvShopItems.Rows[rowidx].Cells["物件类型"].Value.ToString();
     shop.SortIndex = Convert.ToInt32(dgvShopItems.Rows[rowidx].Cells["排列序号"].Value);
     return shop;
 }
Esempio n. 6
0
 static public bool UpdateShopItem(ShopItem shop)
 {
     return App.AppVariables.g_dataprovider.UpdateShopItem(shop);
 }
Esempio n. 7
0
 private ShopItem _buildShopItem(ref SqlDataReader sdr)
 {
     if (null == sdr || false == sdr.HasRows) return null;
     ShopItem shopitem = new ShopItem();
     shopitem.RECID = Convert.ToInt32(sdr["RECID"]);
     shopitem.ShopItemID = Convert.ToInt32(sdr["ShopItemID"]);
     shopitem.ShopTemplateID = Convert.ToInt32(sdr["ShopTemplateID"]);
     shopitem.CountLimit = Convert.ToString(sdr["CountLimit"]);
     shopitem.ItemIndex = Convert.ToInt32(sdr["ItemIndex"]);
     shopitem.Price = Convert.ToInt32(sdr["Price"]);
     shopitem.RandSeed = Convert.ToString(sdr["RandSeed"]);
     shopitem.ReputeLevel = Convert.ToString(sdr["ReputeLevel"]);
     shopitem.TabType = Convert.ToString(sdr["TabType"]);
     shopitem.SortIndex = Convert.ToInt32(sdr["SortIndex"]);
     return shopitem;
 }
Esempio n. 8
0
 public bool UpdateShopItem(ShopItem shop)
 {
     this._setShopItemParamValues(ref this.m_shopitemParams4Update, shop);
     int iret = m_db.RunProc2(this.m_Proc_UpdateShopItem, this.m_shopitemParams4Update, false);
     //int iret = m_db.RunSql("update " + this.m_shopItemTablename 
     //    + " set ShopTemplateID=" +shop.ShopTemplateID
     //    +" TabType='" +shop.TabType +"'"
     //    +" ItemIndex=" +shop.ItemIndex
     //    +" RandSeed='" +shop.RandSeed +"'"
     //    +" CountLimit='" +shop.CountLimit +"'"
     //    +" ReputeLevel='" +shop.ReputeLevel +"'"
     //    +" Price=" +shop.Price
     //    +" where ShopItemID=" +shop.ShopItemID,false);
     return (iret == 0);
 }
Esempio n. 9
0
 public ShopItem AddShopItem(ShopItem shop)
 {
     ShopItem obj = null;
     this._setShopItemParamValues(ref m_shopitemParams4Add, shop);
     int iret = m_db.RunProc2(this.m_Proc_AddShopItem, this.m_shopitemParams4Add, true);
     obj = GetOneShopItem(iret);
     return obj;
 }
Esempio n. 10
0
 private void _setShopItemParamValues(ref SqlParameter[] parm, ShopItem shopitem)
 {
     parm[0].Value = shopitem.ShopItemID;
     parm[1].Value = shopitem.ShopTemplateID;
     parm[2].Value = shopitem.TabType;
     parm[3].Value = shopitem.ItemIndex;
     parm[4].Value = shopitem.RandSeed;
     parm[5].Value = shopitem.CountLimit;
     parm[6].Value = shopitem.ReputeLevel;
     parm[7].Value = shopitem.Price;
     parm[8].Value = shopitem.SortIndex;
 }