public ActionResult GetAdvancePageNum(string name, string beginTime, string endTime)
        {
            string constring = ConfigurationManager.AppSettings["connectionString"];

            if (beginTime == string.Empty)
            {
                beginTime = "2000.1.1 00:00";
            }
            if (endTime == string.Empty)
            {
                endTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            }
            int nums  = new Advance(constring).GetPageNums(name, beginTime, endTime);
            int pages = 0;

            if (nums != 0)
            {
                if (nums % 10 == 0)
                {
                    pages = nums / 10;
                }
                else
                {
                    pages = nums / 10 + 1;
                }
            }
            return(Json(pages));
        }
        public ActionResult Index()
        {
            string       constring    = ConfigurationManager.AppSettings["connectionString"];
            Registration registration = new Registration(constring);

            if (registration.IsItemReturn())
            {
                ViewBag.state = "设备状态: 已归还";
            }
            else
            {
                ViewBag.state = registration.State;
            }
            List <string[]>     tmp    = new Advance(constring).GetTen();
            List <AdvanceModel> result = new List <AdvanceModel>();
            int i = 1;

            foreach (var item in tmp)
            {
                AdvanceModel model = new AdvanceModel();
                model.ID         = i++;
                model.Name       = item[0];
                model.Reason     = item[1];
                model.LendTime   = item[2];
                model.ReturnTime = item[3];
                result.Add(model);
            }
            return(View(result));
        }
        public ActionResult FindAdvance(string name, string beginTime, string endTime, string page)
        {
            string constring = ConfigurationManager.AppSettings["connectionString"];

            if (beginTime == string.Empty)
            {
                beginTime = "2000.1.1 00:00";
            }
            if (endTime == string.Empty)
            {
                endTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            }
            List <string[]>     data   = new Advance(constring).FindPage(name, beginTime, endTime, page);
            List <AdvanceModel> result = new List <AdvanceModel>();

            foreach (var item in data)
            {
                AdvanceModel model = new AdvanceModel();
                model.ID         = int.Parse(item[0]);
                model.Name       = item[1];
                model.Reason     = item[2];
                model.LendTime   = item[3];
                model.ReturnTime = item[4];
                result.Add(model);
            }
            return(Json(result));
        }
        public Object RequestData(int startRow, int pageSize, string sortExpression)
        {
            Advance advance = new Advance();

            advance.DocumentNo    = ctlAdvanceNo.Text.Trim();
            advance.Description   = ctlDescription.Text.Trim();
            advance.AdvanceType   = this.AdvanceType;
            advance.CompanyID     = this.CompanyID;
            advance.RequesterID   = this.RequesterID;
            advance.CurrentUserID = this.CurrentUserID;
            advance.IsRepOffice   = this.IsRepOffice;
            if (PBID != 0)
            {
                advance.PBID = PBID;
            }
            if (MainCurrencyID != 0)
            {
                advance.MainCurrencyID = MainCurrencyID;
            }
            IList <Advance> list;

            //if (ViewState["isRelateWithRemittanceButNotInExpense"] == null ? false : bool.Parse(ViewState["isRelateWithRemittanceButNotInExpense"].ToString()))
            if (IsRelateWithRemittanceButNotInExpense)
            {
                list = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.GetAdvanceListRelateWithRemittanceButNotInExpense(advance, startRow, pageSize, sortExpression);
            }
            else
            {
                list = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.GetAdvanceList(advance, startRow, pageSize, sortExpression);
            }

            return(list);
        }
