public List <State_info> GetState() { SqlConnection conn = new SqlConnection(AppSettingConnectionString.GetConnectionString("entity")); SqlCommand cmd = new SqlCommand("spGetState", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; conn.Open(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); conn.Close(); da.Dispose(); List <State_info> ct = new List <State_info>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { State_info cnt = new State_info(); cnt.State_Id = Convert.ToInt32(row["State_Id"].ToString()); cnt.State_Name = row["State_name"].ToString(); ct.Add(cnt); } } return(ct); }
public bool Uploadfile(Guid uploadid, string Fname, Guid createby, string createon, string ftype, int fsize, string fpath, Guid userrefid, bool isvalid) { SqlConnection conn = new SqlConnection(AppSettingConnectionString.GetConnectionString("entity")); SqlCommand cmd = new SqlCommand("spUpload", conn); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); cmd.Parameters.AddWithValue("@UploadId", uploadid); cmd.Parameters.AddWithValue("@File_name", Fname); cmd.Parameters.AddWithValue("@File_type", ftype); cmd.Parameters.AddWithValue("@File_size", fsize); cmd.Parameters.AddWithValue("@File_path", fpath); cmd.Parameters.AddWithValue("@IsActive", isvalid); cmd.Parameters.AddWithValue("@CreatedBy", createby); cmd.Parameters.AddWithValue("@CreatedOn", createon); cmd.Parameters.AddWithValue("@Userid", userrefid); cmd.ExecuteScalar(); //conn.Close(); return(true); }
public List <Employee_Master> GetData() { SqlConnection conn = new SqlConnection(AppSettingConnectionString.GetConnectionString("entity")); SqlCommand cmd = new SqlCommand("spSelectEmployee", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; conn.Open(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); conn.Close(); da.Dispose(); List <Employee_Master> emp = new List <Employee_Master>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { Employee_Master emp2 = new Employee_Master(); emp2.EmpId = Convert.ToInt32(row["EmpId"].ToString()); emp2.Name = row["Name"].ToString(); emp2.Phone = row["Phone"].ToString(); emp2.Date_Of_Birth = Convert.ToDateTime(row["Date_Of_Birth"].ToString()); emp2.Address = row["Address"].ToString(); emp2.EmailId = row["EmailId"].ToString(); emp2.Country = Convert.ToInt32(row["Country"].ToString()); emp2.State = Convert.ToInt32(row["State"].ToString()); emp2.City = Convert.ToInt32(row["City"].ToString()); emp.Add(emp2); } } return(emp); }