Example #1
0
        //public ActionResult SendMessages()
        //{
        //    List<User> users = db.User.Where(p => p.id== 4203 || p.id== 3867).ToList();
        //    List<string> errors = new List<string>();
        //    string smtpHost = "mail.unibel.by";
        //    string pass = "******";
        //    string from = "*****@*****.**";
        //    string subject = "Регистрация в Системе АИС \"Мониторинг\"";

        //    int i = 0;
        //    foreach (var u in users)
        //    {
        //        string to = u.email.Trim();
        //        string pass_user = u.NewRandomPassword(10);
        //        u.password = Models.User.HashPassword(pass_user);
        //        db.User.AddOrUpdate(u);
        //        db.SaveChanges();

        //        string message = "<table style = 'max-width:600px; width:100%; margin:0; padding:0; font-family: Times New Roman; font-size: 16px;' border = '0' cellpadding = '1' cellspacing = '5'><tr><td style = 'text-align:center; font-size:18px'><b>Уважаемый " + u.Surname + " " + u.Name + " " + u.Patronumic + "!</b></td></tr>";
        //        message = message + "<tr><td style = 'text-align:justify'> С целью оценки качества функционирования официальных интернет-сайтов органов государственного управления, подведомственных им учреждений образования и организаций, подчиненных Министерству образования Республики Беларусь Вам предоставлен доступ к автоматизированной информационной системе аудита информационных ресурсов учреждений образования Республики Беларусь (АИС Мониторинг).</td></tr><tr><td><b> Для авторизации в АИС Мониторинг необходимо:</b></td></tr><tr><td>&nbsp;– перейти по адресу в глобальной сети Интернет: <a target = '_blank' href = 'http://ais-monitoring.unibel.by' > http://ais-monitoring.unibel.by</a>;</td></tr><tr><td>&nbsp;– нажать в правом верхнем углу открывшегося окна режим входа в систему (кнопка «Войти»);</td></tr> ";
        //        message = message + "<tr><td>&nbsp;– ввести следующие данные: логин <b>" + u.email.Trim() + "</b> пароль <b>" + pass_user + "</b> .</td></tr> <tr><td> После успешной процедуры регистрации и входа Вам доступна роль ";
        //        if (u.role_id == 2) { message += "Куратор."; }
        //        else if (u.role_id == 3) { message += "Контролер."; }
        //        else if (u.role_id == 4) { message += "Эксперт."; }
        //        message = message + "</td></tr><tr><td>В разделе «Профиль» Вы можете отредактировать данные или изменить пароль.</td></tr><tr><td>Перед работой в АИС Мониторинг ознакомьтесь с разделом «Справка», где представлено описание принципа работы.</td></tr> <tr><td>Вопросы, замечания и предложения по работе с АИС Мониторинг Вы можете присылать по адресу электронной почты: <a href = 'mailto:[email protected]'> [email protected] </a>.";
        //        if (u.role_id == 2) { message += "За дополнительной информацией обращайтесь в вышестоящие управления по образованию."; }
        //        message = message + "</td></tr><tr><td style = 'height:10px;'></td></tr> <tr><td> <span style='color:#f44336;'>*</span>";
        //        if (u.role_id == 2) { message += "Куратор – лицо, ответственное за работу сайта своей организации."; }
        //        else if (u.role_id == 3) { message += "Контролер – ответственное лицо от местных исполнительных и распорядительных органов в сфере образования, специалист вышестоящей организации, которому доступны результаты мониторинга сайтов подведомственных ей учреждений."; }
        //        else if (u.role_id == 4) { message += "Эксперт – ответственный сотрудник, отвечающий за проведение экспертиз интернет-сайтов, а также проверка и поддержание в актуальном состоянии перечня подведомственных учреждений образования."; }
        //        message = message + "</td></tr><tr><td style = 'height:20px;'></td> </tr> <tr><td>-- <br/>АИС Мониторинг</td> </tr></table>";

        //        try
        //        {
        //            MailMessage mail = new MailMessage();
        //            mail.IsBodyHtml = true;
        //            mail.From = new MailAddress(from);
        //            mail.To.Add(new MailAddress(to));
        //            mail.Subject = subject;
        //            mail.Body = message;
        //            SmtpClient client = new SmtpClient();
        //            client.Host = smtpHost;
        //            client.Port = 25;
        //            client.Credentials = new NetworkCredential(from.Split('@')[0], pass);
        //            client.DeliveryMethod = SmtpDeliveryMethod.Network;
        //            client.Send(mail);
        //            mail.Dispose();
        //        }
        //        catch (Exception e)
        //        {
        //            errors.Add(u.email);
        //            //throw new Exception("Mail.Send: " + e.Message);
        //        }
        //        ++i;
        //    }

        //    return Redirect("/Users/Index");
        //}

        public ActionResult Address()
        {
            Microsoft.Office.Interop.Excel.Application ObjWorkExcel = new Microsoft.Office.Interop.Excel.Application();                                                                                                                                                                                                        //открыть эксель
            Microsoft.Office.Interop.Excel.Workbook    ObjWorkBook  = ObjWorkExcel.Workbooks.Open(@"d:\addres_site.xlsx", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //открыть файл
            Microsoft.Office.Interop.Excel.Worksheet   ObjWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ObjWorkBook.Sheets[1];                                                                                                                                                                                         //получить 1 лист
            var lastCell = ObjWorkSheet.Cells.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell);                                                                                                                                                                                                      //1 ячейку
            int iLastRow = ObjWorkSheet.Cells[ObjWorkSheet.Rows.Count, "A"].End[Microsoft.Office.Interop.Excel.XlDirection.xlUp].Row;                                                                                                                                                                                          //последняя заполненная строка в столбце А
            var arrData  = (object[, ])ObjWorkSheet.Range["A1:B" + iLastRow].Value;

            ObjWorkBook.Close(false, Type.Missing, Type.Missing); //закрыть не сохраняя
            ObjWorkExcel.Quit();                                  // выйти из экселя

            List <audit_object> a = db.audit_object.ToList();

            for (int i = 1; i <= iLastRow; ++i)
            {
                int          k = Convert.ToInt32(arrData[i, 1]);
                audit_object b = a.FirstOrDefault(p => p.id == k);
                if (b != null)
                {
                    b.adress_site = arrData[i, 2].ToString();
                    db.audit_object.AddOrUpdate(b);
                    db.SaveChanges();
                }
            }
            return(Redirect("/Institution/Index"));
        }
 public ActionResult Edit(education__institution education__institution)
 {
     if (ModelState.IsValid)
     {
         audit_object site = db.audit_object.Find(education__institution.audit_object_id);
         site.adress_site = education__institution.audit_object.adress_site;
         db.audit_object.AddOrUpdate(site);
         db.SaveChanges();
         education__institution.audit_object    = null;
         db.Entry(education__institution).State = EntityState.Modified;
         db.SaveChanges();
     }
     ViewBag.audit_object_id             = new SelectList(db.audit_object, "id", "title_site", education__institution.audit_object_id);
     ViewBag.department_subordination_id = new SelectList(db.department_subordination, "id", "name", education__institution.department_subordination_id);
     ViewBag.district_id = new SelectList(db.district, "id", "name", education__institution.district_id);
     if (education__institution.district_id > 0)
     {
         ViewBag.area_id = new SelectList(db.area, "id", "name", db.district.Find(education__institution.district_id).area_id);
     }
     else
     {
         ViewBag.area_id = new SelectList(db.area, "id", "name");
     }
     ViewBag.kind_edu_id                   = new SelectList(db.kind_edu, "id", "name", education__institution.kind_edu_id);
     ViewBag.ownership_type_id             = new SelectList(db.ownership_type, "id", "name", education__institution.ownership_type_id);
     ViewBag.type_edu_id                   = new SelectList(db.type_edu, "id", "name", education__institution.type_edu_id);
     ViewBag.type_education_institution_id = new SelectList(db.type_education_institution, "id", "nane", education__institution.type_education_institution_id);
     return(View(education__institution));
 }
        public ActionResult Create(education__institution education__institution)
        {
            education__institution.id = (db.education__institution.Count() > 0) ? (db.education__institution.Max(p => p.id) + 1) : 1;
            audit_object a = new audit_object();

            a.id          = (db.audit_object.Count() > 0) ? (db.audit_object.Max(p => p.id) + 1) : 1;
            a.adress_site = education__institution.audit_object.adress_site;
            a.title_site  = education__institution.full_name;
            db.audit_object.Add(a);
            db.SaveChanges();
            education__institution.audit_object    = null;
            education__institution.state_id        = 1;
            education__institution.audit_object_id = a.id;
            db.education__institution.Add(education__institution);
            db.SaveChanges();
            return(Redirect("/Institution/Index"));
        }
