Beispiel #1
0
        public string OpeningsOper(int openingId, string Attachments, string Certification, string City, string ContractPeriod, string Country, string CTC,
                                   string Domain, string ExperienceRequired, int FKDepartment, int FKManager, int FKRecruiter, string Role,
                                   string Industry, string JobDescription, int JobOpeningStatus, string JobTitle, string JobType, int NOOfVacancy,
                                   string Skills, string State, string Technologies, int CreatedEmpID, int ModifiedEmpID, int Status,
                                   DateTime CreatedDate, DateTime ModifiedDate, DateTime EndDate, DateTime StartDate, int FKCompanyId, int Operation)
        {
            SqlConnection          con            = new SqlConnection();
            NuPortalRequestService requestService = new NuPortalRequestService();

            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                connection           = ConfigurationManager.ConnectionStrings[Constants.connection].ConnectionString;
                con.ConnectionString = connection;
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = RecruitmentConstants.UspOpenings;
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramAttachments, Attachments);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramCertification, Certification);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamCity, City);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramContractPeriod, ContractPeriod);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamCountry, Country);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramCTC, CTC);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramDomain, Domain);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamExperienceRequired, ExperienceRequired);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamFKDepartment, FKDepartment);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramFKManager, FKManager);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamFKRecruiter, FKRecruiter);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamFKRoleId, Role);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramIndustry, Industry);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramDescription, JobDescription);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramJobOpeningStatus, JobOpeningStatus);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramJobTitle, JobTitle);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamJobType, JobType);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramNOOfVacancy, NOOfVacancy);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamopeningId, openingId);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramSkills, Skills);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramState, State);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamTechnologies, Technologies);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamCreatedEmpID, CreatedEmpID);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramModifiedEmpID, ModifiedEmpID);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamCreatedDate, CreatedDate);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamModifiedDate, ModifiedDate);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramEndDate, EndDate);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramStartDate, StartDate);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamFKCompanyId, FKCompanyId);
                cmd.Parameters.AddWithValue(RecruitmentConstants.ParamStatus, Status);
                cmd.Parameters.AddWithValue(RecruitmentConstants.paramOperation, Operation);

                IDataReader dataReader = cmd.ExecuteReader();
                if (Operation == 1)
                {
                    if (requestService.SendEmail(dataReader, 9, false))
                    {
                        return(JsonConvert.SerializeObject("{\"OpeningId\" : 1}", Formatting.Indented));
                    }
                    else
                    {
                        return("");
                    }
                }
                else
                {
                    DataTable dataTable = new DataTable();
                    dataTable.Load(dataReader);
                    if (dataTable.Rows.Count > 0)
                    {
                        return(JsonConvert.SerializeObject(dataTable, Formatting.Indented));
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception ex)
            {
                return("");
            }
            finally
            {
                con.Close();
            }
        }
        public string SelectEmployeeInfo(int Id, int Operation)
        {
            SqlConnection          con            = new SqlConnection();
            NuPortalRequestService requestService = new NuPortalRequestService();

            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                con                  = new SqlConnection();
                connection           = ConfigurationManager.ConnectionStrings[Constants.connection].ConnectionString;
                con.ConnectionString = connection;
                SqlCommand cmd = new SqlCommand();
                cmd.Connection     = con;
                cmd.CommandText    = Constants.EmployeeOperation;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 300;
                con.Open();
                cmd.Parameters.AddWithValue(Constants.paramId, Id);
                cmd.Parameters.AddWithValue(Constants.paramOperId, Operation);

                var dataReader = cmd.ExecuteReader();
                if (Operation == 37)
                {
                    if (requestService.SendEmail(dataReader, 8, false))
                    {
                        return(JsonConvert.SerializeObject("{\"EventId\" : 1}", Formatting.Indented));
                    }
                    else
                    {
                        return("");
                    }
                }
                else
                {
                    DataTable dataTable = new DataTable(Constants.ddlTable);
                    dataTable.Load(dataReader);
                    if (dataTable.Rows.Count > 0)
                    {
                        List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
                        Dictionary <string, object>         row;
                        foreach (DataRow dr in dataTable.Rows)
                        {
                            row = new Dictionary <string, object>();
                            foreach (DataColumn col in dataTable.Columns)
                            {
                                row.Add(col.ColumnName, dr[col]);
                            }
                            rows.Add(row);
                        }
                        return(serializer.Serialize(rows));
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { con.Close(); }
        }
        public string AnnouncementOrEventsOper(int Id, string Attachments, int createdEmpId, string Description, DateTime EndDate, int CompanyId,
                                               int ModifiedEmpID, DateTime StartDate, int Status, string Title, string StartTime, string EndTime,
                                               int Operation)
        {
            SqlConnection          con            = new SqlConnection();
            bool                   result         = false;
            NuPortalRequestService requestService = new NuPortalRequestService();

            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                connection           = ConfigurationManager.ConnectionStrings[Constants.connection].ConnectionString;
                con.ConnectionString = connection;
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = HRConstants.UspSaveAnnOrEvents;
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                cmd.Parameters.AddWithValue(HRConstants.paramId, Id);
                cmd.Parameters.AddWithValue(HRConstants.paramAttachments, Attachments);
                cmd.Parameters.AddWithValue(HRConstants.ParamCreatedEmpID, createdEmpId);
                cmd.Parameters.AddWithValue(HRConstants.paramDescription, Description);
                cmd.Parameters.AddWithValue(HRConstants.ParamEndDate, EndDate);
                cmd.Parameters.AddWithValue(HRConstants.paramCompanyId, CompanyId);
                cmd.Parameters.AddWithValue(HRConstants.paramModifiedEmpId, ModifiedEmpID);
                cmd.Parameters.AddWithValue(HRConstants.ParamStartDate, StartDate);
                cmd.Parameters.AddWithValue(HRConstants.ParamStatus, Status);
                cmd.Parameters.AddWithValue(HRConstants.paramTitle, Title);
                cmd.Parameters.AddWithValue(HRConstants.ParamStartTime, StartTime);
                cmd.Parameters.AddWithValue(HRConstants.ParamEndTime, EndTime);
                cmd.Parameters.AddWithValue(HRConstants.paramOperation, Operation);

                IDataReader dataReader = cmd.ExecuteReader();
                if (Operation == 1 || Operation == 2 || Operation == 4)
                {
                    if (Operation == 1)
                    {
                        result = requestService.SendEmail(dataReader, 5, false);
                    }
                    else if (Operation == 2)
                    {
                        result = requestService.SendEmail(dataReader, 6, false);
                    }
                    else if (Operation == 4)
                    {
                        result = requestService.SendEmail(dataReader, 7, false);
                    }
                    if (result)
                    {
                        return(JsonConvert.SerializeObject("{\"AnnouncementId\" : 1}", Formatting.Indented));
                    }
                    else
                    {
                        return("");
                    }
                }
                else
                {
                    DataTable dataTable = new DataTable();
                    dataTable.Load(dataReader);
                    if (dataTable.Rows.Count > 0)
                    {
                        return(JsonConvert.SerializeObject(dataTable, Formatting.Indented));
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception ex)
            {
                return("");
            }
            finally
            {
                con.Close();
            }
        }