コード例 #1
0
        public void add()
        {
            var          childJson = HttpContext.Current.Request.Params["child"];
            var          child     = JsonConvert.DeserializeObject(childJson);
            CChildParent c         = JsonConvert.DeserializeObject <CChildParent>(childJson);

            // CChildParent child = (CChildParent)ser.DeserializeObject(childJson);
            if (HttpContext.Current.Request.Files.AllKeys.Any())
            {
                var file = HttpContext.Current.Request.Files["file"];
                ;
                byte[] data;
                using (Stream inputStream = file.InputStream)
                {
                    MemoryStream memoryStream = inputStream as MemoryStream;
                    if (memoryStream == null)
                    {
                        memoryStream = new MemoryStream();
                        inputStream.CopyTo(memoryStream);
                    }
                    data      = memoryStream.ToArray();
                    c.picture = data;
                }
            }

            BChildrenManager.addChildren(c);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: matty770/Ruti-Matti
        private void button4_Click(object sender, EventArgs e)
        {
            CChildren c = new CChildren(txtIdCH.Text, txtNameCH.Text, txtAddressCH.Text, txtPhoneCH.Text, txtCodeParentCH.Text, int.Parse(txtCodeKinderCH.Text));

            BChildrenManager.addChildren(c);
            txtIdCH.Text         = "";
            txtNameCH.Text       = "";
            txtAddressCH.Text    = "";
            txtPhoneCH.Text      = "";
            txtCodeParentCH.Text = "";
            txtCodeKinderCH.Text = "";
        }