Example #4
0
        // GET: Experts/Details/5
        public ActionResult _answer_end(int site_id, int group_id, int?m)
        {
            int type_organization     = Convert.ToInt32(db.audit_object.Find(site_id).education__institution.First(p => p.audit_object_id == site_id).type_education_institution_id);
            int not_type_organization = (type_organization == 1) ? 1 : 2;

            if (m == null)
            {
                audit_object a          = db.audit_object.Find(site_id);
                monitoring   monitoring = db.monitoring.OrderByDescending(p => p.date_end).FirstOrDefault(p => p.date_end < DateTime.Now && p.Rating.Count(t => t.audit_object_id == site_id) > 0);
                if (monitoring != null)
                {
                    m = monitoring.id;
                }
            }
            List <Experts_comments> answers = db.Experts_comments.Where(p => p.site_experts.audit_object_id == site_id && p.site_experts.monitoring_id == m && p.Criteria.group_id == group_id && p.Criteria.type_organization != not_type_organization).ToList();
            List <Experts_comments> result  = new List <Experts_comments>();
            int             id = 1;
            List <Criteria> cr = db.Criteria.Where(p => p.group_id == group_id && p.type_organization != not_type_organization).ToList();

            foreach (Criteria c in cr)
            {
                List <Experts_comments> cr_answer = answers.Where(p => p.criteria_id == c.id).ToList();
                Experts_comments        one       = new Experts_comments();
                one.id          = id++;
                one.criteria_id = c.id;
                int count_cr = cr_answer.Count();
                one.Criteria = c;
                int sum = 0;
                for (int i = 0; i < cr_answer.Count(); ++i)
                {
                    one.answer         += cr_answer.ElementAt(i).answer;
                    one.site_experts_id = cr_answer.ElementAt(i).site_experts_id;
                    one.comment        += " " + cr_answer.ElementAt(i).comment;
                }
                if (count_cr != 0)
                {
                    one.answer = Convert.ToInt32(Math.Round(Convert.ToDouble(one.answer) / count_cr));
                }
                else
                {
                    one.answer = 0;
                }
                result.Add(one);
            }
            return(PartialView(result));
        }
