Esempio n. 1
0
        public void Returnupdate()
        {
            var    mock = new Mock <IBookService>();
            update up   = new update();

            up.Id       = 123;
            up.BookName = "aaa";
            mock.Setup(repo => repo.Update(up)).Returns(true);
            test = new testbook(mock.Object);
            Assert.True(test.Testupdate(up));
        }
 public ActionResult Edit([Bind(Include = "update_id,update_date,title,content,update_image,synopsis,user_id")] update update)
 {
     if (ModelState.IsValid)
     {
         db.Entry(update).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.user_id = new SelectList(db.users, "user_id", "user_asp_id", update.user_id);
     return(View(update));
 }
Esempio n. 3
0
    public dynamic updateAll <clase>(List <clase> listaObj)
    {
        string query = string.Empty;

        foreach (clase item in listaObj)
        {
            IORM orm = new update();
            query += orm.construir <clase>(item, false);
        }
        return(globales.consulta(query));
    }
Esempio n. 4
0
    static void Main(string[] args)
    {
        Console.WriteLine("Parent thread: " + Thread.CurrentThread.ManagedThreadId);
        updateEvent += new update(Test_updateEvent);
        var t = Task.Factory.StartNew(
            () =>
        {
            Console.WriteLine("Task thread: " + Thread.CurrentThread.ManagedThreadId);
            updateEvent();
        });

        t.Wait();
    }
        public ActionResult Edit(int id)
        {
            update update  = db.updates.Single(u => u.UpdateID == id);
            var    project = db.projects.FirstOrDefault(x => x.ProjectID == update.ProjectID && x.UserID == CurrentUser.UserID);

            if (project == null)
            {
                return(RedirectToAction("Index", "Home"));
            }


            ViewBag.Project = project;
            return(View(update));
        }
Esempio n. 6
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        public bool Update(update update)
        {
            var entity = Context.BookRepos.Where(o => o.Id == update.Id).FirstOrDefault();

            if (entity == null)
            {
                throw new Exception();
            }
            entity.Name        = update.BookName;
            entity.Price       = update.Price;
            entity.PublishDate = update.PublishDate;
            entity.Description = update.Description;
            return(Context.SaveChanges() > 0);
        }
Esempio n. 7
0
        }//+

        /// <summary>
        /// עידכון חוזה
        /// בדיקה שהחוזה קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_rent(Renting rent, update t, object obj)
        {
            if (!is_rent_exist(rent.running_code))
            {
                throw new Exception("החוזה הזה לא קיים");
            }
            try
            {
                Dal.update_rent(rent, t, obj);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Esempio n. 8
0
 public ActionResult Edit(int id, update update)
 {
     try
     {
         update.modifiedon        = DateTime.Now;
         update.createdby         = User.Identity.Name;
         conn.Entry(update).State = EntityState.Modified;
         conn.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 9
0
        }//+

        /// <summary>
        /// עידכון תקלה
        /// בדיקה שהתקלה קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_Fault(int Fault_number, update t, object obj)
        {
            Fault m = (from tem in ((List <Fault>)Dal.return_list(BE.retur.fault))
                       where tem.fault_number == Fault_number
                       select tem).FirstOrDefault();

            try
            {
                Dal.update_Fault(m, t, obj);
            }
            catch (Exception e)
            {
                throw e;
            }
        } //+
Esempio n. 10
0
        public ActionResult Delete(int id, update update)
        {
            try
            {
                conn.updates.Remove(conn.updates.Where(x => x.updateid == id).FirstOrDefault());
                conn.SaveChanges();
                // TODO: Add delete logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 11
0
        }//+

        /// <summary>
        /// עידכון תקלה
        /// בדיקה שהתקלה קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_Fault(Fault fail, update t, object obj)
        {
            if (!is_fault_code_exist(fail.fault_number))
            {
                throw new Exception("התקלה שנשלחה לא קיימת");
            }
            try
            {
                Dal.update_Fault(fail, t, obj);
            }
            catch (Exception e)
            {
                throw e;
            }
        }//+
Esempio n. 12
0
        }//+

        /// <הגדרה>
        /// הפונקציה מעדכנת לקוח ע"פ האנום שלו
        /// </הגדרה>
        /// <param name="id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_client(Client cli, update t, object obj)
        {
            if (!is_client_exist(cli.Id1))
            {
                throw new Exception("הלקוח אינו קיים");
            }

            try
            {
                Dal.update_client(cli, t, obj);
            }
            catch (Exception tem)
            {
                throw tem;
            }
        }//+
Esempio n. 13
0
        }//+

        /// <summary>
        /// עידכון רכב
        /// בדיקה שהרכב קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_car(car ca, update t, object obj)
        {
            if (!is_car_exist(ca.car_number))
            {
                throw new Exception("הרכב הזה לא קיים");
            }

            try
            {
                Dal.update_car(ca, t, obj);
            }
            catch (Exception e)
            {
                throw e;
            }
        }//+
Esempio n. 14
0
        public Form1()
        {
            InitializeComponent();

            System.Reflection.Assembly         assembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.Diagnostics.FileVersionInfo fvi      = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
            label1.Text = "versión: " + fvi.FileVersion;


            // comprobamos actualizaciones (cada vez que se inicia el programa)
            if (Actualizaciones.check())
            {
                var d = new update();
                d.ShowDialog();
                d.Dispose();
            }
        }
Esempio n. 15
0
        }//+

        /// <summary>
        /// הפונקציה מעדכנת לקוח ע"פ האנום שלו
        /// </summary>
        /// <param name="id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_client(long id, update t, object obj)
        {
            if (!Dal.is_client_exist(id))
            {
                throw new Exception("התעודת זהות אינה קיימת");
            }

            Client cli = (((List <Client>)Dal.return_list(BE.retur.client)).Where <Client>(fufu => (fufu.Id1 == id))).FirstOrDefault();

            try
            {
                Dal.update_client(cli, t, obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }//+
        // GET: updates/Details/5
        public ActionResult Details(int?id)
        {
            ViewBag.Updates      = db.updates.ToList().OrderBy(t => t.update_date).Reverse();
            ViewBag.contentNote  = db.contents.ToList().OrderBy(p => p.content_id).Reverse();
            ViewBag.responseNote = db.responses.ToList().OrderBy(s => s.response_date).Reverse();
            ViewBag.reactionNote = db.reactions.ToList();
            ViewBag.users        = db.users.ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            update update = db.updates.Find(id);

            if (update == null)
            {
                return(HttpNotFound());
            }
            return(View(update));
        }
Esempio n. 17
0
 // 修改信息
 private void button4_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         string key = this.dataGridView1.SelectedRows[0].Cells["货物代码"].Value.ToString();
         // 将数据传递给upload窗口
         update up = new update();
         up.setValue(key);
         // 如果模态框关闭,则更新数据
         if (up.ShowDialog() == DialogResult.OK)
         {
             this.button5.PerformClick();
         }
     }
     else
     {
         MessageBox.Show("请选择行!", "提示信息");
     }
 }
Esempio n. 18
0
        public ActionResult Edit(update update)
        {
            if (ModelState.IsValid)
            {
                var proj = db.projects.FirstOrDefault(x => x.ProjectID == update.ProjectID);
                if (proj != null)
                {
                    proj.DateUpdate = DateTime.Now;
                }

                db.updates.Attach(update);
                db.ObjectStateManager.ChangeObjectState(update, EntityState.Modified);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.Project   = db.projects.FirstOrDefault(x => x.ProjectID == update.ProjectID);
            ViewBag.ProjectID = new SelectList(db.projects, "ProjectID", "Title", update.ProjectID);
            return(View(update));
        }
Esempio n. 19
0
        /// <summary>
        /// עידכון חוזה
        /// בדיקה שהחוזה קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_rent(long run_code, update t, object obj)
        {
            if (is_rent_exist(run_code))
            {
                throw new Exception("הקוד הזמנה אינו תקין");
            }

            Renting m = (from tem in ((List <Renting>)Dal.return_list(BE.retur.renting))
                         where tem.running_code == run_code
                         select tem).FirstOrDefault();

            try
            {
                Dal.update_rent(m, t, obj);
            }
            catch (Exception e)
            {
                throw e;
            }
        }//+
Esempio n. 20
0
        }//+

        /// <summary>
        /// עידכון רכב
        /// בדיקה שהרכב קיים
        /// בדיקה שאפשר לעדכן
        /// </summary>
        /// <param name="car_id"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_car(int car_id, update t, object obj)
        {
            if (!Dal.is_car_exist(car_id))
            {
                throw new Exception("המספר רכב הזאת לא קיימת");
            }

            car m = (from tem in ((List <car>)Dal.return_list(BE.retur.car))
                     where tem.car_number == car_id
                     select tem).First();

            try
            {
                Dal.update_car(m, t, obj);
            }
            catch (Exception e)
            {
                throw e;
            }
        }//+
Esempio n. 21
0
        private void BMB_Load(object sender, EventArgs e)
        {
            this.input               = new Input();
            this.cornerPoint         = new PointF(0, 0);
            this.buttonReady.Visible = false;

            // Add image to refresh button
            String currPath = System.IO.Directory.GetCurrentDirectory();

            currPath = Directory.GetParent(currPath).Parent.Parent.FullName;
            //this.refreshLobbyListButton.Image= Image.FromFile(currPath+"\\refresh_icon.png");
            //this.refreshLobbyListButton.ImageAlign = ContentAlignment.MiddleCenter;
            //this.window = CreateGraphics();
            this.addLobbyButton.TextAlign = ContentAlignment.MiddleCenter;

            //hide add lobby panel
            this.addLobbyPanel.Visible = false;
            this.label2.Visible        = false;
            populateGameList();
            this.availableGamesBox.SelectedIndex = 0;

            this.connector   = new TCP_Connector();
            this.package     = new Package();
            this.cpackage    = new Communication_Package();
            this.pingPackage = new Communication_Package();
            pingPackage.SetTypePING();
            this.gamePackages = new Queue();

            this.choosenGame = 0;

            this.mainLoopThread = new Thread(MainLoop);
            this.mainLoopThread.IsBackground = true;
            this.mainLoopThread.Start();

            audio = new SoundPlayer(BMB.Properties.Resources.gnome);


            //TEST
            sww = Stopwatch.StartNew();
            this.updateFormDelegate = new update(updateForm);
        }
Esempio n. 22
0
        public ActionResult Create(update update, int projectid = 0)
        {
            update.UserID      = CurrentUser.UserID;
            update.DateCreated = DateTime.Now;
            if (ModelState.IsValid)
            {
                var proj = db.projects.FirstOrDefault(x => x.ProjectID == update.ProjectID);
                if (proj != null)
                {
                    proj.DateUpdate = DateTime.Now;
                }

                db.updates.AddObject(update);
                db.SaveChanges();

                return(RedirectToAction("Edit", "Update", new { id = update.UpdateID }));
            }

            ViewBag.ProjectID = new SelectList(db.projects, "ProjectID", "Title", update.ProjectID);
            ViewBag.Project   = db.projects.FirstOrDefault(x => x.ProjectID == projectid);
            return(View(update));
        }
Esempio n. 23
0
        public ActionResult Create(update update, int projectid = 0)
        {
            update.UserID      = CurrentUser.UserID;
            update.DateCreated = DateTime.Now;
            var project = db.projects.FirstOrDefault(x => x.ProjectID == update.ProjectID && x.UserID == CurrentUser.UserID);

            if (project == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (ModelState.IsValid)
            {
                project.DateUpdate = DateTime.Now;
                db.updates.AddObject(update);
                db.SaveChanges();
                return(RedirectToAction("Edit", "Update", new { id = update.UpdateID }));
            }

            ViewBag.Project = project;
            return(View(update));
        }
        public ActionResult Create([Bind(Include = "update_id,update_date,title,content,update_image,synopsis,user_id")] update update)
        {
            foreach (var n in db.updates)
            {
                if (n.user_id == update.user_id)
                {
                    var id = n.update_id;

                    update updatet = db.updates.Find(id);
                    db.updates.Remove(updatet);
                }
            }
            update.title       = "notification";
            update.update_date = DateTime.Now;
            if (ModelState.IsValid)
            {
                db.updates.Add(update);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.user_id = new SelectList(db.users, "user_id", "user_asp_id", update.user_id);
            return(View(update));
        }
Esempio n. 25
0
        }//+

        /// <summary>
        /// הפונקציה מאפשרת לנו לעדכן אחד מהשדות בקליינט הבאים ע"י אנום
        /// מחיר
        /// כתובת
        /// הוספה/הורדה נהגים מורשים
        /// מספר ימים
        /// </summary>
        /// <param name="run_code"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_rent(Renting rent, update t, object obj)
        {
            switch (t)
            {
            case update.date_end:
                if (obj is DateTime)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.end_rent = (DateTime)obj;
                }
                else
                {
                    throw new Exception("this objet is not a float");
                }
                break;

            case update.destance:
                if (obj is float || obj is int)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.number_at_end = (int)obj;
                    rent.number_drove  = rent.number_at_end - rent.number_at_start;
                }
                else
                {
                    throw new Exception("this objet is not a float");
                }
                break;

            case update.defect:
                if (obj is bool)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.is_defcive = (bool)obj;
                }
                else
                {
                    throw new Exception("this objet is not a bool");
                }
                break;

            case update.ended:
                if (obj is bool)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.ended = (bool)obj;
                }
                else
                {
                    throw new Exception("this objet is not a bool");
                }
                break;

            case update.price:
                if (obj is float)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.price = (float)obj;
                }
                else
                {
                    throw new Exception("this objet is not an pepole number");
                }
                break;

            case update.mosif_n:
                if (obj is Drivers)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.number_of_pepole = 2;
                }
                else
                {
                    throw new Exception("this objet is not a \"driver object\"");
                }
                break;

            case update.morid_n:    //-
                if (obj is int)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.number_of_pepole = 1;
                }
                else
                {
                    throw new Exception("this objet is not a \"int object\"");
                }
                break;

            case update.mispar_yamim:
                if (obj is int)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.days = (int)obj;
                }
                else
                {
                    throw new Exception("this objet is not a \"int object\"");
                }
                break;

            case update.price_horada_achuz:
                if (obj is int)
                {
                    if ((int)obj > 100 || (int)obj < 0)
                    {
                        throw new Exception("המספר שנשלח הוא לא אחוז נדרש מספר בין 0 ל100 ");
                    }

                    DataSource.Renting_list.Remove(rent);
                    rent.price = rent.price - (int)obj * rent.price;
                }
                else
                {
                    throw new Exception("צריך לשלוח משתנה מסוג אינטג'ר ");
                }
                break;

            case update.price_horada_shqulim:
                if (obj is int)
                {
                    if ((int)obj > rent.price || (int)obj < 0)
                    {
                        throw new Exception("המספר שנשלח צריך להיות גדול מ0 וקטן מהמחיר המקורי");
                    }

                    DataSource.Renting_list.Remove(rent);
                    rent.price = rent.price - (int)obj;
                }
                else
                {
                    throw new Exception("צריך לשלוח משתנה מסוג אינטג'ר ");
                }
                break;

            case update.panuy:
                if (obj is bool)
                {
                    DataSource.Renting_list.Remove(rent);
                    rent.panuy = (bool)obj;
                }
                else
                {
                    throw new Exception("this objet is not a \"int object\"");
                }
                break;

            default:
                throw new Exception(string.Format("לא ניתן לעדכן {0} בהשכרה", t.ToString()));
            }
            DataSource.Renting_list.Add(rent);
        }//+
