public void Delete(Intern intern) { _iDIntern.Delete(EIntern(intern)); }
public void Put(int id, [FromBody] Intern intern) { intern.Id = id; internshipService.EditMember(intern); hubContext.Clients.All.SendAsync("EditMember", intern.Name, intern.Id); }
public static ItemTail New(Intern <ItemTail> cache, [NotNull] ItemType type, [NotNull] string[] values) { return(cache.GetReference(new ItemTail(type, values))); }
public static IHystrixCommandGroupKey AsKey(string name) { return(Intern.GetOrAddEx(name, k => new HystrixCommandGroupKeyDefault(k))); }
/// <summary> /// Retrieve (or create) an interned IHystrixThreadPoolKey instance for a given name. /// </summary> /// <param name="name"> thread pool name </param> /// <returns> IHystrixThreadPoolKey instance that is interned (cached) so a given name will always retrieve the same instance. </returns> public static IHystrixThreadPoolKey AsKey(string name) { return(Intern.GetOrAddEx(name, k => new HystrixThreadPoolKeyDefault(k))); }
void next_token() { repeat: token.start = stream; token.suffix = 0; token.mod = 0; switch (*stream) { case ' ': case '\n': case '\r': case '\t': case '\v': while (char.IsWhiteSpace(*stream)) { if (*stream++ == '\n') { line_start = stream; token.pos.line++; } } goto repeat; case '\'': scan_char(); break; case '"': scan_str(); break; case '.': if (char.IsDigit(stream[1])) { scan_float(); } else if (stream[1] == '.' && stream[2] == '.') { token.kind = TOKEN_ELLIPSIS; stream += 3; } else { token.kind = TOKEN_DOT; stream++; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': while (char.IsDigit(*stream)) { stream++; } var c = *stream; stream = token.start; if (c == '.' || char.ToLower(c) == 'e') { scan_float(); } else { scan_int(); } break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': while (char.IsLetterOrDigit(*stream) || *stream == '_') { stream++; } token.name = Intern.InternRange(token.start, stream); token.kind = is_keyword_name(token.name) ? TOKEN_KEYWORD : TOKEN_NAME; break; case '<': stream++; if (*stream == '<') { token.kind = TOKEN_LSHIFT; stream++; if (*stream == '=') { token.kind = TOKEN_LSHIFT_ASSIGN; stream++; } } else if (*stream == '=') { token.kind = TOKEN_LTEQ; stream++; } else { token.kind = TOKEN_LT; } break; case '>': stream++; if (*stream == '>') { token.kind = TOKEN_RSHIFT; stream++; if (*stream == '=') { token.kind = TOKEN_RSHIFT_ASSIGN; stream++; } } else if (*stream == '=') { token.kind = TOKEN_GTEQ; stream++; } else { token.kind = TOKEN_GT; } break; case '\0': token.kind = TOKEN_EOF; stream++; break; case '(': token.kind = TOKEN_LPAREN; stream++; break; case ')': token.kind = TOKEN_RPAREN; stream++; break; case '{': token.kind = TOKEN_LBRACE; stream++; break; case '}': token.kind = TOKEN_RBRACE; stream++; break; case '[': token.kind = TOKEN_LBRACKET; stream++; break; case ']': token.kind = TOKEN_RBRACKET; stream++; break; case ',': token.kind = TOKEN_COMMA; stream++; break; case '?': token.kind = TOKEN_QUESTION; stream++; break; case ';': token.kind = TOKEN_SEMICOLON; stream++; break; case '~': token.kind = TOKEN_NEG; stream++; break; case '@': token.kind = TOKEN_AT; stream++; break; case '#': token.kind = TOKEN_POUND; stream++; break; // CASE2 case ':': stream++; if (*stream == '=') { token.kind = TOKEN_COLON_ASSIGN; stream++; } else { token.kind = TOKEN_COLON; } break; case '!': stream++; if (*stream == '=') { token.kind = TOKEN_NOTEQ; stream++; } else { token.kind = TOKEN_NOT; } break; case '=': stream++; if (*stream == '=') { token.kind = TOKEN_EQ; stream++; } else { token.kind = TOKEN_ASSIGN; } break; case '^': stream++; if (*stream == '=') { token.kind = TOKEN_XOR_ASSIGN; stream++; } else { token.kind = TOKEN_XOR; } break; case '*': stream++; if (*stream == '=') { token.kind = TOKEN_MUL_ASSIGN; stream++; } else { token.kind = TOKEN_MUL; } break; case '/': if (*++stream == '=') { token.kind = TOKEN_DIV_ASSIGN; stream++; } else if (*stream == '/') { stream++; while (*stream != 0 && *stream != '\n') { stream++; } goto repeat; } else if (*stream == '*') { stream++; int level = 1; while (*stream != 0 && level > 0) { if (stream[0] == '/' && stream[1] == '*') { level++; stream += 2; } else if (stream[0] == '*' && stream[1] == '/') { level--; stream += 2; } else { if (*stream == '\n') { token.pos.line++; } stream++; } } goto repeat; } else { token.kind = TOKEN_DIV; } break; case '%': stream++; if (*stream == '=') { token.kind = TOKEN_MOD_ASSIGN; stream++; } else { token.kind = TOKEN_MOD; } break; // CASE3 Types case '+': stream++; if (*stream == '=') { token.kind = TOKEN_ADD_ASSIGN; stream++; } else if (*stream == '+') { token.kind = TOKEN_INC; stream++; } else { token.kind = TOKEN_ADD; } break; case '-': stream++; if (*stream == '=') { token.kind = TOKEN_SUB_ASSIGN; stream++; } else if (*stream == '-') { token.kind = TOKEN_DEC; stream++; } else { token.kind = TOKEN_SUB; } break; case '&': stream++; if (*stream == '=') { token.kind = TOKEN_AND_ASSIGN; stream++; } else if (*stream == '&') { token.kind = TOKEN_AND_AND; stream++; } else { token.kind = TOKEN_AND; } break; case '|': stream++; if (*stream == '=') { token.kind = TOKEN_OR_ASSIGN; stream++; } else if (*stream == '|') { token.kind = TOKEN_OR_OR; stream++; } else { token.kind = TOKEN_OR; } break; default: error_here("Invalid '{0}' token, skipping", *stream); stream++; goto repeat; } token.end = stream; token.pos.col = token.start - line_start + 1; }
public ActionResult imPortExcel(HttpPostedFileBase excelfile, string organID) { // Kiểm tra file đó có tồn tại hay không if (excelfile == null || excelfile.ContentLength == 0) { ViewBag.ListSchool = new Share().listOrgan(2).ToList(); ViewBag.Error = "Thêm File mới<br /> "; return(View("imPortExcel")); } else { // kiểm tra đuôi file có phải là file Excel hay không if (excelfile.FileName.EndsWith("xls") || excelfile.FileName.EndsWith("xlsx")) { // Khai báo đường dẫn string path = Path.Combine("D:/", excelfile.FileName); // Tạo đối tượng COM. Tạo một đối tượng COM cho mọi thứ được tham chiếu Excel.Application application = new Excel.Application(); // Tạo application cái này là mở ms Excel Excel.Workbook workbook = application.Workbooks.Open(path); // Mở WorkBook Mở file Excel mình truyền vào Excel.Worksheet worksheet = (Excel.Worksheet)workbook.ActiveSheet; // Mở worksheet Mở sheet đầu tiên Excel.Range range = worksheet.UsedRange; //Lặp lại qua các hàng và cột và in ra bàn điều khiển khi nó xuất hiện trong tệp //excel is not zero based!! var role = Convert.ToInt32(Session["Role"].ToString()); if (role == 3) { var schoolID = Session["SchoolID"].ToString(); for (int i = 2; i < range.Rows.Count; i++) { Person person = new Person(); string personID; do { personID = new Share().RandomText(); } while (new CompanyAndSchool().FindPerson(personID) == false); person.PersonID = personID; person.LastName = ((Excel.Range)range.Cells[i, 3]).Text; person.FirstName = ((Excel.Range)range.Cells[i, 4]).Text; DateTime dateValue = DateTime.FromOADate(Convert.ToDouble(((Excel.Range)range.Cells[i, 5]).Value)); // Dòng code này có ý nghĩa là nó sẽ chuyển đối kiểu số thành ngày lại person.Birthday = dateValue; int gender = int.Parse(((Excel.Range)range.Cells[i, 6]).Text); person.Gender = Convert.ToBoolean(gender); person.Address = ((Excel.Range)range.Cells[i, 7]).Text; person.Phone = ((Excel.Range)range.Cells[i, 8]).Text; person.Email = ((Excel.Range)range.Cells[i, 9]).Text; person.SchoolID = schoolID; person.CompanyID = organID; person.RoleID = 5; //listproducts.Add(product); InsertPer(person); if (SendMailTK(personID)) { Intern intern = new Intern(); intern.PersonID = personID; intern.StudentCode = ((Excel.Range)range.Cells[i, 2]).Text; intern.Result = 0; InsertInt(intern); } } } else { var companyID = Session["CompanyID"].ToString(); for (int i = 2; i < range.Rows.Count; i++) { Person person = new Person(); string personID; do { personID = new Share().RandomText(); } while (new CompanyAndSchool().FindPerson(personID) == false); person.PersonID = personID; person.LastName = ((Excel.Range)range.Cells[i, 3]).Text; person.FirstName = ((Excel.Range)range.Cells[i, 4]).Text; //person.Birthday = DateTime.ParseExact(((Excel.Range)range.Cells[i, 4]).Text,"yyyy/MM/dd",null); DateTime dateValue = DateTime.FromOADate(Convert.ToDouble(((Excel.Range)range.Cells[i, 5]).Value)); person.Birthday = dateValue; int gender = int.Parse(((Excel.Range)range.Cells[i, 6]).Text); //person.Gender = bool.Parse(Convert.ToUInt32(((Excel.Range)range.Cells[i, 5]).Value)); person.Gender = Convert.ToBoolean(gender); person.Address = ((Excel.Range)range.Cells[i, 7]).Text; person.Phone = ((Excel.Range)range.Cells[i, 8]).Text; person.Email = ((Excel.Range)range.Cells[i, 9]).Text; person.CompanyID = companyID; person.RoleID = 5; //listproducts.Add(product); InsertPer(person); if (SendMailTK(personID)) { Intern intern = new Intern(); intern.PersonID = personID; intern.StudentCode = ((Excel.Range)range.Cells[i, 2]).Text; intern.Result = 0; InsertInt(intern); } } } //cleanup GC.Collect(); GC.WaitForPendingFinalizers(); //xuất các đối tượng com để dừng hoàn toàn quá trình excel chạy trong nền Marshal.ReleaseComObject(range); Marshal.ReleaseComObject(worksheet); //đóng lại và xuất thông tin workbook.Close(); Marshal.ReleaseComObject(workbook); //thoát và xuất thông tin application.Quit(); Marshal.ReleaseComObject(application); //ViewBag.ListProduct = listproducts; //dem = listproducts.Count(); //return View("List"); ViewBag.ListSchool = new Share().listOrgan(2).ToList(); ViewBag.Error = "Thêm thành công<br /> "; return(View("imPortExcel")); } else { ViewBag.ListSchool = new Share().listOrgan(2).ToList(); ViewBag.Error = "File không hợp lệ<br /> "; return(View("imPortExcel")); } } }
public void InsertInt(Intern intern) { database.Intern.Add(intern); database.SaveChanges(); }
public void RemoveIntern(Intern intern) { this.Database.Interns.Remove(intern); this.Database.SaveChanges(); }
public void UpdateIntern(Intern intern) { this.Database.Interns.Update(intern); this.Database.SaveChanges(); }
public void AddIntern(Intern intern) { this.Database.Interns.Add(intern); this.Database.SaveChanges(); }
/// <summary> /// Обработчик контекстного меню списков сотрудников и интернов /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItemWorkList_Click(object sender, RoutedEventArgs e) { // Выбрано меню "Добавить" if ((sender as MenuItem).Header.ToString() == "Добавить") { if (organizationTree.SelectedItem is Department) { // Работаем со списком сотрудников if (employeesList.SelectedItem != null) { Employee employee = new Employee(); DialogNewWorker dlgNewEmployee = new DialogNewWorker(employee); if (dlgNewEmployee.ShowDialog() == true) { (organizationTree.SelectedItem as Department)? .addWorker(employee); // добавляем сотрудника } } // Работаем со списком интернов if (internsList.SelectedItem != null) { Intern intern = new Intern(); DialogNewWorker dlgNewIntern = new DialogNewWorker(intern); if (dlgNewIntern.ShowDialog() == true) { (organizationTree.SelectedItem as Department)? .addWorker(intern); // добавляем интерна } } } } // Выбрано меню "Переместить" if ((sender as MenuItem).Header.ToString() == "Переместить") { if (organizationTree.SelectedItem is Department) { DialogTransferWorker dlgTransferWorker = new DialogTransferWorker(DataContext as Organization); if (dlgTransferWorker.ShowDialog() == true) { // Был выделен сотрудник if (employeesList.SelectedItem != null) { Employee currentEmployee = employeesList.SelectedItem as Employee; // Создаем временного сотрудника для перемещения Employee tmpEmployee = new Employee(currentEmployee.Name, currentEmployee.LastName, currentEmployee.BirthDate, currentEmployee.NamePost, currentEmployee.Salary / 168); (DataContext as Organization).getDepartmentFromId(dlgTransferWorker.ToDepID) .addWorker(tmpEmployee); // Удаляем сотрудника по Id (organizationTree.SelectedItem as Department).removeWorker(currentEmployee.Id); } // Был выделен интерн if (internsList.SelectedItem != null) { Intern currentIntern = internsList.SelectedItem as Intern; // Создаем временного сотрудника для перемещения Intern tmpIntern = new Intern(currentIntern.Name, currentIntern.LastName, currentIntern.BirthDate, currentIntern.Salary); (DataContext as Organization).getDepartmentFromId(dlgTransferWorker.ToDepID) .addWorker(tmpIntern); // Удаляем сотрудника по Id (organizationTree.SelectedItem as Department).removeWorker(currentIntern.Id); } } } } // Выбрано меню "Редактировать" if ((sender as MenuItem).Header.ToString() == "Редактировать") { if (organizationTree.SelectedItem is Department) { // Работаем со списком сотрудников if (employeesList.SelectedItem != null) { Employee employee = employeesList.SelectedItem as Employee; DialogEditWorker dlgEditEmployee = new DialogEditWorker(employee); dlgEditEmployee.ShowDialog(); employee.OnPropertyChanged("Age"); // обновляем отображение возраста } // Работаем со списком интернов if (internsList.SelectedItem != null) { Intern intern = internsList.SelectedItem as Intern; DialogEditWorker dlgEditIntern = new DialogEditWorker(intern); dlgEditIntern.ShowDialog(); intern.OnPropertyChanged("Age"); // обновляем отображение возраста } } // Обновляем интерфейс (organizationTree.SelectedItem as Department).refreshBigBossSalary(); (organizationTree.SelectedItem as Department).refreshLocalBossSalary(); } // Выбрано меню "Удалить" if ((sender as MenuItem).Header.ToString() == "Удалить") { // Работаем со списком сотрудников if (employeesList.SelectedItem != null) { (organizationTree.SelectedItem as Department)? .removeWorker((employeesList.SelectedItem as Worker).Id); // удаление сотрудника с переданным Id } // Работаем со списком интернов if (internsList.SelectedItem != null) { (organizationTree.SelectedItem as Department)? .removeWorker((internsList.SelectedItem as Worker).Id); // удаление интерна с переданным Id } } }
public static char *_I(char *s) { var len = strlen(s); return(Intern.InternRange(s, s + len)); }
public static char *_I(string s) { var c = s.ToPtr(); return(Intern.InternRange(c, c + s.Length)); }
//Обработчик кнопки добавления нового стажера protected void AddIntern_Click(object sender, EventArgs e) { //Берем данные из разметки String name = Name.Text; String universityName = UniversityName.Text; String cours = Cours.Text; String faculty = Faculty.Text; String phone = Phone.Text; String email = Email.Text; String about = About.Text; String day = Day.Text; String month = Month.Text; String year = Year.Text; //Проверяем Email на повторение bool repeatlogin = false; using (LenternContext db = new LenternContext()) { foreach (var i in db.Interns) { if (i.Email == email) { repeatlogin = true; } } } //Проверяем данные на пустоту, и чиловые значения, если что-то не так, выводим сообщение if (String.IsNullOrEmpty(name) && String.IsNullOrEmpty(phone) && String.IsNullOrEmpty(email) && String.IsNullOrEmpty(day) && String.IsNullOrEmpty(month) && String.IsNullOrEmpty(year) && Int32.TryParse(cours, out int a) && Int32.TryParse(day, out int u) && Int32.TryParse(month, out int b) && Int32.TryParse(year, out int c)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Введите все обязательные поля! Либо поля с цифровым значением введены некорректно!')", true); } //Если Email повторился, сообщаем об этом else if (repeatlogin) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Пользователь с таким Email уже существует')", true); } //Иначе добавляем данные в БД else { //Для этого необходимо получить дополнительные поля, дата создания и имя пользователя //Если на странице новый пользователь, то, ставим в поле createName Email который был введен string userurl = Request.QueryString["User"]; String createName; if (!String.IsNullOrEmpty(userurl)) { Encoding enc = new Encoding(); string user = enc.decode(userurl); createName = user; } else { createName = email; } DateTime time = DateTime.Now; DateTime birthDate = new DateTime(Int32.Parse(year), Int32.Parse(month), Int32.Parse(day)); //Добавляем и сохраняем ланные, выводим сообщение об удачном добавлении стажера using (LenternContext db = new LenternContext()) { Intern i = new Intern { Name = name, BirthDate = birthDate, UniversityName = universityName, Course = Int32.Parse(cours), Faculty = faculty, Phone = phone, Email = email, About = about, CreateDate = time, EditDate = time, CreateName = createName, EditName = createName, Approve = false }; db.Interns.Add(i); db.SaveChanges(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Запись стажера добавлена!')", true); Response.Redirect("Default.aspx"); } } }