Ejemplo n.º 1
0
        public static int AddAnalitickoKonto(AnalitickoKonto akonto)
        {
            SqlConnection connection    = AppDB.GetConnection();
            SqlCommand    insertCommand = new SqlCommand();

            insertCommand.Connection  = connection;
            insertCommand.CommandType = CommandType.StoredProcedure;
            insertCommand.CommandText = "AKontoInsert";
            insertCommand.Parameters.AddWithValue("@SAK", akonto.SifraNaAKonto);
            insertCommand.Parameters.AddWithValue("@NAK", akonto.NazivNaAKonto);
            try
            {
                connection.Open();
                int b = insertCommand.ExecuteNonQuery();
                if (b >= 0)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
Ejemplo n.º 2
0
        public ActionResult <List <Data_Type> > Get()
        {
            AppDB       db        = provider.GetService <AppDB>();
            Data_TypeDA data_Type = new Data_TypeDA(db);

            return(data_Type.getAll());
        }
Ejemplo n.º 3
0
        public ActionResult <List <Case> > Get()
        {
            AppDB  db    = provider.GetService <AppDB>();
            CaseDA cases = new CaseDA(db);

            return(cases.getAll());
        }
Ejemplo n.º 4
0
        public ActionResult <object> Login(Users users)
        {
            AppDB   db      = provider.GetRequiredService <AppDB>();
            UsersDA usersDA = new UsersDA(db);
            var     res     = usersDA.Login(users.Email, users.Pass);

            MailService mail = new MailService();

            Token token = new Token
            {
                text       = Guid.NewGuid().ToString(),
                created_dt = DateTime.Now,
                expired_dt = DateTime.Now.AddHours(TOKEN_EXP_HOURS),
                id_User    = res[0].Id,
                status     = "ACTIVE"
            };

            var re = usersDA.create_Token(token);

            mail.SendMail(users.Email, token.text);

            return(new
            {
                result = res
            });
        }
Ejemplo n.º 5
0
        public ActionResult <List <Status> > Get()
        {
            AppDB    db     = provider.GetService <AppDB>();
            StatusDA status = new StatusDA(db);

            return(status.getAll());
        }
Ejemplo n.º 6
0
        public ActionResult <List <Company> > Get(int id)
        {
            AppDB     db      = provider.GetRequiredService <AppDB>();
            CompanyDA company = new CompanyDA(db);

            return(company.getById(id));
        }
Ejemplo n.º 7
0
        public ActionResult <List <Users> > Get(int id)
        {
            AppDB   db    = provider.GetRequiredService <AppDB>();
            UsersDA users = new UsersDA(db);

            return(users.getById(id));
        }
        public ActionResult <List <Process_Field> > Get(int id)
        {
            AppDB           db            = provider.GetRequiredService <AppDB>();
            Process_FieldDA process_Field = new Process_FieldDA(db);

            return(process_Field.getById(id));
        }
Ejemplo n.º 9
0
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };

            using (AppDB db = new AppDB())
            {
                var currentRole = db.Roles.Where(r => CurrentUser.Roles.Contains(r.Code)).Min(r => r.Priority);
                response = IEnumerableData.GetPageResponse <EmployeeModel>(model, (from b in db.Employees
                                                                                   join
                                                                                   r in db.Roles on b.Role equals r.Code
                                                                                   where r.Priority > currentRole
                                                                                   select new EmployeeModel()
                {
                    Id = b.Id,
                    BarCode = b.BarCode,
                    Name = b.Name,
                    Phone = b.Phone,
                    Email = b.Email,
                    Address = b.Address,
                    Role = r.Name,
                    CreatedAt = b.CreatedAt,
                    IsActive = b.IsActive
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public ActionResult <List <Suscription> > Get(int id)
        {
            AppDB         db          = provider.GetRequiredService <AppDB>();
            SuscriptionDA suscription = new SuscriptionDA(db);

            return(suscription.getById(id));
        }
Ejemplo n.º 11
0
        public ActionResult <List <Process_Field> > Get()
        {
            AppDB           db            = provider.GetService <AppDB>();
            Process_FieldDA process_Field = new Process_FieldDA(db);

            return(process_Field.getAll());
        }
Ejemplo n.º 12
0
        public ActionResult <List <Suscription> > Get()
        {
            AppDB         db          = provider.GetService <AppDB>();
            SuscriptionDA suscription = new SuscriptionDA(db);

            return(suscription.getAll());
        }
Ejemplo n.º 13
0
        public ActionResult <List <Sec_Object> > Get(int id)
        {
            AppDB         db          = provider.GetRequiredService <AppDB>();
            Sec_ObjectsDA sec_Objects = new Sec_ObjectsDA(db);

            return(sec_Objects.getById(id));
        }
Ejemplo n.º 14
0
        public ActionResult <List <Sec_Object> > Get()
        {
            AppDB         db          = provider.GetService <AppDB>();
            Sec_ObjectsDA sec_Objects = new Sec_ObjectsDA(db);

            return(sec_Objects.getAll());
        }
Ejemplo n.º 15
0
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };
            var data = new Pagger <dynamic>();

            using (AppDB db = new AppDB())
            {
                response = IEnumerableData.GetPageResponse <BundleModel>(model, (from b in db.Bundles
                                                                                 join s in db.Styles on b.StyleId equals s.Id
                                                                                 join st in db.Status on b.Status equals st.Id
                                                                                 join o in db.Employees on b.OperatorId equals o.Id
                                                                                 join l in db.Employees on b.LinkingBy equals l.Id
                                                                                 where b.Status == 2
                                                                                 select new BundleModel()
                {
                    BarCode = b.BarCode,
                    Style = s.Name,
                    StyleId = b.StyleId,
                    Id = b.Id,
                    Quantity = b.Quantity,
                    Status = st.Name,
                    StatusId = st.Id,
                    KnittingMachine = b.KnittingMachine,
                    LinkingEndAt = b.LinkingEndAt,
                    OperatorId = b.OperatorId,
                    Operator = o.Name,
                    LinkingBy = l.Name,
                    LinkingById = l.Id
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 16
0
        public ActionResult <List <Object_Type> > Get()
        {
            AppDB         db          = provider.GetService <AppDB>();
            Object_TypeDA object_Type = new Object_TypeDA(db);

            return(object_Type.getAll());
        }
Ejemplo n.º 17
0
        public ActionResult <List <Company> > Get()
        {
            AppDB     db      = provider.GetService <AppDB>();
            CompanyDA company = new CompanyDA(db);

            return(company.getAll());
        }
Ejemplo n.º 18
0
        public ActionResult <List <Object_Type> > Get(int id)
        {
            AppDB         db          = provider.GetRequiredService <AppDB>();
            Object_TypeDA object_Type = new Object_TypeDA(db);

            return(object_Type.GetById(id));
        }
Ejemplo n.º 19
0
        public ActionResult <List <Users> > Get()
        {
            AppDB   db    = provider.GetService <AppDB>();
            UsersDA users = new UsersDA(db);

            return(users.getAll());
        }
Ejemplo n.º 20
0
        public ActionResult <List <Roles> > Get()
        {
            AppDB   db    = provider.GetService <AppDB>();
            RolesDA roles = new RolesDA(db);

            return(roles.getAll());
        }
Ejemplo n.º 21
0
        public async void RequestRegions()
        {
            IList <EFRegion> regions = await this._network.requestRegions();

            if (regions == null)
            {
                MessagingCenter.Send <MainVM>(this, "RequestFailed");
                return;
            }

            using (var db = new AppDB())
            {
                db.ClearRegions();
                this._regions.Clear();

                foreach (EFRegion region in regions)
                {
                    db.Add <EFRegion>(region);

                    this._regions.Add(region);
                }
            }

            this._constructGroupedList();

            MessagingCenter.Send <MainVM>(this, "RegionsResponse");
        }
Ejemplo n.º 22
0
        public ActionResult <List <Roles> > Get(int id)
        {
            AppDB   db    = provider.GetRequiredService <AppDB>();
            RolesDA roles = new RolesDA(db);

            return(roles.getById(id));
        }
Ejemplo n.º 23
0
 //
 // GET: /Materials/Create
 public ActionResult Get(Page model)
 {
     using (AppDB db = new AppDB())
     {
         return(Json(IEnumerableData.GetPageResponse <MaterialModel>(model, (from m in db.Materials
                                                                             join s in db.Sellers on m.SellerId equals s.Id
                                                                             join o in db.Orders on m.OrderId equals o.Id
                                                                             join u in db.Employees on m.CreatedBy equals u.Id
                                                                             where m.OrderId == model.id
                                                                             select new MaterialModel()
         {
             Id = m.Id,
             SellerId = m.SellerId,
             Seller = s.Name,
             OrderId = m.OrderId,
             Order = o.CodeNumber,
             Amount = m.Amount,
             Description = m.Description,
             OrderDate = m.OrderDate,
             DeliveryDate = m.DeliveryDate,
             CreatedBy = m.CreatedBy,
             CreatedByName = u.Name,
             ReceivedDate = m.ReceivedDate
         })), JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 24
0
        public ActionResult <List <Audit_Logs> > Get()
        {
            AppDB        db           = provider.GetService <AppDB>();
            Audit_LogsDA audit_LogsDA = new Audit_LogsDA(db);

            return(audit_LogsDA.getAll());
        }
Ejemplo n.º 25
0
        public ActionResult <List <Status> > Get(int id)
        {
            AppDB    db     = provider.GetRequiredService <AppDB>();
            StatusDA status = new StatusDA(db);

            return(status.getById(id));
        }
Ejemplo n.º 26
0
        public ActionResult Get(Page model)
        {
            ResponseJson response = new ResponseJson()
            {
                Data = new List <object>()
            };
            var data = new Pagger <dynamic>();

            using (AppDB db = new AppDB())
            {
                response = IEnumerableData.GetPageResponse <StyleModel>(model, (from s in db.Styles
                                                                                join b in db.Buyers on s.BuyerId equals b.Id
                                                                                join st in db.Status on s.Status equals st.Id
                                                                                select new StyleModel()
                {
                    BarCode = s.BarCode,
                    Buyer = b.Name,
                    BuyerId = s.BuyerId,
                    Id = s.Id,
                    Name = s.Name,
                    Quantity = s.Quantity,
                    Status = st.Name,
                    StatusId = st.Id,
                    ShippingDate = s.ShippingDate,
                    Description = s.Description,
                    YarnType = s.YarnType,
                    Size = s.Size,
                }));
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 27
0
        public ActionResult <List <Data_Type> > Get(int id)
        {
            AppDB       db        = provider.GetRequiredService <AppDB>();
            Data_TypeDA data_Type = new Data_TypeDA(db);

            return(data_Type.getById(id));
        }
Ejemplo n.º 28
0
        public static SuperIdToken GetSystemUserToken(string contextIdentifier)
        {
            lock (_cachedTokens)
            {
                CachedToken cachedToken;
                if (_cachedTokens.TryGetValue(contextIdentifier, out cachedToken))
                {
                    if (cachedToken.CacheTime.AddMinutes(45) > DateTime.Now)
                    {
                        return(cachedToken.Token);
                    }
                }
                using (var db = new AppDB())
                {
                    var sysUserToken = db.Customers
                                       .Where(c => c.ContextIdentifier == contextIdentifier)
                                       .Select(c => c.SystemUserToken)
                                       .FirstOrDefault();
                    var token = GetSystemUserToken(sysUserToken, contextIdentifier);

                    _cachedTokens[contextIdentifier] = new CachedToken
                    {
                        CacheTime = DateTime.Now,
                        Token     = token,
                    };

                    return(token);
                }
            }
        }
Ejemplo n.º 29
0
        public ActionResult <List <Case> > Get(int id)
        {
            AppDB  db    = provider.GetRequiredService <AppDB>();
            CaseDA cases = new CaseDA(db);

            return(cases.getById(id));
        }
Ejemplo n.º 30
0
        public static bool DeleteAnalitickoKonto(AnalitickoKonto akonto)
        {
            SqlConnection connection    = AppDB.GetConnection();
            SqlCommand    deleteCommand = new SqlCommand();

            deleteCommand.Connection  = connection;
            deleteCommand.CommandType = CommandType.StoredProcedure;
            deleteCommand.CommandText = "AKontoDelete";
            deleteCommand.Parameters.AddWithValue("@SAK", akonto.SifraNaAKonto);
            //updateCommand.Parameters.AddWithValue("@NAK", akonto.NazivNaAKonto);

            try
            {
                connection.Open();
                int count = deleteCommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }