Update() public method

public Update ( ) : void
return void
Beispiel #1
0
        public void Update(UnitRecord unitRecord)
        {
            // referential integrity:
            //GetStackById(unitRecord.StackId.Value);
            _gameConfigCache.GetUnitConfigById(unitRecord.UnitTypeId.Value);

            Units.Update(unitRecord);
            UnitUpdated?.Invoke(this, unitRecord);
        }
Beispiel #2
0
    private void Update(int id)
    {
        Data objdata = new Data(Global.ConnectionSql);

        try
        {
            Units obj = new Units();
            obj.DataObject = objdata;
            obj.ID         = id;
            obj.Value      = txtValue.Text.Trim();
            int iResult = Convert.ToInt32(obj.Update());
            if (iResult > 0)
            {
                this.BindingData();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "sucess", "messagesucess();", true);
            }
            else if (iResult == 0)
            {
                lblmessage.Text = "Trùng dữ liệu vui lòng kiểm tra lại";
                mdPopup.Show();
            }
            else
            {
                lblmessage.Text = "Lỗi xảy ra trong quá trình lưu dữ liệu. Liên hệ với người quản trị để khắc phục";
                mdPopup.Show();
            }
        }
        catch (Exception ex)
        {
            Global.WriteLogError("Update () " + ex);
            lblmessage.Text = "Lỗi xảy ra trong quá trình lưu dữ liệu. Liên hệ với người quản trị để khắc phục";
            mdPopup.Show();
        }
        finally
        {
            objdata.DeConnect();
        }
    }
Beispiel #3
0
        public void Start()
        {
            if (!running)
            {
                new Task(() =>
                {
                    double ttime = 0;
                    running      = true;
                    abort        = false;
                    while (!abort)
                    {
                        double ltime, utime;
                        DateTime start;

                        if (Store.Count == 0)
                        {
                            continue;
                        }
                        RNdArray i, t, o, p;
                        var bitem = Store.CreateBatch(BatchSize);
                        i         = bitem.Input.Shuffle(InputNoize);
                        t         = bitem.Teacher;

                        start     = DateTime.Now;
                        var error = Units.Learn(i, t, out o, out p, rho);
                        ltime     = (DateTime.Now - start).TotalMilliseconds;
                        start     = DateTime.Now;
                        Units.Update((float)error);
                        utime = (DateTime.Now - start).TotalMilliseconds;
                        _generateUpdate?.Invoke(new UpdateInstanceArgs()
                        {
                            Generation  = Units.Generation,
                            Error       = error,
                            Input       = i,
                            Output      = o,
                            Teacher     = t,
                            Propagator  = p,
                            LearnTime   = ltime,
                            UpdateTime  = utime,
                            ProcessTime = ltime + utime,
                        });

                        ttime      += (ltime + utime);
                        errorstack += error;
                        count++;

                        if (bitem.EpochIteration)
                        {
                            errorstack /= count;
                            _epochUpdate?.Invoke(new UpdateInstanceArgs()
                            {
                                Epoch      = Store.Generation,
                                EpochError = errorstack,
                                EpochTime  = ttime,
                            });
                            rho        = errorstack;
                            errorstack = count = ttime = 0;
                            GC.Collect();
                        }
                    }
                    running = false;
                }).Start();
            }
        }