Exemplo n.º 1
0
 /// <summary>
 /// 修改部门信息
 /// </summary>
 public void EditDepartment(string id, string name, DepartmentType state)
 {
     EDepartment dp = Dc.Department.Find(id);
     if (dp == null)
     {
         throw new DbNotFoundException();
     }
     int count = (from item in Dc.Department
                 where item.Name.Equals(name)
                 && !item.ID.Equals(id)
                 select item).Count();
     if (count > 0)
     {
         throw new ExistedDepartmentNameException();
     }
     if (name != null)
     {
         dp.Name = name;
     }
     dp.State = state;
     try
     {
         Dc.SaveChanges();
     }
     catch (InvalidOperationException)
     {
         throw new DbSaveException();
     }
 }
Exemplo n.º 2
0
 public CatalogItem()
 {
     Department = new DepartmentType();
     Categories = new List <CategoryType>();
     Media      = new List <MediaContent>();
     Reviews    = new List <CustomerReview>();
 }
 public PersonInformation(string surname, string name, string patronymic, DepartmentType departmentType)
 {
     Surname        = surname ?? String.Empty;
     Name           = name ?? String.Empty;
     Patronymic     = patronymic ?? String.Empty;
     DepartmentType = departmentType;
 }
Exemplo n.º 4
0
        public void WhenINeedDepartmentToEitherBeOrType(string key, DepartmentType type1, DepartmentType type2)
        {
            var department = context.GetToken <Department>(key);

            context.Either(x => x.DepartmentHasType(department, type1),
                           x => x.DepartmentHasType(department, type2));
        }
        public static string DepartmentsToBgLang(this DepartmentType text)
        {
            switch (text)
            {
            case DepartmentType.Kids:
                return(KidsDepartment);

            case DepartmentType.Rent:
                return(RentDepartment);

            case DepartmentType.Read:
                return(ReadDepartment);

            case DepartmentType.Check:
                return(CheckDepartment);

            case DepartmentType.Art:
                return(ArtDepartment);

            case DepartmentType.Land:
                return(LandDepartment);

            case DepartmentType.Foreign:
                return(ForeignDepartment);
            }

            return(String.Empty);
        }
Exemplo n.º 6
0
 //根据部门类型获取对应的部门名称List
 public List <string> ToDepartmentList(DepartmentType type)
 {
     return(departmentMap
            .Where(pair => pair.Value.Equals(type))
            .Select(pair => pair.Key)
            .ToList());
 }
Exemplo n.º 7
0
 public DepartmentTypeVM(DepartmentType bo)
 {
     this.ID          = bo.ID;
     this.Name        = bo.Name;
     this.Description = bo.Description;
     this.SortCode    = bo.SortCode;
 }
        public async Task EditAsync(int id, string authorName, string bookTitle, string bookDescription, string cityIssued,
                                    string press, DepartmentType department, int publishDate, int pages, string genre, string imageUrl, Language language)
        {
            var book = await this.db.Books.FindAsync(id);

            if (book == null)
            {
                return;
            }

            book.AuthorName      = authorName;
            book.BookTitle       = bookTitle;
            book.BookDescription = bookDescription;
            book.CityIssued      = cityIssued;
            book.Press           = press;
            book.Department      = department;
            book.PublishDate     = publishDate;
            book.Pages           = pages;
            book.Genre           = genre;
            book.Language        = language;

            if (imageUrl != null)
            {
                if (imageUrl != DefaultBookCoverImagePathBg)
                {
                    FileExtensions.DeleteImage(book.ImageUrl);
                }

                book.ImageUrl = imageUrl;
            }

            await this.db.SaveChangesAsync();
        }
Exemplo n.º 9
0
        public void ExecuteThisCommand(string[] commandParameters)
        {
            this.coreValidator.ExactParameterLength(commandParameters, 2);

            department = this.coreValidator.DepartmentTypeFromString(commandParameters[1], "department");

            var employeesInDepartment = database.Employees.Where(x => x.Department == department).ToList();

            if (employeesInDepartment.Count == 0)
            {
                throw new ArgumentException($"The are no employees at department: {department}!");
            }

            StringBuilder str = new StringBuilder();

            str.AppendLine($"Employees at: {department} department:");
            var counter = 1;

            foreach (var employee in employeesInDepartment)
            {
                str.AppendLine($"{counter}. {employee.ToString()}");
                counter++;
            }
            this.writer.Write(str.ToString());
        }
