//public StatementRestFewHours(string sidEmployee, int hoursCount, DateTime hourStart, DateTime dateRest, string cause = null)
        //{
        //    Init(hoursCount, hourStart, dateRest, cause);
        //}
        //public StatementRestFewHours(int idEmployee, int hoursCount, DateTime hourStart, DateTime dateRest, string cause = null)
        //{
        //    Init(hoursCount, hourStart, dateRest, cause);
        //}
        //int hoursCount, DateTime hourStart, DateTime dateRest, string cause = null
        public void Configure()
        {
            base.Configure(SidEmployee, "GRP");
                //Organization.Director = new Employee().GetDirector();
                Matchers = new List<Employee>() {Employee.Manager};
                var depDir = new Employee().GetDepartmentDirector(SidEmployee);
                if (depDir != null)
                {
                    if (Employee.Manager.Id != depDir.Id) Matchers.Add(depDir);
                }
                if (HoursCount <= 0) throw new ArgumentException("Количество часов должно быть больше 0");
                Name = "Служебная записка";
                HoursCount = HoursCount;
                HourEnd = HourStart.AddHours(HoursCount);

                //Склоняем часы
                string hoursStr = "часа";
                int hDig = HoursCount%10;
                if (hDig == 1) hoursStr = "час";
                if (hDig > 1 && hDig < 5) hoursStr = "часа";
                if (hDig > 4 && hDig < 21) hoursStr = "часов";

                Text =
                    String.Format(
                        "Прошу предоставить мне {0} {5} рабочего времени с {1:HH:mm} по {2:HH:mm} {3:dd.MM.yyyy} года за свой счет {4}.",
                        HoursCount, HourStart, HourEnd, DateRest, Cause, hoursStr);
        }
Exemple #2
0
        public void TestModel()
        {
            Employee emp = new Employee();

            string surname51 = (new char[51]).ToString();
            Assert.IsTrue(surname51.Length == 51);
            emp.Surname = surname51;
            Assert.IsTrue(emp.Surname.Length==50);
        }
        public void Configure()
        {
            base.Configure(SidEmployee);
            Matchers = new List<Employee>() { Employee.Manager };
            var depDir = new Employee().GetDepartmentDirector();
            if (Employee.Manager.AdSid != depDir.AdSid) Matchers.Add(depDir);
             if (DaysCount <= 0) throw new ArgumentException("Количество дней должно быть больше 0");
            DateEnd = DateStart.AddDays(DaysCount);

            Name = "З А Я В Л Е Н И Е";
            Text = String.Format("прошу предоставить мне отпуск без сохранения заработной платы в количестве {0} календарных дней с {1:dd.MM.yyyy} г. по {2:dd.MM.yyyy} г., включительно, {3}.", DaysCount, DateStart, DateEnd, Cause);
        }
        public ActionResult Edit(int? id)
        {
            var user = DisplayCurUser();
            if (!user.UserCanEdit()) return RedirectToAction("AccessDenied", "Error");

            if (id.HasValue)
            {
                var emp = new Employee(id.Value);
                return View(emp);
            }
            else
            {
                return View("New");
            }
        }
Exemple #5
0
 //public Statement(int idEmployee)
 //{
 //    Employee = new Employee(idEmployee);
 //    Init();
 //}
 //public Statement(string sidEmployee)
 //{
 //    Employee = new Employee(sidEmployee);
 //    Init();
 //}
 protected void Configure(string empSid, string organizationSysName = null)
 {
     Employee = new Employee(empSid);
     Employee.Position = new Position(Employee.Position.Id);
     Employee.PositionOrg = new Position(Employee.PositionOrg.Id);
     if (String.IsNullOrEmpty(organizationSysName))
     {
         Organization = new Organization(Employee.Organization.Id);
     }
     else
     {
         Organization = new Organization(organizationSysName);
     }
     //Organization.Name = Organization.Name.Replace("«", "\"").Replace("»", "\"");
     Organization.Director = new Employee(Organization.Director.Id, true);
     Organization.Director.Position = new Position(Organization.Director.Position.Id);
     Organization.Director.PositionOrg = new Position(Organization.Director.PositionOrg.Id);
 }
        public ActionResult Edit(Employee emp)
        {
            var user = DisplayCurUser();
            if (!user.UserCanEdit()) return RedirectToAction("AccessDenied", "Error");

            //Save employee
            try
            {
                ResponseMessage responseMessage;
                bool complete = SaveEmployee(emp, out responseMessage);
                if (!complete) throw new Exception(responseMessage.ErrorMessage);
                return RedirectToAction("Index", "Employee", new { id = responseMessage.Id });
            }
            catch (Exception ex)
            {
                ViewData["ServerError"] = ex.Message;
                return View("Edit", emp);
            }
        }