Esempio n. 26
0
 public System.IAsyncResult Beginupdate(update update, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("update", new object[] {
                 update}, callback, asyncState);
 }
Esempio n. 27
0
        }//+

        /// <summary>
        /// הפונקציה מאפשרת לנו לעדכן אחד מהשדות בקליינט הבאים ע"י אנום
        /// מירחק שננסע
        /// כתובת
        /// הוספה/הורדה נהגים
        /// בדיקה שמספר הרכב תקין ומעדכן אותו
        /// </summary>
        /// <param name="cli"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_car(car ca, update t, object obj)
        {
            switch (t)
            {
            case update.date_test:
                if (obj is DateTime?)
                {
                    DataSource.car_list.Remove(ca);
                    ca.date_of_fix = (DateTime)obj;
                }
                else
                {
                    throw new Exception("this objet is not a DateTime");
                }
                break;

            case update.destance:
                if (obj is float)
                {
                    DataSource.car_list.Remove(ca);
                    ca.total_distance += (float)obj;
                }
                else
                {
                    throw new Exception("this objet is not a bool");
                }
                break;

            case update.rishion_rachav:
                if (obj is rishion_rachav)
                {
                    DataSource.car_list.Remove(ca);
                    ca.rishion = (rishion_rachav)obj;
                }
                else
                {
                    throw new Exception("this objet is not an rishion rachav");
                }
                break;

            case update.takin:
                if (obj is bool)
                {
                    DataSource.car_list.Remove(ca);
                    ca.takin = (bool)obj;
                }
                else
                {
                    throw new Exception("this objet is not an boolean");
                }
                break;

            case update.panuy:
                if (obj is bool)
                {
                    DataSource.car_list.Remove(ca);
                    ca.moosker = (bool)obj;
                }
                else
                {
                    throw new Exception("this objet is not an boolean");
                }
                break;

            case update.mirchk:
                if (obj is float)
                {
                    DataSource.car_list.Remove(ca);
                    ca.total_distance += (float)obj;
                }
                else
                {
                    throw new Exception("this objet is not an mailage");
                }
                break;

            case update.address:
            {
                if (obj is addres)
                {
                    DataSource.car_list.Remove(ca);
                    ca.snif_address = (addres)obj;
                }
                else
                {
                    throw new Exception("this objet is not an addres");
                }
            }
            break;

            case update.mosif_n:
                DataSource.car_list.Remove(ca);
                if (obj is int)
                {
                    DataSource.car_list.Remove(ca);
                    ca.car_people_able += (int)obj;
                }
                else
                {
                    throw new Exception("this objet is not an pepole number");
                }
                break;

            case update.morid_n:
                if (obj is int)
                {
                    DataSource.car_list.Remove(ca);
                    ca.car_people_able -= (int)obj;
                }
                else
                {
                    throw new Exception("this objet is not an pepole number");
                }
                break;

            case update.ids:
            {
                DataSource.car_list.Remove(ca);
                if (obj is int || obj is long || obj is decimal)
                {
                    if (ca.car_number > 10m || ca.car_number < 1m)
                    {
                        ca.car_number = create_new_license_number();
                    }
                    else
                    {
                        ca.car_number = (int)obj;
                    }
                }
                else
                {
                    throw new Exception("this objet is not an id");
                }
            }
            break;

            default:
                throw new Exception(string.Format("this {0} is not an update option", t.ToString()));
            }
            DataSource.car_list.Add(ca);
        }//+
