public ActionResult DeleteConfirmed(string id)
        {
            JobTransaction jobTransaction = db.Transactions.Find(id);

            db.Transactions.Remove(jobTransaction);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            JobTransaction objJobTransaction;


            mstrbldrErrors.Clear();
            this.ValidateChildren();
            if (mstrbldrErrors.Length > 0)
            {
                return;
            }

            objJobTransaction = new JobTransaction();
            try
            {
                objJobTransaction.CompleteOperation = chkCompleteOperation.Checked;
                objJobTransaction.CloseJob          = chkCloseJob.Checked;
                objJobTransaction.JobNumber         = mobjItem.SelectedJob.FormattedJobNumber;//mobjItem.SelectedJob.JobNumber;//To accomodate job field length difference between SL4 & SL8
                objJobTransaction.Location          = cboLocation.SelectedItem as StockLocation;
                objJobTransaction.Operation         = mobjItem.SelectedJob.SelectedOperation;
                objJobTransaction.Warehouse         = "MAIN";
                objJobTransaction.UserCode          = "SHA";
                objJobTransaction.TransactionClass  = 'J';
                objJobTransaction.TransactionType   = 'M';
                objJobTransaction.Suffix            = mobjItem.SelectedJob.Suffix;
                objJobTransaction.QtyMoved          = double.Parse(txtQuantity.Text);
                objJobTransaction.QtyComplete       = double.Parse(txtQuantity.Text);
                objJobTransaction.NextOperation     = mobjItem.SelectedJob.SelectedOperation.NextOperation;

                /*MODIFIED 1/20/2014 - As part of the last operation removal project I removed the functionality where a move transaction is inserted into the unposted job transactions table for posting
                 * since quantities that the operator enters are the quantitites that will go into inventory.*/
                //objJobTransaction.Insert();

                if (mobjItem.IsPulledFromInventory)
                {
                    foreach (ItemHistoryTransaction objTransaction in mobjItem.SelectedHistoryTransactions)
                    {
                        Item.ShipItemFromInventory(objTransaction);
                    }
                }
            }
            catch (Exception objEx)
            {
                MessageBox.Show(objEx.Message);
                FormStatus = WTFClassLibrary.FormStatus.Errored;
                this.Dispose();
                return;
            }
            FormStatus = WTFClassLibrary.FormStatus.Succeeded;
            this.Dispose();
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            JobTransaction objJobTransaction;

            mstrbldrErrors.Clear();
            this.ValidateChildren();
            if (mstrbldrErrors.Length > 0)
                return;

            objJobTransaction = new JobTransaction();
            try
            {
                objJobTransaction.CompleteOperation = chkCompleteOperation.Checked;
                objJobTransaction.CloseJob = chkCloseJob.Checked;
                objJobTransaction.JobNumber = mobjItem.SelectedJob.FormattedJobNumber;//mobjItem.SelectedJob.JobNumber;//To accomodate job field length difference between SL4 & SL8
                objJobTransaction.Location = cboLocation.SelectedItem as StockLocation;
                objJobTransaction.Operation = mobjItem.SelectedJob.SelectedOperation;
                objJobTransaction.Warehouse = "MAIN";
                objJobTransaction.UserCode = "SHA";
                objJobTransaction.TransactionClass = 'J';
                objJobTransaction.TransactionType = 'M';
                objJobTransaction.Suffix = mobjItem.SelectedJob.Suffix;
                objJobTransaction.QtyMoved = double.Parse(txtQuantity.Text);
                objJobTransaction.QtyComplete = double.Parse(txtQuantity.Text);
                objJobTransaction.NextOperation = mobjItem.SelectedJob.SelectedOperation.NextOperation;

                /*MODIFIED 1/20/2014 - As part of the last operation removal project I removed the functionality where a move transaction is inserted into the unposted job transactions table for posting
                 since quantities that the operator enters are the quantitites that will go into inventory.*/
                //objJobTransaction.Insert();

                if (mobjItem.IsPulledFromInventory)
                    foreach (ItemHistoryTransaction objTransaction in mobjItem.SelectedHistoryTransactions)
                        Item.ShipItemFromInventory(objTransaction);
            }
            catch(Exception objEx)
            {
                MessageBox.Show(objEx.Message);
                FormStatus = WTFClassLibrary.FormStatus.Errored;
                this.Dispose();
                return;
            }
            FormStatus = WTFClassLibrary.FormStatus.Succeeded;
            this.Dispose();
        }
        /// <summary>
        /// Deletes a Job Transaction for the job
        /// </summary>
        /// <param name="id">the job transaction id</param>
        /// <returns></returns>
        public ActionResult Delete(string id)
        {
            if (getAccount() == null)
            {
                this.AddNotification("Sorry! You are not allowed to access this page", NotificationType.ERROR);
                return(RedirectToAction("Home", "Index"));
            }
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            JobTransaction jobTransaction = db.Transactions.Find(id);

            if (jobTransaction == null)
            {
                return(HttpNotFound());
            }
            return(View(jobTransaction));
        }
