Пример #1
0
        /// <summary>
        /// Return list of Assessor details based on supplied Search-Parameters
        /// </summary>
        /// <returns></returns>
        AssessorResponse IAssessorDemographicDbService.SearchAssessors(SearchAssessorRequestParams request)
        {
            AssessorResponse assessorResponse = new AssessorResponse();

            try
            {
                var dbSet = GetDbConnector().LoadDataSet("SearchAssessors", QueryCommandType.StoredProcedure,
                                                         new List <System.Data.IDbDataParameter>
                {
                    new SqlParameter()
                    {
                        ParameterName = "@Name", Value = request.Name, SqlDbType = SqlDbType.VarChar, Size = 200
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@IRIS_Id", Value = request.IRIS_Id, SqlDbType = SqlDbType.VarChar, Size = 30
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@Gender", Value = request.Gender, SqlDbType = SqlDbType.Char, Size = 1
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@EmailId", Value = request.EmailId, SqlDbType = SqlDbType.VarChar, Size = 150
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@MobileNo", Value = request.MobileNo, SqlDbType = SqlDbType.VarChar, Size = 10
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@StateId", Value = request.StateId, SqlDbType = SqlDbType.Int
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@CityId", Value = request.CityId, SqlDbType = SqlDbType.Int
                    },

                    //later will add other search params like "JobRole, IdProofTypeId" etc
                    new SqlParameter()
                    {
                        ParameterName = "@AccountNumber", Value = request.AccountNumber, SqlDbType = SqlDbType.VarChar, Size = 20
                    },
                });

                //Comment : Here fill & return generic list from DbSet
                var listAssessors = new List <Assessor>();
                if (dbSet != null && dbSet.Tables.Count > 0)
                {
                    foreach (DataRow dataRow in dbSet.Tables[0].Rows)
                    {
                        listAssessors.Add(
                            new Assessor()
                        {
                            Id      = Convert.ToInt64(dataRow["AssessorId"]),
                            IRIS_Id = dataRow["IRIS_Id"].ToString(),
                            NSDC_Id = dataRow["NSDC_Id"].ToString(),
                            SSC_Id  = dataRow["SSC_Id"].ToString(),

                            #region Comment: Here data for dependent child data like Personal, JobRoles, PrefLocation etc

                            PerosnalDetail = new AssessorPersonalDetail()
                            {
                                //refrence key data
                                AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                                Name       = dataRow["AssessorName"].ToString(),
                                Gender     = Convert.ToChar((dataRow["Gender"] == DBNull.Value || dataRow["IsActive"] == null) ? null : dataRow["Gender"]),
                            },

                            CommunicationDetail = new AssessorCommunicationDetail()
                            {
                                //refrence key data
                                AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                                EmailId    = dataRow["EmailId"].ToString(),
                                MobileNo   = dataRow["MobileNo"].ToString(),
                                CityName   = dataRow["CityName"].ToString(),
                                StateName  = dataRow["StateName"].ToString(),
                            },

                            //IdProofs = new AssessorIdProofDetail()
                            //{
                            //    //refrence key data
                            //    AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                            //    //SchemeName = dataRow["SchemeName"].ToString(),
                            //    //JobRoleName = dataRow["JobRoleName"].ToString(),
                            //    //CityName = dataRow["CityName"].ToString(),
                            //    //VTP_Name = dataRow["VTP_Name"].ToString(),
                            //    //TotalCandidates = Convert.ToInt32(dataRow["TotalCandidates"]),
                            //},

                            //JobRoles = new AssessorJobRole()
                            //{
                            //    //refrence key data
                            //    AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                            //    //SchemeName = dataRow["SchemeName"].ToString(),
                            //    //JobRoleName = dataRow["JobRoleName"].ToString(),
                            //    //CityName = dataRow["CityName"].ToString(),
                            //    //VTP_Name = dataRow["VTP_Name"].ToString(),
                            //    //TotalCandidates = Convert.ToInt32(dataRow["TotalCandidates"]),
                            //},

                            //PreferredLocations = new AssessorPreferredLocation()
                            //{
                            //    //refrence key data
                            //    AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                            //    //SchemeName = dataRow["SchemeName"].ToString(),
                            //    //JobRoleName = dataRow["JobRoleName"].ToString(),
                            //    //CityName = dataRow["CityName"].ToString(),
                            //    //VTP_Name = dataRow["VTP_Name"].ToString(),
                            //    //TotalCandidates = Convert.ToInt32(dataRow["TotalCandidates"]),
                            //},

                            #endregion

                            IsActive = Convert.ToBoolean((dataRow["IsActive"] == DBNull.Value || dataRow["IsActive"] == null) ? 0 : dataRow["IsActive"])
                        });
                    }
                }

                //assign fecthed list
                assessorResponse.Assessor        = listAssessors;
                assessorResponse.OperationStatus = new OperationStatus {
                    ServiceName = "SearchAssessor", ServiceMethod = "Get", RequestProcessed = true, RequestSuccessful = true
                };
            }
            catch (Exception ex)
            {
                assessorResponse.OperationStatus = new OperationStatus {
                    Messages = new List <Message>()
                    {
                        new Message()
                        {
                            DTOName = "Assessor", DTOProperty = "", MessageType = MessageType.SystemError, Text = ex.Message
                        }
                    }, RequestProcessed = true, RequestSuccessful = false
                };
            }

            return(assessorResponse);
        }
