コード例 #1
0
 public static Shop ToShop(dtoShop dtoShop, string password)
 {
     return(new Shop()
     {
         Code = dtoShop.Code, NameShop = dtoShop.NameShop, Password = password, Connections = Converts.ToConnections(dtoShop.Connections), Getaways = Converts.ToGetaways(dtoShop.Getaways), Walls = Converts.ToWalls(dtoShop.Walls), Stands = Converts.ToStands(dtoShop.Stands), CodeGetaway = dtoShop.CodeGetaway
     });
 }
コード例 #2
0
ファイル: shopController.cs プロジェクト: ilana10/rep5
        public RequestResponse InsertShop1(dtoShop s)
        {
            //הכנסת חנות ע"י בניה ללא קשתות
            RequestResponse r = s.Insert("1234", path);

            return(r);
        }
コード例 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            dtoShop s1 = new dtoShop()
            {
                Code = 80, Connections = null, NameShop = "ממתקולד"
            };
            dtoShop s2 = new dtoShop()
            {
                Code = 80, Connections = null, NameShop = "סופרזול"
            };
            dtoShop s3 = new dtoShop()
            {
                Code = 80, Connections = null, NameShop = "ממתיק"
            };
            dtoShop s4 = new dtoShop()
            {
                Code = 80, Connections = null, NameShop = "מספרה"
            };

            s1.Insert("1234", path);
            s2.Insert("1234", path);
            s3.Insert("1234", path);
            s4.Insert("1234", path);
            MessageBox.Show("הוספו 3 " + s2.NameShop);
            ShopWayEntities sho = new ShopWayEntities();

            dataGridView1.DataSource = sho.Shops.ToList();
        }
コード例 #4
0
        //מחלץ XML
        private void button2_Click(object sender, EventArgs e)
        {
            dtoShop       s3  = new dtoShop();
            XmlSerializer xml = new XmlSerializer(typeof(dtoShop));
            StreamReader  sw  = new StreamReader(@"D:\Data\shop.xml");

            s3 = (dtoShop)xml.Deserialize(sw);
            MessageBox.Show("ok, get shop " + s3.NameShop);
            s3.Insert("1234", path);
        }
コード例 #5
0
        //יוצר XML
        private void button6_Click(object sender, EventArgs e)
        {
            ShopWayEntities shopWayEntities = new ShopWayEntities();
            Shop            s2  = shopWayEntities.Shops.ToList().First();
            dtoShop         s3  = Converts.ToDtoShop(s2);
            XmlSerializer   xml = new XmlSerializer(typeof(dtoShop));
            StreamWriter    sw  = new StreamWriter(@"E:\Data\shop.xml");

            xml.Serialize(sw, s3);
        }
コード例 #6
0
ファイル: shopController.cs プロジェクト: ilana10/rep5
        public RequestResponse PostShopBasic(RequestResponse request)
        {
            dynamic       data        = request.Data;
            List <object> objectsData = data.ToObject <List <object> >();
            dynamic       d0          = objectsData[0];
            dynamic       d1          = objectsData[1];
            dtoShop       shop        = (dtoShop)d0.ToObject <dtoShop>();
            string        password    = (string)d1;

            //זה מה שצריך לעבוד בסוף
            return(shop.Insert(password, path));
        }
コード例 #7
0
        public static dtoShop ToDtoShop(Shop shop)
        {// כל רשימה שממירים יש לבדוק האם אינה ריקה
         //משום שהרשימות של אוייקט הדאל צריכות המרה לטיפוס רשימה, ולא ניתן להמיר אובייקט ריק
            dtoShop dto = new dtoShop();

            dto.Code     = shop.Code;
            dto.NameShop = shop.NameShop;
            dto.Stands   = shop.Stands != null?Converts.ToDtoStands(shop.Stands.ToList()) : null;

            dto.Walls = shop.Walls != null?Converts.ToDtoWalls(shop.Walls.ToList()) : null;

            dto.Connections = shop.Connections != null?Converts.ToDtoConnections(shop.Connections.ToList()) : null;

            dto.Getaways = shop.Stands != null?Converts.ToDtoGetawaysI(dtoShop.GetawayProcI_Results(shop.Code)) : null;

            dto.CodeGetaway = Convert.ToInt32(shop.CodeGetaway);
            return(dto);
        }
コード例 #8
0
ファイル: shopController.cs プロジェクト: ilana10/rep5
        public RequestResponse PostXml(RequestResponse request)
        {
            //הוספת XML של החנות
            //string xml= System.Text.Encoding.Default.GetString(request);
            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(xml);
            //doc["shop"][]


            RequestResponse r = new RequestResponse();

            try
            {
                //TODO: מה עושים איתו
                r.Data    = null;
                r.Message = "thank you for the file";
                r.Result  = true;

                dtoShop       s3   = new dtoShop();
                XmlSerializer xml2 = new XmlSerializer(typeof(dtoShop));
                string        str  = (string)request.Data;
                List <byte>   arr  = new List <byte>();
                str.Split(',').ToList().ForEach(x => arr.Add(byte.Parse(x)));
                Encoding.ASCII.GetBytes(str);
                var str1 = System.Text.Encoding.Default.GetString(arr.ToArray());

                Stream stream = new MemoryStream(arr.ToArray());
                s3        = (dtoShop)xml2.Deserialize(stream);
                r         = s3.Insert("", path);
                r.Result  = true;
                r.Message = "החנות נוספה בהצלחה. ביכולתך לשבץ בה מוצרים";
            }
            catch (Exception e)
            {
                r.Result  = false;
                r.Message = "קיימת בעיה בקובץ שהזנת, בדוק שהוא בתבנית הנדרשת";
            }

            return(r);
        }
コード例 #9
0
 //[Route("Post")]
 public void Post(dtoShop s)
 {
     //זה מה שצריך לעבוד בסוף
     s.Insert();
 }