Exemplo n.º 10
0
 public static void DepartmentHasType(this ITokenRegister register,
                                      IHaveToken <Department> department,
                                      DepartmentType departmentType)
 {
     register.For(department)
     .IsTrue(dep => dep.Type == departmentType);
 }
Exemplo n.º 11
0
 public Department(DepartmentType type, PhoneNumber phone)
 {
     Type      = type;
     Phone     = phone;
     Employees = new List <Employee>();
     Id        = Type.ToString().Substring(0, 1);
 }
Exemplo n.º 12
0
 public static void DepartmentHasType(this ITokenRegister register,
     IHaveToken<Department> department,
     DepartmentType departmentType)
 {
     register.For(department)
             .IsTrue(dep => dep.Type == departmentType);
 }
Exemplo n.º 13
0
 public PersonInformationComponent(string surname, string name, string patronymic, DepartmentType departmentType)
 {
     Surname        = surname;
     Name           = name;
     Patronymic     = patronymic;
     DepartmentType = departmentType;
 }
Exemplo n.º 14
0
        public IActionResult UpdateSalesMan(int id, string userName, string code, DepartmentType department)
        {
            if (!_permissionService.Authorize("UpdateSalesMan"))
            {
                return(Error("权限不足"));
            }
            var salesMan = _salesManService.GetSalesManById(id);

            if (salesMan == null)
            {
                return(Error("错误,数据不存在"));
            }

            var _salesMan = _salesManService.GetSalesManByNameAndCode(userName, code);

            if (_salesMan != null && salesMan.Id != _salesMan.Id)
            {
                return(Error("已存在名称和编码相同的数据"));
            }

            salesMan.UserName   = userName;
            salesMan.Code       = code;
            salesMan.Department = department;

            _salesManService.UpdateSalesMan(salesMan);
            return(Success());
        }
Exemplo n.º 15
0
        public Department Find(int TableID, bool recursive = true, bool byPrimary = true)
        {
            using (DataTable dt = this.DBHandler.Execute <DataTable>(
                       CRUD.READ,
                       "SELECT * FROM Department WHERE " + (byPrimary ? "DepartmentID" : "Type") + " = " + TableID))
            {
                DataRow row = dt.Rows[0];

                this.DepartmentID   = Int32.Parse(row["DepartmentID"].ToString());
                this.DepartmentName = row["DepartmentName"].ToString();
                this.Type           = (DepartmentType)Int32.Parse(row["Type"].ToString());

                if (recursive)
                {
                    this.Branch = new Branch(Int32.Parse(row["Branch"].ToString()), recursive: false);
                    try
                    {
                        this.DepartmentHead = (Employee) new Employee().FindProfile(
                            Int32.Parse(row["DepartmentHead"].ToString()),
                            byPrimary: true,
                            recursive: false);
                    }
                    catch (Exception e)
                    {
                        this.DepartmentHead = null;
                    }
                }
            }
            return(this);
        }
Exemplo n.º 16
0
 private List <BriefItem> ToBriefItemList(DepartmentType type, List <WeeklyItem> weeklyItemList)
 {
     Env.Instance.BriefSequence = 0;
     return(weeklyItemList
            .Where(item => Department.Instance.ToDepartmentType(item.BizDepartment).Equals(type))
            .Select(item => ToBriefItem(item))
            .ToList());
 }
Exemplo n.º 17
0
 internal Department(int departmentID, DepartmentType departmentType, int storeID,
                     string departmentName)
 {
     DepartmentID   = departmentID;
     DepartmentType = departmentType;
     StoreID        = storeID;
     DepartmentName = departmentName;
 }
Exemplo n.º 18
0
        /// <summary>
        /// Get All Film Crew List List
        /// </summary>
        /// <returns></returns>
        public List <DropdownList> GetFilmCrewList(DepartmentType DepartmentType)
        {
            int _departmentType = (int)DepartmentType;

            return(_MoviesDBEntitiesContext.tblFilmCrews.Where(w => w.DepartmentType == _departmentType).Select(x => new DropdownList {
                Key = x.ID, Value = x.Name
            }).ToList());
        }
