Ejemplo n.º 1
0
        public static void InputAccessPower(string shkafName, int powerCurrent, int powerPast,
                                            int accessCurrent, int accessPast)
        {
            var query = from f in db.ShkafStatements
                        where f.ShkafID == int.Parse(shkafName) &&
                        ((f.Year == DateTime.Now.Year && f.Month == DateTime.Now.Month) ||
                         (f.Year == DateTime.Now.AddMonths(-1).Year&& f.Month == DateTime.Now.AddMonths(-1).Month))
                        select f;

            if (query.Any())
            {
                db.ShkafStatements.DeleteAllOnSubmit(query);
            }

            ShkafStatement statPast = new ShkafStatement
            {
                ShkafID        = int.Parse(shkafName),
                Year           = DateTime.Now.AddMonths(-1).Year,
                Month          = DateTime.Now.AddMonths(-1).Month,
                Power          = (powerPast == 1 ? true : false),
                AccessQuantity = accessPast
            };

            db.ShkafStatements.InsertOnSubmit(statPast);

            ShkafStatement statCurrent = new ShkafStatement
            {
                ShkafID        = int.Parse(shkafName),
                Year           = DateTime.Now.Year,
                Month          = DateTime.Now.Month,
                Power          = (powerCurrent == 1 ? true : false),
                AccessQuantity = accessCurrent
            };

            db.ShkafStatements.InsertOnSubmit(statCurrent);

            db.SubmitChanges();
        }
Ejemplo n.º 2
0
 private void detach_ShkafStatements(ShkafStatement entity)
 {
     this.SendPropertyChanging();
     entity.Shkaf = null;
 }
Ejemplo n.º 3
0
 private void attach_ShkafStatements(ShkafStatement entity)
 {
     this.SendPropertyChanging();
     entity.Shkaf = this;
 }
Ejemplo n.º 4
0
 partial void DeleteShkafStatement(ShkafStatement instance);
Ejemplo n.º 5
0
 partial void UpdateShkafStatement(ShkafStatement instance);
Ejemplo n.º 6
0
 partial void InsertShkafStatement(ShkafStatement instance);