public clsTransferHistory GetTransferHistoryById(int id) { clsTransferHistory info = new clsTransferHistory(); try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_GetTransferHistoryByID")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@ID", id); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows == false) { info = null; } while (reader.Read()) { info = new clsTransferHistory(); info.intID = Convert.ToInt32(reader["ID"].ToString()); info.strRegistrationNo = reader["RegistrationNo"].ToString(); info.strTransferFromID = reader["TransferFromID"].ToString(); info.strTransferToID = reader["TransferToID"].ToString(); info.dtTransferDate = Convert.ToDateTime(reader["TransferDate"]); info.strName = reader["Name"].ToString(); info.strFatherOrHusbandType = reader["FatherOrHusbandType"].ToString(); info.strFatherOrHusband = reader["FatherOrHusbandName"].ToString(); info.strNIDOrCNIC = reader["CNIC"].ToString(); info.strNationality = reader["Nationality"].ToString(); info.dtDOB = Convert.ToDateTime(reader["DOB"].ToString()); info.strCurrentAddress1 = reader["CurrentAddress1"].ToString(); info.strCurrentAddress2 = reader["CurrentAddress2"].ToString(); info.strCurrentAddress3 = reader["CurrentAddress3"].ToString(); info.strCountry = reader["Country"].ToString(); info.strCity = reader["City"].ToString(); info.strPhOff = reader["PhOff"].ToString(); info.strRes = reader["Res"].ToString(); info.strMob = reader["Mob"].ToString(); //info.strFax = reader["Fax"].ToString(); info.strEmailAddress = reader["EmailAddress"].ToString(); info.ApprovalStatusCode = Convert.ToInt32(reader["ApprovalStatusCode"].ToString()); info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString(); info.ApprovalActionUser = reader["ApprovalActionUser"].ToString(); info.ApprovalStatusCode = Convert.ToInt32(reader["ApprovalStatusCode"].ToString()); info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString(); info.ApprovalActionUser = reader["ApprovalActionUser"].ToString(); info.ApprovalActionDate = Convert.ToDateTime(reader["ApprovalActionDate"]); info.CreatedBy = reader["CreatedBy"].ToString(); info.CreationDate = Convert.ToDateTime(reader["CreationDate"].ToString()); info.LastUpdateUser = reader["LastUpdateUser"].ToString(); info.LastUpdateDate = Convert.ToDateTime(reader["LastUpdateDate"]); } conn.Close(); } } } catch (Exception exc) { info = null; } finally { } return(info); }
public List <clsTransferHistory> GetAllTransferHistoryList(clsDocumentFilter clsdoc) { List <clsTransferHistory> lst = new List <clsTransferHistory>(); using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("TMR_USP_GetAllTransferHistory")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@RegistrationNo", clsdoc.strRegistrationNo); cmd.Parameters.AddWithValue("@ProjectID", clsdoc.strProjectID); cmd.Parameters.AddWithValue("@TransferFromID", clsdoc.strClientID); cmd.Parameters.AddWithValue("@TransferToID", clsdoc.strToClientID); cmd.Parameters.AddWithValue("@StartDate", clsdoc.dateStartDate); cmd.Parameters.AddWithValue("@EndDate", clsdoc.dateEndDate); cmd.Parameters.AddWithValue("@ApprovalStatusCode", clsdoc.intApprovalStatusCode); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var info = new clsTransferHistory(); info.intID = Convert.ToInt32(reader["ID"].ToString()); info.strRegistrationNo = reader["RegistrationNo"].ToString(); info.strTransferFromID = reader["TransferFromID"].ToString(); info.strTransferToID = reader["TransferToID"].ToString(); info.dtTransferDate = Convert.ToDateTime(reader["TransferDate"]); info.ApprovalStatusCode = Convert.ToInt32(reader["ApprovalStatusCode"].ToString()); info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString(); info.ApprovalActionUser = reader["ApprovalActionUser"].ToString(); info.ApprovalStatusCode = Convert.ToInt32(reader["ApprovalStatusCode"].ToString()); info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString(); info.ApprovalActionUser = reader["ApprovalActionUser"].ToString(); info.ApprovalActionDate = Convert.ToDateTime(reader["ApprovalActionDate"]); info.CreatedBy = reader["CreatedBy"].ToString(); info.CreationDate = Convert.ToDateTime(reader["CreationDate"].ToString()); info.LastUpdateUser = reader["LastUpdateUser"].ToString(); info.LastUpdateDate = Convert.ToDateTime(reader["LastUpdateDate"]); info.strName = reader["Name"].ToString(); info.strFatherOrHusbandType = reader["FatherOrHusbandType"].ToString(); info.strFatherOrHusband = reader["FatherOrHusbandName"].ToString(); info.strNIDOrCNIC = reader["CNIC"].ToString(); info.strNationality = reader["Nationality"].ToString(); info.dtDOB = Convert.ToDateTime(reader["DOB"].ToString()); info.strCurrentAddress1 = reader["CurrentAddress1"].ToString(); info.strCurrentAddress2 = reader["CurrentAddress2"].ToString(); info.strCurrentAddress3 = reader["CurrentAddress3"].ToString(); info.strCountry = reader["Country"].ToString(); info.strCity = reader["City"].ToString(); info.strPhOff = reader["PhOff"].ToString(); info.strRes = reader["Res"].ToString(); info.strMob = reader["Mob"].ToString(); info.strEmailAddress = reader["EmailAddress"].ToString(); lst.Add(info); } conn.Close(); } } return(lst); }
public bool AddTransferHistory(clsTransferHistory info, ref int id) { int st = 0; try { using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); { using (SqlCommand cmd = new SqlCommand("TMR_USP_AddTransferHistory")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.AddWithValue("@RegistrationNo", info.strRegistrationNo); cmd.Parameters.AddWithValue("@TransferFromID", info.strTransferFromID); cmd.Parameters.AddWithValue("@TransferToID", info.strTransferToID); cmd.Parameters.AddWithValue("@TransferDate", info.dtTransferDate); cmd.Parameters.AddWithValue("@Name", info.strName); cmd.Parameters.AddWithValue("@FatherOrHusbandType", info.strFatherOrHusbandType); cmd.Parameters.AddWithValue("@FatherOrHusbandName", info.strFatherOrHusband); cmd.Parameters.AddWithValue("@CNIC", info.strNIDOrCNIC); cmd.Parameters.AddWithValue("@Nationality", info.strNationality); cmd.Parameters.AddWithValue("@DOB", info.dtDOB); cmd.Parameters.AddWithValue("@CurrentAddress1", info.strCurrentAddress1); cmd.Parameters.AddWithValue("@CurrentAddress2", info.strCurrentAddress2); cmd.Parameters.AddWithValue("@CurrentAddress3", info.strCurrentAddress3); cmd.Parameters.AddWithValue("@Country", info.strCountry); cmd.Parameters.AddWithValue("@City", info.strCity); cmd.Parameters.AddWithValue("@PhOff", info.strPhOff); cmd.Parameters.AddWithValue("@Res", info.strRes); cmd.Parameters.AddWithValue("@Mob", info.strMob); cmd.Parameters.AddWithValue("@EmailAddress", info.strEmailAddress); cmd.Parameters.AddWithValue("@ApprovalStatusCode", info.ApprovalStatusCode); cmd.Parameters.AddWithValue("@ApprovalActionUser", info.ApprovalActionUser); cmd.Parameters.AddWithValue("@ApprovalActionDate", info.ApprovalActionDate); cmd.Parameters.AddWithValue("@CreatedBy", info.CreatedBy); cmd.Parameters.AddWithValue("@CreationDate", info.CreationDate); cmd.Parameters.AddWithValue("@LastUpdateUser", info.LastUpdateUser); cmd.Parameters.AddWithValue("@LastUpdateDate", info.LastUpdateDate); cmd.Parameters.AddWithValue("@ID", info.intID); SqlParameter parm = new SqlParameter(); parm.ParameterName = "@Outid"; parm.SqlDbType = SqlDbType.Int; parm.Direction = ParameterDirection.Output; //parm.Value = info.id; cmd.Parameters.Add(parm); st = cmd.ExecuteNonQuery(); id = (int)parm.Value; } } conn.Close(); } } catch (Exception ex) { } if (st > 0) { return(true); } else { return(false); } }