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();
            }
        }
        public ActionResult <List <Data_Type> > Get()
        {
            AppDB       db        = provider.GetService <AppDB>();
            Data_TypeDA data_Type = new Data_TypeDA(db);

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

            return(cases.getAll());
        }
示例#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
            });
        }
示例#5
0
        public ActionResult <List <Status> > Get()
        {
            AppDB    db     = provider.GetService <AppDB>();
            StatusDA status = new StatusDA(db);

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

            return(company.getById(id));
        }
示例#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));
        }
示例#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));
        }
示例#10
0
        public ActionResult <List <Suscription> > Get(int id)
        {
            AppDB         db          = provider.GetRequiredService <AppDB>();
            SuscriptionDA suscription = new SuscriptionDA(db);

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

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

            return(suscription.getAll());
        }
示例#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));
        }
示例#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());
        }
        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));
        }
        public ActionResult <List <Object_Type> > Get()
        {
            AppDB         db          = provider.GetService <AppDB>();
            Object_TypeDA object_Type = new Object_TypeDA(db);

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

            return(company.getAll());
        }
        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));
        }
示例#19
0
        public ActionResult <List <Users> > Get()
        {
            AppDB   db    = provider.GetService <AppDB>();
            UsersDA users = new UsersDA(db);

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

            return(roles.getAll());
        }
示例#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");
        }
示例#22
0
        public ActionResult <List <Roles> > Get(int id)
        {
            AppDB   db    = provider.GetRequiredService <AppDB>();
            RolesDA roles = new RolesDA(db);

            return(roles.getById(id));
        }
示例#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));
     }
 }
示例#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());
        }
示例#25
0
        public ActionResult <List <Status> > Get(int id)
        {
            AppDB    db     = provider.GetRequiredService <AppDB>();
            StatusDA status = new StatusDA(db);

            return(status.getById(id));
        }
示例#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));
        }
示例#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));
        }
示例#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);
                }
            }
        }
示例#29
0
        public ActionResult <List <Case> > Get(int id)
        {
            AppDB  db    = provider.GetRequiredService <AppDB>();
            CaseDA cases = new CaseDA(db);

            return(cases.getById(id));
        }
示例#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();
            }
        }