Esempio n. 1
0
        private static List <DOC10_Responses> getResponseList(DataSet resultSet)
        {
            List <DOC10_Responses> listResponse = new List <DOC10_Responses>();

            foreach (DataRow item in resultSet.Tables[2].Rows)
            {
                var response = new DOC10_Responses();
                response.ResponseId = Convert.ToInt32(item["ResponseId"]);
                response.Response   = Convert.ToString(item["Response"]);
                listResponse.Add(response);
            }
            return(listResponse);
        }
Esempio n. 2
0
        public static JobActivationChecklist JobActivationLookup(JobActivationChecklist objActivation)
        {
            try
            {
                var resultSet = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure,
                                                         "spATL_PRJ_JobActChkLst_LkUp",
                                                         new SqlParameter("@PRJID", objActivation.PRJID));

                objActivation.ListCustomersTypes = new List <DOC08_CustomerType>();
                foreach (DataRow item in resultSet.Tables[0].Rows)
                {
                    var customer = new DOC08_CustomerType();
                    customer.CustomerTypeID = Convert.ToInt32(item["CustomerTypeId"]);
                    customer.Description    = Convert.ToString(item["Description"]);
                    objActivation.ListCustomersTypes.Add(customer);
                }

                objActivation.ListJobTypes = new List <DOC09_JobTypes>();
                foreach (DataRow item in resultSet.Tables[1].Rows)
                {
                    var jobType = new DOC09_JobTypes();
                    jobType.JobTypeId   = Convert.ToInt32(item["JobTypeId"]);
                    jobType.JobTypeDesc = Convert.ToString(item["JobTypeDesc"]);
                    objActivation.ListJobTypes.Add(jobType);
                }

                objActivation.ListResponses = new List <DOC10_Responses>();
                foreach (DataRow item in resultSet.Tables[2].Rows)
                {
                    var response = new DOC10_Responses();
                    response.ResponseId = Convert.ToInt32(item["ResponseId"]);
                    response.Response   = Convert.ToString(item["Response"]);
                    objActivation.ListResponses.Add(response);
                }

                objActivation.ListLabourTypes = new List <SYS10_MhRates>();
                foreach (DataRow item in resultSet.Tables[3].Rows)
                {
                    var labourType = new SYS10_MhRates();
                    labourType.MhRateId   = Convert.ToString(item["MhRateId"]);
                    labourType.MhRateName = Convert.ToString(item["MhRateName"]);
                    objActivation.ListLabourTypes.Add(labourType);
                }

                objActivation.ListUsers = new List <Sys_UsersData>();
                foreach (DataRow item in resultSet.Tables[4].Rows)
                {
                    var usersData = new Sys_UsersData();
                    usersData.UserId = Convert.ToInt32(item["UserId"]);
                    usersData.Name   = Convert.ToString(item["Name"]);
                    objActivation.ListUsers.Add(usersData);
                }

                foreach (DataRow item in resultSet.Tables[5].Rows)
                {
                    objActivation.PRJID = Convert.ToInt32(item["ProjectHeaderId"]);
                    objActivation.projectInformation.JobNumber                   = Convert.ToString(item["Atlas_Job_Number"]);
                    objActivation.projectInformation.CompanyName                 = Convert.ToString(item["Atlas_Company_Name"]);
                    objActivation.projectInformation.CustomerProfile             = new Profile();
                    objActivation.projectInformation.CustomerProfile.Name        = Convert.ToString(item["Contractor_Name"]);
                    objActivation.projectInformation.CustomerProfile.Address     = Convert.ToString(item["Contractor_Address"]);
                    objActivation.projectInformation.CustomerProfile.City        = Convert.ToString(item["Contractor_City"]);
                    objActivation.projectInformation.CustomerProfile.State       = Convert.ToString(item["Contractor_State"]);
                    objActivation.projectInformation.CustomerProfile.Zip         = Convert.ToString(item["Contractor_Zip"]);
                    objActivation.projectInformation.CustomerProfile.PhoneNumber = Convert.ToString(item["Contractor_Phone"]);
                    //TODO: Check Ext, Contact
                    //objActivation.projectInformation.CustomerProfile.Extension = Convert.ToString(item["Contractor_PhoneExt"]);
                    //objActivation.projectInformation.CustomerProfile.ContactName = Convert.ToString(item["Contractor_Contact"]);
                    objActivation.projectInformation.ProjectProfile             = new Profile();
                    objActivation.projectInformation.ProjectProfile.Name        = Convert.ToString(item["JobName"]);
                    objActivation.projectInformation.ProjectProfile.Address     = Convert.ToString(item["JobAddress"]);
                    objActivation.projectInformation.ProjectProfile.City        = Convert.ToString(item["JobCity"]);
                    objActivation.projectInformation.ProjectProfile.State       = Convert.ToString(item["JobState"]);
                    objActivation.projectInformation.ProjectProfile.Zip         = Convert.ToString(item["JobZip"]);
                    objActivation.projectInformation.ProjectProfile.PhoneNumber = Convert.ToString(item["JobPhone"]);
                    //TODO:
                    //objActivation.projectInformation.ProjectProfile.Extension = Convert.ToString(item["Job_PhoneExt"]);
                    objActivation.projectInformation.ProjectProfile.ContactName = Convert.ToString(item["JobContact"]);
                    objActivation.projectInformation.Estimator = Convert.ToString(item["EstimatorsName"]);
                }

                if (resultSet.Tables[5].Rows.Count == 0)
                {
                    objActivation.PRJID = 0;
                }
            }
            catch (Exception ex)
            {
                Logger.SaveErr(ex);
                throw ex;
            }
            return(objActivation);
        }