コード例 #1
0
 private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     Console.Write("1");
     try
     {
         int r = this.dataGridView2.CurrentRow.Index;
         Console.Write("2");
         Console.Write(dataGridView2.Rows[r].Cells[1].Value.ToString());
         DataTable dt = new DataTable("teble");
         dt.Columns.Add("编号", typeof(string));
         dt.Columns.Add("名称", typeof(string));
         dt.Columns.Add("单位", typeof(String));
         dt.Columns.Add("数量", typeof(double));
         dt.Columns.Add("单价", typeof(double));
         dt.Columns.Add("金额", typeof(double));
         dt.Columns.Add("备注", typeof(String));
         sale             p  = new sale();
         List <sale_good> ps = new List <sale_good>();
         Console.Write("3");
         ps = p.selectMaterial_danhao(dataGridView2.Rows[r].Cells[1].Value.ToString());
         foreach (sale_good p1 in ps)
         {
             good    r1   = new good();
             gooddao rdao = new gooddao();
             r1 = rdao.selectNumber(p1.Good_number);
             dt.Rows.Add(p1.Good_number, r1.Good_name, p1.Unit, p1.Count, p1.Price, p1.Money, p1.Remark);
         }
         dataGridView2.DataSource = dt;
     }
     catch (SystemException)
     {
         MessageBox.Show("操作有误");
     }
 }
コード例 #2
0
 public ActionResult Search(String name)
 {
     if (name != null && name.Length > 0)
     {
         String      sql     = "select * from good where name like '%" + name + "%' ORDER by upitem";
         DataSet     ds      = dbo.query(sql);
         List <good> navList = new List <good>();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             good info = new good()
             {
                 id     = (Guid)dr["id"],
                 img    = dr["img"].ToString(),
                 info   = dr["info"].ToString(),
                 price  = (double)dr["price"],
                 upitem = (int)dr["upitem"],
                 name   = dr["name"].ToString()
             };
             navList.Add(info);
         }
         return(Json(navList));
     }
     else
     {
         return(Json("error"));
     }
 }
コード例 #3
0
        //添加商品
        public void add(good r)
        {
            MySqlConnection conn = Util.Util.getConn();
            MySqlCommand    command;

            try
            {
                command             = conn.CreateCommand();
                command.CommandText = "INSERT INTO good(good_number,good_name,good_type,good_unit,good_price) VALUES(@good_number,@good_name,@good_type,@good_unit,@good_price,)";
                command.Parameters.AddWithValue("@good_number", r.Good_number);
                command.Parameters.AddWithValue("@good_name", r.Good_name);
                command.Parameters.AddWithValue("@good_type", r.Good_type);
                command.Parameters.AddWithValue("@good_unit", r.Good_unit);
                command.Parameters.AddWithValue("@good_price", r.Good_price);
                command.ExecuteNonQuery();
                MessageBox.Show("插入成功");
            }
            catch (Exception)
            {
                MessageBox.Show("插入失败");
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
コード例 #4
0
        }                                                                 // Команда открытия окна создания товара

        // Добавление товара к заказу
        private object AddingGood(int param)
        {
            good_view selected_item = goods_base.First(x => x.id_good == param);
            good      order_item    = order.Where(x => x.id_good == selected_item.id_good).FirstOrDefault();

            if (selected_item.in_storage > 0)
            {
                if (order_item != null)
                {
                    if (order_item.in_storage < selected_item.in_storage)
                    {
                        good i = order_item;
                        i.in_storage++;
                        int index = order.IndexOf(order_item);
                        order.Remove(order_item);
                        order.Insert(index, i);
                    }
                }
                else
                {
                    good j = selected_item.ToGood();
                    order.Add(j);
                }
            }
            res.prop = 0;
            foreach (var item in order)
            {
                res.prop += item.price * item.in_storage;
            }
            return(null);
        }
コード例 #5
0
ファイル: saleDetail.cs プロジェクト: lovema121016/HappyLemon
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = new DataTable("teble");
         dt.Columns.Add("销售日期", typeof(string));
         dt.Columns.Add("单据号", typeof(string));
         dt.Columns.Add("客户", typeof(String));
         dt.Columns.Add("商品编号", typeof(string));
         dt.Columns.Add("商品名称", typeof(string));
         dt.Columns.Add("单位", typeof(string));
         dt.Columns.Add("单价", typeof(double));
         dt.Columns.Add("数量", typeof(double));
         dt.Columns.Add("销售金额", typeof(double));
         dt.Columns.Add("备注", typeof(String));
         sale             p  = new sale();
         List <sale_good> ps = new List <sale_good>();
         if (comboBox1.Text == "" && textBox1.Text == "")
         {
             ps = p.selectMaterial_date(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text));
         }
         if (comboBox1.Text == "" && textBox1.Text != "")
         {
             ps = p.selectMaterial_dateandrname(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text), textBox1.Text);
         }
         if (comboBox1.Text != "" && textBox1.Text == "")
         {
             string[] suppliername = comboBox1.Text.Split(' ');
             ps = p.selectMaterial_dateandsnumber(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text), suppliername[0]);
         }
         if (comboBox1.Text != "" && textBox1.Text != "")
         {
             string[] suppliername = comboBox1.Text.Split(' ');
             ps = p.selectMaterial_dateandrnameandsupplier(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text), suppliername[0], textBox1.Text);
         }
         foreach (sale_good p1 in ps)
         {
             Console.Write(p1.Danju_id + "姚雅丽呀");
             good    r1   = new good();
             gooddao rdao = new gooddao();
             r1 = rdao.selectNumber(p1.Good_number);
             customer    s1   = new customer();
             customerdao sdao = new customerdao();
             s1 = sdao.selectnumber(p1.Customernumber);
             dt.Rows.Add(p1.Dan_date, p1.Danju_id, s1.Customer_name, r1.Good_number, r1.Good_name, p1.Unit, p1.Price, p1.Count, p1.Money, p1.Remark);
         }
         dataGridView1.DataSource = dt;
         double money = 0;
         for (int i = 0; i < dataGridView1.Rows.Count; i++)
         {
             money += Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value);
         }
         label6.Text = money.ToString();
     }
     catch (SystemException)
     {
         MessageBox.Show("操作不当");
     }
 }
