public ActionResult New(Organization org)
        {
            var user = DisplayCurUser();
            if (!user.UserCanEdit()) return RedirectToAction("AccessDenied", "Error");

            try
            {
                ResponseMessage responseMessage;
                bool complete = SaveOrganization(org, out responseMessage);
                if (!complete) throw new Exception(responseMessage.ErrorMessage);
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                TempData["ServerError"] = ex.Message;
                return View("New", org);
            }
        }
示例#2
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);
     Organization.Director.Position = new Position(Organization.Director.Position.Id);
     Organization.Director.PositionOrg = new Position(Organization.Director.PositionOrg.Id);
 }
示例#3
0
 private void FillSelf(Organization model)
 {
     Id = model.Id;
     Name = model.Name;
     EmpCount = model.EmpCount;
     AddressUr = model.AddressUr;
     AddressFact = model.AddressFact;
     Phone = model.Phone;
     Email = model.Email;
     Inn = model.Inn;
     Kpp = model.Kpp;
     Ogrn = model.Ogrn;
     Rs = model.Rs;
     Bank = model.Bank;
     Ks = model.Ks;
     Bik = model.Bik;
     Okpo = model.Okpo;
     Okved = model.Okved;
     //ManagerName = model.ManagerName;
     //ManagerNameDat = model.ManagerNameDat;
     //ManagerPosition = model.ManagerPosition;
     //ManagerPositionDat = model.ManagerPositionDat;
     Site = model.Site;
     StateImages = model.StateImages;
     //ManagerShortName = model.ManagerShortName;
     Director = model.Director;
 }
 public bool SaveOrganization(Organization org, out ResponseMessage responseMessage)
 {
     if (Request.Files.Count > 0)
     {
         for (int i = 0; i < Request.Files.Count; i++)
         {
             var file = Request.Files[i];
             if (file != null)
             {
                 byte[] data = null;
                 using (var br = new BinaryReader(file.InputStream))
                 {
                     data = br.ReadBytes(file.ContentLength);
                 }
                 org.StateImages.Add(new OrgStateImage(data));
             }
         }
     }
     bool complete = org.Save(out responseMessage);
     return complete;
 }
示例#5
0
 public DocumentEmployeeList()
 {
     Employees = Employee.GetList(26, showHidden:false);
     Organization = new Organization("UPR");
 }
示例#6
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);
 }
示例#7
0
        public ActionResult DocumentHeader(int? idOrg)
        {
            if (!idOrg.HasValue) return HttpNotFound();
            var org = new Organization(idOrg.Value);

            return PartialView(org);
        }