public int db_insert(business bs) { SqlConnection con = new SqlConnection(str); SqlCommand cm = new SqlCommand(); cm.CommandText = "sp_instreg"; cm.CommandType = CommandType.StoredProcedure; cm.Connection = con; cm.Parameters.AddWithValue("@fn", bs.fname); cm.Parameters.AddWithValue("@ln", bs.lname); cm.Parameters.AddWithValue("@gn", bs.gender); cm.Parameters.AddWithValue("@em", bs.email); cm.Parameters.AddWithValue("@pw", bs.pwd); cm.Parameters.AddWithValue("@cp", bs.cpwd); cm.Parameters.AddWithValue("@cal", bs.cal); cm.Parameters.AddWithValue("@cl", bs.clas); cm.Parameters.AddWithValue("@strm", bs.stream); cm.Parameters.AddWithValue("@hb", bs.hobby); cm.Parameters.AddWithValue("@st", bs.state); cm.Parameters.AddWithValue("@ct", bs.city); cm.Parameters.AddWithValue("@im", bs.image); con.Open(); int p = cm.ExecuteNonQuery(); con.Close(); return(p); }
public ActionResult Edit(int?id) { ViewBag.UserID = Request.Cookies["UserID"].Value; using (Entities dc = new Entities()) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } business bus = dc.businesses.Find(id); Business viewBus = new Business() { BusName = bus.BusName, BusAddress = bus.BusAddress, BusDesc = bus.BusDesc, UserEmail = bus.UserEmail, UserPW = bus.UserPW, UserStatus = bus.UserStatus, UserID = bus.UserID, }; if (bus == null) { return(HttpNotFound()); } return(View(viewBus)); } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } business data = (business)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(business)); if (data == null) { data = ScriptableObject.CreateInstance <business> (); data.SheetName = filePath; data.WorksheetName = sheetName; AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath); //data.hideFlags = HideFlags.NotEditable; } //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<businessData>().ToArray(); //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject; //EditorUtility.SetDirty (obj); ExcelQuery query = new ExcelQuery(filePath, sheetName); if (query != null && query.IsValid()) { data.dataArray = query.Deserialize <businessData>().ToArray(); ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } } }
public void Remove(business business, string serverPath) { //Remove(business.Positions); RemoveAll(business.BusinessID); Remove(business.Zip, business.City, business.State, business.BusinessID); if ((System.IO.File.Exists(serverPath + business.Photo))) { System.IO.File.Delete(serverPath + business.Photo); } using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING)) { connection.Open(); RemoveUser(business, connection); StringBuilder sb = new StringBuilder(); sb.Append("DELETE FROM [careerfair].[business]"); sb.Append("WHERE [BusinessID] = " + business.BusinessID); String sql = sb.ToString(); using (SqlCommand command = new SqlCommand(sql, connection)) { command.CommandType = System.Data.CommandType.Text; command.ExecuteNonQuery(); } } }
public List <business> ReadAccountInfo() { List <business> businesses = new List <business>(); using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING)) { connection.Open(); StringBuilder sb = new StringBuilder(); sb.Append("SELECT [BusinessID],[Password],[Email]"); sb.Append("FROM [careerfair].[business]"); String sql = sb.ToString(); using (SqlCommand command = new SqlCommand(sql, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { business bus = new business(); bus.BusinessID = DatabaseHelper.CheckNullInt(reader, 0); bus.Email = DatabaseHelper.CheckNullString(reader, 1); businesses.Add(bus); } } } } return(businesses); }
private void AddPositions(business bus, SqlConnection connection) { StringBuilder sb = new StringBuilder(); sb.Append("SELECT [PositionID], [Name], [Description], [Website], [Internship]"); sb.Append("FROM [careerfair].[position]"); sb.Append("WHERE [careerfair].[position].[Business] = " + bus.BusinessID); String sql = sb.ToString(); using (SqlCommand command = new SqlCommand(sql, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { position pos = new position(); pos.PositionID = DatabaseHelper.CheckNullInt(reader, 0); pos.Name = DatabaseHelper.CheckNullString(reader, 1); pos.Description = DatabaseHelper.CheckNullString(reader, 2); pos.Website = DatabaseHelper.CheckNullString(reader, 3); pos.Internship = DatabaseHelper.CheckNullBool(reader, 4); bus.Positions.Add(pos); } } } }
private string BusinessToCSV(business b) { //sb.Append("BusinessID,Email,BusinessName,ListedPositions,FirstName,LastName,City,State,Street,Zip,Phone,Alumni,NonProfit,Outlet,Display,DisplayDescription,Attendees,BusinessDescription,Website,SocialMedia,LocationPreference,ContactMe,PreferEmail,Approved,Active"); //string output = b.BusinessID.ToString() + delim + b.Email.Replace(",", string.Empty) + delim + b.BusinessName.Replace(",", string.Empty) + delim + // b.Positions.Count.ToString() + delim + b.FirstName.Replace(",", string.Empty) + delim + b.LastName.Replace(",", string.Empty) + delim + // b.City.Replace(",", string.Empty) + delim + b.State.Replace(",", string.Empty) + delim + b.Street.Replace(",", string.Empty) + delim + // b.Zip.Replace(",", string.Empty) + delim + b.Phone.Replace(",", string.Empty) + delim + b.Alumni.ToString() + delim + // b.NonProfit.ToString() + delim + b.Outlet.ToString() + delim + b.Display.ToString() + delim + b.DisplayDescription.Replace(",", string.Empty) + delim + // b.Attendees.ToString() + delim + b.BusinessDescription.Replace(",", string.Empty) + delim + b.Website.Replace(",", string.Empty) + delim + // b.SocialMedia.Replace(",", string.Empty) + delim + b.LocationPreference.Replace(",", string.Empty) + delim + b.ContactMe.ToString() + delim + // b.PreferEmail.ToString() + delim + b.Approved.ToString() + delim + b.Active.ToString() + delim; string formatted = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24}", b.BusinessID.ToString(), b.Email.Replace(",", string.Empty), b.BusinessName.Replace(",", string.Empty), b.Positions.Count.ToString(), b.FirstName.Replace(",", string.Empty), b.LastName.Replace(",", string.Empty), b.City.Replace(",", string.Empty), b.State.Replace(",", string.Empty), b.Street.Replace(",", string.Empty), b.Zip.Replace(",", string.Empty), b.Phone.Replace(",", string.Empty), b.Alumni.ToString(), b.NonProfit.ToString(), b.Outlet.ToString(), b.Display.ToString(), b.DisplayDescription.Replace(",", string.Empty), b.Attendees.ToString(), b.BusinessDescription.Replace(",", string.Empty), b.Website.Replace(",", string.Empty), b.SocialMedia.Replace(",", string.Empty), b.LocationPreference.Replace(",", string.Empty), b.ContactMe.ToString(), b.PreferEmail.ToString(), b.Approved.ToString(), b.Active.ToString()); return(formatted); }
public void Insert(business business) { //business.BusinessID = NextIdValue(); //_businesses.Add(business); _ds.Insert(business); }
public int emp_insert(business bs) { SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_emp_insert"; cmd.Connection = con; cmd.Parameters.AddWithValue("@n", bs.ename); cmd.Parameters.AddWithValue("@a", bs.addr); cmd.Parameters.AddWithValue("@c", bs.city); cmd.Parameters.AddWithValue("@d", bs.deptid); cmd.Parameters.AddWithValue("@jd", bs.jdate); cmd.Parameters.AddWithValue("@bd", bs.bdate); cmd.Parameters.AddWithValue("@g", bs.gender); cmd.Parameters.AddWithValue("@is", bs.isact); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); return(i); }
public async Task <IHttpActionResult> Putbusiness(int id, business business) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != business.id) { return(BadRequest()); } db.Entry(business).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!businessExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static bool CnpjBusinessIsUnique(business c) { try { string s = MonoCTeRepo.GetInstance().ExecuteScalar <string> ("SELECT COUNT(id) FROM business WHERE cnpj=@0", c.cnpj); int count; if (s.Equals(DBNull.Value) || String.IsNullOrEmpty(s)) { count = 0; } else { count = Convert.ToInt32(s); } if (count == 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
public ActionResult GetSearchUserType(int id, bool isApplicant) { ApplicantRepository ar = null; BusinessRepository br = null; applicant applicant = null; business business = null; if (isApplicant) { ar = new ApplicantRepository(); br = new BusinessRepository(); applicant = ar.SelectOne(id); } else { br = new BusinessRepository(); business = br.SelectOne(id); } if (applicant != null && User.IsInRole("Business") && (br.CheckApproved(User.Identity.GetUserName()) || User.IsInRole("Admin"))) { return(ApplicantViewProfile(ar.ToViewModel(applicant), null)); } else if (business != null && User.IsInRole("Applicant")) { return(BusinessSearchViewProfile(br.ToViewModel(business))); } else { return(View("Error")); } }
public BusinessViewModel ToViewModel(business b) { return(new BusinessViewModel { BusinessID = b.BusinessID, Email = b.Email, BusinessName = b.BusinessName, FirstName = b.FirstName, LastName = b.LastName, Street = b.Street, City = b.City, State = b.State, Zip = b.Zip, Phone = b.Phone, Alumni = b.Alumni, NonProfit = b.NonProfit, Outlet = b.Outlet, Display = b.Display, DisplayDescription = b.DisplayDescription, Attendees = b.Attendees, BusinessDescription = b.BusinessDescription, Website = b.Website, SocialMedia = b.SocialMedia, Photo = b.Photo, LocationPreference = b.LocationPreference, ContactMe = b.ContactMe, PreferEmail = b.PreferEmail, Approved = b.Approved, Active = b.Active, Fields = b.Fields, Positions = b.Positions }); }
public void showInfoBusiness() { Thread.Sleep(700); business b = Singleton.getCurrentBusiness(); string infoB = String.Format("Emitente: {0}-{1} CNPJ: {2} IE: {3}", b.id, b.corporate_name, b.cnpj, b.ie); lbBusinessInfo.Caption = infoB; }
public void db_delete(business bs) { //int i = bs.id; //var p = (from n in dc.tbl_regs where n.id == i select n).FirstOrDefault(); //dc.tbl_regs.DeleteOnSubmit(p); //dc.SubmitChanges(); dc.sp_delete_linq(bs.id); }
private void btnEdit_Click(object sender, EventArgs e) { business b = ((business)bdgBusiness.Current); if (b != null) { showBusinessForm(b); } }
public static string fn_del_bin(string binid) { DataSet ds = new DataSet(); business ob = new business(); connections con = new connections(); ds = con.FN_ExecuteQuerySingle("update Mst_Bin_Collection set status='D' where binid='" + binid + "'"); return("0"); }
/// business to show public static TurnInBusinessDTO GetSmallBusinessDTO(business business) { TurnInBusinessDTO businessDTO = new TurnInBusinessDTO() { BusinessName = business.businessName, Address = business.adress_city + " " + business.adress_street + " " + business.adress_numOfStreet, }; return(businessDTO); }
public BusinessViewModel SelectOneAsViewModel(int id) { business bus = SelectOne(id); BusinessViewModel selectedBusiness = ToViewModel(bus); GetAccountInfoByUserID(selectedBusiness); return(selectedBusiness); }
public IHttpActionResult Post(business business) { bool isSave = businessService.SaveBusiness(business); if (isSave == true) { return(Ok()); } return(BadRequest()); }
public IHttpActionResult Put(business business) { bool isUpdated = businessService.UpdateBusiness(business.busid, business); if (isUpdated == true) { return(Ok()); } return(BadRequest()); }
private void showBusinessForm(business b) { BusinessForm bf = new BusinessForm(b); DialogResult rs = bf.ShowDialog(); if (rs == DialogResult.OK) { search(); } }
private void InitBusiness(SqlConnection connection, List <business> businesses, int startRow, int numberOfRows) { StringBuilder sb = new StringBuilder(); sb.Append("SELECT [BusinessID],[Email],[BusinessName],[FirstName],[LastName],[Street],[Phone],[Alumni],[NonProfit],[Outlet],[Display],[DisplayDescription],[Attendees],[BusinessDescription],[Website],[SocialMedia],[Photo],[LocationPreference],[ContactMe],[Approved],[Active],[PreferEmail]"); sb.Append("FROM [careerfair].[business]"); if (startRow >= 0) { sb.Append("ORDER BY [BusinessID] ASC OFFSET " + startRow + " ROWS FETCH NEXT " + numberOfRows + " ROWS ONLY;"); } String sql = sb.ToString(); using (SqlCommand command = new SqlCommand(sql, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { business bus = new business(); bus.BusinessID = DatabaseHelper.CheckNullInt(reader, 0); bus.Email = DatabaseHelper.CheckNullString(reader, 1); bus.BusinessName = DatabaseHelper.CheckNullString(reader, 2); bus.FirstName = DatabaseHelper.CheckNullString(reader, 3); bus.LastName = DatabaseHelper.CheckNullString(reader, 4); bus.Street = DatabaseHelper.CheckNullString(reader, 5); bus.Phone = DatabaseHelper.CheckNullString(reader, 6); bus.Alumni = DatabaseHelper.CheckNullBool(reader, 7); bus.NonProfit = DatabaseHelper.CheckNullBool(reader, 8); bus.Outlet = DatabaseHelper.CheckNullBool(reader, 9); bus.Display = DatabaseHelper.CheckNullBool(reader, 10); bus.DisplayDescription = DatabaseHelper.CheckNullString(reader, 11); bus.Attendees = DatabaseHelper.CheckNullByte(reader, 12); bus.BusinessDescription = DatabaseHelper.CheckNullString(reader, 13); bus.Website = DatabaseHelper.CheckNullString(reader, 14); bus.SocialMedia = DatabaseHelper.CheckNullString(reader, 15); bus.Photo = DatabaseHelper.CheckNullString(reader, 16); bus.LocationPreference = DatabaseHelper.CheckNullString(reader, 17); bus.ContactMe = DatabaseHelper.CheckNullBool(reader, 18); bus.Approved = DatabaseHelper.CheckNullBool(reader, 19); bus.Active = DatabaseHelper.CheckNullBool(reader, 20); bus.PreferEmail = DatabaseHelper.CheckNullBool(reader, 21); businesses.Add(bus); } } foreach (business b in businesses) { AddFields(b, connection); AddPositions(b, connection); AddZip(b, connection); } } }
public async Task <IHttpActionResult> Getbusiness(int id) { business business = await db.businesses.FindAsync(id); if (business == null) { return(NotFound()); } return(Ok(business)); }
public void UpdateBusinessProfile(business business, string serverPath) { var oldBusiness = SelectOne(business.BusinessID); if (oldBusiness != null) { //_businesses.Remove(oldBusiness); //_businesses.Add(business); _ds.UpdateBusinessProfile(business, serverPath, oldBusiness.Photo); } }
public business Read(string email) { business business = null; using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING)) { connection.Open(); StringBuilder sb = new StringBuilder(); sb.Append("SELECT [BusinessID],[Email],[BusinessName],[FirstName],[LastName],[Street],[Phone],[Alumni],[NonProfit],[Outlet],[Display],[DisplayDescription],[Attendees],[BusinessDescription],[Website],[SocialMedia],[Photo],[LocationPreference],[ContactMe],[Approved],[Active],[PreferEmail]"); sb.Append("FROM [careerfair].[business]"); sb.Append("WHERE [Email] = '" + email + "'"); String sql = sb.ToString(); using (SqlCommand command = new SqlCommand(sql, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { business = new business(); business.BusinessID = DatabaseHelper.CheckNullInt(reader, 0); business.Email = DatabaseHelper.CheckNullString(reader, 1); business.BusinessName = DatabaseHelper.CheckNullString(reader, 2); business.FirstName = DatabaseHelper.CheckNullString(reader, 3); business.LastName = DatabaseHelper.CheckNullString(reader, 4); business.Street = DatabaseHelper.CheckNullString(reader, 5); business.Phone = DatabaseHelper.CheckNullString(reader, 6); business.Alumni = DatabaseHelper.CheckNullBool(reader, 7); business.NonProfit = DatabaseHelper.CheckNullBool(reader, 8); business.Outlet = DatabaseHelper.CheckNullBool(reader, 9); business.Display = DatabaseHelper.CheckNullBool(reader, 10); business.DisplayDescription = DatabaseHelper.CheckNullString(reader, 11); business.Attendees = DatabaseHelper.CheckNullByte(reader, 12); business.BusinessDescription = DatabaseHelper.CheckNullString(reader, 13); business.Website = DatabaseHelper.CheckNullString(reader, 14); business.SocialMedia = DatabaseHelper.CheckNullString(reader, 15); business.Photo = DatabaseHelper.CheckNullString(reader, 16); business.LocationPreference = DatabaseHelper.CheckNullString(reader, 17); business.ContactMe = DatabaseHelper.CheckNullBool(reader, 18); business.Approved = DatabaseHelper.CheckNullBool(reader, 19); business.Active = DatabaseHelper.CheckNullBool(reader, 20); business.PreferEmail = DatabaseHelper.CheckNullBool(reader, 21); } } AddFields(business, connection); AddPositions(business, connection); AddZip(business, connection); } } return(business); }
public void db_insert(business bs) { // tbl_reg tr = new tbl_reg(); // tr.fname = bs.fname; // tr.lname = bs.lname; // dc.tbl_regs.InsertOnSubmit(tr); // dc.SubmitChanges(); dc.sp_insert_linq(bs.fname, bs.lname); }
public void db_update(business bs) { //int i = bs.id; //var p = (from n in dc.tbl_regs where n.id == i select n).FirstOrDefault(); //p.fname = bs.fname; //p.lname = bs.lname; //dc.SubmitChanges(); dc.sp_update_linq(bs.id, bs.fname, bs.lname); }
public static string update_route(string id, string lat, string lon, string routeid) { DataSet ds = new DataSet(); business ob = new business(); ds = ob.fn_update_route_for_bin(id, lat, lon, routeid); return("Route Updated Successfully"); }
public ActionResult DeletePosition(int id) { TechCareerFair.DAL.PositionDAL.PositionRepository pr = new DAL.PositionDAL.PositionRepository(); position position = pr.SelectOne(id); BusinessRepository br = new BusinessRepository(); business bus = br.SelectOne(position.Business); ViewBag.Business = bus.BusinessName; return(View(position)); }
public static void setCurrentBusiness(business b) { currentBusiness = b; }