public static List <IdName> GetEmpleadosDropDown() { var empleados = new List <IdName>(); cn = DBConnection.MainConnection(); try { cmd = new OleDbCommand("SELECT * FROM empleados;", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { IdName temp = new IdName(); temp.ID = dr["id"].ToString(); temp.Name = dr["nombre"].ToString(); empleados.Add(temp); } dr.Close(); cn.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("Error al obtener empleados para DropDown " + ex); } return(empleados); }
public SubLocRgModel() { ResourceGroup = new ResourceGroup(); _SubscripionIdName = new IdName(); _LocationIdName = new IdName(); }
public async Task <List <IdName> > LoadMenuPermission() { //菜单 var menus = await _menu.GetAllAsync(w => w.IsAllow == true, ob => ob.Sort); //权限 var permissions = await _permission.GetAllAsync(w => menus.Select(s => s.Id).Contains(w.MenuId)); List <IdName> names = new List <IdName>(); //循环遍历所有菜单 foreach (var item in menus) { IdName name = new IdName(); name.Id = item.Id; name.Name = item.Name; name.Children = permissions .Where(w => w.MenuId == item.Id) .Select(s => new IdName { Id = s.Id, Name = s.Name }) .ToList(); if (item.Url == "/") { name.IsHidden = false; } names.Add(name); } return(names); }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { var list = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), "dl").ToList(); if (ClassName.IsNullOrEmpty() == false) { list = list.Where(n => n.Parameter.Contains("class=\"" + ClassName + "\"")).ToList(); } if (IdName.IsNullOrEmpty() == false) { list = list.Where(n => n.Parameter.Contains("id=\"" + IdName + "\"")).ToList(); } definitionList = new List <KeyValuePair <string, string> >(); foreach (var item in list) { foreach (var item2 in RawlerLib.Web.GetTagContentList(item.Inner, "<dt", "</dd>", true)) { var key = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(item2, "dt", true); var val = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(item2, "dd", true); definitionList.Add(new KeyValuePair <string, string>(key.First().Inner, val.First().Inner)); } } RunChildren(runChildren); }
public static SelectableData MapToSelectableData(this IdName entity) { return(new SelectableData { Id = entity.Id, Name = entity.Name }); }
public RicEnterInFolderCommand(string idParent, string nameParent) : base() { IdName idName = new IdName(idParent, nameParent); _path.Add(idName); _currentPage = 1; }
public ActionResult Parents(string term, long?sinceid) { var options = new IdName(); options.id = sinceid.HasValue?sinceid.Value.ToString():""; options.name = term; return(View(options)); }
public TDLEnterInFolderCommand(string idParent, string nameParent, string idTrasm) : base() { IdName idName = new IdName(idParent, nameParent); _path.Add(idName); _currentPage = 1; _idTrasm = idTrasm; }
public ActionResult UploadAnswer(long id, string qqfile) { var length = long.Parse(Request.Params["CONTENT_LENGTH"]); var filename = Path.GetFileNameWithoutExtension(qqfile); var ext = Path.GetExtension(qqfile); var uploader = new FileHandler(filename.ToSafeUrl() + ext, UploaderType.HOMEWORK, sessionid); bool ok = uploader.Save(Request.InputStream); if (!ok) { return(Json("An error has occurred. Unable to save file".ToJsonFail())); } // save to database var homeworkstudent = db.homework_students.SingleOrDefault(x => x.studentid == sessionid.Value && x.id == id); var answer = new homework_answer(); answer.created = DateTime.Now; answer.url = uploader.url; answer.filename = qqfile; answer.size = uploader.size; answer.homeworkid = homeworkstudent.homeworkid; homeworkstudent.homework_answers.Add(answer); repository.Save(); // notify teacher? if (homeworkstudent.homework.notifyme) { var viewmodel = new NotificationSendViewModel(); var studentname = homeworkstudent.user.ToName(); viewmodel.message = string.Format( "An answer has been uploaded by <a href='http://wwww.ioschools.edu.my/users/{0}'>{1}</a>", homeworkstudent.studentid, studentname); viewmodel.message += string.Format("<br/> To view your homeworks. <a href='http://wwww.ioschools.edu.my/homework'>Please follow this link</a>."); var teacher = homeworkstudent.homework.user; if (!string.IsNullOrEmpty(teacher.email)) { viewmodel.receiver = teacher.ToName(); this.SendEmailNow( EmailViewType.HOMEWORK_NOTIFICATION, viewmodel, string.Format("Homework {0}: Answer uploaded by {1}", homeworkstudent.homework.title, studentname), teacher.email, viewmodel.receiver); } } var retVal = new IdName(answer.id, uploader.filename); return(Json(retVal.ToJsonOKData())); }
private IdName ToIdName(DataRow row) { IdName idname = new IdName(); idname.Id = (Guid)row["Id"]; idname.Name = (string)row["Name"]; idname.Category = (string)row["Category"]; return(idname); }
private string GetForm_d_ts_Process(string formXml) { if (Processes.Count == 0) { return(string.Empty); } var _d_ts = string.Empty; var part1 = string.Empty; foreach (var entity in Processes) { var xaml = entity.GetAttributeValue <string>("xaml"); var name = entity.GetAttributeValue <string>("name"); name = Utility.SafeName(name); _d_ts += $"\t\tinterface Process{name} {{\r\n"; var xdoc = XDocument.Parse(xaml); var ns = xdoc.Root?.GetNamespaceOfPrefix("mxswa"); var rows2 = from x in xdoc.Descendants(ns + "Workflow").Elements(ns + "ActivityReference") select new { DisplayName = x.Attribute("DisplayName")?.Value, InnerText = x.ToString() }; var fields = new List <IdName>(); foreach (var row in rows2) { var arr = row.DisplayName.Split(" ".ToCharArray()); if (arr.Length == 1) { continue; } const string pattern = @"DataFieldName=""\w*"""; foreach (Match m in Regex.Matches(row.InnerText, pattern)) { var array = m.Value.Split("=".ToCharArray()); var fieldName = array[1].Substring(1, array[1].Length - 2); var field = new IdName { ClassId = ControlClassId.SINGLE_LINE_OF_TEXT, Name = fieldName, Id = null, ControlId = null }; fields.Add(field); } } fields = fields.OrderBy(f => f.Name).ToList(); _d_ts += Get_d_ts_ForListFields(formXml, fields); _d_ts += $"\t\t}}\r\n"; part1 += $"\t\t\t{name}: Process{name};\r\n"; } _d_ts += $"\t\tinterface Process extends DevKit.Form.Controls.IControlProcess {{\r\n"; _d_ts += part1; _d_ts += $"\t\t}}\r\n"; return(_d_ts); }
public Factura() { Empleado = new IdName(); Cliente = new IdName(); Emission = DateTime.Today; Imp = 0.00; Sub = 0.00; Total = 0.00; Descuento = 0.00; }
protected override bool ParseSelectorToken(IItemFactory itemFactory, ITextProvider text, ITokenStream stream) { var name = itemFactory.CreateSpecific<IdName>(this, text, stream); if (name.Parse(itemFactory, text, stream)) { Name = name; Children.Add(name); } return Children.Count > 0; }
//显示所有 public IdName[] ListAll() { DataTable table = SqlHelper.ExecuteDataTable("select * from T_IdName"); IdName[] idname = new IdName[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { idname[i] = ToIdName(table.Rows[i]); } return(idname); }
protected override bool ParseSelectorToken(IItemFactory itemFactory, ITextProvider text, ITokenStream stream) { var name = itemFactory.CreateSpecific <IdName>(this, text, stream); if (name.Parse(itemFactory, text, stream)) { Name = name; Children.Add(name); } return(Children.Count > 0); }
public async Task DoAsync(IdName arg) { await MarsConnection.ExecuteAsync(new CommandDefinition(@"update temptb set Enable = @Enable where Id = @Id", new { Enable = true, arg.Id }, flags : CommandFlags.Pipelined)); }
public async Task <List <IdName> > GetAuthorizedAccountsAsync(string id, string activityId, int currentRoleId) { if (string.IsNullOrEmpty(id)) { return(null); } var WhereClause = new StringBuilder(); var parameters = new List <OracleParameter>(); var param = new OracleParameter { ParameterName = "PartnerId", OracleDbType = OracleDbType.Varchar2, Value = id }; parameters.Add(param); var param2 = new OracleParameter { ParameterName = "activityId", OracleDbType = OracleDbType.Varchar2, Value = activityId }; parameters.Add(param2); var param3 = new OracleParameter { ParameterName = "currentRoleId", OracleDbType = OracleDbType.Int32, Value = currentRoleId }; parameters.Add(param3); var sql = $"Select partner_id, partner_acc, partner_name from partner " + $" where partner_id = :PartnerId and partner.roleid in " + $" (select det.toroleid from V_PARTNER_ACTIVITY_DETAIL det where det.act_id = :activityId and det.fromroleid = :currentRoleId) " + $" order by partner_acc desc"; var dataTable = await this.db.GetDataAsync(sql, parameters); if (dataTable == null) { return(null); } if (dataTable.Rows.Count == 0) { return(null); } var partners = new List <IdName>(); foreach (DataRow row in dataTable.Rows) { var account = new IdName(); account.Id = row["partner_acc"] == DBNull.Value ? -1 : int.Parse(row["partner_acc"].ToString()); var partnerName = row["partner_name"] == DBNull.Value ? string.Empty : row["partner_name"].ToString(); account.Name = $"{account.Id} - {partnerName}"; partners.Add(account); } return(partners); }
public static Exam ToMarksModel(this ioschools.DB.exam row) { var exam = new Exam(); exam.maxMark = row.maxMark; exam.id = row.id; exam.name = row.name; exam.date = row.exam_date.ToString(Constants.DATETIME_SHORT_DATE); exam.subjects = row.exam_subjects.OrderBy(x => x.name).Select(x => new IdName(x.id, x.name)).ToArray(); // gets student entries // sections = classes var sections = row.exam_classes.ToModel(row.year); foreach (var examSection in sections) { var section = new ExamSection(); section.class_name = examSection.class_name; section.class_id = examSection.class_id; foreach (var examMark in examSection.marks) { var mark = new ExamMark(); mark.student = examMark.student; foreach (var entry in exam.subjects) { var subject = entry; var exist = row.exam_marks .SingleOrDefault(x => x.studentid.ToString() == mark.student.id && x.exam_subjectid.ToString() == subject.id); var newmark = new IdName(); if (exist != null) { // show x if student absent if (exist.absent) { newmark = new IdName(exist.id, "x"); } else { newmark = new IdName(exist.id, exist.mark); } } mark.marks.Add(newmark); } section.marks.Add(mark); } section.marks = section.marks.OrderBy(x => x.student.name).ToList(); exam.sections.Add(section); } return(exam); }
private void ParseIzvodjac(IViewModel input) { if (IzvodjaciId.Any(p => p == input.Id)) { Console.Clear(); Console.WriteLine("Izvodjac je vec unet!"); } else { IzvodjaciId.Add(input.Id); IdName.Add(input.Id, input.Naziv); Console.Clear(); } }
public void custom_mapper() { var custom = false; var d= _db.WithSql("select 1 as Id, 'test' as Name").Query(rd => { var rez = new IdName(); rez.Id = rd.GetInt32(0); rez.Name = rd.GetString(1); custom = true; return rez; }).First(); Assert.True(custom); Assert.Equal(1,d.Id); Assert.Equal("test",d.Name); }
public bool Send(IdName dest, IdName src, string subject, string body, string cclist = null, string replyto = null) { // need to check for invalid email address if (!IsValidEmail(dest.id)) { return(false); } var from = new MailAddress(src.id, src.name, Encoding.UTF8); var to = new MailAddress(dest.id, dest.name, Encoding.UTF8); var msg = new MailMessage(from, to) { Body = body, IsBodyHtml = true, BodyEncoding = Encoding.UTF8, Subject = subject, SubjectEncoding = Encoding.UTF8 }; if (!string.IsNullOrEmpty(replyto)) { msg.ReplyToList.Add(replyto); } // cclist if (!string.IsNullOrEmpty(cclist)) { msg.CC.Add(cclist); } bool success = true; try { smtp.Send(msg); } catch (SmtpFailedRecipientException ex) { Syslog.Write(ex); } catch (Exception ex) { Syslog.Write(ex); success = false; } return(success); }
public void custom_mapper() { var custom = false; var d = _db.WithSql("select 1 as Id, 'test' as Name").ExecuteQuery(rd => { var rez = new IdName(); rez.Id = rd.GetInt32(0); rez.Name = rd.GetString(1); custom = true; return(rez); }).First(); Assert.True(custom); Assert.Equal(1, d.Id); Assert.Equal("test", d.Name); }
//根据Category获得IdName的数组 public IdName[] GetByCategory(string category) { DataTable table = SqlHelper.ExecuteDataTable("select Id,Name from T_IdName where Category=@Category", new SqlParameter("@Category", category)); IdName[] items = new IdName[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; IdName idname = new IdName(); idname.Id = (Guid)row["Id"]; idname.Name = (string)row["Name"]; items[i] = idname; } return(items); }
public static List <User> GetUsers() { var users = new List <User>(); cn = DBConnection.MainConnection(); try { cmd = new OleDbCommand("SELECT * FROM (usuarios INNER JOIN roles ON usuarios.id_rol = roles.id)" + "INNER JOIN empleados on empleados.id = usuarios.id_empleado", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { User tempUser = new User(); Role tempRole = new Role(); IdName empleado = new IdName(); tempUser.UserName = dr["usuario"].ToString(); tempRole.Id = int.Parse(dr["roles.id"].ToString()); tempRole.RoleName = dr["roles.nombre"].ToString(); tempUser.Status = Convert.ToBoolean(dr["status"]); tempUser.id = int.Parse(dr["usuarios.id"].ToString()); empleado.ID = dr["id_empleado"].ToString(); empleado.Name = dr["empleados.nombre"].ToString(); tempUser.UserRole = tempRole; tempUser.Empleado = empleado; users.Add(tempUser); } dr.Close(); cn.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("Error al obtener usuarios " + ex); } return(users); }
/// <summary> /// Create an ACL item for an AND group. /// </summary> /// <param name="v">UserInfo objects</param> /// <param name="access">Access rights, AccessC.LUR_*</param> /// <returns>AclItem object</returns> public static AclItem CreateItem(UserInfo[] v, int access) { AclItem ai = CreateItem(v[0], access); if (v.Length > 1) { ai.andGroups = new IdName[v.Length - 1]; for (int i = 0; i < ai.andGroups.Length; i++) { IdName idn = ai.andGroups[i] = new IdName(); idn.id = v[i + 1].id; idn.name = v[i + 1].name; } } return(ai); }
public ActionResult Subjects(int id) { var result = repository.GetSchoolSubjects(id); var subjects = new List <IdName>(); foreach (var entry in result.OrderBy(x => x.name)) { var subject = new IdName(entry.id, entry.name); subjects.Add(subject); } if (id == (int)Schools.Kindergarten) { var empty = new IdName("", "None"); subjects.Insert(0, empty); } return(Json(subjects.ToJsonOKData())); }
public static void Initialize(IPlaysContext context) { if (!context.Plays.Find(_ => true).Any()) { var personGenerator = new PersonNameGenerator(); var placeGenerator = new PlaceNameGenerator(); var random = new Random(250); var plays = Enumerable.Range(1, 250) .Select(i => new Play { Game = new Game { Id = Guid.NewGuid(), Title = placeGenerator.GenerateRandomPlaceName() }, Id = Guid.NewGuid(), Notes = placeGenerator.GenerateRandomPlaceName(), PlayedDate = DateTime.Now.AddDays(-i), PlayerScores = new PlayScore[] { new() { Player = new IdName(Guid.NewGuid(), personGenerator.GenerateRandomFirstAndLastName()), Score = random.Next() }, new() { Player = new IdName(Guid.NewGuid(), personGenerator.GenerateRandomFirstAndLastName()), Score = random.Next() }, new() { Player = new IdName(Guid.NewGuid(), personGenerator .GenerateRandomFirstAndLastName()), Score = random.Next() }, } });
public override bool Equals(object obj) { if (obj == null) { return(false); } if (ReferenceEquals(obj, this)) { return(true); } if (obj.GetType() != GetType()) { return(false); } IdName rhs = obj as IdName; return(Id == rhs.Id && Name == rhs.Name); }
public static List <IdName> getSubmenus() { List <IdName> Submenus = new List <IdName>(); cn = DBConnection.MainConnection(); try { cmd = new OleDbCommand("SELECT * from submenu;", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { IdName temp = new IdName(); temp.ID = dr["id"].ToString(); temp.Name = dr["nombre_submenu"].ToString(); Submenus.Add(temp); //System.Windows.MessageBox.Show("this is the name " + CurrentMenu[].MenuText); } dr.Close(); cn.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("Error al obtener los menus " + ex); } return(Submenus); }
public async Task OnSubscriptionChanged(IdName value) { if (value != null) { Model.SubcriptionId = value?.Id; Model.SubcriptionName = value?.Name; LastVmStatus = null; ShowLoading(); await LoadRg(value?.Id); HideLoading(); } else { Model.SubcriptionId = null; Model.SubcriptionName = null; ClearSelection(); } }
private void izbrisiIzvodjaca() { while (true) { Console.Clear(); Console.WriteLine("-------------------------------------------------------------------------------------------"); Stats.AddIzvodjacStats(IdName); Console.WriteLine("-------------------------------------------------------------------------------------------"); Console.WriteLine("Unesite Id broj izvodjaca kog zelite da izbrisete sa liste i pritisnite Enter.\nZa povratak na prethodni meni ukucajte znak \'*\' i pritisnite Enter."); string unos = Console.ReadLine().ToLower().Replace(" ", ""); int myId = 0; if (unos == "*") { Console.Clear(); return; } if (int.TryParse(unos, out myId)) { if (IzvodjaciId.Any(p => p == myId)) { IzvodjaciId.Remove(myId); IdName.Remove(myId); } else { Console.Clear(); Console.WriteLine("Na listi nema izvodjaca sa tim Id brojem! Pritisnite Enter da pokusate ponovo!"); Console.ReadLine(); } } else { Console.Clear(); Console.WriteLine("Neispravan unos! Pritisnite Enter da pokusate ponovo."); Console.ReadLine(); } } }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { var list = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), "dl").ToList(); if (ClassName.IsNullOrEmpty() == false) { list = list.Where(n => n.Parameter.Contains("class=\"" + ClassName + "\"")).ToList(); } if (IdName.IsNullOrEmpty() == false) { list = list.Where(n => n.Parameter.Contains("id=\"" + IdName + "\"")).ToList(); } List <string> txtList = new List <string>(); foreach (var item in list) { txtList.AddRange(RawlerLib.Web.GetTagContentList(item.Inner, "<dt", "</dd>", true)); } base.RunChildrenForArray(true, txtList); }