Exemplo n.º 1
0
        // Remove the items that are check within the input job array
        private void delButton_Click(object sender, EventArgs e)
        {
            // Create a bool array to track the state of each item
            bool[] delete = new bool[JobTable.Items.Count];
            error1.Visible = false;

            for (i = 0; i < JobTable.Items.Count; i++)
            {
                // Preset the item to false (unchecked).  Check the state and revise as
                // needed
                delete[i] = false;
                if (JobTable.GetItemCheckState(i) == CheckState.Checked)
                {
                    delete[i] = true;
                }
            }

            // Run through delete array, and delete the flaged values from the array.
            // Working backwards ensures that the correct items are removed.
            for (i = JobTable.Items.Count - 1; i >= 0; i--)
            {
                if (delete[i])
                {
                    JobTable.Items.RemoveAt(i);
                }
            }
        }
        public ActionResult Create(JobTableViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CrudJobDbEntities db = new CrudJobDbEntities())
                    {
                        var oJobsTable = new JobTable();
                        oJobsTable.Job            = model.Job;
                        oJobsTable.JobTile        = model.JobTile;
                        oJobsTable.JobDescription = model.JobDescription;
                        oJobsTable.FromDate       = model.FromDate;
                        oJobsTable.ToDate         = model.ToDate;

                        db.JobTables.Add(oJobsTable);
                        db.SaveChanges();
                    }

                    return(Redirect("~/Jobs/Index"));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// Creates a connection to the jobs table and
        /// upserts the given job entity.
        /// </summary>
        /// <param name="log"></param>
        /// <param name="jobEntity"></param>
        /// <returns></returns>
        public static async Task UpdateJobTableWithStatus(ILogger log, JobEntity jobEntity)
        {
            log.LogInformation("[PENDING] Connecting to jobs table...");
            JobTable jobTable = new JobTable(log, ConfigSettings.IMAGEJOBS_PARTITIONKEY);

            log.LogInformation("[SUCCESS] Connected to Jobs Table");

            await jobTable.InsertOrReplaceJobEntity(jobEntity);
        }
Exemplo n.º 4
0
        private void SavaJobsToDatabase(List <Job> jobs)
        {
            db.jobTable.DeleteAllOnSubmit(db.jobTable.ToList <JobTable>());
            foreach (Job job in jobs)
            {
                if (db.jobTable.Any(c => c.Job_ID.Equals(job.Id)))
                {
                    continue;
                }
                JobTable jobItem = new JobTable()
                {
                    Job_ID            = job.Id,
                    Job_AddressCity   = job.Address.City,
                    Job_AddressDetail = job.Address.Detail,
                    //   Job_AddressLatitude=job.Address.Accurate.Latitude,
                    // Job_AddressLongitude=job.Address.Accurate.Longitude,
                    Job_CompanyId   = job.Company.Id,
                    Job_CompanyName = job.Company.Name,
                    Job_Url         = job.Url,

                    Job_StartTime = job.StartTime,
                    //  Job_EndTime=job.EndTime+"",
                    Job_IsCollection = false,
                    Job_IsRemind     = false,
                    Job_University   = job.Address.University,
                };
                if (job.Address.Accurate != null)
                {
                    jobItem.Job_AddressLatitude  = job.Address.Accurate.Latitude;
                    jobItem.Job_AddressLongitude = job.Address.Accurate.Longitude;
                }
                try
                {
                    //wait for my turn
                    OperationOnDatabase.WaitOne();

                    //interact with the database
                    //use 'ToArray' to make sure we are indeed done
                    //with our DataContext before we continue
                    db.jobTable.InsertOnSubmit(jobItem);
                }
                finally
                {
                    //always give my turn away when done.
                    OperationOnDatabase.Set();
                }
                //  if(!db.jobTable.Contains<JobTable>(jobItem,new JobEqualityComparer()))
            }
            //         int count = db.jobTable.Count();
            db.SubmitChanges();
            //      count = db.jobTable.Count();
        }
Exemplo n.º 5
0
        void ReleaseDesignerOutlets()
        {
            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DetailsView != null)
            {
                DetailsView.Dispose();
                DetailsView = null;
            }

            if (JobTable != null)
            {
                JobTable.Dispose();
                JobTable = null;
            }

            if (NewNoteField != null)
            {
                NewNoteField.Dispose();
                NewNoteField = null;
            }

            if (NoteTable != null)
            {
                NoteTable.Dispose();
                NoteTable = null;
            }

            if (OrderNoLabel != null)
            {
                OrderNoLabel.Dispose();
                OrderNoLabel = null;
            }

            if (StatusLabel != null)
            {
                StatusLabel.Dispose();
                StatusLabel = null;
            }

            if (DetailsSection != null)
            {
                DetailsSection.Dispose();
                DetailsSection = null;
            }
        }
