Beispiel #1
0
        public List <Jobs> GetJobsDetailsAsync(int Id, int projId)
        {
            DataTable dtJobs = new DataTable();

            if (myconn.State != ConnectionState.Open)
            {
                myconn.Open();
            }

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.CommandText = "SP_JobsGet";
            sqlCmd.Parameters.Add(new SqlParameter("@Id", Id));
            sqlCmd.Parameters.Add(new SqlParameter("@projId", projId));
            sqlCmd.Connection = myconn;
            SqlDataAdapter daJobs = new SqlDataAdapter(sqlCmd);

            dtJobs.Clear();
            daJobs.Fill(dtJobs);
            List <Jobs> lst = new List <Jobs>();

            if (dtJobs.Rows.Count == 0)
            {
                lst.Add(new Jobs());
                lst[0].project         = project.GetProjectDetailsAsync(projId, 0);
                lst[0].team            = team.GetTeamDetailsAsync(0, 'I');
                lst[0].subcontractor   = subcontractor.GetSubContractorDetailsAsync(0, 'I');
                lst[0].jobstatus       = jobstatus.GetJobStatusDetailsAsync(0);
                lst[0].projectjobtypes = projectjobtypes.GetProjectJobTypesDetailsAsync(0, projId);
                lst[0].projectRates    = projectRates.GetProjectRatesDetailsAsync(0, projId);
                lst[0].members         = members.GetMembersDetailsAsync(0, 'I');
                lst[0].jRates          = jRates.GetJobRatesDetailsAsync(0, Id);
            }
            else
            {
                foreach (DataRow item in dtJobs.Rows)
                {
                    lst.Add(new Jobs()
                    {
                        Id              = Convert.ToInt32(item[0]),
                        projId          = Convert.ToInt32(item[1]),
                        projJobTypeId   = Convert.ToInt32(item[2]),
                        jobDesc         = item[3].ToString(),
                        projName        = item[4].ToString(),
                        jobTypeName     = item[5].ToString(),
                        locCode         = item[6].ToString(),
                        completionDate  = Convert.ToDateTime(item[7]).Date,
                        jobStatusId     = Convert.ToInt32(item[8]),
                        jobStatusName   = item[9].ToString(),
                        createdDate     = Convert.ToDateTime(item[10]),
                        modifiedDate    = item[11] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(item[11]),
                        userId          = Convert.ToInt32(item[12]),
                        jobAssign       = jAssign.GetJobAssignmentDetailsAsync(0, Convert.ToInt32(item[0])),
                        jobRates        = jRates.GetJobRatesDetailsAsync(0, Convert.ToInt32(item[0])),
                        jobBOQVariation = jBOQVariation.GetJobBOQVariationDetailsAsync(0, Convert.ToInt32(item[0])),
                        jobDocuments    = jDocuments.GetJobDocumentsDetailsAsync(0, Convert.ToInt32(item[0])),
                        jobComplaints   = jComplaints.GetJobComplaintsDetailsAsync(0, Convert.ToInt32(item[0])),
                        jobDefects      = jDefects.GetJobDefectsDetailsAsync(0, Convert.ToInt32(item[0]))
                    });
                }
                lst[0].project         = project.GetProjectDetailsAsync(projId, 0);
                lst[0].team            = team.GetTeamDetailsAsync(0, 'I');
                lst[0].subcontractor   = subcontractor.GetSubContractorDetailsAsync(0, 'I');
                lst[0].jobstatus       = jobstatus.GetJobStatusDetailsAsync(0);
                lst[0].projectjobtypes = projectjobtypes.GetProjectJobTypesDetailsAsync(0, projId);
                lst[0].projectRates    = projectRates.GetProjectRatesDetailsAsync(0, projId);
                lst[0].members         = members.GetMembersDetailsAsync(0, 'I');
                lst[0].jRates          = jRates.GetJobRatesDetailsAsync(0, Id);
            }
            if (myconn.State != ConnectionState.Closed)
            {
                myconn.Close();
            }
            return(lst);
        }
Beispiel #2
0
        public async Task <List <SubContractor> > Get()
        {
            List <SubContractor> lst = await Task.Run(() => _SubContractorRepo.GetSubContractorDetailsAsync(0, 'I'));

            return(lst);
        }