Пример #1
0
        private int SaveToDB(string filename, int ticketid)
        {
            try
            {
                FileInfo fileStream = new FileInfo(filename);

                var fileupload = new FileUpload();

                byte[]     filecontent = new byte[fileStream.Length];
                FileStream imagestream = fileStream.OpenRead();
                imagestream.Read(filecontent, 0, filecontent.Length);
                imagestream.Close();
                fileupload.Filedata   = filecontent;
                fileupload.FileName   = fileStream.Name;
                fileupload.UploadDate = DateTime.Now;
                fileupload.Filetype   = fileStream.Name.Split('.')[1].ToString();
                fileupload.TicketId   = ticketid;
                TicketDB.FileUpload.Add(fileupload);
                TicketDB.SaveChanges();

                if ((System.IO.File.Exists(filename)))
                {
                    System.IO.File.Delete(filename);
                }

                return(1);
            }
            catch (System.Exception e)
            {
                Log.LogDebug(e.Message);
                return(0);
            }
        }
Пример #2
0
        private void wjwCountNum_Click(object sender, RoutedEventArgs e)
        {
            TicketDB  ticket = new TicketDB();
            int       num    = int.Parse(count.Text);
            Hashtable table  = new Hashtable();

            if (num > 0)
            {
                table = ticket.findBallListOfNum(num);
            }

            if (table != null)
            {
                List <int> redList      = (List <int>)table["redList"];
                List <int> blueList     = (List <int>)table["blueList"];
                List <int> redFullList  = (List <int>)table["redFullList"];
                List <int> blueFullList = (List <int>)table["blueFullList"];
                if (redList != null && blueList != null && redList.Count > 0 && blueList.Count > 0)
                {
                    this.content.Text = sb.getAppearRedBall(redList) + sb.getNoAppearRedBall(redList) + sb.getAppearBlueBall(blueList) + sb.getNoAppearBlueBall(blueList) + sb.getRedBallFrequency(redFullList) + sb.getBlueBallFrequency(blueFullList);
                }
                else
                {
                    this.content.Text = "没有相关数据!\r\n";
                }
            }
        }
 private void BtnAddOrUpdate_Click(object sender, EventArgs e)
 {
     if (FieldsAreValid())
     {
         PopulateTicket();
         TicketDB.AddOrUpdate(Ticket);
         this.Close();
     }
 }
Пример #4
0
        public IActionResult Put(int id, [FromBody] keyvalueModel value)
        {
            ApplicationMaster _applicationMaster = new ApplicationMaster()
            {
                ApplicationId = value.Id, ApplicationName = value.keyValue, IsDeleted = false
            };

            TicketDB.Entry(_applicationMaster).State = EntityState.Modified;
            return(Ok(TicketDB.SaveChanges()));
        }
Пример #5
0
        private void wjwOperation_Click(object sender, RoutedEventArgs e)
        {
            TicketDB   ticket = new TicketDB();
            List <int> list   = ticket.findListOfOneNum("2018");

            if (list != null && list.Count > 0)
            {
                var result = new DiscreteMarkov(list, 33, 5);
                this.content.Text = "预测状态概率::" + result.PredictValue[0] + "\r\n" + "概率转移矩阵:" + result.ProbMatrix + "\r\n";
            }
        }
Пример #6
0
        public IActionResult Post([FromBody] keyvalueModel value)
        {
            var app = new ApplicationMaster()
            {
                ApplicationId = value.Id, ApplicationName = value.keyValue, IsDeleted = false
            };

            TicketDB.ApplicationMaster.Add(app);
            TicketDB.SaveChanges();
            TicketDB.Dispose();
            return(CreatedAtAction(nameof(GetById), new { id = app.ApplicationId }));
        }
        private void BtnCreateTicket_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                string   title    = TxtTitle.Text;
                DateTime?due      = (DtpDueDate.Checked) ? (DateTime?)DtpDueDate.Value : null;
                Priority priority = (Priority)CboPriorities.SelectedItem;

                Ticket newTicket = new Ticket(title, due, priority);

                TicketDB.Create(newTicket);
            }

            LoadTickets();
        }