Esempio n. 28
0
 //TODO: decide what to do if the type is already registered? currently the old registration is overwritten
 states.Add(typeof(TYPE), new Data(update, defaultValue));
Esempio n. 29
0
 public bool Update([FromServices] IBookService bookService, [FromBody] update update)
 {
     return(bookService.Update(update));
 }
Esempio n. 30
0
 private void updateLocation(PictureLocation loc)
 {
     if (this.InvokeRequired)
     {
         update d = new update(updateLocation);
         this.Invoke(d, new object[] { loc });
     }
     else
     {
         long a = ((this.Width - 19) - (int)((this.Width - 19) * 33 / 800)) / 3;
         this.pictureBox1.Location = new Point(loc.x + (int)(a * 0.45 / 5.8), loc.y);
         this.pictureBox21.Location = new Point(loc.x, loc.y);
         this.pictureBox22.Location = new Point(loc.x + (int)(a * 0.25 / 5.8), loc.y);
     }
 }
Esempio n. 31
0
        }//++

        /// <summary>
        /// הפונקציה מאפשרת לנו לעדכן אחד מהשדות בקליינט הבאים ע"י אנום
        /// כתובת
        /// מספר כרטיס
        /// גיל
        /// רישיון נהג
        /// </summary>
        /// <param name="cli"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_client(Client cli, update t, object obj)
        {
            switch (t)
            {
            case update.vatek:
                if (obj is int)
                {
                    DataSource.Client_list.Remove(cli);
                    cli.Vatk = (int)obj;
                }
                else
                {
                    throw new Exception("לא נשלח מספר של וטק");
                }
                break;

            case update.vip:
                if (obj is bool)
                {
                    DataSource.Client_list.Remove(cli);
                    cli.isVip = (bool)obj;
                }
                else
                {
                    throw new Exception("האוביקט שנשלח אינו מסוג בוליאן");
                }
                break;

            case update.address:
            {
                if (obj is addres)
                {
                    DataSource.Client_list.Remove(cli);
                    cli.Address1 = (addres)obj;
                }
                else
                {
                    throw new Exception("this objet is not an addres");
                }
            }
            break;

            case update.cradit_card:
            {
                DataSource.Client_list.Remove(cli);
                if (obj is CreditCard)
                {
                    cli.Card_dit = (CreditCard)obj;
                }
                else
                {
                    throw new Exception("this objet is not a credit card");
                }
            }
            break;

            case update.age:
            {
                if (obj is int)
                {
                    DataSource.Client_list.Remove(cli);
                    cli.Age = (int)obj;
                }
                else
                {
                    throw new Exception("this objet is not a age");
                }
            }
            break;

            case update.rishion_nahg:
                if (obj is rishion)
                {
                    DataSource.Client_list.Remove(cli);
                    cli.rishoi = (rishion)obj;
                }
                else
                {
                    throw new Exception("this objet is not a age");
                }
                break;

            default:
                throw new Exception(string.Format("this {0} is not an updat option", t.ToString()));
            }

            DataSource.Client_list.Add(cli);
        }//+