Esempio n. 5
0
        protected override void Seed(SecureSoftwareApplication.Models.ApplicationDbContext context)
        {
            if (System.Diagnostics.Debugger.IsAttached == false)
            {
                System.Diagnostics.Debugger.Launch();
            }

            try
            {
                if (!context.Users.Any())
                {
                    Account admin = new Account
                    {
                        Email       = "*****@*****.**",
                        UserName    = "******",
                        PhoneNumber = "07714922341",
                        AccountType = AccountType.Admin
                    };

                    Account employee = new Account
                    {
                        Email       = "*****@*****.**",
                        UserName    = "******",
                        PhoneNumber = "08459517880",
                        AccountType = AccountType.Employee
                    };

                    CreateAccount(admin, "Admin1!", context);
                    CreateAccount(employee, "Employee456", context);

                    File file1 = new File
                    {
                        Contents  = "Empty seed data",
                        Folder    = "Fake folder",
                        PubDate   = DateTime.Now.Date,
                        Name      = "Empty seed File",
                        Source    = "FakeSRC",
                        TimeStamp = DateTime.Now.AddDays(-1)
                    };

                    File file2 = new File
                    {
                        Contents  = "Empty seed data number 2 ",
                        Folder    = "Fake folder 2",
                        PubDate   = DateTime.Now.Date,
                        Name      = "Empty seed File 2",
                        Source    = "FakeSRC2",
                        TimeStamp = DateTime.Now.AddDays(-2)
                    };

                    context.Files.AddOrUpdate(file1);
                    context.Files.AddOrUpdate(file2);

                    Job job = new Job
                    {
                        Author      = employee,
                        authorised  = true,
                        Destination = Destination.HongKong,
                        Start       = DateTime.Now.Date,
                        End         = DateTime.Now.AddDays(2),
                        isPublic    = true,
                        state       = State.Active,
                        Type        = JobType.Continous,
                    };

                    JobTransaction jt1 = new JobTransaction
                    {
                        File      = file1,
                        Job       = job,
                        TimeStamp = DateTime.Now.Date
                    };

                    JobTransaction jt2 = new JobTransaction
                    {
                        File      = file2,
                        Job       = job,
                        TimeStamp = DateTime.Now.Date
                    };



                    context.Jobs.AddOrUpdate(job);

                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
            }
        }
Esempio n. 6
0
        public ActionResult Create(FileViewModel files)
        {
            if (getAccount() == null)
            {
                this.AddNotification("Sorry! You are not allowed to access this page", NotificationType.ERROR);
                return(RedirectToAction("Home", "Index"));
            }

            if (ModelState.IsValid)
            {
                File addFile = new Models.File()
                {
                    Contents  = files.Contents,
                    Name      = files.Name,
                    Folder    = files.Folder,
                    PubDate   = DateTime.Now.Date,
                    TimeStamp = DateTime.Now.Date,
                    Size      = 0
                };

                // Files is looking for the corresponding ID in the view
                HttpPostedFileBase content = Request.Files["file"];

                //calculates the size of the file to Mb
                int size = (content.ContentLength / 1024) / 1024;

                addFile.Size = size;

                if (content != null)
                {
                    //Where a file exists in this entry, upload to cloud.
                    FileStorageService fss = new FileStorageService();

                    addFile.Source = fss.Upload(content);
                }



                db.Files.Add(addFile);


                var job = db.Jobs.Find(files.job);

                JobTransaction jt = new JobTransaction()
                {
                    File      = addFile,
                    Job       = job,
                    TimeStamp = DateTime.Now.Date,
                };


                db.SaveChanges();

                db.Transactions.AddOrUpdate(jt);

                db.SaveChanges();

                return(RedirectToAction("Index", "JobTransactions", new { id = files.job }));
            }

            return(View(files));
        }