Exemple #7
0
 protected void SetMatchersOficial(string empSid)
 {
     Matchers = new List<Employee>() { Employee.Manager };
     var depDir = new Employee().GetDepartmentDirector(empSid);
     if (depDir != null)
     {
         if (Employee.Manager.Id != depDir.Id && Employee.Id != depDir.Id) Matchers.Add(depDir);
     }
     else
     {
         depDir = new Employee();
     }
     var dir = new Employee().GetDirector();
     if (dir != null)
     {
         if (Employee.Manager.Id != dir.Id && depDir.Id != dir.Id) Matchers.Add(dir);
     }
 }
Exemple #8
0
 private void FillSelf(Employee emp)
 {
     Id = emp.Id;
     AdSid = emp.AdSid;
     Manager = emp.Manager;
     Surname = emp.Surname;
     Name = emp.Name;
     Patronymic = emp.Patronymic;
     FullName = emp.FullName;
     DisplayName = emp.DisplayName;
     Position = emp.Position;
     Organization = emp.Organization;
     Email = emp.Email;
     WorkNum = emp.WorkNum;
     MobilNum = emp.MobilNum;
     EmpState = emp.EmpState;
     Department = emp.Department;
     City = emp.City;
     Photo = emp.Photo;
     DateCame = emp.DateCame;
     BirthDate = emp.BirthDate;
     IsChief = emp.IsChief;
     Male = emp.Male;
     PositionOrg = emp.PositionOrg;
     HasAdAccount = emp.HasAdAccount;
     Creator = emp.Creator;
     ExpirenceString = emp.ExpirenceString;
     FullNameDat = emp.FullNameDat;
     FullNameRod = emp.FullNameRod;
     ShortNameDat = emp.ShortNameDat;
     ShortNameRod = emp.ShortNameRod;
 }
Exemple #9
0
 public Organization()
 {
     StateImages = new List<OrgStateImage>();
     Director = new Employee();
 }
        public bool SaveEmployee(Employee emp, out ResponseMessage responseMessage)
        {
            if (Request.Files.Count > 0 && Request.Files[0] != null && Request.Files[0].ContentLength > 0)
            {
                var file = Request.Files[0];

                string ext = Path.GetExtension(file.FileName).ToLower();

                if (ext != ".png" && ext != ".jpeg" && ext != ".jpg" && ext != ".gif") throw new Exception("Формат фотографии должен быть .png .jpeg .gif");

                byte[] picture = null;
                using (var br = new BinaryReader(file.InputStream))
                {
                    picture = br.ReadBytes(file.ContentLength);
                }
                emp.Photo = picture;
            }
            emp.Creator = new Employee(){AdSid = GetCurUser().Sid};
            //var chkCreateAdUser = Request.Form["chkCreateAdUser"];
            //bool createAdUser = chkCreateAdUser != "false";
            bool complete = emp.Save(out responseMessage);
            return complete;
        }
        public ActionResult New(bool? test)
        {
            var user = DisplayCurUser();
            if (!user.UserCanEdit()) return RedirectToAction("AccessDenied", "Error");

            var emp = new Employee() {HasAdAccount = true};

            if (test.HasValue && test.Value)
            {
                emp.Name = "Тест";
                emp.Surname = "Тестов";
                emp.Patronymic = "Тестович";
                emp.MobilNum = "9536001000";
                emp.WorkNum = "111";
                emp.Email = "*****@*****.**";
                emp.City = new City() { Id = 26 };
                emp.Organization = new Organization() { Id = 45 };
                emp.Position = new Position() { Id = 46 };
                emp.PositionOrg = new Position() { Id = 46 };
                emp.Department = new Department() { Id = 10 };
            }

            return View(emp);
        }
        public ActionResult Index(int? id)
        {
            DisplayCurUser();

            if (id.HasValue && id.Value > 0)
            {
                var emp = new Employee(id.Value);

                return View(emp);
            }
            else
            {
                return RedirectToAction("Index", "Error");
            }
        }
Exemple #13
0
 //public Statement(int idEmployee)
 //{
 //    Employee = new Employee(idEmployee);
 //    Init();
 //}
 //public Statement(string sidEmployee)
 //{
 //    Employee = new Employee(sidEmployee);
 //    Init();
 //}
 protected void Configure(string empSid)
 {
     Employee = new Employee(empSid);
     Organization = new Organization(Employee.Organization.Id);
     Organization.Director = new Employee(Organization.Director.AdSid);
 }