Пример #2
0
        /// <summary>
        /// Method will return list of Assessor
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        AssessorResponse IAssessorDemographicDbService.GetAssessor(AssessorRequestParams request)
        {
            AssessorResponse assessorResponse = new AssessorResponse();

            try
            {
                var dbSet = GetDbConnector().LoadDataSet("GetAssessor", QueryCommandType.StoredProcedure,
                                                         new List <System.Data.IDbDataParameter>
                {
                    new SqlParameter()
                    {
                        ParameterName = "@AssessorId", Value = request.AssessorId, SqlDbType = SqlDbType.Int
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@IRIS_Id", Value = request.IRIS_Id, SqlDbType = SqlDbType.VarChar, Size = 30
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@OnlyActive", Value = request.IsActive, SqlDbType = SqlDbType.Bit
                    }
                });

                //Comment : Here fill & return generic list from DbSet
                var listAssessors = new List <Assessor>();
                if (dbSet != null && dbSet.Tables.Count > 0)
                {
                    foreach (DataRow dataRow in dbSet.Tables[0].Rows)
                    {
                        //get running assessor-id for fetching related child (JobRoles, PrefLocations)
                        Int64 assessorId = Convert.ToInt64(dataRow["AssessorId"]);

                        listAssessors.Add(
                            new Assessor()
                        {
                            Id      = assessorId,
                            IRIS_Id = dataRow["IRIS_Id"].ToString(),
                            NSDC_Id = dataRow["NSDC_Id"].ToString(),
                            SSC_Id  = dataRow["SSC_Id"].ToString(),

                            #region Comment: Here data for dependent child data like Personal, JobRoles, PrefLocation etc

                            PerosnalDetail = new AssessorPersonalDetail()
                            {
                                //refrence key data
                                AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                                Name       = dataRow["AssessorName"].ToString(),
                                FatherName = dataRow["FatherName"].ToString(),
                                MotherName = dataRow["MotherName"].ToString(),
                                //conversion fields
                                Gender        = Convert.ToChar((dataRow["Gender"] == DBNull.Value || dataRow["Gender"] == null) ? null : dataRow["Gender"]),
                                DOB           = ((dataRow["DOB"] == DBNull.Value || dataRow["DOB"] == null) ? (DateTime?)null : Convert.ToDateTime(dataRow["DOB"])),
                                MaritalStatus = ((dataRow["MaritalStatus"] == DBNull.Value || dataRow["MaritalStatus"] == null) ? (bool?)null : Convert.ToBoolean(dataRow["MaritalStatus"])),
                            },

                            CommunicationDetail = new AssessorCommunicationDetail()
                            {
                                //refrence key data
                                AssessorId = Convert.ToInt32(dataRow["AssessorId"]),
                                EmailId    = dataRow["EmailId"].ToString(),
                                MobileNo   = dataRow["MobileNo"].ToString(),
                                CityId     = ((dataRow["CityId"] == DBNull.Value || dataRow["CityId"] == null) ? (int?)null : Convert.ToInt16(dataRow["CityId"])),
                                CityName   = dataRow["CityName"].ToString(),

                                StateId             = ((dataRow["StateId"] == DBNull.Value || dataRow["StateId"] == null) ? (int?)null : Convert.ToInt16(dataRow["StateId"])),
                                StateName           = dataRow["StateName"].ToString(),
                                OtherLocalityName   = dataRow["OtherLocalityName"].ToString(),
                                WhatsAppOnPrimaryNo = ((dataRow["WhatsAppOnPrimaryNo"] == DBNull.Value || dataRow["WhatsAppOnPrimaryNo"] == null) ? (bool?)null : Convert.ToBoolean(dataRow["WhatsAppOnPrimaryNo"])),
                                WhatsAppNo          = dataRow["WhatsAppNo"].ToString(),
                                SecondaryEmailId    = dataRow["SecondaryEmailId"].ToString(),
                                SecondaryMobileNo   = dataRow["SecondaryMobileNo"].ToString(),
                                LandlineNo          = dataRow["LandlineNo"].ToString(),

                                EmergancyContactNo1 = dataRow["EmergancyContactNo1"].ToString(),
                                EmergancyContactNo2 = dataRow["EmergancyContactNo2"].ToString(),
                                CommAddressLine1    = dataRow["CommAddressLine1"].ToString(),
                                CommAddressLine2    = dataRow["CommAddressLine2"].ToString(),
                                CommAddressLine3    = dataRow["CommAddressLine3"].ToString(),
                                CommAddressPinCode  = dataRow["CommAddressPinCode"].ToString(),

                                HasSameAsCommAddress    = ((dataRow["HasSameAsCommAddress"] == DBNull.Value || dataRow["HasSameAsCommAddress"] == null) ? (bool?)null : Convert.ToBoolean(dataRow["HasSameAsCommAddress"])),
                                PermanentAddressLine1   = dataRow["PermanentAddressLine1"].ToString(),
                                PermanentAddressLine2   = dataRow["PermanentAddressLine2"].ToString(),
                                PermanentAddressLine3   = dataRow["PermanentAddressLine3"].ToString(),
                                PermanentAddressPinCode = dataRow["PermanentAddressPinCode"].ToString(),
                            },

                            OtherDetail = new AssessorOtherDetail()
                            {
                                //refrence key data
                                AssessorId             = Convert.ToInt64(dataRow["AssessorId"]),
                                OdigoOkayStatus        = dataRow["OdigoOkayStatus"].ToString(),
                                BankName               = dataRow["BankName"].ToString(),
                                AccountNumber          = dataRow["AccountNumber"].ToString(),
                                IFSC_Code              = dataRow["IFSC_Code"].ToString(),
                                BankAddress            = dataRow["BankAddress"].ToString(),
                                HighestQualificationId = ((dataRow["HighestQualificationId"] == DBNull.Value || dataRow["HighestQualificationId"] == null) ? (int?)null : Convert.ToInt16(dataRow["HighestQualificationId"])),
                                Qualifications         = dataRow["Qualifications"].ToString(),
                            },

                            #region All other related details having mutiple records like JobRoles, PrefLocations will be get from Other DataSet by iteration

                            //get mutiple "IdProofs" details for this/current "Assessor"
                            IdProofs = GetAssessorIdProodDetails(assessorId, dbSet.Tables[1]),

                            //get mutiple "JobRoles" details for this/current "Assessor"
                            JobRoles = GetAssessorJobRoleDetails(assessorId, dbSet.Tables[2]),

                            //get mutiple "PreferredLocations" details for this/current "Assessor"
                            PreferredLocations = GetAssessorPreferredLocationDetails(assessorId, dbSet.Tables[3]),

                            #endregion

                            #endregion

                            //DB.Null should be checked before conversion
                            CreatedDate  = (dataRow["CreatedDate"] == DBNull.Value || dataRow["CreatedDate"] == null) ? (DateTime?)null : Convert.ToDateTime(dataRow["CreatedDate"]),
                            CreatedBy    = Convert.ToInt32(dataRow["CreatedBy"]),
                            ModifiedDate = (dataRow["ModifiedDate"] == DBNull.Value || dataRow["ModifiedDate"] == null) ? (DateTime?)null : Convert.ToDateTime(dataRow["ModifiedDate"]),
                            ModifiedBy   = Convert.ToInt32((dataRow["ModifiedBy"] != DBNull.Value || dataRow["ModifiedBy"] != null) ? 0 : dataRow["ModifiedBy"]),
                            IsActive     = Convert.ToBoolean((dataRow["IsActive"] == DBNull.Value || dataRow["IsActive"] == null) ? 0 : dataRow["IsActive"])
                        });
                    }
                }

                //assign fecthed list
                assessorResponse.Assessor        = listAssessors;
                assessorResponse.OperationStatus = new OperationStatus {
                    ServiceName = "GetAssessors", ServiceMethod = "Get", RequestProcessed = true, RequestSuccessful = true
                };
            }
            catch (Exception ex)
            {
                assessorResponse.OperationStatus = new OperationStatus {
                    Messages = new List <Message>()
                    {
                        new Message()
                        {
                            DTOName = "Assessor", DTOProperty = "", MessageType = MessageType.SystemError, Text = ex.Message
                        }
                    }, RequestProcessed = true, RequestSuccessful = false
                };
            }

            return(assessorResponse);
        }