Пример #8
0
        public IActionResult Put(int id, [FromBody] Tickets value)
        {
            Tickets _ticket = new Tickets()
            {
                TicketId = id, Title = value.Title, Tdescription = value.Tdescription, CreatedBy = value.CreatedBy, StatusId = value.StatusId, Createddate = value.Createddate, AssignedTo = value.AssignedTo, PriorityId = value.PriorityId, TypeId = value.TypeId, ApplicationId = value.ApplicationId, ModuleId = value.ModuleId, ResponseDeadline = value.ResponseDeadline, ResolutionDeadline = value.ResolutionDeadline, RootCauseId = value.RootCauseId, Comments = value.Comments, UpdatedBy = Convert.ToInt32(GetClaimValue(ClaimTypes.Name)), LastModifiedon = value.LastModifiedon
            };

            if (_ticket.TicketId == 0)
            {
                TicketDB.Tickets.Add(_ticket);
            }
            else
            {
                TicketDB.Entry(_ticket).State = EntityState.Modified;
            }
            return(Ok(TicketDB.SaveChanges()));
        }
        private void BtnCreateTicket_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                string   title    = TxtTitle.Text;
                DateTime?due      = (DateTime?)DtpDueDate.Value;
                Priority priority = (Priority)CboPriorities.SelectedItem;

                Ticket newTicket = new Ticket(title, due, priority);
                TicketDB.Create(newTicket);

                FrmAddComment newComment = new FrmAddComment(newTicket);
                newComment.ShowDialog();
            }

            LoadTickets();
        }
Пример #10
0
        public IActionResult Put(int id, [FromBody] TodoList value)
        {
            TodoList _todoitem = new TodoList()
            {
                TodoId = value.TodoId, Userid = value.Userid, Titile = value.Titile, Description = value.Description, ActionDate = value.ActionDate, IsActive = value.IsActive
            };

            if (_todoitem.TodoId == 0)
            {
                TicketDB.TodoList.Add(_todoitem);
            }
            else
            {
                TicketDB.Entry(_todoitem).State = EntityState.Modified;
            }
            TicketDB.SaveChanges();
            return(Ok(1));
        }
Пример #11
0
        private void wjwSameForecast_Click(object sender, RoutedEventArgs e)
        {
            NumConfig numConfig = new NumConfig();
            String    termStr   = term.Text;

            if (termStr == null || termStr == "")
            {
                return;
            }
            TicketDB   ticket = new TicketDB();
            List <int> list   = ticket.findSameForecastListOfTerm(termStr);

            if (list != null)
            {
                this.content.Text = sb.getAppearRedBall(list) + sb.getNoAppearRedBall(list);
            }
            else
            {
                this.content.Text = "没有相关数据!\r\n";
            }
        }
Пример #12
0
 public IActionResult adduser([FromBody] UserModel value)
 {
     try
     {
         if (value.FirstName == null || value.LastName == null || value.EmailId == null || value.Roleid == null)
         {
             throw new InvalidOperationException("invalid user details");
         }
         Log.LogInformation("Saving users");
         TicketDB.Resource.Add(new Resource()
         {
             Fname = value.FirstName, Lname = value.LastName, Email = value.EmailId, Pwd = "1234", Roles = "2", Isactive = true
         });
         TicketDB.SaveChanges();
         Log.LogInformation("Saving complete");
         return(Ok(1));
     }
     catch (System.Exception e)
     {
         Log.LogError(null, e);
         return(ValidationProblem("something wrong with user details " + e.Message));
     }
 }
Пример #13
0
 public IActionResult Delete(int id)
 {
     TicketDB.ApplicationMaster.Remove(TicketDB.ApplicationMaster.FirstOrDefault(x => x.ApplicationId == id));
     TicketDB.SaveChanges();
     return(Ok(1));
 }