Esempio n. 32
0
        }//+

        /// <summary>
        /// פומנקציה לעדכון תקלה
        /// </summary>
        /// <param name="Fault"></param>
        /// <param name="t"></param>
        /// <param name="obj"></param>
        public void update_Fault(Fault Fault, update t, object obj)
        {
            switch (t)
            {
            case update.price:
                if (obj is float)
                {
                    Fault.total_price = (float)obj;
                    DataSource.Fault_list.Remove(Fault);
                }
                else
                {
                    throw new Exception("לא נשלח מחיר");
                }
                break;

            case update.pirut_htakla:
                if (obj is fault_type)
                {
                    DataSource.Fault_list.Remove(Fault);
                    Fault.Ft = (fault_type)obj;
                }
                else
                {
                    throw new Exception("לא נשלח סוג התקלה");
                }
                break;

            case update.gorm_htakla:
                if (obj is who_fault)
                {
                    DataSource.Fault_list.Remove(Fault);
                    Fault.who = (who_fault)obj;
                }
                else
                {
                    throw new Exception("לא נשלח מקור התקלה");
                }
                break;

            case update.musch:
                if (obj is string)
                {
                    DataSource.Fault_list.Remove(Fault);
                    Fault.name_of_shop = (string)obj;
                }
                else
                {
                    throw new Exception("לא נשלח שם המוסך");
                }
                break;

            case update.price_horada_shqulim:
                if (obj is float)
                {
                    DataSource.Fault_list.Remove(Fault);
                    Fault.total_price = Fault.total_price - (float)obj;
                }
                else
                {
                    throw new Exception("לא נשלח סוג מחיר");
                }
                break;

            case update.price_horada_achuz:
                if (obj is float)
                {
                    DataSource.Fault_list.Remove(Fault);
                    Fault.total_price = Fault.total_price - Fault.total_price * (float)obj / 100 + Fault.total_price * (float)obj % 100;
                }
                else
                {
                    throw new Exception("לא נשלח סוג מחיר");
                }
                break;

            default:
                break;
            }
            DataSource.Fault_list.Add(Fault);
        }//+
Esempio n. 33
0
        async private void locator_PositionChanged(Geolocator sender, PositionChangedEventArgs e)
        {
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
            {

                Geoposition geoPosition = e.Position;

                double lat = geoPosition.Coordinate.Point.Position.Latitude;
                double longi = geoPosition.Coordinate.Point.Position.Longitude;
                double accuracy = geoPosition.Coordinate.Accuracy;

                var js = new update { username = uname, latitude = lat, longitude = longi, accuracy = accuracy };
                string json = JsonConvert.SerializeObject(js);

                using (HttpClient hc = new HttpClient())
                {
                    hc.DefaultRequestHeaders
                    .Accept
                    .Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    var response = await hc.PostAsync(URI + "/updatemember?gid="+gid, new StringContent(json));


                }

                funcmap();
            });
        }