public static void LogActivity(String message, string PageName) { try { if (HttpContext.Current.Session["sessionid"] == null) { HttpContext.Current.Session["sessionid"] = HttpContext.Current.Session.SessionID + DateTime.Now.Ticks.ToString(); } String connstring = Connection.GetConnectionString(); string session = string.Empty; using (SqlConnection conn = new SqlConnection(connstring)) { conn.Open(); String query = "INSERT INTO dbo.ActivityLog (Timestamp, Session, IP, Browser, Device, Message,PageName) VALUES (@Timestamp, @Session, @IP, @Browser, @Device, @Message,@PageName)"; using (SqlCommand cmd = new SqlCommand(query, conn)) { cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@Timestamp", DateTime.UtcNow); cmd.Parameters.AddWithValue("@Session", HttpContext.Current.Session["sessionid"]); cmd.Parameters.AddWithValue("@IP", HttpContext.Current.Request.UserHostAddress); cmd.Parameters.AddWithValue("@Browser", HttpContext.Current.Request.Browser.Browser); cmd.Parameters.AddWithValue("@Device", HttpContext.Current.Request.Browser.Platform); cmd.Parameters.AddWithValue("@Message", message); cmd.Parameters.AddWithValue("@PageName", PageName); cmd.ExecuteNonQuery(); } conn.Close(); } } catch (Exception ex) { DALError.LogError("Utility.LogActivity", ex); } }
public static DataSet CandidateData() { DataSet ds = new DataSet(); try { String sql_select = String.Format("Select ISNULL(QUALIFICATION,'') +' '+ISNULL(EXPERIANCE,'') +' '+ISNULL(INTEREST,'') as PerKeyword, EMAIL,NAME from PERSON"); String connstring = Connection.GetConnectionString(); SqlDataAdapter adpt = new SqlDataAdapter(sql_select, connstring); adpt.Fill(ds); } catch (Exception ex) { DALError.LogError("Utility.CandidateData", ex); } return(ds); }
public static string Decrypt(string cipherString) { string ret_str = cipherString.TrimEnd(); try { byte[] keyArray; byte[] toEncryptArray = Convert.FromBase64String(cipherString.TrimEnd()); string key = "drashtajinfotech@Job2019"; keyArray = UTF8Encoding.UTF8.GetBytes(key); TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider(); tdes.Key = keyArray; tdes.Mode = CipherMode.ECB; tdes.Padding = PaddingMode.PKCS7; ICryptoTransform cTransform = tdes.CreateDecryptor(); byte[] resultArray = cTransform.TransformFinalBlock( toEncryptArray, 0, toEncryptArray.Length); tdes.Clear(); ret_str = UTF8Encoding.UTF8.GetString(resultArray); } catch (Exception ex) { DALError.LogError("PortalEncryption.Decrypt", ex); } return(ret_str); }
public static List <int> SaveJobDetails(Job JobDetails) { String connstring = Connection.GetConnectionString(); List <int> ret = new List <int>(); int status = 0; Int32 JobNumber = JobDetails.JobNo; using (SqlConnection dbCon = new SqlConnection(connstring)) { dbCon.Open(); JobNumber = SaveJobInfo(JobDetails); status = 1; if (JobDetails.JobNotes != null) { if (JobDetails.JobNotes.Count > 0) { foreach (var item in JobDetails.JobNotes) { using (SqlCommand dbCom = new SqlCommand(StoredProcedure.USP_JOBIMNOTES_INSERTIMNOTES, dbCon)) { dbCom.CommandType = CommandType.StoredProcedure; try { dbCom.Parameters.AddWithValue("@JobNumber", JobNumber); dbCom.Parameters.AddWithValue("@STR_TITLE", item.Title); dbCom.Parameters.AddWithValue("@DT_UPLODEDDATE", DateTime.UtcNow); dbCom.Parameters.AddWithValue("@STR_DOWNLOADLINK", item.DownloadLink); dbCom.Parameters.AddWithValue("@STR_UPLODEDBY", System.Web.HttpContext.Current.User.Identity.Name.ToString()); dbCom.Parameters.AddWithValue("@INT_INSERT", item.DBOP); dbCom.Parameters.AddWithValue("Id", item.Id); dbCom.ExecuteNonQuery(); status = 2; } catch (Exception ex) { DALError.LogError("Job.SaveJobDetails-SaveImpNotes", ex); } } } } } else { status = 2; } if (JobDetails.JobImpDates != null) { if (JobDetails.JobImpDates.Count > 0) { foreach (var item in JobDetails.JobImpDates) { using (SqlCommand dbCom = new SqlCommand(StoredProcedure.USP_JOBEVENTDATETIME_INSERTJOBDETAILS, dbCon)) { try { dbCom.CommandType = CommandType.StoredProcedure; dbCom.Parameters.AddWithValue(JobEvents, item.Events); dbCom.Parameters.AddWithValue(JobEventsDT, item.EventDateTime); dbCom.Parameters.AddWithValue(InsertCondition, item.DBOP); dbCom.Parameters.AddWithValue(JobNum, JobNumber); dbCom.Parameters.AddWithValue("Id", item.Id); dbCom.ExecuteNonQuery(); status = status + 1; if (status < 3) { status = 4; } } catch (Exception ex) { DALError.LogError("Job.SaveJobDetails-SaveImpDates", ex); } } } var JobImpDatesCount = JobDetails.JobImpDates.Count + 2; if (status == JobImpDatesCount) { status = 3; } } } else { status = status + 1; if (status < 3) { status = 4; } } } ret.Add(status); ret.Add(JobNumber); return(ret); }