public IHttpActionResult Delete(List <COMPANIEDC> objCompanieslist) { COMPANIEBL objCompanie = new COMPANIEBL(); try { int IsDeleted = objCompanie.Delete(objCompanieslist); return(Ok(new { IsDeleted })); } catch (Exception ex) { return(new TextResult(ex.Message, Request, ex.StackTrace)); } }
public IHttpActionResult Update(List <COMPANIEDC> objCompanieslist) { List <EXCEPTIONDC> lstException = new List <EXCEPTIONDC>(); COMPANIEBL objCompanie = new COMPANIEBL(); try { int IsUpdated = objCompanie.Update(objCompanieslist, ref lstException); return(Ok(IsUpdated)); } catch (Exception ex) { return(new TextResult(lstException, Request)); } }
public IHttpActionResult Get(int id) { COMPANIEBL objCompanies = new COMPANIEBL(); COMPANIEDC objResult = new COMPANIEDC(); try { objResult = objCompanies.LoadByPrimaryKey(id); return(Ok(new { objResult })); } catch (Exception ex) { return(new TextResult(ex.Message, Request, ex.StackTrace)); } }
public IHttpActionResult GetAll() { COMPANIEBL objCompanies = new COMPANIEBL(); List <COMPANIEDC> objResultList = new List <COMPANIEDC>(); try { objResultList = objCompanies.LoadAll(); return(Ok(new { objResultList })); } catch (Exception ex) { return(new TextResult(ex.Message, Request, ex.StackTrace)); } }
public IHttpActionResult Insert(List <COMPANIEDC> objCompanieslist) { COMPANIEBL objCompanie = new COMPANIEBL(); List <EXCEPTIONDC> lstException = new List <EXCEPTIONDC>(); foreach (COMPANIEDC objCompany in objCompanieslist) { objCompany.MODIFIED_BY = objCompany.CREATED_BY; objCompany.MODIFIED_ON = System.DateTime.Now; objCompany.CREATED_ON = System.DateTime.Now; } //try //{ int IsInserted = objCompanie.Insert(objCompanieslist); return(Ok(IsInserted)); //} //catch (Exception ex) //{ // return new TextResult(ex.Message, Request,ex.StackTrace); //} }
public int SetAuthenticationTicket(string username, string companies, string email, DateTime?logindate = null) { int authStatus = 0; try { string CompanyNames = "No Company Associated"; string separator = "_-_-_"; System.Web.HttpContext context = System.Web.HttpContext.Current; FormsAuthentication.SetAuthCookie(username, false); if (!string.IsNullOrEmpty(username)) { if (!string.IsNullOrEmpty(companies)) { COMPANIEBL CompanyHandler = new COMPANIEBL(); CompanyNames = CompanyHandler.CompanyNameString(companies); } context.Session.Add("CurrentUserSessions", username); string useragent = " - Windows"; if (context.Request.UserAgent.Contains("Android")) { useragent = " - Android"; } else if (context.Request.UserAgent.Contains("iPad")) { useragent = " - iPad"; } else if (context.Request.UserAgent.Contains("iPhone")) { useragent = " - iPhone"; } KeyValuePair <string, string> user = new KeyValuePair <string, string>(username, CompanyNames + separator + email + separator + DateTime.Now + separator + context.Request.Browser.Browser + useragent); List <KeyValuePair <string, string> > users = (List <KeyValuePair <string, string> >)context.Application["LoggedInUsers"]; ////string logItem = "\r\nList count::" + users.Count.ToString(); ////logItem += "\r\nUser Name:: " + (user.Key); ////logItem += "\r\nUser Key:: " + (user.Value); var list = new List <KeyValuePair <string, string> >(); list = users; string checkKey = username; if (list.Contains(new KeyValuePair <string, string>(checkKey, string.Empty), new KeyComparer())) { KeyValuePair <string, string> item = list.Find((lItem) => lItem.Key.Equals(checkKey)); string exstBrows = item.Value.Split(new string[] { separator }, StringSplitOptions.RemoveEmptyEntries)[3]; ////logItem += "\r\nExisting brow::" + exstBrows; ////logItem += "\r\nComparing::" + (context.Request.Browser.Browser + useragent); ////if ((context.Request.Browser.Browser + useragent) == exstBrows) //// authStatus = 1; ////else authStatus = 1; } else { users.Add(user); context.Application.Set("LoggedInUsers", users); authStatus = 1; } ////LogToFile(logItem); } } catch (Exception ex) { authStatus = 0; } return(authStatus); }