Exemplo n.º 19
0
 public RegisterNewDepartmentCommand(DepartmentGroup departmentGroup, DepartmentType departmentType, string description, bool applyTax, decimal amount, decimal percentage)
 {
     this.DepartmentGroup = departmentGroup;
     this.DepartmentType  = departmentType;
     this.Description     = description;
     this.Amount          = amount;
     this.ApplyTax        = applyTax;
 }
Exemplo n.º 20
0
        public static DepartmentType GetDepartment()
        {
            var department = Enum.GetValues(typeof(DepartmentType));

            DepartmentType dep = (DepartmentType)department.GetValue(new Random().Next(department.Length));

            return(dep);
        }
Exemplo n.º 21
0
 public Department(DepartmentType departmentType, string departmentName, int maximumCountEmploes)
 {
     DepartmentType = departmentType;
     DepartmentName = departmentName;
     if (maximumCountEmploes > 0)
     {
         MaximumCountEmployes = maximumCountEmploes;
     }
 }
Exemplo n.º 22
0
 public CreateProductDataDelegate(int storeID, double unitPrice, int stockQuantity, string productName, DepartmentType departmentType)
     : base("Store.CreateDepartment")
 {
     this.storeID        = storeID;
     this.unitPrice      = unitPrice;
     this.stockQuantity  = stockQuantity;
     this.productName    = productName;
     this.departmentType = departmentType;
 }
Exemplo n.º 23
0
 public Product(int productID, int storeID, DepartmentType departmentType, double unitprice, int stockquantity, string productName)
 {
     ProductID     = productID;
     StoreID       = storeID;
     DepartmentID  = (int)departmentType;
     UnitPrice     = unitprice;
     StockQuantity = stockquantity;
     ProductName   = productName;
 }
Exemplo n.º 24
0
        private void AddEmployee(string firstName, string lastName, string position, decimal salary,
                                 decimal ratePerMinute, DepartmentType department)
        {
            IEmployee employee =
                this.factory.CreateEmployee(firstName, lastName, position, salary, ratePerMinute, department);

            this.employees.Add(employee);
            Console.WriteLine(employee);
            Console.WriteLine($"Employee {firstName} {lastName} added successfully with Id {this.employees.Count}");
        }
Exemplo n.º 25
0
 public DepartmentRegisteredEvent(DepartmentGroup departmentGroup, DepartmentType departmentType, string description, bool applyTax, decimal amount, decimal percentage)
 {
     // Id = id;
     DepartmentGroup = departmentGroup;
     DepartmentType  = DepartmentType;
     ApplyTax        = applyTax;
     Amount          = amount;
     Percentage      = percentage;
     Description     = description;
 }
