public async Task <IActionResult> Edit(int id, [Bind("ID,summary,experienceID")] duties duties) { if (id != duties.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(duties); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!dutiesExists(duties.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["experienceID"] = new SelectList(_context.experience, "ID", "placeWorked", duties.experienceID); return(View(duties)); }
duties GetShowduty(duties d) { d.department = (this.cb_department.SelectedItem as department).guid; d.dutiesName = this.tb_dutyname.Text.Trim(); d.comment = this.tb_comm.Text.Trim(); return(d); }
public async Task <IActionResult> Create([Bind("ID,summary,experienceID")] duties duties) { if (ModelState.IsValid) { _context.Add(duties); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(duties)); }
bool save(duties d) { //List<duties> dl = UserDuty.SelectByName(d.dutiesName); //List<department> dpl = Department.Select(); //if (dpl.Count < 0) //{ // MessageAlert.Warning("当前系统还没有任何部门信息请先添加部门!"); // return false; //} //if (dl.Count > 0) { return false; } //d.department = dpl.First().id.ToString (); return(UserDuty.Add(d)); }
public bool Add(List <Model.users> userlist) { try { string sql = ""; foreach (users user in userlist) { string sqldep = string.Format("select * from department where id='{0}'", user.department); DataSet dps = SqliteHelper.ExecuteDataSet(con, sqldep, CommandType.Text); if (dps != null && dps.Tables.Count > 0) { department dep = DataTableToList.GetList <department>(dps.Tables[0]).FirstOrDefault(); if (dep != null) { user.department = dep.guid; } } string sqlduty = string.Format("select * from duties where id='{0}'", user.duties); dps = SqliteHelper.ExecuteDataSet(con, sqlduty, CommandType.Text); if (dps != null && dps.Tables.Count > 0) { duties dep = DataTableToList.GetList <duties>(dps.Tables[0]).FirstOrDefault(); if (dep != null) { user.duties = dep.guid; } } sql += string.Format ( "INSERT INTO users(username,is_superuser,password,is_staff,joinDate,department_id,duties_id,empID,cardID,phoneNumber,IDNum,mail,comment,guid) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}');", user.username, user.is_superuser == true?1:0, user.password, user.is_staff == true?1:0, user.joinDate, user.department, user.duties, user.empID, user.cardID, user.phoneNumber, user.IDNum, user.mail, user.comment, user.guid ) + "\r"; } sql += "select last_insert_rowid()"; var ds = SqliteHelper.ExecuteNonQuery(con, sql, CommandType.Text); if (Convert.ToInt32(ds) > 0) { return(true); } return(false); } catch { return(false); } }
bool IsRepeat(duties d) { List <duties> duty = UserDuty.SelectByName(this.tb_dutyname.Text.Trim()); foreach (duties dy in duty) { if (dy != null && dy.guid != d.guid) { MessageAlert.Alert("该职位名称已经存在!"); return(true); } } return(false); }
private void Button_Click(object sender, RoutedEventArgs e) { if (!Validate()) { return; } try { if (isadd) { duties d = new duties(); d.dutiesName = this.tb_dutyname.Text.Trim(); d.comment = this.tb_comm.Text.Trim(); d.guid = Guid.NewGuid().ToString(); d.department = this.cb_department.SelectedValue.ToString(); //if (IsExit()) // return; if (save(d)) { MessageAlert.Alert("保存成功!"); clear(); DataBind(GetDutyModel()); return; } } else { duties duty = new duties(); duty.department = _duty.department; duty.dutiesName = _duty.dutiesName; duty.comment = _duty.comment; duty.guid = _duty.guid; duty.id = _duty.id; duty = GetShowduty(duty); //if (IsRepeat(duty)) // return; if (UserDuty.Update(GetShowduty(duty))) { MessageAlert.Alert("保存成功!"); clear(); DataBind(GetDutyModel()); return; } } MessageAlert.Warning("保存失败!"); } catch { MessageAlert.Alert("保存失败!"); } }
public List <UserModel> GetUserModel() { List <UserModel> uml = new List <UserModel>(); List <QDDL.Model.UserToRoleModel.usertorole> utr = new List <UserToRoleModel.usertorole>(); try { int count = 0; utr = GetUserToRole(programname); foreach (QDDL.Model.UserToRoleModel.usertorole ur in utr) { count++; users us = User.SelectByguid(ur.user); role r = UserRole.SelectByGuid(ur.role); department d = Department.SelectByGuid(us.department); duties du = new duties(); du = UserDuty.SelectByGuid((us == null || us.duties == null) ? "" : us.duties); uml.Add(new UserModel() { username = us.username, id = count, password = us.password, is_superuser = us.is_superuser, is_staff = us.is_staff, //joinDate =us.joinDate.Replace ('T',' ') , joinDate = us.joinDate, duties = us.duties, empID = us.empID, cardID = us.cardID, phoneNumber = us.phoneNumber, IDNum = us.IDNum, mail = us.mail, department = us.department, comment = us.comment, guid = us.guid, departName = (d == null || d.departmentName == null) ? "" : d.departmentName, roleName = (r == null || r.roleName == null) ? "" : r.roleName, roleID = (r == null || r.roleDM == null) ? "" : r.guid, dutyname = (du == null || du.dutiesName == null) ? "" : du.dutiesName }); } } catch (Exception ep) { return(uml = null); } return(uml); }
void ShowUser(users user) { tbox_UserName.Text = user.username; tbox_EmpId.Text = user.empID; QDDL.Model.UserToRoleModel.usertorole usertorolemodel = UserToRole.selectbyuserid(user.guid).FirstOrDefault(); if (usertorolemodel != null) { for (int i = 0; i < cbox_role.Items.Count; i++) { role r = cbox_role.Items[i] as role; if (r.guid == usertorolemodel.role) { cbox_role.SelectedItem = r; break; } } } for (int j = 0; j < cbox_department.Items.Count; j++) { department d = cbox_department.Items[j] as department; if (d.guid == user.department) { cbox_department.SelectedItem = d; break; } } for (int k = 0; k < cb_duty.Items.Count; k++) { duties d = cb_duty.Items[k] as duties; if (d.guid == user.duties) { cb_duty.SelectedItem = d; break; } } tb_cardid.Text = user.cardID; tb_pwd.Text = user.password; tb_phone.Text = user.phoneNumber; this.dp_jointime.Text = user.joinDate.ToString(); }
public string addreturnid(Model.users user) { try { string sqldep = string.Format("select * from department where id='{0}'", user.department); DataSet dps = SqliteHelper.ExecuteDataSet(con, sqldep, CommandType.Text); if (dps != null && dps.Tables.Count > 0) { department dep = DataTableToList.GetList <department>(dps.Tables[0]).FirstOrDefault(); if (dep != null) { user.department = dep.guid; } } string sqlduty = string.Format("select * from duties where id='{0}'", user.duties); dps = SqliteHelper.ExecuteDataSet(con, sqlduty, CommandType.Text); if (dps != null && dps.Tables.Count > 0) { duties dep = DataTableToList.GetList <duties>(dps.Tables[0]).FirstOrDefault(); if (dep != null) { user.duties = dep.guid; } } string sql = string.Format ( "INSERT INTO users(username,is_superuser,password,is_staff,joinDate,department_id,duties_id,empID,cardID,phoneNumber,IDNum,mail,comment,guid) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}') ;select last_insert_rowid()", user.username, user.is_superuser == true?1:0, user.password, user.is_staff == true?1:0, user.joinDate, user.department, user.duties, user.empID, user.cardID, user.phoneNumber, user.IDNum, user.mail, user.comment, user.guid ); var ds = SqliteHelper.ExecuteScalar(con, sql, CommandType.Text); return(ds.ToString()); } catch { return("-1"); } }
public userinfo getuserinfo(List <users> u) { List <users> us = u; userinfo ui = new userinfo(); system s = getsystem(programname); List <role> rlist = new List <role>(); department d = new department(); duties duty = new duties(); List <QDDL.Model.UserToRoleModel.usertorole> ur = new List <UserToRoleModel.usertorole>(); if (us != null && us.Count > 0) { ur = UserToRole.selectbyuserid(us.FirstOrDefault().guid); d = Department.SelectByGuid(us.FirstOrDefault().department); duty = UserDuty.SelectByGuid(us.FirstOrDefault().duties); } if (s != null) { foreach (QDDL.Model.UserToRoleModel.usertorole um in ur) { List <role> r = UserRole.selectSysidandguid(s.guid, um.role); if (r.Count > 0) { rlist.Add(r.FirstOrDefault()); } } if (rlist != null && rlist.Count > 0) { ui.user = us.FirstOrDefault(); ui.role = rlist.FirstOrDefault(); if (d.guid != null) { ui.department = d; } ui.duty = duty; } } return(ui); }
public static void Initialize(ResumeContext context) { context.Database.EnsureCreated(); // Look for any applicants if (!context.applicant.Any()) { var applicants = new applicant[] { new applicant { FirstName = "Carson", LastName = "Alexander", City = "ABQ", State = "NM", Phone = "505-933-9799", Email = "*****@*****.**", WebAddress = "kellycockrell.net" } // new applicant {FirstName="Johnson",LastName="Joan",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"}, // new applicant {FirstName="Raphael",LastName="Lobato",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"}, // new applicant {FirstName="Elsa",LastName="Castillo",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"}, // new applicant {FirstName="Cassiano",LastName="de Oliveira",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"}, // new applicant {FirstName="Brendaleigh",LastName="Lobato",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"}, }; foreach (applicant a in applicants) { context.applicant.Add(a); } context.SaveChanges(); } if (!context.education.Any()) { var education = new education[] { new education { degreeType = "Bachelors", subject = "Fine Arts", institution = "University of New Mexico", city = "Albuquerque", state = "NM", gradDate = "May 1994", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new education { degreeType = "Bachelors", subject = "Electrical Engineering", institution = "University of Texas", city = "Austin", state = "NM", gradDate = "May 1994", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new education { degreeType = "Masters", subject = "Physics", institution = "Boston College", city = "Boston", state = "MA", gradDate = "May 2016", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, //new education {degreeType = "PhD", subject = "Sociology", institution = "Harvard University", city = "Cambridge", state = "MA", gradDate = "December 2010",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, //new education {degreeType = "PhD", subject = "Nuclear Engineering", institution = "Imperial College", city = "London", state = "UK", gradDate = "May 1989",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, //new education {degreeType = "Associates", subject = "Business Administration", institution = "Santa Fe Community College", city = "Santa Fe", state = "NM", gradDate = "May 2018",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, //new education {degreeType = "Bachelors", subject = "Biology", institution = "University of Colorado", city = "Boulder", state = "CO", gradDate = "December 1994",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID } }; foreach (education e in education) { context.education.Add(e); } context.SaveChanges(); } if (!context.references.Any()) { var references = new references[] { new references { firstName = "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city = "Washington DC", state = "", emailAddress = "*****@*****.**", phone = "212-444-5555", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new references { firstName = "Vladimir", lastName = "Putin", companyName = "President and DIctator of Russia", mailingAddress = "P.O. Box 666661", city = "Moscow", state = "Russia", emailAddress = "*****@*****.**", phone = "33-433-4424-09090", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new references { firstName = "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city = "Washington DC", state = "", emailAddress = "*****@*****.**", phone = "212-444-5555", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="", emailAddress= "*****@*****.**", phone = "212-444-5555" }, //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="", emailAddress= "*****@*****.**", phone = "212-444-5555" }, //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="", emailAddress= "*****@*****.**", phone = "212-444-5555" } }; foreach (references r in references) { context.references.Add(r); } context.SaveChanges(); } if (!context.skills.Any()) { var skills = new skills[] { new skills { skillName = "Javascript", experienceLevel = "Advanced", yearsUsed = "3", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new skills { skillName = "Adobe Photoshop", experienceLevel = "Expert", yearsUsed = "10", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new skills { skillName = "Adobe Illustrator", experienceLevel = "Advanced", yearsUsed = "8", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new skills { skillName = "C#", experienceLevel = "Novice", yearsUsed = "1", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new skills { skillName = "HTML/CSS", experienceLevel = "Expert", yearsUsed = "10", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new skills { skillName = "Microsoft Office", experienceLevel = "Advanced", yearsUsed = "20", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID } }; foreach (skills s in skills) { context.skills.Add(s); } context.SaveChanges(); } if (!context.experience.Any()) { var experience = new Experience[] { new Experience { jobName = "Internship Coordinator and Graphic Designer", placeWorked = "University of New Mexico", city = "Albuquerque", state = "NM", startDate = "June 2015", endDate = "present", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new Experience { jobName = "Teacher of Computer Science and Technology", placeWorked = "The Meadows School", city = "Las Vegas", state = "NV", startDate = "August 2013", endDate = "June 2015", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new Experience { jobName = "Director of Technology", placeWorked = "Steamboat Mountain School", city = "Steamboat Springs", state = "CO", startDate = "June 2012", endDate = "July 2013", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new Experience { jobName = "Technology Lab Coordinator", placeWorked = "Rowland Hall-St. Mark's School", city = "Salt Lake City", state = "UT", startDate = "August 2007", endDate = "June 2012", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new Experience { jobName = "Web and UX Designer", placeWorked = "University of Arkansas", city = "Fayetteville", state = "AR", startDate = "November 2006", endDate = "August 2007", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }, new Experience { jobName = "Marketing Advertising Executive", placeWorked = "Lovely County Citizen", city = "Eureka Springs", state = "AR", startDate = "Jan 2005", endDate = "October 2006", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID } }; foreach (Experience e in experience) { context.experience.Add(e); } context.SaveChanges(); } if (!context.duties.Any()) { var duty = new duties[] { new duties { summary = "• Coordinates mentoring and internship program under a grant from the National Science Foundation.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID }, new duties { summary = "• Organizes and expedites mentoring events and meetings with faculty and students.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID }, new duties { summary = "• Advises and mentors students in meaningful development of careers. ", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID }, new duties { summary = "• Conceptualizes and designs advertising campaigns for School of Engineering.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID }, new duties { summary = "• Photographs students, faculty, and departmental events, to be used for publication", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID }, new duties { summary = "• Conceptualized, designed, and taught computer science and technology curriculum to students in a project-based environment at rigorous private middle school.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID }, new duties { summary = "• Oversaw entire technology department for an independent boarding school,grades 9-12.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID }, new duties { summary = "• Configured and administered firewall, wireless network, and Active Directory Server.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID }, new duties { summary = "• Oversaw budget, recommended to and consulted with Head of School or purchases.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID }, new duties { summary = "• Taught graphic design; advised and supervised students in the creation of theschool yearbook.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID }, new duties { summary = "• Managed the scheduling, maintenance, and security of computer labs.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID }, new duties { summary = "• Recommended hardware, software and learning resources to teachers.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID }, new duties { summary = "• First responder for end - user and technical support to faculty and students.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID } }; foreach (duties d in duty) { context.duties.Add(d); } context.SaveChanges(); } }
public bool Del(duties duty) { string contion = string.Format("id='{0}'", duty.id); return(ServerHelp.deleteDataByWhere <duties>(_webip, contion)); }
public bool Add(duties duty) { return(ServerHelp.addSingleInfoNotReturnID(duty, _webip)); }