コード例 #6
0
ファイル: DesignDataService.cs プロジェクト: aisilu93/Shop
        public void GetData(Action <good, Exception> callback)
        {
            // Use this to create design time data

            var item = new good();

            callback(item, null);
        }
コード例 #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            good good = db.goods.Find(id);

            db.goods.Remove(good);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #8
0
ファイル: goodBaseUI.cs プロジェクト: ylbs110/test
	public void setCode(string T){
		code = T;
		foreach (good go in GM.allGood) {
			if(go.code==code){
				thisGood=go;
				return;
			}
		}
	}
コード例 #9
0
 public ActionResult Edit([Bind(Include = "good_id,good_name")] good good)
 {
     if (ModelState.IsValid)
     {
         db.Entry(good).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(good));
 }
コード例 #10
0
        public ActionResult Create([Bind(Include = "good_id,good_name")] good good)
        {
            if (ModelState.IsValid)
            {
                db.goods.Add(good);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(good));
        }
コード例 #11
0
 private void Awake()
 {
     if (singleton)
     {
         Destroy(gameObject);
     }
     else
     {
         singleton = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
コード例 #12
0
        // Добавить новый товар в базу
        public void AddNewGood(string good_name, int price, int category_id, int in_storage)
        {
            good new_good = new good();

            new_good.name_g     = good_name;
            new_good.price      = price;
            new_good.cat_g      = category_id;
            new_good.in_storage = in_storage;
            db.goods.Add(new_good);
            db.SaveChanges();

            LoadGoodsBase();
        }
コード例 #13
0
        // GET: goods/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            good good = db.goods.Find(id);

            if (good == null)
            {
                return(HttpNotFound());
            }
            return(View(good));
        }
コード例 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name  = textBox2.Text;
            double price = Convert.ToDouble(textBox3.Text);

            goodsFactory.addGoods(name, price);
            using (var db = new ShopContext())
            {
                var newgood = new good(name, price);
                db.Goods.Add(newgood);
                db.SaveChanges();
            }
            Console.WriteLine("Add new good");
        }
コード例 #15
0
        public async Task <ActionResult <good> > Postgood(good good, long id)
        {
            var Shop = await _context.Shops.FindAsync(id);

            if (Shop == null)
            {
                return(BadRequest());
            }

            Shop.Goods.Add(good);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("Getgood", new { id = good.Id }, good);
            return(CreatedAtAction(nameof(Getgood), new { id = good.Id }, good));
        }
