public ActionResult JobDetails(int id = 0) { WalkInInfo wi = GetWalkIns().Where(w => w.id == id).FirstOrDefault(); new DataContext().updatejobviews(id); return(View(wi)); }
public int savewalkin(WalkInInfo wi) { Location loc = new Location() { CityName = wi.location.CityName, CountryName = wi.location.CountryName }; int lid = savelocation(loc); loc.id = lid; CompanyInfo cinfo = new CompanyInfo() { CompanyName = wi.companyinfo.CompanyName, Email = wi.companyinfo.Email, Phone = wi.companyinfo.Phone }; int cid = savecompanyinfo(cinfo); cinfo.id = cid; WalkInInfo winfo = new WalkInInfo() { companyinfo = cinfo, location = loc, venue = wi.venue, dtfrom = wi.dtfrom, dtto = wi.dtto, timefrom = wi.timefrom, timeto = wi.timeto, jobtitle = wi.jobtitle, jobdescription = wi.jobdescription, salary = wi.salary, experience = wi.experience, contactperson = wi.contactperson, createdon = DateTime.Now }; int wid = savewalkininfo(winfo); return(wid); }
public string savewinfo(WalkInInfo wi) { var query = "INSERT INTO walkdrum.wiinfo" + "(companyinfo," + "location," + "jobtitle," + "jobdescription," + "salary," + "experience," + "venue," + "datefrom," + "dateto," + "timefrom," + "timeto," + "contactperson," + "createdon)" + "VALUES" + "(" + "'" + wi.companyinfo.id + "'," + "'" + wi.location.id + "'," + "'" + wi.jobtitle + "'," + "'" + wi.jobdescription + "'," + "'" + wi.salary + "'," + "'" + wi.experience + "'," + "'" + wi.venue + "'," + "'" + wi.dtfrom.ToString("yyyy-MM-dd") + "'," + "'" + wi.dtto.ToString("yyyy-MM-dd") + "'," + "'" + wi.timefrom.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'" + wi.timeto.ToString("yyyy-MM-dd HH:mm:ss") + "'," + "'" + wi.contactperson + "'," + "'" + wi.createdon.ToString("yyyy-MM-dd HH:mm:ss") + "'" + ");"; return(query); }
public ActionResult addwalkin(WalkInInfo wi) { if (Request.HttpMethod == "POST") { if (String.IsNullOrEmpty(wi.jobtitle)) { ViewBag.elementid = "jobtitle"; ViewBag.invalidfield = "jobtitle"; } else if (String.IsNullOrEmpty(wi.jobdescription)) { ViewBag.elementid = "jobdescription"; ViewBag.invalidfield = "jobdescription"; } else if (String.IsNullOrEmpty(wi.salary)) { ViewBag.elementid = "salary"; ViewBag.invalidfield = "salary"; } else if (String.IsNullOrEmpty(wi.experience)) { ViewBag.elementid = "experience"; ViewBag.invalidfield = "experience"; } else if (String.IsNullOrEmpty(wi.companyinfo.CompanyName)) { ViewBag.elementid = "companyinfo_CompanyName"; ViewBag.invalidfield = "CompanyName"; } else if (String.IsNullOrEmpty(wi.companyinfo.Email)) { ViewBag.elementid = "companyinfo_Email"; ViewBag.invalidfield = "Email"; } else if (String.IsNullOrEmpty(wi.companyinfo.Phone)) { ViewBag.elementid = "companyinfo_Phone"; ViewBag.invalidfield = "Phone"; } else if (String.IsNullOrEmpty(wi.dtfrom.ToString())) { ViewBag.elementid = "dtfrom"; ViewBag.invalidfield = "dtfrom"; } else if (String.IsNullOrEmpty(wi.dtto.ToString())) { ViewBag.elementid = "dtto"; ViewBag.invalidfield = "dtto"; } else if (String.IsNullOrEmpty(wi.timefrom.ToString())) { ViewBag.elementid = "timefrom"; ViewBag.invalidfield = "timefrom"; } else if (String.IsNullOrEmpty(wi.timeto.ToString())) { ViewBag.elementid = "timeto"; ViewBag.invalidfield = "timeto"; } else if (String.IsNullOrEmpty(wi.venue)) { ViewBag.elementid = "venue"; ViewBag.invalidfield = "venue"; } else if (String.IsNullOrEmpty(wi.location.CountryName)) { ViewBag.elementid = "location_CountryName"; ViewBag.invalidfield = "CountryName"; } else if (String.IsNullOrEmpty(wi.location.CityName)) { ViewBag.elementid = "location_CityName"; ViewBag.invalidfield = "CityName"; } else if (String.IsNullOrEmpty(wi.contactperson)) { ViewBag.elementid = "contactperson"; ViewBag.invalidfield = "Contact Person"; } else { ViewBag.invalidfield = null; } if (ViewBag.invalidfield == null) { new DataContext().savewalkin(wi); } else { ViewBag.focusscript = "$('#" + ViewBag.elementid + "').focus();$('#" + ViewBag.elementid + "').attr('placeholder', 'Please enter a valid " + new wdDictionary().getdisplayname(ViewBag.invalidfield) + "');"; ViewBag.focusscript += "$('#" + ViewBag.elementid + "').addClass('highlight');"; ViewBag.focusscript += "$('#" + ViewBag.elementid + "').keyup(function(){$('#" + ViewBag.elementid + "').removeClass('highlight')});"; } } return(View()); }
private int savewalkininfo(WalkInInfo winfo) { var savewinfo = new queries().savewinfo(winfo); return(MySqlEvents.executeinsert(savewinfo)); }
private static T DatatoObj <T>(DataSet ds, string retType) { if (retType == typeof(List <WalkInInfo>).ToString()) { List <WalkInInfo> winfos = new List <WalkInInfo>(); foreach (DataRow dr in ds.Tables[0].Rows) { winfos.Add(new WalkInInfo { id = Convert.ToInt32(dr["id"]), jobtitle = dr["jobtitle"].ToString(), companyinfo = executeselect <CompanyInfo>(new queries().getcinfo(Convert.ToInt32(dr["companyinfo"]))), location = executeselect <Location>(new queries().getlinfo(Convert.ToInt32(dr["location"]))), venue = dr["venue"].ToString(), jobdescription = dr["jobdescription"].ToString(), contactperson = dr["contactperson"].ToString(), //dtfrom = DateTime.ParseExact(dr["datefrom"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), //dtto = DateTime.ParseExact(dr["dateto"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), //timefrom = DateTime.ParseExact(dr["timefrom"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), //timeto = DateTime.ParseExact(dr["timeto"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), dtfrom = Convert.ToDateTime(dr["datefrom"]), dtto = Convert.ToDateTime(dr["dateto"]), timefrom = Convert.ToDateTime(dr["timefrom"]), timeto = Convert.ToDateTime(dr["timeto"]), salary = dr["salary"].ToString(), experience = dr["experience"].ToString(), createdon = Convert.ToDateTime(dr["createdon"]), views = Convert.ToInt32(dr["views"]) }); } return((T)(object)winfos); } else if (retType == typeof(WalkInInfo).ToString()) { WalkInInfo winfo = new WalkInInfo(); DataRow dr = ds.Tables[0].Rows[0]; winfo.id = Convert.ToInt32(dr["id"]); winfo.jobtitle = dr["jobtitle"].ToString(); winfo.companyinfo = executeselect <CompanyInfo>(new queries().getcinfo(Convert.ToInt32(dr["companyinfo"]))); winfo.location = executeselect <Location>(new queries().getlinfo(Convert.ToInt32(dr["location"]))); winfo.venue = dr["venue"].ToString(); winfo.jobdescription = dr["jobdescription"].ToString(); winfo.contactperson = dr["contactperson"].ToString(); return((T)(object)winfo); } else if (retType == typeof(List <CompanyInfo>).ToString()) { List <CompanyInfo> cinfos = new List <CompanyInfo>(); foreach (DataRow dr in ds.Tables[0].Rows) { cinfos.Add(new CompanyInfo { id = Convert.ToInt32(dr["id"]), CompanyName = dr["companyname"].ToString(), Email = dr["email"].ToString(), Phone = dr["phone"].ToString() }); } return((T)(object)cinfos); } else if (retType == typeof(CompanyInfo).ToString()) { CompanyInfo winfo = new CompanyInfo(); DataRow dr = ds.Tables[0].Rows[0]; winfo.id = Convert.ToInt32(dr["id"]); winfo.CompanyName = dr["companyname"].ToString(); winfo.Email = dr["email"].ToString(); winfo.Phone = dr["phone"].ToString(); return((T)(object)winfo); } else if (retType == typeof(List <Location>).ToString()) { List <Location> linfos = new List <Location>(); foreach (DataRow dr in ds.Tables[0].Rows) { linfos.Add(new Location { id = Convert.ToInt32(dr["id"]), CityName = dr["cityname"].ToString(), CountryName = dr["countryname"].ToString() }); } return((T)(object)linfos); } else if (retType == typeof(Location).ToString()) { Location linfo = new Location(); DataRow dr = ds.Tables[0].Rows[0]; linfo.id = Convert.ToInt32(dr["id"]); linfo.CityName = dr["cityname"].ToString(); linfo.CountryName = dr["countryname"].ToString(); return((T)(object)linfo); } else { return((T)(object)null); } }