Exemplo n.º 6
0
        public frmAddWorker(String st)
        {
            tsr = st;
            InitializeComponent();
            JobTable  jt = new JobTable();
            CityTable ct = new CityTable();

            Suport.FillCombox(cmbCity, ct.GetTable(), "nameCity", "coudeCity");
            WorkerTable wo = new WorkerTable();

            Suport.FillCombox(cmbBranch, wo.GetTable(), "branchName", "branchCoude");
            Suport.FillCombox(cmbJob, jt.GetTable(), "nameJob", "doudeJob");

            BranchTable curentb = new BranchTable();

            Suport.FillCombox(cmbBranch, curentb.GetTable(), "branchName", "branchCoude");
            if (st == "Add")
            {
                curentWorker      = new Worker();
                lblAdd.Visible    = true;
                lblUpdate.Visible = false;
                lblSearch.Visible = false;
                txtSearch.Visible = false;
                btnSearch.Visible = false;
                lblDel.Visible    = false;
                txtSearch.Visible = false;
            }
            if (st == "Update")
            {
                lblAdd.Visible    = false;
                lblUpdate.Visible = true;
                lblDel.Visible    = false;
                txtSearch.Visible = true;
                txtID.Enabled     = false;
            }
            if (st == "Del")
            {
                lblAdd.Visible    = false;
                lblUpdate.Visible = false;
                lblDel.Visible    = true;
                txtSearch.Visible = true;
            }
        }
Exemplo n.º 7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string sql = "INSERT INTO Jobs (vehicleRowId, customerRowId, employeeRowId, description, status) " +
                         "VALUES (@vehicleRowId, @customerRowId, @employeeRowId, @description, @status)";

            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@vehicleRowId", Util.SGC(ddlVehicle.SelectedValue)));
            param.Add(new SqlParameter("@customerRowId", Util.SGC(ddlCustomer.SelectedValue)));
            param.Add(new SqlParameter("@employeeRowId", Util.SGC(ddlEmployee.SelectedValue)));
            param.Add(new SqlParameter("@description", Util.SGC(txtIssueDescription.Text)));
            param.Add(new SqlParameter("@status", "Pending"));

            if (Util.DoNonQuery(sql, param) > 0)
            {
                JobTable.LoadData();
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemplo n.º 8
0
        public static async Task Run([BlobTrigger("failedimages/{name}", Connection = ConfigSettings.STORAGE_CONNECTION_STRING_NAME)] CloudBlockBlob failedImage, ILogger log)
        {
            const int    jobStatus  = 4;
            const string jobMessage = "Image conversion failed.";

            // Retrieve attributes (jobId) from blob
            await failedImage.FetchAttributesAsync();

            if (failedImage.Metadata.ContainsKey(ConfigSettings.JOBID_METADATA_NAME))
            {
                string jobId       = failedImage.Metadata[ConfigSettings.JOBID_METADATA_NAME];
                string imageResult = failedImage.Uri.ToString();

                log.LogInformation($"C# Blob trigger function Processed blob\n Name:{failedImage.Name} \n JobId: [{jobId}]");

                // Set the job status
                JobTable jobTable = new JobTable(log, ConfigSettings.IMAGEJOBS_PARTITIONKEY);
                await jobTable.UpdateJobEntityStatus(jobId, jobStatus, jobMessage, imageResult);
            }
            else
            {
                log.LogError($"The blob {failedImage.Name} is missing its {ConfigSettings.JOBID_METADATA_NAME} metadata can't update the job");
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Updates the job table with status.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="jobId">The job identifier.</param>
 /// <param name="status">The status.</param>
 /// <param name="message">The message.</param>
 /// <param name="imageSource">The original image URL.</param>
 private static async Task UpdateJobTableWithStatus(ILogger log, string jobId, int status, string message, string imageSource)
 {
     JobTable jobTable = new JobTable(log, ConfigSettings.IMAGEJOBS_PARTITIONKEY);
     await jobTable.InsertOrReplaceJobEntity(jobId, status : status, message : message, imageSource : imageSource, imageConversionMode);
 }
Exemplo n.º 10
0
        public void InitLocalMySQL()
        {
            if (this.Database.CreateIfNotExists())
            {
                EntityGenerator <Address> generatorAddress = new EntityGenerator <Address>();
                for (int i = 0; i < 10; i++)
                {
                    AddressTable.Add(generatorAddress.GenerateItem());
                }

                EntityGenerator <StreetNumber> generatorStreetNumber = new EntityGenerator <StreetNumber>();
                for (int i = 0; i < 20; i++)
                {
                    StreetNumberTable.Add(generatorStreetNumber.GenerateItem());
                }

                EntityGenerator <Employee> generatorEmployee = new EntityGenerator <Employee>();
                for (int i = 0; i < 10; i++)
                {
                    EmployeeTable.Add(generatorEmployee.GenerateItem());
                }

                EntityGenerator <Animal> generatorAnimal = new EntityGenerator <Animal>();
                for (int i = 0; i < 10; i++)
                {
                    AnimalTable.Add(generatorAnimal.GenerateItem());
                }

                EntityGenerator <Job> generatorJob = new EntityGenerator <Job>();
                for (int i = 0; i < 10; i++)
                {
                    JobTable.Add(generatorJob.GenerateItem());
                }

                EntityGenerator <Schedule> generatorSchedule = new EntityGenerator <Schedule>();
                for (int i = 0; i < 10; i++)
                {
                    ScheduleTable.Add(generatorSchedule.GenerateItem());
                }


                EntityGenerator <Structure> generatorStructure = new EntityGenerator <Structure>();
                for (int i = 0; i < 10; i++)
                {
                    StructureTable.Add(generatorStructure.GenerateItem());
                }

                EntityGenerator <Zoo> generatorZoo = new EntityGenerator <Zoo>();
                for (int i = 0; i < 10; i++)

                {
                    ZooTable.Add(generatorZoo.GenerateItem());
                }

                this.SaveChangesAsync();


                AddressTable.Find(1).StreetNumber = StreetNumberTable.Find(1);
                this.SaveChangesAsync();
            }
        }