コード例 #16
0
        // Удаление товара из заказа
        private object DeletingGood(int param)
        {
            good order_item = order.Where(x => x.id_good == param).FirstOrDefault();

            if (order_item != null)
            {
                order.Remove(order_item);
            }
            res.prop = 0;
            foreach (var item in order)
            {
                res.prop += item.price * item.in_storage;
            }
            return(null);
        }
コード例 #17
0
        private info getInfo()
        {
            info one = new info();

            one.n = m_items.Count;

            vehTool    m_veh = new vehTool("D:\\logistics data\\address-backup.sqlite");
            List <Veh> vehs  = m_veh.GetVehs();

            m_veh.close();
            one.nj = vehs[0].number;
            one.nx = vehs[1].number;

            one.Lj = vehs[0].distance;
            one.Lx = vehs[1].distance;

            one.Vj = vehs[0].capacity;
            one.Vx = vehs[1].capacity;

            one.Cj = vehs[0].cost;
            one.Cx = vehs[1].cost;

            envTool m_env = new envTool("D:\\logistics data\\address-backup.sqlite");

            one.Pt = m_env.getLoadTime();
            one.At = m_env.getWorkTime();
            m_env.close();

            addrAnalyser       m_addr = new addrAnalyser(m_items, false);
            List <PointLatLng> points = m_addr.getTargets();

            List <good> targets = new List <good>();

            good center = new good();

            center.pos = points[0];
            targets.Add(center);

            for (int i = 0; i < one.n; ++i)
            {
                good g = new good();
                g.pos = points[i + 1];
            }

            return(one);
        }
コード例 #18
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO:  这行代码将数据加载到表“lemonDataSet.customer”中。您可以根据需要移动或删除它。
            //panel1.Visible = false;
            //自动生成单据
            sale p = new sale();
            int  P_Int_newBillCode = p.selectMaxdanjuid() + 1;//记录单据编号中的数字码

            textBox1.Text = DateTime.Now.ToString("yyyyMMdd") + "HappyLemon_sale" + P_Int_newBillCode;
            //  label9.Focus();
            panel1.Visible = false;



            good    r1  = new good();
            gooddao dao = new gooddao();

            //int index=this.purchaseTable.Rows.Add();
            //Console.Write(number1[0]);
            if (number1 == null)
            {
            }
            else
            {
                foreach (string i in number1)
                {
                    r1 = dao.selectNumber(i);
                    if (r1 == null)
                    {
                    }
                    else
                    {
                        int index = this.dataGridView1.Rows.Add();
                        this.dataGridView1.Rows[index].Cells[0].Value = r1.Good_number;
                        this.dataGridView1.Rows[index].Cells[1].Value = r1.Good_name;
                        this.dataGridView1.Rows[index].Cells[3].Value = r1.Good_unit;
                        this.dataGridView1.Rows[index].Cells[5].Value = r1.Good_price;
                    }
                }
            }
            dataGridView1.Focus(); //使表格获得鼠标焦点
            supplier_text.Focus(); //使供应商文本框成为焦点


            //datagridview2
        }
