public string GetCompanyProfile(string id) { string output = string.Empty; try { Domain.Socioboard.Domain.CompanyProfiles objCompanyProfiles = ObjCompanySocialProfilesRepository.getCompanyProfiles(Guid.Parse(id)); return(new JavaScriptSerializer().Serialize(objCompanyProfiles)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
public Domain.Socioboard.Domain.CompanyProfiles getProfiles(string Name) { Domain.Socioboard.Domain.CompanyProfiles companyProfile = null; //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { NHibernate.IQuery query = session.CreateQuery("from companyprofiles where CompanyName = :CompanyName"); query.SetParameter("CompanyName", Name); List <Domain.Socioboard.Domain.CompanyProfiles> result = (List <Domain.Socioboard.Domain.CompanyProfiles>)query.Enumerable(); companyProfile = result[0]; } //End Transaction } //End session return(companyProfile); }
public bool addAccount(Domain.Socioboard.Domain.CompanyProfiles compnayProfiles) { bool IsSuccess = false; //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { //proceed action, to save data. session.Save(compnayProfiles); transaction.Commit(); IsSuccess = true; } //End Transaction } //End session return(IsSuccess); }
public string SearchCompanyProfile(string keyword) { string output = string.Empty; try { Domain.Socioboard.Domain.CompanyProfiles objCompanyName = ObjCompanySocialProfilesRepository.SearchCompanyName(keyword); if (objCompanyName == null) { objCompanyName = AddCompanyInfo(keyword); } return(new JavaScriptSerializer().Serialize(objCompanyName)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }
// [OutputCache(Duration=180)] public ActionResult Company(string q) { Domain.Socioboard.Domain.CompanyProfiles companyprofile = new Domain.Socioboard.Domain.CompanyProfiles(); string result = apicompanydashboard.SearchCompanyProfile(q); //string result = string.Empty; if (string.IsNullOrEmpty(result) || result.Equals("Something Went Wrong")) { companyprofile.Companyname = q; companyprofile.Fbprofileid = q.Replace(" ", string.Empty); companyprofile.Gplusprofileid = q.Replace(" ", string.Empty); companyprofile.Instagramprofileid = q.Replace(" ", string.Empty); companyprofile.Linkedinprofileid = q.Replace(" ", string.Empty); companyprofile.Tumblrprofileid = q.Replace(" ", string.Empty); companyprofile.Twitterprofileid = q.Replace(" ", string.Empty); companyprofile.Youtubeprofileid = q.Replace(" ", string.Empty); } else { companyprofile = (Domain.Socioboard.Domain.CompanyProfiles)(new JavaScriptSerializer().Deserialize(result, typeof(Domain.Socioboard.Domain.CompanyProfiles))); } return View(companyprofile); }
public ActionResult Company(string q) { Domain.Socioboard.Domain.CompanyProfiles companyprofile = new Domain.Socioboard.Domain.CompanyProfiles(); // string result = apicompanydashboard.SearchCompanyProfile(q); string result = string.Empty; if (string.IsNullOrEmpty(result) || result.Equals("Something Went Wrong")) { companyprofile.CompanyName = q; companyprofile.FbProfileId = q.Replace(" ", string.Empty); companyprofile.GPlusProfileId = q.Replace(" ", string.Empty); companyprofile.InstagramProfileId = q.Replace(" ", string.Empty); companyprofile.LinkedinProfileId = q.Replace(" ", string.Empty); companyprofile.TumblrProfileId = q.Replace(" ", string.Empty); companyprofile.TwitterProfileId = q.Replace(" ", string.Empty); companyprofile.YoutubeProfileId = q.Replace(" ", string.Empty); } else { companyprofile = (Domain.Socioboard.Domain.CompanyProfiles)(new JavaScriptSerializer().Deserialize(result, typeof(Domain.Socioboard.Domain.CompanyProfiles))); } return(View(companyprofile)); }
public bool updateAccount(Domain.Socioboard.Domain.CompanyProfiles compnayProfiles) { bool IsUpdated = false; using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { // Proceed action to Update Data. // And Set the reuired paremeters to find the specific values. session.CreateQuery("Update companyprofiles set CompanyName =:CompanyName,FbProfileId =:FbProfileId,TwitterProfileId =:TwitterProfileId,LinkedinProfileId=:LinkedinProfileId,InstagramProfileId=:InstagramProfileId,YoutubeProfileId=:YoutubeProfileId,GPlusProfileId=:GPlusProfileId,TumblrProfileId=:TumblrProfileId,UserId=:UserId where Id = :Id ") .SetParameter("CompanyName", compnayProfiles.Companyname) .SetParameter("FbProfileId", compnayProfiles.Fbprofileid) .SetParameter("TwitterProfileId", compnayProfiles.Twitterprofileid) .SetParameter("LinkedinProfileId", compnayProfiles.Linkedinprofileid) .SetParameter("InstagramProfileId", compnayProfiles.Instagramprofileid) .SetParameter("YoutubeProfileId", compnayProfiles.Youtubeprofileid) .SetParameter("GPlusProfileId", compnayProfiles.Gplusprofileid) .SetParameter("TumblrProfileId", compnayProfiles.Tumblrprofileid) .SetParameter("UserId", compnayProfiles.Userid) .SetParameter("Id", compnayProfiles.Id) .ExecuteUpdate(); transaction.Commit(); IsUpdated = true; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } return(IsUpdated); } //End Transaction } //End session }
//[WebMethod] //[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)] public Domain.Socioboard.Domain.CompanyProfiles AddCompanyInfo(string name) { string ret = string.Empty; Domain.Socioboard.Domain.CompanyProfiles companyProfile = new Domain.Socioboard.Domain.CompanyProfiles(); companyProfile.Companyname = name; try { companyProfile.Fbprofileid = Getfbpage(name); } catch (Exception e) { } try { companyProfile.Instagramprofileid = GetInstagramPage(name); } catch (Exception e) { } try { companyProfile.Linkedinprofileid = GetLinkedinPage(name); //companyProfile.LinkedinProfileId = string.Empty; } catch (Exception e) { // throw; } try { companyProfile.Tumblrprofileid = GetTumblrPage(name); } catch (Exception e) { //throw; } try { companyProfile.Twitterprofileid = GetTwitterPage(name); } catch { } try { companyProfile.Youtubeprofileid = GetYoutubeChannel(name); } catch (Exception e) { //throw; } try { companyProfile.Gplusprofileid = GetGplusPage(name); } catch (Exception e) { } //try //{ // companyProfile.UserId = Guid.NewGuid().ToString(); //} //catch (Exception ex) //{ // Console.WriteLine(ex.Message); //} companyProfile.Id = Guid.NewGuid(); ObjCompanySocialProfilesRepository.AddcompanyProfileName(companyProfile); return companyProfile; }
public string getCompanyProfile(string keyword) { string output = string.Empty; Domain.Socioboard.Domain.CompanyProfiles companyProfile = new Domain.Socioboard.Domain.CompanyProfiles(); try { Domain.Socioboard.Domain.CompanyProfiles objCompanyName = ObjCompanySocialProfilesRepository.SearchCompanyName(keyword); companyProfile.Userid = objCompanyName.Userid; companyProfile.Id = objCompanyName.Id; companyProfile.Companyname = objCompanyName.Companyname; try { companyProfile.Fbprofileid = Getfbpage(objCompanyName.Fbprofileid); } catch (Exception e) { } if (!string.IsNullOrEmpty(objCompanyName.Instagramprofileid)) { try { companyProfile.Instagramprofileid = GetInstagramPage(objCompanyName.Instagramprofileid); } catch (Exception e) { } } if (!string.IsNullOrEmpty(objCompanyName.Linkedinprofileid)) { try { companyProfile.Linkedinprofileid = GetLinkedinPage(objCompanyName.Linkedinprofileid); //companyProfile.LinkedinProfileId = string.Empty; } catch (Exception e) { // throw; } } if (!string.IsNullOrEmpty(objCompanyName.Tumblrprofileid)) { try { companyProfile.Tumblrprofileid = GetTumblrPage(objCompanyName.Tumblrprofileid); } catch (Exception e) { //throw; } } if (!string.IsNullOrEmpty(objCompanyName.Twitterprofileid)) { try { companyProfile.Twitterprofileid = GetTwitterPage(objCompanyName.Twitterprofileid); } catch { } } if (!string.IsNullOrEmpty(objCompanyName.Youtubeprofileid)) { try { companyProfile.Youtubeprofileid = GetYoutubeChannel(objCompanyName.Youtubeprofileid); } catch (Exception e) { //throw; } } if (!string.IsNullOrEmpty(objCompanyName.Gplusprofileid)) { try { companyProfile.Gplusprofileid = GetGplusPage(objCompanyName.Gplusprofileid); } catch (Exception e) { } } return new JavaScriptSerializer().Serialize(companyProfile); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return "Something Went Wrong"; } }
//[WebMethod] //[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)] public Domain.Socioboard.Domain.CompanyProfiles AddCompanyInfo(string name) { string ret = string.Empty; Domain.Socioboard.Domain.CompanyProfiles companyProfile = new Domain.Socioboard.Domain.CompanyProfiles(); companyProfile.Companyname = name; try { companyProfile.Fbprofileid = Getfbpage(name); } catch (Exception e) { } try { companyProfile.Instagramprofileid = GetInstagramPage(name); } catch (Exception e) { } try { companyProfile.Linkedinprofileid = GetLinkedinPage(name); //companyProfile.LinkedinProfileId = string.Empty; } catch (Exception e) { // throw; } try { companyProfile.Tumblrprofileid = GetTumblrPage(name); } catch (Exception e) { //throw; } try { companyProfile.Twitterprofileid = GetTwitterPage(name); } catch { } try { companyProfile.Youtubeprofileid = GetYoutubeChannel(name); } catch (Exception e) { //throw; } try { companyProfile.Gplusprofileid = GetGplusPage(name); } catch (Exception e) { } //try //{ // companyProfile.UserId = Guid.NewGuid().ToString(); //} //catch (Exception ex) //{ // Console.WriteLine(ex.Message); //} companyProfile.Id = Guid.NewGuid(); ObjCompanySocialProfilesRepository.AddcompanyProfileName(companyProfile); return(companyProfile); }
public string getCompanyProfile(string keyword) { string output = string.Empty; Domain.Socioboard.Domain.CompanyProfiles companyProfile = new Domain.Socioboard.Domain.CompanyProfiles(); try { Domain.Socioboard.Domain.CompanyProfiles objCompanyName = ObjCompanySocialProfilesRepository.SearchCompanyName(keyword); companyProfile.Userid = objCompanyName.Userid; companyProfile.Id = objCompanyName.Id; companyProfile.Companyname = objCompanyName.Companyname; try { companyProfile.Fbprofileid = Getfbpage(objCompanyName.Fbprofileid); } catch (Exception e) { } if (!string.IsNullOrEmpty(objCompanyName.Instagramprofileid)) { try { companyProfile.Instagramprofileid = GetInstagramPage(objCompanyName.Instagramprofileid); } catch (Exception e) { } } if (!string.IsNullOrEmpty(objCompanyName.Linkedinprofileid)) { try { companyProfile.Linkedinprofileid = GetLinkedinPage(objCompanyName.Linkedinprofileid); //companyProfile.LinkedinProfileId = string.Empty; } catch (Exception e) { // throw; } } if (!string.IsNullOrEmpty(objCompanyName.Tumblrprofileid)) { try { companyProfile.Tumblrprofileid = GetTumblrPage(objCompanyName.Tumblrprofileid); } catch (Exception e) { //throw; } } if (!string.IsNullOrEmpty(objCompanyName.Twitterprofileid)) { try { companyProfile.Twitterprofileid = GetTwitterPage(objCompanyName.Twitterprofileid); } catch { } } if (!string.IsNullOrEmpty(objCompanyName.Youtubeprofileid)) { try { companyProfile.Youtubeprofileid = GetYoutubeChannel(objCompanyName.Youtubeprofileid); } catch (Exception e) { //throw; } } if (!string.IsNullOrEmpty(objCompanyName.Gplusprofileid)) { try { companyProfile.Gplusprofileid = GetGplusPage(objCompanyName.Gplusprofileid); } catch (Exception e) { } } return(new JavaScriptSerializer().Serialize(companyProfile)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return("Something Went Wrong"); } }