Example #5
0
        public ActionResult _rating(int?id)
        {
            int           site   = (id != null) ? Convert.ToInt32(id) : Convert.ToInt32(Session["curator_site_id"]);
            audit_object  s      = db.audit_object.Find(site);
            monitoring    m      = db.monitoring.OrderByDescending(p => p.date_end).FirstOrDefault(p => p.date_end < DateTime.Now && p.Rating.Count(a => a.audit_object_id == site) > 0);
            List <Rating> rating = new List <Rating>();
            int           place  = 0;

            if (m != null)
            {
                rating = db.Rating.Where(p => p.monitoring_id == m.id).OrderByDescending(p => p.sum).ToList();
                for (int i = 0; i < rating.Count(); ++i)
                {
                    if (rating.ElementAt(i).audit_object_id == site)
                    {
                        place = i + 1;
                        break;
                    }
                }
            }
            ViewBag.place = place;
            return(PartialView(s));
        }
        public ActionResult GetExcelUO()
        {
            Microsoft.Office.Interop.Excel.Application ObjWorkExcel = new Microsoft.Office.Interop.Excel.Application();                                                                                                                                                                                                             //открыть эксель
            Microsoft.Office.Interop.Excel.Workbook    ObjWorkBook  = ObjWorkExcel.Workbooks.Open(@"d:\novopolock_forma.xlsx", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //открыть файл
            Microsoft.Office.Interop.Excel.Worksheet   ObjWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ObjWorkBook.Sheets[1];                                                                                                                                                                                              //получить 1 лист
            var lastCell = ObjWorkSheet.Cells.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell);                                                                                                                                                                                                           //1 ячейку
            int iLastRow = ObjWorkSheet.Cells[ObjWorkSheet.Rows.Count, "A"].End[Microsoft.Office.Interop.Excel.XlDirection.xlUp].Row;                                                                                                                                                                                               //последняя заполненная строка в столбце А
            var arrData  = (object[, ])ObjWorkSheet.Range["A1:Z" + iLastRow].Value;

            ObjWorkBook.Close(false, Type.Missing, Type.Missing); //закрыть не сохраняя
            ObjWorkExcel.Quit();                                  // выйти из экселя

            int id1 = (db.audit_object.Count() > 0) ? (db.audit_object.Max(p => p.id) + 1) : 1, id2 = (db.education__institution.Count() > 0) ? (db.education__institution.Max(p => p.id) + 1) : 1, id3 = (db.User.Count() > 0) ? (db.User.Max(p => p.id) + 1) : 1, id4 = (db.curators_and_controlers.Count() > 0) ? (db.curators_and_controlers.Max(p => p.id) + 1) : 1;

            for (int i = 5; i <= iLastRow; ++i)
            {
                string       site = (arrData[i, 20] != null) ? arrData[i, 20].ToString() : " ";
                audit_object a    = new audit_object();
                if (!site.Equals(" "))
                {
                    a.id          = id1++;
                    a.adress_site = site;
                    a.title_site  = (arrData[i, 3] != null) ? arrData[i, 3].ToString() : " ";
                    db.audit_object.Add(a);
                    db.SaveChanges();
                }
                education__institution e = new education__institution();
                e.id         = id2++;
                e.full_name  = (arrData[i, 2] != null) ? arrData[i, 2].ToString() : " ";
                e.short_name = (arrData[i, 3] != null) ? arrData[i, 3].ToString() : " ";
                if (!site.Equals(" "))
                {
                    e.audit_object_id = a.id;
                }
                if (arrData[i, 5] != null)
                {
                    e.district_id = Convert.ToInt32(arrData[i, 5]);
                }
                e.address = (arrData[i, 6] != null) ? arrData[i, 6].ToString() : " ";
                e.email   = (arrData[i, 7] != null) ? arrData[i, 7].ToString() : " ";
                e.phone   = (arrData[i, 8] != null) ? arrData[i, 8].ToString() : " ";
                if (arrData[i, 9] != null)
                {
                    e.type_edu_id = Convert.ToInt32(arrData[i, 9]);
                }
                if (arrData[i, 10] != null)
                {
                    e.kind_edu_id = Convert.ToInt32(arrData[i, 10]);
                }
                e.OKPO           = (arrData[i, 11] != null) ? arrData[i, 11].ToString() : " ";
                e.UNP            = (arrData[i, 12] != null) ? arrData[i, 12].ToString() : " ";
                e.director       = (arrData[i, 13] != null) ? arrData[i, 13].ToString() : " ";
                e.is_application = 0;
                if (arrData[i, 15] != null)
                {
                    e.type_education_institution_id = Convert.ToInt32(arrData[i, 15]);
                }
                if (arrData[i, 16] != null)
                {
                    e.ownership_type_id = Convert.ToInt32(arrData[i, 16]);
                }
                if (arrData[i, 17] != null)
                {
                    e.department_subordination_id = Convert.ToInt32(arrData[i, 17]);
                }
                e.state_id = 1;
                e.UNP_superior_management = (arrData[i, 19] != null) ? arrData[i, 19].ToString() : " ";
                db.education__institution.Add(e);
                db.SaveChanges();

                if (!site.Equals(" "))
                {
                    User u = new User();
                    u.id         = id3++;
                    u.Surname    = (arrData[i, 21] != null) ? arrData[i, 21].ToString() : " ";
                    u.Name       = (arrData[i, 22] != null) ? arrData[i, 22].ToString() : " ";
                    u.Patronumic = (arrData[i, 23] != null) ? arrData[i, 23].ToString() : " ";
                    u.email      = (arrData[i, 25] != null) ? arrData[i, 25].ToString() : " ";
                    u.phone      = (arrData[i, 26] != null) ? arrData[i, 26].ToString().Trim() : " ";
                    u.position   = (arrData[i, 24] != null) ? arrData[i, 24].ToString() : " ";
                    u.password   = Models.User.HashPassword("password");
                    u.state_id   = 1;
                    u.role_id    = (e.type_education_institution_id > 1) ? 3 : 2;
                    db.User.Add(u);
                    db.SaveChanges();

                    curators_and_controlers c = new curators_and_controlers();
                    c.id         = id4++;
                    c.curator_id = u.id;
                    c.education_institution_id = e.id;
                    db.curators_and_controlers.Add(c);
                    db.SaveChanges();
                }
            }

            return(Redirect("/Institution/Index"));
        }