コード例 #19
0
        public List <good> find_all1()
        {
            MySqlConnection conn       = Util.Util.getConn();
            MySqlDataReader dataReader = null;
            MySqlCommand    command    = null;
            good            r          = null;
            List <good>     rs         = new List <model.good>();

            try
            {
                command             = conn.CreateCommand();
                command.CommandText = "SELECT * FROM rawMaterial";
                dataReader          = command.ExecuteReader();
                Console.WriteLine();
                while (dataReader.Read())
                {
                    r             = new good();
                    r.Id          = dataReader.GetInt16(0);
                    r.Good_number = dataReader.GetString(1);
                    r.Good_name   = dataReader.GetString(2);
                    r.Good_type   = dataReader.GetString(3);
                    r.Good_unit   = dataReader.GetString(4);
                    r.Good_price  = dataReader.GetDouble(5);
                    Console.Write(r.Good_price);
                    Console.Write("瑶瑶李");
                    rs.Add(r);
                    Console.Write("瑶瑶李");
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (!dataReader.IsClosed)
                {
                    dataReader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(rs);
        }
コード例 #20
0
ファイル: GoodController.cs プロジェクト: id717890/lc-manager
        public string GetGoods()
        {
            OperatorGoodsResponse operatorGoodsResponse = new OperatorGoodsResponse();

            try
            {
                OperatorGoodsRequest operatorGoodsRequest = new OperatorGoodsRequest
                {
                    Operator = JwtProps.GetOperator()
                };
                HttpResponseMessage responseMessage = HttpClientService.PostAsync("api/values/OperatorGoods", operatorGoodsRequest).Result;
                if (responseMessage.IsSuccessStatusCode)
                {
                    operatorGoodsResponse = responseMessage.Content.ReadAsAsync <OperatorGoodsResponse>().Result;
                    if (operatorGoodsResponse.ErrorCode == 0 && string.IsNullOrEmpty(operatorGoodsResponse.Message))
                    {
                        goodsdata data = new goodsdata();
                        foreach (var c in operatorGoodsResponse.OperatorGoods)
                        {
                            good g = new good
                            {
                                chek = "<input type='checkbox' class='checkbox checkbox-for-good' name='checkbox[]" + c.Id + "' id='checkbox" + c.Id + "' value='" + c.Id + "'><label for='checkbox" + c.Id + "'></label>",
                                id   = c.Id.ToString(),
                                name = c.Code,
                                text = c.Name
                            };
                            data.data.Add(g);
                        }
                        return(JsonConvert.SerializeObject(data));
                    }
                    return(JsonConvert.SerializeObject(operatorGoodsResponse));
                }
                else
                {
                    operatorGoodsResponse.ErrorCode = 10;
                    operatorGoodsResponse.Message   = "Ошибка получения данных";
                }
            }
            catch (Exception ex)
            {
                operatorGoodsResponse.ErrorCode = 2;
                operatorGoodsResponse.Message   = ex.Message;
            }
            return(JsonConvert.SerializeObject(operatorGoodsResponse));
        }
コード例 #21
0
        public async Task <IActionResult> Putgood(long idS, long idG, good good)
        {
            var Shop = await _context.Shops.FindAsync(idS);

            if (Shop == null)
            {
                return(BadRequest());
            }

            var currentGood = Shop.Goods.FirstOrDefault(g => g.Id == idG);
            int index       = Shop.Goods.IndexOf(currentGood);

            Shop.Goods.Remove(currentGood);
            Shop.Goods.Insert(index, good);

            await _context.SaveChangesAsync();

            return(NoContent());
        }
コード例 #22
0
        public ActionResult Modify(Guid id)
        {
            DboUtils db  = new DboUtils();
            String   sql = "select * from good where id = '" + id + "'";
            DataSet  ds  = db.query(sql);
            DataRow  dr  = ds.Tables[0].Rows[0];
            good     g   = new good()
            {
                id     = (Guid)dr["id"],
                img    = dr["img"].ToString(),
                info   = dr["info"].ToString(),
                price  = (double)dr["price"],
                upitem = (int)dr["upitem"],
                name   = dr["name"].ToString()
            };

            ViewBag.g = g;
            return(View());
        }
コード例 #23
0
        public ActionResult getInfoAll()
        {
            String      sql     = "select * from good ORDER by upitem";
            DataSet     ds      = dbo.query(sql);
            List <good> navList = new List <good>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                good info = new good()
                {
                    id     = (Guid)dr["id"],
                    img    = dr["img"].ToString(),
                    info   = dr["info"].ToString(),
                    price  = (double)dr["price"],
                    upitem = (int)dr["upitem"],
                    name   = dr["name"].ToString()
                };
                navList.Add(info);
            }
            return(Json(navList));
        }
コード例 #24
0
        //根据id查询商品
        public good selectAll(int id)
        {
            MySqlConnection conn       = Util.Util.getConn();
            MySqlDataReader dataReader = null;
            MySqlCommand    command    = null;
            good            r          = new good();

            try
            {
                command             = conn.CreateCommand();
                command.CommandText = "SELECT * FROM good where id =" + id;
                dataReader          = command.ExecuteReader();
                Console.WriteLine();
                while (dataReader.Read())
                {
                    r.Id          = dataReader.GetInt16(0);
                    r.Good_number = dataReader.GetString(1);
                    r.Good_name   = dataReader.GetString(2);
                    r.Good_type   = dataReader.GetString(3);
                    r.Good_unit   = dataReader.GetString(4);
                    r.Good_price  = dataReader.GetDouble(5);
                    return(r);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (!dataReader.IsClosed)
                {
                    dataReader.Close();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(null);
        }
コード例 #25
0
        public Form1()
        {
            InitializeComponent();       //工厂增加商品

            /*   goodsFactory.addGoods("goodsa", 1);
             * goodsFactory.addGoods("goodsb", 2);
             * goodsFactory.addGoods("goodsc", 3);
             *
             * //增加订单
             * int orderId = oServe.addorder("order1", 1);
             * oServe.orderAddDetail(orderId, 0, 3, 0.5);
             * oServe.orderAddDetail(orderId, 2, 3, 0.5);
             * orderId = oServe.addorder("order2", 2);
             * oServe.orderAddDetail(orderId, 0, 3, 0.5);
             * oServe.orderAddDetail(orderId, 2, 3, 0.5);
             * oServe.orderList[0].listDeatil();
             * //Console.WriteLine(oServe.orderList[0].orderTotal);
             * Console.WriteLine(oServe.orderList[0].ifHaveGood(2));
             * //oServe.orderList.Sort();
             * //oServe.queryByOid(2,true);
             * //  oServe.queryByCusid(1);
             * oServe.queryByGoodId(2);
             * Console.WriteLine("Hello World!");*/

            this.goodsBindingSource.DataSource       = goodsFactory.goodsList;
            this.orderQueryBindingSource.DataSource  = oServe.queryList;
            this.AllOrderbindingSource.DataSource    = oServe.orderList;
            this.orderDetailbindingSource.DataSource = oServe.orderDetailList;
            using (var db = new ShopContext())
            {
                var newgood = new good("test", 3.14);
                if (db.Goods == null)
                {
                    Console.WriteLine("oh");
                }
                db.Goods.Add(newgood);
                db.SaveChanges();
            }
        }
コード例 #26
0
ファイル: ExelData.cs プロジェクト: MorozVladimir/exeltoxml
        public ExelData(string fName)
        {
            company = new Company();

            // JArray data = new JArray();
            //       using (ExcelPackage package = new ExcelPackage(file.OpenReadStream()))
            FileInfo fileInfo = new FileInfo(fName);

            using (ExcelPackage package = new ExcelPackage(fileInfo))
            {
                ExcelWorksheet companysheet  = package.Workbook.Worksheets[0];
                ExcelWorksheet categorysheet = package.Workbook.Worksheets[1];
                ExcelWorksheet goodsheet     = package.Workbook.Worksheets[2];

                company.name           = companysheet.Cells[1, 2].Value.ToString();
                company.url            = companysheet.Cells[2, 2].Value.ToString();
                company.currenciesId   = companysheet.Cells[3, 2].Value.ToString();
                company.currenciesRate = companysheet.Cells[4, 2].Value.ToString();
                //Process, read from excel here and populate jarray
                //  int companyRowCount = companysheet.Dimension.Rows;
                //   int companyColCount = companysheet.Dimension.Columns;

                Console.WriteLine(company.name);
                Console.WriteLine(company.url);
                Console.WriteLine(company.currenciesId);
                Console.WriteLine(company.currenciesRate);
                Console.WriteLine();


                categories = new List <Category>();
                int categoryRowCount = categorysheet.Dimension.Rows;
                int categoryColCount = categorysheet.Dimension.Columns;

                for (int i = 2; i <= categoryRowCount; i++)
                {
                    Category category = new Category();
                    category.id = Int32.Parse(categorysheet.Cells[i, 1].Value.ToString());
                    //       category.parentId = Int32.Parse(categorysheet.Cells[i, 2].Value.ToString());
                    try { category.parentId = Int32.Parse(categorysheet.Cells[i, 2].Value.ToString()); }
                    catch { category.parentId = 0; }
                    category.value = categorysheet.Cells[i, 3].Value.ToString();
                    categories.Add(category);
                }

                foreach (var cat in categories)
                {
                    Console.WriteLine(cat.id + " " + cat.parentId + " " + cat.value);
                }


                goods = new List <good>();
                int goodRowCount    = goodsheet.Dimension.Rows;
                int goodColumnCount = goodsheet.Dimension.Columns;
                Console.WriteLine("grow -" + goodRowCount + "  gcol -" + goodColumnCount);
                bool nextId = false;
                good good   = new good();
                for (int i = 2; i <= goodRowCount; i++)
                {
                    //       good = new good();
                    int gidtemp;
                    try { gidtemp = Int32.Parse(goodsheet.Cells[i, 1].Value.ToString()); }
                    catch { gidtemp = 0; }
                    Console.Write("gid-" + gidtemp);
                    if (gidtemp != 0)
                    {
                        if (nextId == true)
                        {
                            goods.Add(good);
                            good = new good();
                            //                         nextId = true;
                        }
                        else
                        {
                            nextId = true;
                        }
                        good.id        = gidtemp;
                        good.available = (goodsheet.Cells[i, 2].Value.ToString().Equals("true")) ? true : false;
                        //       Console.Write("  gava-" + good.available);
                        good.price = decimal.Parse(goodsheet.Cells[i, 3].Value.ToString());
                        //       Console.Write("  price-" + good.price);
                        good.priceOld = decimal.Parse(goodsheet.Cells[i, 4].Value.ToString());
                        //       Console.Write("  priceOld-" + good.priceOld);
                        good.pricePromo = decimal.Parse(goodsheet.Cells[i, 5].Value.ToString());
                        //       Console.Write("  pricePromo-" + good.pricePromo);
                        good.stockQuantity = decimal.Parse(goodsheet.Cells[i, 6].Value.ToString());
                        //        Console.Write("  stockQuantity-" + good.stockQuantity);
                        good.CurrencyId = goodsheet.Cells[i, 7].Value.ToString();
                        //         Console.Write("  currenciId-" + good.CurrencyId);
                        good.categoryId = Int32.Parse(goodsheet.Cells[i, 8].Value.ToString());
                        //        Console.Write("  categoryId-" + good.categoryId);
                        //   good.pictures = new List<string>();
                        //  Console.Write("  picture-" + goodsheet.Cells[i, 9].Value.ToString());
                        good.pictures.Add(goodsheet.Cells[i, 9].Value.ToString());
                        //        Console.Write("  picture-" + good.pictures.ToArray()[0]);
                        good.name        = goodsheet.Cells[i, 10].Value.ToString();
                        good.article     = goodsheet.Cells[i, 11].Value.ToString();
                        good.vendor      = goodsheet.Cells[i, 12].Value.ToString();
                        good.description = goodsheet.Cells[i, 13].Value.ToString();
                        goodParam goodParam = new goodParam();
                        goodParam.name  = goodsheet.Cells[i, 14].Value.ToString();
                        goodParam.value = goodsheet.Cells[i, 15].Value.ToString();
                        ///  good.pictures
                        Console.WriteLine(goodParam.name + " " + goodParam.value + " " + good.id);
                        good.parametrs.Add(goodParam);
                    }
                    else
                    {
                        try
                        {
                            var pic = goodsheet.Cells[i, 9].Value.ToString();
                            good.pictures.Add(pic);
                        }
                        catch
                        {
                        }

                        try
                        {
                            var parname = goodsheet.Cells[i, 14].Value.ToString();
                            var parval  = goodsheet.Cells[i, 15].Value.ToString();
                            //    Console.WriteLine(parname + " " + parval);
                            goodParam goodParam = new goodParam();
                            goodParam.name  = parname;
                            goodParam.value = parval;
                            Console.WriteLine(goodParam.name + " " + goodParam.value + " " + good.id);
                            good.parametrs.Add(goodParam);
                        }
                        catch
                        {
                        }
                        Console.WriteLine(i + " из " + goodRowCount);
                        if (i == goodRowCount)
                        {
                            goods.Add(good);
                        }
                    }
                }
                foreach (var g in goods)
                {
                    Console.WriteLine("gid-" + g.id + "  gname-" + g.name);
                    foreach (var pi in g.pictures)
                    {
                        Console.WriteLine("   ->" + pi);
                    }
                    foreach (var pa in g.parametrs)
                    {
                        Console.WriteLine("              paname>>" + pa.name + "   paval>>" + pa.value + " " + g.id);
                    }
                }

                Console.WriteLine("+++++++++++++++++++++");
                Console.WriteLine(goods.ToArray()[0].parametrs.ToArray()[0].value);
            }
        }
コード例 #27
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 private void getAllGood()
 {
     for (int i=0; i<goodDataJson.Count; i++){
         good goData=new good();
         goData.code=goodDataJson [i] ["code"].ToString();
         goData.name=goodDataJson [i] ["name"].ToString();
         goData.type=int.Parse(goodDataJson [i] ["type"].ToString());
         goData.describe=goodDataJson [i] ["describe"].ToString();
         goData.number=int.Parse(goodDataJson [i] ["number"].ToString());
         goData.price=int.Parse(goodDataJson [i] ["price"].ToString());
         allGood.Add(goData);
     }
 }
コード例 #28
0
ファイル: goodBaseUI.cs プロジェクト: ylbs110/test
	// Use this for initialization
	void Start () {
		GM=GameObject.FindGameObjectWithTag ("Player").GetComponent<gameManager> ();
		thisGood = new good ();
	}