Пример #1
0
        public ActionResult GetLogin(string email, string password, string ip)
        {
            var res = ActionResult.NoAction;

            res = ApplicationLogOn.ApplicationAccess(email, password, ip);
            if (res.Success)
            {
                var logon = res.ReturnValue as LogOnObject;
                HttpContext.Current.Session["dictionary"] = ApplicationDictionary.Load("es");
            }

            return(res);
        }
Пример #2
0
        public ActionResult GetLogin(string email, string password, string ip)
        {
            var res = ApplicationLogOn.GetApplicationAccess(email, password, ip);

            if (res.Success)
            {
                var logon  = res.ReturnValue as LogOnObject;
                int userId = logon.Id;
                HttpContext.Current.Session["UniqueSessionId"] = UniqueSession.SetSession(userId, ip);
            }

            return(res);
        }
Пример #3
0
        public void GetEmployees()
        {
            this.employees = new Collection <Employee>();
            using (SqlCommand cmd = new SqlCommand("Company_GetEmployees"))
            {
                cmd.Connection  = new SqlConnection(ConfigurationManager.ConnectionStrings["cns"].ConnectionString);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@CompanyId", SqlDbType.Int);
                cmd.Parameters["@CompanyId"].Value = this.id;

                try
                {
                    cmd.Connection.Open();
                    SqlDataReader rdr         = cmd.ExecuteReader();
                    Employee      newEmployee = new Employee();
                    while (rdr.Read())
                    {
                        int employeeId = rdr.GetInt32(0);
                        if (employeeId != newEmployee.Id)
                        {
                            newEmployee = new Employee()
                            {
                                Id             = employeeId,
                                Name           = rdr.GetString(1),
                                LastName       = rdr.GetString(2),
                                SecondLastName = rdr.GetString(3),
                                Email          = rdr.GetString(4),
                                Phone          = rdr.GetString(5)
                            };

                            if (rdr.GetInt32(7) != 0)
                            {
                                newEmployee.User = new ApplicationUser()
                                {
                                    Id       = rdr.GetInt32(7),
                                    Login    = rdr.GetString(8),
                                    Language = rdr.GetString(9),
                                    Status   = ApplicationLogOn.IntegerToLoginResult(rdr.GetInt32(10))
                                };
                            }

                            this.employees.Add(newEmployee);
                        }

                        int departmetId = rdr.GetInt32(6);
                        foreach (Department department in this.departments)
                        {
                            if (department.Id == departmetId)
                            {
                                newEmployee.AddDepartment(department);
                                department.AddEmployee(newEmployee);
                                break;
                            }
                        }
                    }
                }
                catch (SqlException ex)
                {
                    string s = ex.Message;
                }
                catch (NotSupportedException ex)
                {
                    string s = ex.Message;
                }
                catch (Exception ex)
                {
                    string s = ex.Message;
                }
                finally
                {
                    if (cmd.Connection.State != ConnectionState.Closed)
                    {
                        cmd.Connection.Close();
                    }
                    ;
                }
            }
        }
Пример #4
0
 public LogOnObject GetLogin(string userName, string password, string company, string ip)
 {
     return(ApplicationLogOn.GetLogin(userName, password, company, ip));
 }