Пример #14
0
 protected virtual void LoadTickets()
 {
     LstTickets.DataSource = null;
     LstTickets.DataSource = TicketDB.GetAllTicketsCreatedByUser(State.CurrUser);
 }
Пример #15
0
 public TicketBiz()
 {
     ticketdb = new TicketDB();
 }
 protected virtual void LoadTickets()
 {
     LstTickets.DataSource = null;
     LstTickets.DataSource = TicketDB.GetAllTickets();
 }
Пример #17
0
        public void LoadEntities()
        {
            UserDB          userDB          = new UserDB();
            ManifestationDB manifestationDB = new ManifestationDB();
            LocationDB      locationDB      = new LocationDB();
            TicketDB        ticketDB        = new TicketDB();
            CommentDB       commentDB       = new CommentDB();

            User user1 = new User();

            user1.Username        = "******";
            user1.Name            = "User1";
            user1.Surname         = "User1";
            user1.Password        = "******";
            user1.Gender          = "male";
            user1.Role            = "Buyer";
            user1.DateOfBirth     = Convert.ToDateTime("12/01/1995");
            user1.ManifestationId = "";
            user1.TicketId        = "2894181f-4595-4a3f-8f68-39e937d4d206";
            user1.Type            = "Bronze";
            user1.Points          = 133;
            user1.NoQuit          = 0;
            user1.IsBlocked       = false;
            user1.IsActive        = true;
            userDB.Insert(user1);

            User user2 = new User();

            user2.Username        = "******";
            user2.Name            = "User2";
            user2.Surname         = "User2";
            user2.Password        = "******";
            user2.Gender          = "male";
            user2.Role            = "Buyer";
            user2.DateOfBirth     = Convert.ToDateTime("12/05/1965");
            user2.ManifestationId = "";
            user2.TicketId        = "";
            user2.Type            = "";
            user2.Points          = 0;
            user2.NoQuit          = 0;
            user2.IsBlocked       = false;
            user2.IsActive        = true;
            userDB.Insert(user2);

            User seller = new User();

            seller.Username        = "******";
            seller.Name            = "seller1";
            seller.Surname         = "seller1";
            seller.Password        = "******";
            seller.Gender          = "male";
            seller.Role            = "Seller";
            seller.DateOfBirth     = Convert.ToDateTime("10/05/1994");
            seller.ManifestationId = "5b6a4143-87c0-4d7b-817b-0458dd7cf726";
            seller.TicketId        = "";
            seller.Type            = "";
            seller.Points          = 0;
            seller.NoQuit          = 0;
            seller.IsBlocked       = false;
            seller.IsActive        = true;
            userDB.Insert(seller);

            User seller2 = new User();

            seller2.Username        = "******";
            seller2.Name            = "seller2";
            seller2.Surname         = "seller2";
            seller2.Password        = "******";
            seller2.Gender          = "male";
            seller2.Role            = "Seller";
            seller2.DateOfBirth     = Convert.ToDateTime("02/11/1945");
            seller2.ManifestationId = "168273d1-fdcb-4527-8c8a-e77bd4b331d4";
            seller2.TicketId        = "";
            seller2.Type            = "";
            seller2.Points          = 0;
            seller2.NoQuit          = 0;
            seller2.IsBlocked       = false;
            seller2.IsActive        = true;
            userDB.Insert(seller2);

            Manifestation event1 = new Manifestation();

            event1.Id              = new Guid("d58dfb04-822f-41d7-b170-973e69514fce");
            event1.Name            = "Event1";
            event1.Type            = "Festival";
            event1.Capacity        = 190;
            event1.CapacityVIP     = 20;
            event1.CapacityRegular = 130;
            event1.CapacityFunPit  = 40;
            event1.Price           = 100;
            event1.EventTime       = new DateTime(2020, 12, 15);
            event1.Status          = "Approved";
            event1.Place           = "81 Bulevar  oslobodjenja, Novi Sad, Serbia";
            event1.SellerId        = "seller1";
            event1.Pictures        = "poster2.png;";
            event1.IsActive        = true;
            event1.LocationId      = "2d3b287e-ba87-49ab-971f-af431648eb2d";
            manifestationDB.Insert(event1);

            Manifestation event2 = new Manifestation();

            event2.Id              = new Guid("5b6a4143-87c0-4d7b-817b-0458dd7cf726");
            event2.Name            = "Event2";
            event2.Type            = "Concert";
            event2.Capacity        = 100;
            event2.CapacityVIP     = 10;
            event2.CapacityRegular = 70;
            event2.CapacityFunPit  = 20;
            event2.Price           = 500;
            event2.EventTime       = new DateTime(2021, 1, 25);
            event2.Status          = "Approved";
            event2.Place           = "Mise Dimitrijevica 2, Novi Sad, Serbia";
            event2.SellerId        = "seller1";
            event2.Pictures        = "poster1.jpg;";
            event2.IsActive        = true;
            event2.LocationId      = "28a19974-ea43-46dc-972a-8f8eeb7d52ee";
            manifestationDB.Insert(event2);

            Manifestation event3 = new Manifestation();

            event3.Id              = new Guid("168273d1-fdcb-4527-8c8a-e77bd4b331d4");
            event3.Name            = "Event3";
            event3.Type            = "Festival";
            event3.Capacity        = 50;
            event3.CapacityVIP     = 5;
            event3.CapacityRegular = 35;
            event3.CapacityFunPit  = 10;
            event3.Price           = 1000;
            event3.EventTime       = new DateTime(2021, 2, 5);
            event3.Status          = "Approved";
            event3.Place           = "Mise Dimitrijevica 2, Novi Sad, Serbia";
            event3.SellerId        = "seller2";
            event3.Pictures        = "poster1.jpg;";
            event3.IsActive        = true;
            event3.LocationId      = "28a19974-ea43-46dc-972a-8f8eeb7d52ee";
            manifestationDB.Insert(event3);

            Location location1 = new Location();

            location1.Id        = new Guid("28a19974-ea43-46dc-972a-8f8eeb7d52ee");
            location1.Address   = "Mise Dimitrijevica 2, Novi Sad, Serbia";
            location1.Lattitude = 45.247537f;
            location1.Longitude = 19.834377f;
            locationDB.Insert(location1);

            Location location2 = new Location();

            location2.Id        = new Guid("2d3b287e-ba87-49ab-971f-af431648eb2d");
            location2.Address   = "81 Bulevar  oslobodjenja, Novi Sad, Serbia";
            location2.Lattitude = 45.254244f;
            location2.Longitude = 19.836737f;
            locationDB.Insert(location2);

            Ticket ticket1 = new Ticket();

            ticket1.Id              = "2894181f-4595-4a3f-8f68-39e937d4d206";
            ticket1.Buyer           = "User1 User1";
            ticket1.EventTime       = new DateTime(2020, 12, 15);
            ticket1.IsActive        = true;
            ticket1.ManifestationId = "d58dfb04-822f-41d7-b170-973e69514fce";
            ticket1.Price           = 1000;
            ticket1.SellerId        = "seller1";
            ticket1.Status          = "Reserved";
            ticket1.Type            = "Regular";
            ticketDB.Insert(ticket1);


            Comment comment1 = new Comment();

            comment1.Id              = new Guid("6cd3d269-ea5b-4110-a4f1-b28518bfffce");
            comment1.IsActive        = false;
            comment1.ManifestationId = "d58dfb04-822f-41d7-b170-973e69514fce";
            comment1.Rating          = 5;
            comment1.Text            = "Ova manifestacija je odlicna!";
            comment1.UserId          = "User1";
            commentDB.Insert(comment1);
        }