Exemplo n.º 5
0
        public async Task <Advance> EndEvaluation(Advance advance, bool isApproved, string authAdminToken)
        {
            var admin = await _account.WhoAdminAmI(authAdminToken);

            if (admin == null)
            {
                return(null);
            }

            var adv = _dbContext.Advances.Include(q => q.Payments).ThenInclude(p => p.Instalments).Single(q => q.Id == advance.Id);

            adv.EvaluationDateEnd = DateTime.Now;
            adv.EvaluationBy      = admin.AdminId;
            adv.IsApproved        = isApproved;

            if (adv.IsApproved.GetValueOrDefault())
            {
                foreach (var p in adv.Payments)
                {
                    foreach (var i in p.Instalments)
                    {
                        decimal _advanceTaxRate = GetAdvanceTaxRate(adv.RequestDate, i.TargetDate);
                        i.PaidAt     = DateTime.Now;
                        i.AdvanceTax = i.Ammount * _advanceTaxRate;
                    }
                    p.Status = Enums.PaymentStatus.Done;
                    p.PaidAt = DateTime.Now;
                }
            }

            return(adv);
        }
Exemplo n.º 6
0
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Advance":
                if (!double.TryParse(Advance.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Rent":
                if (!double.TryParse(Rent.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;
            }

            return(validationMessage);
        }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        mask = GameManager.Instance.GetMask(team);

        sprite = GetComponentInChildren <SpriteRenderer>();
        if (!sprite)
        {
            sprite = GetComponent <SpriteRenderer>();
        }

        if (sprite)
        {
            Debug.Log("Found sprite!");
            original = sprite.color;
        }

        ProximityDetect detector = GetComponent <ProximityDetect>();

        if (detector)
        {
            detector.AddObserver(this);
        }

        adv = GetComponent <Advance>();
    }
Exemplo n.º 8
0
 private void AdvanceTimer(object sender, EventArgs e)
 {
     if (Advance != null)
     {
         Advance.Invoke(this);
     }
 }
Exemplo n.º 9
0
        // GET: TestAPI
        public async Task <ActionResult> GetAdvance()
        {
            WebClient client  = new WebClient();
            Advance   advance = await client.GetAdvance();

            return(View(advance));
        }
Exemplo n.º 10
0
        public ActionResult DeleteConfirmed(int id)
        {
            Advance advance = db.Advances.Find(id);

            db.Advances.Remove(advance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 11
0
 public RedisHelper(string host, ISerializer serializer = null, uint maxBytesLength = 10 * 1024)
 {
     _connector      = ConnectionMultiplexer.Connect(host);
     _db             = _connector.GetDatabase();
     _serializer     = serializer ?? new NewtonsoftSerializer();
     _maxBytesLength = maxBytesLength;
     Advanced        = new Advance(_connector);
 }
Exemplo n.º 12
0
        protected override void OnTurn()
        {
            // check if research complete
            if (HadEvent__Turn(EmpireEvent.ResearchComplete))
            {
                if (random.Next(20) == 0)
                {                 // start military research
                    Blueprint.SetDomain__Turn(ModelDomain.Ground);
                    Blueprint.SetProperty__Turn(ModelProperty.Weapons, 3);
                    Blueprint.SetProperty__Turn(ModelProperty.Armor, 1);
                    Blueprint.SetProperty__Turn(ModelProperty.Mobility, Blueprint.Stage.MaximumWeight - Blueprint.Weight);
                    SetResearch__Turn(Advance.MilitaryResearch);
                }
                else
                {                 // set random research
                    Advance newResearch = Advance.None;
                    int     count       = 0;
                    for (Advance testResearch = Advance.FirstCommon; testResearch <= Advance.LastFuture; testResearch++)
                    {
                        if (CanSetResearch__Turn(testResearch))
                        {
                            count++;
                            if (random.Next(count) == 0)
                            {
                                newResearch = testResearch;
                            }
                        }
                    }
                    if (newResearch != Advance.None)
                    {
                        SetResearch__Turn(newResearch);
                    }
                }
            }

            // check cities
            foreach (City city in Cities)
            {
                if (city.Size < 4)
                {
                    city.OptimizeExploitedLocations__Turn(ResourceWeights.MaxGrowth);
                }
                else
                {
                    city.OptimizeExploitedLocations__Turn(ResourceWeights.HurryProduction);
                }
            }

            // move units
            foreach (Unit unit in Units)
            {
                OtherLocation[] neighborLocations = unit.Location.Neighbors;
                if (neighborLocations.Length > 0)
                {
                    unit.MoveTo__Turn(neighborLocations[random.Next(neighborLocations.Length)].Location);                     // move unit to random adjacent location
                }
            }
        }
Exemplo n.º 13
0
        private void addAdvanceButton_Click(object sender, RoutedEventArgs e)
        {
            Advance advance = new Advance();

            advance.ID_Journey = _journey.ID_Journey;
            advance.Is_Active  = 1;

            if (borrowerComboBox.SelectedIndex == -1)
            {
                notiMessageSnackbar.MessageQueue.Enqueue($"Không được bỏ trống người mượn", "OK", () => { });
                return;
            }

            advance.ID_Borrower   = JourneyAttendances[borrowerComboBox.SelectedIndex].ID_Member;
            advance.Borrower_Name = _databaseUtilities.GetMemberNameByID(advance.ID_Borrower);

            if (lenderComboBox.SelectedIndex == -1)
            {
                notiMessageSnackbar.MessageQueue.Enqueue($"Không được bỏ trống người cho mượn", "OK", () => { });
                return;
            }

            advance.ID_Lender   = JourneyAttendances[lenderComboBox.SelectedIndex].ID_Member;
            advance.Lender_Name = _databaseUtilities.GetMemberNameByID(advance.ID_Lender);

            if (advanceMoneyTextBox.Text.Length == 0)
            {
                notiMessageSnackbar.MessageQueue.Enqueue($"Không được bỏ trống số tiền mượn", "OK", () => { });
            }

            advance.Advance_Money     = decimal.Parse(advanceMoneyTextBox.Text, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowCurrencySymbol | NumberStyles.Currency, new CultureInfo("en-US"));
            advance.Money_For_Binding = _appUtilities.GetMoneyForBinding(decimal.ToInt32(advance.Advance_Money ?? 0));

            if (advanceListView.SelectedIndex != -1)
            {
                advance.Advance_Index = Advances_For_Binding[advanceListView.SelectedIndex].Advance_Index;

                Advances_For_Binding[advanceListView.SelectedIndex] = advance;

                advanceListView.SelectedIndex = -1;
            }
            else
            {
                advance.Advance_Index = Advances_For_Binding.Count + 1;

                advance.Is_Active = 1;

                Advances_For_Binding.Add(advance);
            }

            borrowerComboBox.SelectedIndex = -1;
            lenderComboBox.SelectedIndex   = -1;
            advanceMoneyTextBox.Text       = "";

            advanceListView.ItemsSource = null;
            advanceListView.ItemsSource = Advances_For_Binding;
        }
        private void button5_Click(object sender, EventArgs e)
        {
            //// TODO: This line of code loads data into the 'homeTextileDBDataSet2.Employees' table. You can move, or remove it, as needed.
            //this.employeesTableAdapter.Fill(this.homeTextileDBDataSet2.Employees);
            //// TODO: This line of code loads data into the 'homeTextileDBDataSet2.Advances' table. You can move, or remove it, as needed.
            //this.advancesTableAdapter.Fill(this.homeTextileDBDataSet2.Advances);

            DialogResult res = MessageBox.Show("Are you sure you want to Update", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (res == DialogResult.Cancel)
            {
                return;
            }

            Advance advances = new Advance();
            Advance advanceU = new Advance();

            try
            {
                advances.Id = Convert.ToInt32(idTextBox.Text);
                advanceU    = db.Advances.Find(advances.Id);
            }
            catch
            {
            }
            advanceU.EmployeeId = Convert.ToInt32(employeeIdComboBox.SelectedValue);
            advanceU.Amount     = Convert.ToDouble(amountTextBox.Text) - advanceU.Amount;
            advanceU.Date       = Convert.ToDateTime(dateDateTimePicker.Text);


            if (advanceU.IsAbleToTakeAdvance() && advanceU.Id != 0)
            {
                advanceU.Amount          = Convert.ToDouble(amountTextBox.Text);
                db.Entry(advanceU).State = EntityState.Modified;

                db.SaveChanges();
            }

            else
            {
                MessageBox.Show("Employee can not take advance for this month!");
                db = new DatabaseContext();
                db = new DatabaseContext();
                this.advanceDataGridView.DataSource = db.Advances.ToList();
                return;
            }



            MessageBox.Show("Save Sucessfully!");
            db = new DatabaseContext();
            db = new DatabaseContext();
            this.advanceDataGridView.DataSource = db.Advances.ToList();


            //this.advanceBindingSource.DataSource = db.Advances.ToList();
        }
Exemplo n.º 15
0
        public Advance GetAdvance()
        {
            Advance advance = new Advance {
                Amount = 12, Date = DateTime.Today, Id = 1
            };

            return(advance);
            //  return _am.FindAdvance(advance);
        }
Exemplo n.º 16
0
        public void current_phase_is_not_advance()
        {
            var command = new Advance(
                To: Player.P1.Army(3),
                Game: GameId,
                ExpectedVersion: 4);

            Handle(command, Benelux()).Should().BeInvalid()
            .WithMessage(ValidationMessage.Error("Action must be in the Advance phase to be executed, not in the Deploy phase."));
        }
Exemplo n.º 17
0
        public static void Add(Advance a, ConnectionToDB disconnect)
        {
            string select = "insert into zaliczka values('" + a.IdEmployee + "'" +
                            ",'" + a.Amount.ToString().Replace(',', '.') + "','" + a.Date.ToString("d", DateFormat.TakeDateFormat()) + "','" + a.OtherInfo + "')";

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.zaliczka,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Exemplo n.º 18
0
 public ActionResult Edit([Bind(Include = "id,employeeId,date,amount,reason")] Advance advance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(advance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.employeeId = new SelectList(db.Employees, "id", "employeeId", advance.employeeId);
     return(View(advance));
 }
Exemplo n.º 19
0
        public void advancement_exceeds_available()
        {
            var command = new Advance(
                To: Player.P1.Army(1),
                Game: GameId,
                ExpectedVersion: 5);

            Handle(command, Benelux().Add(new Conquered(Netherlands, Belgium)))
            .Should().BeValid()
            .Value.ArmyBuffer.Should().Be(Army.None);
        }
Exemplo n.º 20
0
        public void army_of_not_active_player()
        {
            var command = new Advance(
                To: Player.P2.Army(3),
                Game: GameId,
                ExpectedVersion: 5);

            Handle(command, Benelux().Add(new Conquered(Netherlands, Belgium)))
            .Should().BeInvalid()
            .WithMessage(ValidationMessage.Error("Action can only be applied by the active P1, not by P2."));
        }
Exemplo n.º 21
0
        public void advancement_exceeds_available([Range(2, 4)] int size)
        {
            var command = new Advance(
                To: Player.P1.Army(size),
                Game: GameId,
                ExpectedVersion: 5);

            Handle(command, Benelux().Add(new Conquered(Netherlands, Belgium)))
            .Should().BeInvalid()
            .WithMessage(ValidationMessage.Error($"Action not be executed as it requires more armies (P1.Army({size})) then available (P1.Army(1))."));
        }
Exemplo n.º 22
0
        private static Advance AssignAdvance(SqlDataReader dataReader)
        {
            Advance d = new Advance();

            d.Id         = dataReader.GetInt32(0);
            d.IdEmployee = dataReader.GetInt32(1);
            d.Amount     = dataReader.GetFloat(2);
            d.Date       = dataReader.GetDateTime(3);
            d.OtherInfo  = dataReader.GetString(4);

            return(d);
        }
Exemplo n.º 23
0
 /// <inheritdoc/>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 23 + GlyphIndex.GetHashCode();
         hash = hash * 23 + OffsetX.GetHashCode();
         hash = hash * 23 + OffsetY.GetHashCode();
         hash = hash * 23 + Advance.GetHashCode();
         return(hash);
     }
 }
Exemplo n.º 24
0
        public static void EnterDefaultDocumentCode(Object o)
        {
            MenuLabel label = o as MenuLabel;
            int       defDocType;
            String    docType = label.Value.ToString().Split('\n')[1].Trim();

            switch (docType)
            {
            case PosMessage.RECEIPT_TR:
                defDocType = 0;
                break;

            case PosMessage.INVOICE:
                defDocType = new Invoice().DocumentTypeId;
                break;

            case PosMessage.E_ARCHIVE:
                defDocType = new EArchive().DocumentTypeId;
                break;

            case PosMessage.E_INVOICE:
                defDocType = new EInvoice().DocumentTypeId;
                break;

            case PosMessage.MEAL_TICKET:
                defDocType = new MealTicket().DocumentTypeId;
                break;

            case PosMessage.CAR_PARKIMG:
                defDocType = new CarParkDocument().DocumentTypeId;
                break;

            case PosMessage.ADVANCE:
                defDocType = new Advance().DocumentTypeId;
                break;

            case PosMessage.COLLECTION_INVOICE:
                defDocType = new CollectionInvoice().DocumentTypeId;
                break;

            case PosMessage.CURRENT_ACCOUNT_COLLECTION:
                defDocType = new CurrentAccountDocument().DocumentTypeId;
                break;

            default:
                defDocType = 0;
                break;
            }

            customerInput.Append(defDocType.ToString().PadLeft(2, '0'));

            cr.State = SaveCustomerInput();
        }
Exemplo n.º 25
0
    public EnemyDecisionTree(Enemy agent)
    {
        advance   = new Advance(agent);
        breakWall = new BreakWall(agent);
        attack    = new Attack(agent);
        defend    = new Defend(agent);

        wallInWay         = new BooleanDecision(breakWall, advance);
        defenderAttacking = new BooleanDecision(defend, attack);
        defenseInRange    = new BooleanDecision(defenderAttacking, wallInWay);

        start = defenseInRange;
    }
Exemplo n.º 26
0
    public DefenderDecisionTree(Defender agent)
    {
        patrol  = new Advance(agent);
        rebuild = new Rebuild(agent);
        attack  = new Attack(agent);
        rest    = new Rest(agent);

        wallBroken   = new BooleanDecision(rebuild, patrol);
        enemyInRange = new BooleanDecision(attack, wallBroken);
        tired        = new BooleanDecision(rest, enemyInRange);

        start = tired;
    }
Exemplo n.º 27
0
        public static void Edit(Advance a, ConnectionToDB disconnect)
        {
            string select = "update zaliczka set kwota='" + a.Amount.ToString().Replace(',', '.') +
                            "', inne='" + a.OtherInfo + "', data='" + a.Date.ToString("d", DateFormat.TakeDateFormat()) + "'where id_zaliczki = '" + a.Id + "'";

            Database.Save(select, disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.edycja, DateTime.Now, Polaczenia.ip, NazwaTabeli.zaliczka,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
            //odłączenie od bazy
            Polaczenia.OdlaczenieOdBazy();
        }
        public ActionResult DeleteAdvance(string id)
        {
            string constring = ConfigurationManager.AppSettings["connectionString"];
            bool   flag      = new Advance(constring).Delete(id);

            if (flag)
            {
                return(Json("true"));
            }
            else
            {
                return(Json("false"));
            }
        }
Exemplo n.º 29
0
        // GET: Advances/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Advance advance = db.Advances.Find(id);

            if (advance == null)
            {
                return(HttpNotFound());
            }
            return(View(advance));
        }
Exemplo n.º 30
0
    Advance advance;     // move towards next target
    #endregion

    /// <param name="agent">the agent to act upon</param>
    public EnemyDecisionTree(BasicEnemy agent)
    {
        advance   = new Advance(agent);
        breakWall = new BreakWall(agent);
        attack    = new Attack(agent);
        defend    = new Defend(agent);

        wallInWay         = new BooleanDecision(breakWall, advance);
        defenderAttacking = new BooleanDecision(defend, attack);
        defenseInRange    = new BooleanDecision(defenderAttacking, wallInWay);

        start = defenseInRange;

        // subscribe update method to game events
    }
Exemplo n.º 31
0
	void Start () {
		script=adv.GetComponent<Advance> ();
	}