Exemplo n.º 26
0
 public UpdateDepartmentCommand(string id, DepartmentGroup departmentGroup, DepartmentType departmentType, string description, bool applyTax, decimal amount, decimal percentage)
 {
     Id = id;
     DepartmentGroup = departmentGroup;
     DepartmentType  = DepartmentType;
     ApplyTax        = applyTax;
     Amount          = amount;
     Percentage      = percentage;
     Description     = description;
 }
        public ActionResult Update(DepartmentType departmentType)
        {
            var result = _departmentTypeService.Update(departmentType);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public IResult Update(DepartmentType departmentType)
        {
            IResult result = BusinessRules.Run(CheckIfDepartmentAlreadyExist(departmentType));

            if (result != null)
            {
                return(result);
            }
            _departmentTypeDal.Update(departmentType);
            return(new SuccessResult(Messages.DepartmentUpdated));
        }
Exemplo n.º 29
0
        protected Department(Int32 id, Uuid uuid, String name, DepartmentType type, DepartmentState state, Int32 timeZoneUTCOffset, Country country)
        {
            Id      = id;
            Uuid    = uuid;
            Name    = name;
            Type    = type;
            State   = state;
            Country = country;

            TimeZoneUTCOffset = timeZoneUTCOffset;
        }
Exemplo n.º 30
0
 public Employee(string firstName, string lastName, string position, decimal salary, decimal ratePerMinute,
                 DepartmentType department)
 {
     this.FirstName        = firstName;
     this.LastName         = lastName;
     this.Position         = position;
     this.Salary           = salary;
     this.RatePerMinute    = ratePerMinute;
     this.Department       = department;
     this.isHired          = true;
     this.responsibilities = new List <ResponsibilityType>();
 }
Exemplo n.º 31
0
 public void WhenINeedDepartmentToEitherBeTypeOrHaveEmployeeOrHaveProjectWithBudjetOrMore(string departmentName, 
     DepartmentType departmentType, 
     EmploymentType employeeType,
     int amount)
 {
     IHaveToken<Employee> employee = null;
     var department = context.GetToken<Department>(departmentName);
     context.Either(x => x.DepartmentHasType(department, departmentType),
                x => employee = x.DepartmentHasEmployeeOfType(department, employeeType),
                x => x.DepartmentHasProjectWithBudget(department, amount));
     context.Storage.Set(employee);
 }
Exemplo n.º 32
0
        public ActionResult DepartmentType(FormCollection form)
        {
            string code, desc;

            for (int i = 0; i < form.Keys.Count; i++)
            {
                string         key   = form.Keys[i];
                string         value = form[key];
                DepartmentType data  = null;
                if (key.StartsWith("CODE_", StringComparison.OrdinalIgnoreCase))
                {
                    string id = key.Substring("CODE_".Length);
                    code = form["CODE_" + id];
                    desc = form["DESC_" + id];
                    data = new DepartmentType {
                        id          = Convert.ToInt32(id),
                        stringValue = code,
                        description = desc,
                    };

                    departmentTypeService.Update(data);
                }
                else if (key.StartsWith("CODE", StringComparison.OrdinalIgnoreCase))
                {
                    code = form["CODE"];
                    desc = form["DESC"];
                    if (!string.IsNullOrEmpty(code) && !string.IsNullOrEmpty(desc))
                    {
                        departmentTypeService.Insert(new DepartmentType {
                            stringValue = code,
                            description = desc,
                        });
                    }
                }
                else
                {
                }
            }

            string  result = "<div class=\"paginatorNotFound hint\" style=\"display: block; \">暂无记录</div>";
            XmlNode node   = KTList.GetConfigNode("dataTableAjax.xml", "DepartmentType");

            if (node != null)
            {
                IEnumerable <DepartmentType> list = departmentTypeService.GetList("");
                result = KTList.GetDataList <DepartmentType>(node, 0, 0, list);
            }

            ViewBag.ListHTML = result;

            return(View());
        }
Exemplo n.º 33
0
        public void CallEmergencyService(DepartmentType type, string userName)
        {
            IOperator freeOperator;

            do
            {
                freeOperator = GetFreeOperator();
            } while (freeOperator == null);

            var department = GetDepartment(type);

            freeOperator.RecieveCall(department, userName);
        }
Exemplo n.º 34
0
    public void SetDepartment( string s )
    {
        if ( s.Contains( "Bathroom" ) ) this.Department = DepartmentType.BathRoom;
        if ( s.Contains( "Bedroom" ) ) this.Department = DepartmentType.BedRoom;
        if ( s.Contains( "Children" ) ) this.Department = DepartmentType.Childrens;
        if ( s.Contains( "Dining" ) ) this.Department = DepartmentType.DiningRoom;
        if ( s.Contains( "Kitchen" ) ) this.Department = DepartmentType.Kitchen;
        if ( s.Contains( "Living Room" ) ) this.Department = DepartmentType.LivingRoom;
        if ( s.Contains( "Workspace" ) ) this.Department = DepartmentType.Workspaces;

        //Debug.Log(s);
        //Debug.Log(this.Department);
    }
Exemplo n.º 35
0
 public void WhenINeedDepartmentToNOTHaveAllThreeTypeEmployeeProjectBudjetOrMore(string departmentName,
     DepartmentType departmentType,
     EmploymentType employeeType,
     int amount)
 {
     IHaveToken<Employee> employee = null;
     var department = context.GetToken<Department>(departmentName);
     context.Not(x =>
     {
         x.DepartmentHasType(department, departmentType);
         employee = x.DepartmentHasEmployeeOfType(department, employeeType);
         x.DepartmentHasProjectWithBudget(department, amount);
     });
     context.Storage.Set(employee);
 }
Exemplo n.º 36
0
 /// <summary>
 /// 添加一个部门
 /// </summary>
 public EDepartment AddDepartment(string name, DepartmentType state)
 {
     EDepartment dp = Dc.Department.Create();
     dp.ID = SqlDataHelper.CreateID();
     dp.Name = name;
     dp.State = state;
     try
     {
         Dc.Department.Add(dp);
         Dc.SaveChanges();
     }
     catch (InvalidOperationException)
     {
         throw new DbSaveException();
     }
     return dp;
 }
Exemplo n.º 37
0
 public SalesEmployee(int id, string firstName, string lastName, decimal salary, DepartmentType department)
     : base(id, firstName, lastName, salary, department)
 {
     this.sales = new List<Sale>();
 }
Exemplo n.º 38
0
    public void TickBackgroundInt()
    {
        backgroundTick++;
        if ( backgroundTick >= 5 )
        {
            currentDepartment = (DepartmentType)UnityEngine.Random.Range( 0, Enum.GetNames( typeof( DepartmentType ) ).Length - 2 );

            foreach ( Background BG in Background )
                BG.UpdateBackground();

            backgroundTick = 0;
        }
    }
Exemplo n.º 39
0
 protected Employee(string firstName, string lastName, string id, decimal salary, DepartmentType department)
     : base(firstName, lastName, id)
 {
     this.Salary = salary;
     this.department = department;
 }
Exemplo n.º 40
0
 protected Employee(uint id, string firstName, string lastName, decimal salary, DepartmentType department) :
     base(id, firstName, lastName)
 {
     this.Salary = salary;
     this.Department = department;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Indicates whether or not there is a member in a given department within a givin committee.
 /// </summary>
 /// <param name="session">A valid session.</param>
 /// <param name="committee">The committee in question.</param>
 /// <param name="department">The department to find in the committee.</param>
 /// <returns></returns>
 public static bool DepartmentRepresented(ISession session, Committee committee, DepartmentType department)
 {
     List<User> members = User.FindUsers(session, committee.Name);
     foreach (User i in members)
     {
         if (i.Department == department)
             return true;
     }
     return false;
 }
 public RegularEmployee(uint id, string firstName, string lastName, decimal salary, DepartmentType department)
     : base(id, firstName, lastName, salary, department)
 {
 }
Exemplo n.º 43
0
 public Manager(string firstName, string lastName, string id, decimal salary, DepartmentType department, List<Employee> employees)
     : base(firstName, lastName, id, salary, department)
 {
     this.employees = new List<Employee>();
 }
Exemplo n.º 44
0
 // Helper functions
 /// <summary>
 /// Creates a new user object with the specified values
 /// </summary>
 /// <param name="email">The user's email</param>
 /// <param name="first">The user's first name</param>
 /// <param name="last">The user's last name</param>
 /// <param name="password">The user's password to be hashed</param>
 /// <param name="passwordHint">The user's password hint</param>
 /// <param name="isAdmin">Whether ot not the user is an admin</param>
 /// <param name="isNEC">Whether or not the user is an NEC member</param>
 /// <param name="isFaculty">Whether or not the user is an faculty member</param>
 /// <param name="isTenured">Whether or not the user is tenured</param>
 /// <param name="isUnion">Whether or not the user is in APSCUF</param>
 /// <param name="isBargainingUnit">Whether or not the user is in a bargainingunit committee</param>
 /// <param name="department">The department the faculty member is in</param>
 /// <param name="officerPosition">The officer position of the user</param>
 /// <param name="canVote">Whether or not the user can vote</param>
 /// <param name="currentCommittee">The committee this user serves on</param>
 /// <returns>Returns a user object with the specified officer position</returns>
 public static User CreateUser(string email, string first, string last, string password,
     string passwordHint, bool isAdmin, bool isNEC, bool isFaculty,bool isTenured, bool isUnion,
     bool isBargainingUnit, DepartmentType department,
     OfficerPositionType officerPosition, bool canVote, int currentCommittee)
 {
     User ret = new User();
     ret.Email = email;
     ret.FirstName = first;
     ret.LastName = last;
     ret.Password = Hash(password);
     ret.PasswordHint = passwordHint;
     ret.IsAdmin = isAdmin;
     ret.IsNEC = isNEC;
     ret.IsFaculty = isFaculty;
     ret.IsTenured = isTenured;
     ret.IsUnion = isUnion;
     ret.IsBargainingUnit = isBargainingUnit;
     ret.Department = department;
     ret.OfficerPosition = officerPosition;
     ret.CanVote = canVote;
     ret.CurrentCommittee = currentCommittee;
     return ret;
 }
Exemplo n.º 45
0
 public Developer(uint id, string firstName, string lastName, decimal salary, DepartmentType department)
     : base(id, firstName, lastName, salary, department)
 {
     this.projects = new List<Project>();
 }
Exemplo n.º 46
0
 public void WhenINeedDepartmentToEitherBeOrType(string key, DepartmentType type1, DepartmentType type2)
 {
     var department = context.GetToken<Department>(key);
     context.Either(x => x.DepartmentHasType(department, type1),
                    x => x.DepartmentHasType(department, type2));
 }
Exemplo n.º 47
0
 public Manager(uint id, string firstName, string lastName,
     decimal salary, DepartmentType department)
     : base(id, firstName, lastName, salary, department)
 {
 }
Exemplo n.º 48
0
 public RegularEmployee(string firstName, string lastName, string id, decimal salary, DepartmentType department)
     : base(firstName, lastName, id, salary, department)
 {
     //
 }
Exemplo n.º 49
0
 public Manager(int id, string firstName, string lastName, decimal salary,
     DepartmentType department)
     : base(id, firstName, lastName, salary, department)
 {
     this.employees = new List<Employee>();
 }
Exemplo n.º 50
0
 static int DepartmentType() 
 {
     DepartmentType e = new DepartmentType()
     {
         DepartmentTypeName = "DepartmentTypeName",
         DepartmentLevel = 1
     };
     commonUow.DepartmentTypes.Add<DepartmentType, int>(e);
     commonUow.DepartmentTypes.Commit();
     return e.ID;
 }
Exemplo n.º 51
0
 public Developer(string firstName, string lastName, string id, decimal salary, DepartmentType department, List<Project> projects)
     : base(firstName, lastName, id, salary, department)
 {
     this.projects = new List<Project>();
 }
Exemplo n.º 52
0
    /// <summary>
    /// This function builds a panel with the controls necessary to
    /// allow the admin to perform shared-department-conflict resolution.
    /// </summary>
    /// <param name="user1">The first user involved in the conflict.</param>
    /// <param name="user2">The second user involved in the conflict.</param>
    /// <param name="department">The department the two users share.</param>
    private void BuildTooManyDeptConflictPanel(User user1, User user2,
        DepartmentType department, int conflictID)
    {
        // create the panel
        Panel panel = new Panel();
        panel.CssClass = "alert";
        panel.ID = "ConflictPanel" + conflictID.ToString("0000");

        // Create a label which explicates the conflict
        HtmlGenericControl message = new HtmlGenericControl("p");
        message.InnerText = user1.FirstName + " " + user1.LastName + " and "
            + user2.FirstName + " " + user2.LastName + " were both elected to the "
            + committee.Name + "but they are both members of the " + user1.Department.ToString()
            + " department.  Only one member of each department may be elected to the committee.";
        panel.Controls.Add(message);

        HtmlGenericControl hp = new HtmlGenericControl("p");
        // add a button which will allow the admin to disqualify the
        // first person in the conflict
        Button first = new Button();
        first.CssClass = "btn btn-warning";
        first.ID = user1.Email + conflictID.ToString("0000");
        first.Text = "Disqualify " + user1.FirstName + " " + user1.LastName;
        first.Click += new EventHandler(this.Disq_Click);
        hp.Controls.Add(first);

        // add a button which will allow the admin to disqualify the
        // second person in the conflict
        Button second = new Button();
        second.CssClass = "btn btn-warning";
        second.ID = user2.Email + conflictID.ToString("0000");
        second.Text = "Disqualify " + user2.FirstName + " " + user2.LastName;
        second.Click += new EventHandler(this.Disq_Click);
        hp.Controls.Add(second);

        panel.Controls.Add(hp);

        AdminConflictPanel.Controls.Add(panel);
    }