private async Task SearchData(string sw, incParams incp, filter f, grdictParams dp) { var w = await db.searchWord(f, sw); if (w != null) { incp.currentPage = w.wordsPageNumber; incp.wid = w.nom_old; dp.entry = await db.getEntry(incp.wid); dp.count = w.CountOfWords; int count_plus = dp.count % 100; dp.maxpage = count_plus > 0 ? (dp.count / 100) + 1 : (dp.count / 100); if (dp.incp.currentPage >= dp.maxpage) { dp.incp.currentPage = dp.maxpage - 1; } if (dp.incp.currentPage < 0) { dp.incp.currentPage = 0; } } else { incp.currentPage = 0; incp.wid = 0; dp.entry = null; dp.count = 0; dp.maxpage = 0; dp.incp.currentPage = 0; } }
public async Task <ActionResult> SearchWord(incParams incp, filter f, int count, int maxpage) { //global::System.Resources.ResourceManager rm = new global::System.Resources.ResourceManager("mphdeck.Resources.idispl", typeof(Resources.idispl).GetTypeInfo().Assembly); //System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(mphdeck.Resources.idispl)); //System.Resources.ResourceManager rm = System.Resources.ResourceManager("mphdeck.Resources.idispl", typeof(Resources.idispl).GetTypeInfo().Assembly); //string test2 = mphdeck.Resources.idispl.ResourceManager.GetString("bname_ua", new System.Globalization.CultureInfo("uk")); //string test1 = mphdeck.Resources.idispl.ResourceManager.GetString("bname_ua", new System.Globalization.CultureInfo("en")); //System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("MyResource", Assembly.GetExecutingAssembly //string test2 = rm.GetString("bname_ua", new System.Globalization.CultureInfo("uk")); //string test1 = rm.GetString("bname_ua", new System.Globalization.CultureInfo("en")); var dpg = new grdictParams() { incp = incp, f = f, id_lang = db.lid.id_lang }; dpg.count = count; dpg.maxpage = maxpage; dpg.entry = await db.getEntry(incp.wid); ViewBag.dp = new dictParams() { gr = dpg, vtype = viewtype.dict }; return(View("Index", dpg)); }
public List <EmployeeViewModel> ListEmployee(filter f) { using (var _dbcontext = new PayRollEntities()) { SqlConnection con = _dbcontext.Database.Connection as SqlConnection; var eMPLOYEEData = con.Query <EMPLOYEE>("[dbo].[SP_GetEmployeelist] @Mode,@UNITID,@DEPARTMENTID,@DESIGNATIONID,@WAGES_TYPEID", new { Mode = f.Mode, UNITID = f.UNIT, DEPARTMENTID = f.Department, DESIGNATIONID = f.DESIGNATION, WAGES_TYPEID = f.Wagetype }); var Emp = (from e in eMPLOYEEData join dep in _dbcontext.Departments on e.DEPARTMENTID equals dep.DepId join des in _dbcontext.Designations on e.DESIGNATIONID equals des.DegId join u in _dbcontext.UNITs on e.UNITID equals u.UnitId join W in _dbcontext.WAGESTYPEs on e.WAGES_TYPEID equals W.WGId select new EmployeeViewModel() { EMPID = e.EMPID, EMPCODE = e.EMPCODE, MACCODE = e.MACCODE, EMP_NAME = e.EMP_NAME, FATHER_NAME = e.FATHER_NAME, MOTHER_NAME = e.MOTHER_NAME, DOB = e.DOB, DOJ = e.DOJ, MARITAL_STATUS = e.MARITAL_STATUS, GENDER = e.GENDER, ACTUAL_SALARY = e.ACTUAL_SALARY, ADUITING_SALARY = e.ADUITING_SALARY, UNIT = u.Name, DEPARTMENT = dep.DEPT, DESIGNATION = des.DESG, WAGESTYPE = W.Type }).OrderBy(x => x.EMPCODE).ToList(); return(Emp); } }
public HttpResponseMessage getdetail([FromBody] filter filter) { string startdate = DateTime.Parse(filter.startdate.ToString()).ToString("yyyy-MM-dd HH:mm:ss"); string enddate = DateTime.Parse(filter.enddate.ToString()).ToString("yyyy-MM-dd HH:mm:ss"); string iptemp = ""; filter.ip.ToList().ForEach(fff => { iptemp += "'" + fff.ip + "'" + ","; }); using (DB db = new DB()) { var data = db.Database.SqlQuery <datareturn>(@"select User_ID ,Verify_Date, CASE WHEN CONVERT(varchar, Verify_Date,108)>='05:00:00' and CONVERT(varchar, Verify_Date,108)<='09:30:00' THEN N'Bữa sáng' WHEN CONVERT(varchar, Verify_Date,108)>='10:00:00' and CONVERT(varchar, Verify_Date,108)<='13:00:00' THEN N'Bữa trưa' WHEN CONVERT(varchar, Verify_Date,108)>='16:30:00' and CONVERT(varchar, Verify_Date,108)<='20:00:00' THEN N'Bữa tối' ELSE N'Không tính tiền' END as loaibuaan from KTX0050 as G where Verify_Date>='" + startdate + "' and Verify_Date<='" + enddate + "' and ip in (" + iptemp.TrimEnd(',') + ") and User_ID='" + filter.id + "' "); return(REST.GetHttpResponseMessFromObject(data)); } }
public async Task <IActionResult> Index(incParams incp, filter f, pclsfilter pclsf) { try { var dp = new dictParams() { gr = new grdictParams() { f = f, incp = incp }, pcls = new pclsdictParams() { indents = db.indent, f = pclsf, pclsinfo = await db.getPClass(pclsf.pclassPcls) }, vtype = viewtype.pclass }; if (pclsf.ispofsPcls) { dp.pcls.indents = (from c in db.indents where c.gr_id == pclsf.pofsPcls select c).ToArray(); } ViewBag.dp = dp; return(View(dp.pcls.pclsinfo)); } catch (Exception ex) { ApplicationLogging.CreateLogger <flexesController>().LogError(new EventId(0), ex, ex.Message); return(BadRequest("Зверніться до розробника")); } }
public JsonResult GetSalaryDataJson() { if (Session[Constances.UserId] != null) { filter f = new filter(); f.Wagetype = Request.Form["Wagetype"].ToString() != "" ? Convert.ToInt32(Request.Form["Wagetype"]) : 0; f.StartDate = Request.Form["StartDate"].ToString() != "" ? Convert.ToDateTime(Request.Form["StartDate"]) : DateTime.Now.AddDays(-1); f.EndDate = Request.Form["EndDate"].ToString() != "" ? Convert.ToDateTime(Request.Form["EndDate"]) : DateTime.Now.AddDays(-1); f.Mode = Session[Constances.Mode].ToString(); var draw = Request.Form.GetValues("draw").FirstOrDefault(); var start = Request.Form.GetValues("start").FirstOrDefault(); var length = Request.Form.GetValues("length").FirstOrDefault(); int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int totalRecords = 0; CommonRepository repo = new CommonRepository(); var res = repo.GetSalaryData(f); totalRecords = res.Count(); var data = res.Skip(skip).Take(pageSize).ToList(); return(Json(new { draw = draw, recordsFiltered = totalRecords, recordsTotal = totalRecords, data = data }, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
private async Task <grdictParams> prepaireData(incParams incp, filter f) { grdictParams dp = new grdictParams() { incp = incp, f = f, id_lang = db.lid.id_lang }; if (incp.wid != 0) { dp.entry = await db.getEntry(incp.wid); dp.count = await db.CountWords(f); int count_plus = dp.count % 100; dp.maxpage = count_plus > 0 ? (dp.count / 100) + 1 : (dp.count / 100); if (dp.incp.currentPage >= dp.maxpage) { dp.incp.currentPage = dp.maxpage - 1; } if (dp.incp.currentPage < 0) { dp.incp.currentPage = 0; } } else { await SearchData(string.Empty, incp, f, dp); } return(dp); }
private static ObservableCollection <Element> SearchNoAtt(filter Filter, string currentPath) { if (Filter.search_in) { var search = FindFiles(currentPath); foreach (var r in search) { if (r.Title.Contains(Filter.search)) { Result.Add(r); } } foreach (var path in Folders(currentPath)) { files(path, Filter.search); } } else { var search = FindFiles(currentPath); foreach (var r in search) { if (r.Title.Contains(Filter.search)) { Result.Add(r); } } } return(Result); }
public JsonResult ProceedAttenanceJson(string Date) { AttenenceRepository ar = new AttenenceRepository(); if (Session[Constances.UserId] != null) { filter f = new filter(); f.Date = Date != "" ? Convert.ToDateTime(Date).Date : DateTime.Now.Date; var draw = Request.Form.GetValues("draw").FirstOrDefault(); var start = Request.Form.GetValues("start").FirstOrDefault(); var length = Request.Form.GetValues("length").FirstOrDefault(); int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int totalRecords = 0; AttenenceRepository arepo = new AttenenceRepository(); var res = arepo.GetProcessedAttenancedata(f); totalRecords = res.Count(); var data = res.Skip(skip).Take(pageSize).ToList(); foreach (var d in data) { d.sHoursWorked = Convert.ToDateTime(DateTime.Now.Date + d.HoursWorked).ToString("HH:mm"); } return(Json(new { draw = draw, recordsFiltered = totalRecords, recordsTotal = totalRecords, data = data }, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> SearchWord(incParams incp, filter f, int count, int maxpage) { //global::System.Resources.ResourceManager rm = new global::System.Resources.ResourceManager("mphdeck.Resources.idispl", typeof(Resources.idispl).GetTypeInfo().Assembly); //System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(mphdeck.Resources.idispl)); //System.Resources.ResourceManager rm = System.Resources.ResourceManager("mphdeck.Resources.idispl", typeof(Resources.idispl).GetTypeInfo().Assembly); //string test2 = mphdeck.Resources.idispl.ResourceManager.GetString("bname_ua", new System.Globalization.CultureInfo("uk")); //string test1 = mphdeck.Resources.idispl.ResourceManager.GetString("bname_ua", new System.Globalization.CultureInfo("en")); //System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("MyResource", Assembly.GetExecutingAssembly //string test2 = rm.GetString("bname_ua", new System.Globalization.CultureInfo("uk")); //string test1 = rm.GetString("bname_ua", new System.Globalization.CultureInfo("en")); try { var dpg = new grdictParams() { incp = incp, f = f, id_lang = db.lid.id_lang }; dpg.count = count; dpg.maxpage = maxpage; dpg.entry = await db.getEntry(incp.wid); ViewBag.dp = new dictParams() { gr = dpg, vtype = viewtype.dict }; return(View("Index", dpg)); } catch (Exception ex) { ApplicationLogging.CreateLogger <inflectionController>().LogError(new EventId(0), ex, ex.Message); return(BadRequest("Зверніться до розробника")); } }
public static DataTable Getdata(filter filter) { SDKHelper SDK = new SDKHelper(); DataTable dt = new DataTable(); dt.Columns.Add("STT"); dt.Columns.Add("User_ID"); dt.Columns.Add("Verify_Date"); dt.Columns.Add("Verify_Type"); dt.Columns.Add("Verify_State"); dt.Columns.Add("WorkCode"); dt.Columns.Add("sDeviceName"); dt.Columns.Add("sSN"); dt.Columns.Add("ip"); if (filter.startdate == null || filter.enddate == null) { return(null); } string lbSysOutputInfo = ""; int ret = SDK.sta_ConnectTCP(ref lbSysOutputInfo, filter.ip, filter.port, filter.commkey); if (ret == 1) { SDK.sta_readLogByPeriod(ref lbSysOutputInfo, ref dt, filter.startdate, filter.enddate, filter.ip); SDK.sta_ConnectTCP(ref lbSysOutputInfo, filter.ip, filter.port, filter.commkey); } return(dt); }
public int HandleGrayscale(int x, int y, int w, int h, HttpListenerContext listenerContext) { int intensity; filter grayscale = c => Color.FromArgb(c.A, intensity = (c.R + c.G + c.B) / 3, intensity, intensity); return(handleWithFilter(x, y, w, h, listenerContext, grayscale)); }
public static void addFilters(int typeId, String names) { String[] nameList = names.Split(';'); using (DB_entities db = new DB_entities()) { using (TransactionScope scope = new TransactionScope()) { foreach (String name in nameList) { if (name == "") { break; } filter prodFilter = new filter(); prodFilter.name = name; prodFilter.prodtype_id = typeId; try { db.filters.Add(prodFilter); db.SaveChanges(); } catch (Exception ex) { Log.error("addFilters - Insert.cs", DateTime.Now, ex); } } scope.Complete(); } } }
void Awake() { Instance = this; LOADED = false; filterSelector = filter.SMA; Initialize(); }
}/// <summary> /// used by mfparam.vrml2par /// </summary> /// <param name="f"></param> /// <param name="sfp"></param> /// <param name="n"></param> /// <param name="mode"></param> /// <returns></returns> public override bool instring(filter f, sfparam sfp, nodeBean n, int mode) { String s; try { s = f.nextToken(); if (s != null) if (s.Equals("IS")) { s = f.nextToken(); if (sfp != null) sfp.setIs(s); return true; } x = Double.Parse(s); s = f.nextToken(); y = Double.Parse(s); s = f.nextToken(); z = Double.Parse(s); s = f.nextToken(); angle = Double.Parse(s); } catch (Exception e) { Console.WriteLine("sfrotation.instring {0}", e); } return true; }/// <summary>
public FilteredTaxon BuildFiltered(filter _filter, FilteredTaxon _father) { FilterResult result = _filter(this); if (result == FilterResult.YesAndChildToo) { return(null); } if (result == FilterResult.No) { FilteredTaxon ft = new FilteredTaxon(); ft.original = this; ft.Father = _father; _father = ft; } foreach (Taxon child in Children) { FilteredTaxon ftChild = BuildFiltered(_filter, _father); if (ftChild == null) { continue; } if (_father.Children == null) { _father.Children = new List <FilteredTaxon>(); } _father.Children.Add(ftChild); } return(_father); }
// Update is called once per frame void Update() { filter_set = filter.GetComponent <filter> (); change_music = filter.GetComponent <change> (); this.acceleration = Input.acceleration; this.compass = Input.compass; this.gyro = Input.gyro.attitude; }
public HttpResponseMessage getall([FromBody] filter filter) { using (QLDX_DB db = new QLDX_DB()) { var data = db.DX0060.AsEnumerable().Select(p => getDX00600(p)); return(REST.GetHttpResponseMessFromObject(data)); } }
public Wise(string[] stack) { reloading = defaultLoader; indexing = defaultIndexer; filtering = defaultFilter; list.AddRange(stack); }
public async Task <Object> Search(filter String) { var hero = from Hero in HeroContext.Heros where Hero.HeroName.Contains(String.condition) select Hero; return(await hero.ToListAsync()); }
public int HandleThreshold(int x, int y, int w, int h, int thresholdValue, HttpListenerContext listenerContext) { Console.WriteLine(thresholdValue); int newRGB; filter threshold = c => Color.FromArgb(c.A, newRGB = ((c.R + c.G + c.B) / 3 >= (255 * thresholdValue / 100)) ? 255 : 0, newRGB, newRGB); return(handleWithFilter(x, y, w, h, listenerContext, threshold)); }
public int HandleSepia(int x, int y, int w, int h, HttpListenerContext listenerContext) { link newR = c => Math.Min((int)((c.R * .393) + (c.G * .769) + (c.B * .189)), 255); link newG = c => Math.Min((int)((c.R * .349) + (c.G * .686) + (c.B * .168)), 255); link newB = c => Math.Min((int)((c.R * .272) + (c.G * .534) + (c.B * .131)), 255); filter sepia = c => Color.FromArgb(c.A, newR(c), newG(c), newB(c)); return(handleWithFilter(x, y, w, h, listenerContext, sepia)); }
public List <SalaryData> GetSalaryData(filter f) { using (var _dbcontext = new PayRollEntities()) { SqlConnection con = _dbcontext.Database.Connection as SqlConnection; var sd = con.Query <SalaryData>("[dbo].[GetSalaryData] @Mode,@WAGES_TYPEID,@StartDate,@EndDate", new { Mode = f.Mode, WAGES_TYPEID = f.Wagetype, StartDate = f.StartDate, EndDate = f.EndDate }); return(sd.ToList()); } }
public HttpResponseMessage Getdondangkylamthem([FromBody] filter filter) { using (QLDX_DB db = new QLDX_DB()) { var data = db.Database.SqlQuery <DX0001>(@"select * from DX0001 where maForm='SF015' " + (filter.trangThai != null? ("and trangThai=" + filter.trangThai) : "") + (filter.ngaytao == null?"": (filter.ngaytao == true ? "and CONVERT(date, ngaytao, 111)<CONVERT(date, getdate(), 111)" : "and CONVERT(date, ngaytao, 111)>=CONVERT(date, getdate(), 111)")) ); return(REST.GetHttpResponseMessFromObject(data)); } }
public static object GetAccount(filter filter) { using (DB db = new DB()) { var acc = db.Database.SqlQuery <MKV9999>(@"SELECT [MKV9999_ID] ,[manhansu] ,[matkhau] ,[id] ,[hodem] ,[ten] ,[ngaysinh] ,[gioitinh] ,[noisinh] ,[quequan] ,[diachithuongtru] ,[diachitamtru] ,[cmtnd_so] ,[cmtnd_ngayhethan] ,[cmtnd_noicap] ,[hochieu_so] ,[hochieu_ngaycap] ,[hochieu_ngayhethan] ,[ngayvaocongty] ,[phong_id] ,[ban_id] ,[congdoan_id] ,[chucvu_id] ,[nganhang_stk] ,[nganhang_id] ,[sosobaohiem] ,[honnhantinhtrang] ,[datnuoc_id] ,[phuongxa] ,[suckhoetinhtrang] ,[dienthoai_nharieng] ,[dienthoai_didong] ,[email] ,[tinhtrangnhansu] ,[thutu] ,[chucvu] ,[capbac] ,thetu_id=(SELECT bophan_ten FROM MKV9998 where phong_id=G.phong_id ) ,[type] FROM MKV9999 as G " + ((filter.id != null || filter.manhansu != null)?" where ":"") + (filter.id != null?(" MKV9999_ID =" + filter.id):"") + (filter.manhansu != null?(" manhansu ='" + filter.manhansu + "'"):"")); if (filter.id != null) { return(acc.FirstOrDefault()); } if (filter.manhansu != null) { return(acc.FirstOrDefault()); } return(acc); } }
public async Task <IActionResult> toPage(incParams incp, filter f) { incp.currentPage = incp.currentPage - 1; var dpg = await prepaireData(incp, f); ViewBag.dp = new dictParams() { gr = dpg, vtype = viewtype.dict }; return(View("Index", dpg)); }
public static ObservableCollection <Element> Search(filter Filter, string currentPath) { if (Filter.SizeFrom == -1 && Filter.CreationDateFrom == null && Filter.ChangeDateFrom == null && Filter.SizeTo == 0 && Filter.CreationDateTo == null && Filter.ChangeDateTo == null) { return(SearchNoAtt(Filter, currentPath)); } else { return(SearchAtt(Filter, currentPath)); } }
void BGW_DoWork(object sender, DoWorkEventArgs e) { filter filter = (filter)e.Argument; //取得資料 List <string> where = new List <string>(); where.Add("ref_creationitemsrecord_id = '" + filter.ref_creationitemsrecord_id + "'"); //tool._A.Select<CreationItemsParticipateRecord>(); List <CreationItemsParticipateRecord> lr = tool._A.Select <CreationItemsParticipateRecord>(string.Join(" and ", where)); e.Result = lr; }
// Apply filter on each no. in array and print only if no. fits the filter public static void GetResult(ArrayNumbers arr, filter filterOption) { Console.WriteLine("\n--------------------------------------------------------------\n"); for (int i = 0; i < ArrayNumbers.size; i++) { if (filterOption(arr[i])) { Console.Write(arr[i] + "\t"); } } Console.WriteLine("\n--------------------------------------------------------------\n"); }
public List <AttenanceViewModel> GetAttenanceReport(filter f) { using (var _dbcontext = new PayRollEntities()) { SqlConnection con = _dbcontext.Database.Connection as SqlConnection; var eMPLOYEEData = con.Query <EMPLOYEE>("[dbo].[SP_GetEmployeelist] @Mode,@UNITID,@DEPARTMENTID,@DESIGNATIONID,@WAGES_TYPEID", new { Mode = f.Mode, UNITID = f.UNIT, DEPARTMENTID = f.Department, DESIGNATIONID = f.DESIGNATION, WAGES_TYPEID = f.Wagetype }); var Empdetails = (from e in eMPLOYEEData join u in _dbcontext.UNITs on e.UNITID equals u.UnitId join dep in _dbcontext.Departments on e.DEPARTMENTID equals dep.DepId join des in _dbcontext.Designations on e.DESIGNATIONID equals des.DegId select new AttenanceViewModel() { EMPID = e.EMPID, Unit = u.Name, Department = dep.DEPT, Designation = des.DESG, EmpName = e.EMP_NAME, EmpCode = e.EMPCODE }).ToList(); var ProcessedData = (from pd in _dbcontext.ProcessedData where pd.Date == DbFunctions.TruncateTime(f.Date) select pd).ToList(); var Attdetails = (from ai in _dbcontext.ATTENDANCE_IMPORT where ai.AttendanceDate == DbFunctions.TruncateTime(f.Date) select ai).ToList(); var res = (from e in Empdetails join at in Attdetails on e.EmpCode equals at.EmployeeId into Attendance from ai in Attendance.DefaultIfEmpty() join pd in ProcessedData on e.EmpCode equals pd.EmpCode into Data from d in Data.DefaultIfEmpty() select new AttenanceViewModel() { EMPID = e.EMPID, Unit = e.Unit, Department = e.Department, Designation = e.Designation, EmpName = e.EmpName, EmpCode = e.EmpCode, InTime = ai != null ? ai.InTime : null, OutTime = ai != null ? ai.OutTime : null, PunchRecords = ai != null ? ai.PunchRecords : "", Status = ai != null ? "Present" : "Absent", Attenanceid = ai != null ? ai.Id : 0, ShiftCount = d != null ? d.ShiftCount : 0m }).ToList(); return(res); } }
// returns true if at least one "include" filter matches this (or, if we don't have any include filters) public bool has_matches_via_include(filter f) { if (!f.has_include_filters) // in this case, we match all return true; if (matches.Count == 0) return false; // it needs to match at least one include filter! for ( int idx = 0; idx < matches.Count; ++idx) if ( matches[idx]) if (f.is_include_filter(idx)) return true; return false; }
protected override void ProcessRecord() { base.BeginProcessing(); try { var resclass = _clientconnection.getAttributeList(_name); if (resclass != null) { var o = new card { className = _name }; var ht = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach (var prop in resclass) { try { WriteVerbose("Property in Class: " + prop.name); ht.Add(prop.name, prop); } catch (Exception e) { WriteError(new ErrorRecord(e, "property '" + prop.name + "' has already been added to collection", ErrorCategory.InvalidOperation, prop)); } } // now go through the hashtable that has the values we we want to use and // assigned them into the new values foreach (string s in PropertyHashtable.Keys) { if (!ht.ContainsKey(s)) { WriteError(new ErrorRecord(new SystemException(s), "property not found on object", ErrorCategory.NotSpecified, o)); } else { var p = ht[s] as attributeSchema; if (p != null) { WriteVerbose(p.name); AssignNewValue(this,p, o, PropertyHashtable[s]); } } } //Create Card var query = new query(); var f = new filter(); f.@operator = "EQUALS"; f.name = "Code"; f.value = new[] {ht["Code"].ToString()}; query.filter = f; var searchcard = _clientconnection.getCardList(o.className, null, query, null, 1, 0, null, null); int rcard; if (searchcard != null) { var firstOrDefault = searchcard.cards.FirstOrDefault(); if (firstOrDefault != null) rcard = firstOrDefault.id; //_clientconnection.updateCard() } else { rcard = _clientconnection.createCard(o); } if (PassThru) { var r = _clientconnection.getCard(_name, 0, null); WriteObject(AdaptCardObject(this, r)); } } } catch (Exception e) { WriteError(new ErrorRecord(e, "Unknown error", ErrorCategory.NotSpecified, "")); } }
/// used by mfparam.vrml2par /// </summary> /// <param name="f"></param> /// <param name="sfp"></param> /// <param name="n"></param> /// <param name="mode"></param> /// <returns></returns> public override bool instring(filter f, sfparam sfp, nodeBean n, int mode) { String s; try { s = f.nextToken(); if (s != null) if (s.Equals("IS")) { s = f.nextToken(); if (sfp != null) sfp.setIs(s); return true; } x = Double.Parse(s); s = f.nextToken(); y = Double.Parse(s); s = f.nextToken(); z = Double.Parse(s); s = f.nextToken(); angle = Double.Parse(s); } catch (Exception e) { Console.WriteLine("sfrotation.instring {0}", e); } return true; }
public query ConvertFilterToQuery(string filter) { query myQuery = null; try { var re1 = @"^(?<Attribute>\w{1,})+\s(?<Operator>\-\w{1,})+\s(?<Value>(\S|\w|\d|\s){1,})+$"; WriteVerbose("Original Filter: " + filter); var r = new Regex(re1, RegexOptions.IgnoreCase | RegexOptions.Singleline); var m = r.Match(filter); if (m.Success) { var var1 = m.Groups["Attribute"].ToString(); var var2 = m.Groups["Operator"].ToString(); var var3 = m.Groups["Value"].ToString().Replace("*","%"); string filterString = ConvertFilterToCMDBuildOperator(var2); //filterString = FixUpPropertyNames(filterString, mpClass); WriteVerbose("Property: " + var1); WriteVerbose("Operator: " + filterString); WriteVerbose("Value: " + var3); myQuery = new query(); //(filterString, mpClass); var fil = new filter { @operator = filterString, name = var1, value = new string[] { var3 } }; myQuery.filter = fil; WriteVerbose("Using " + filterString + " as query"); return myQuery; } } catch // This is non-catastrophic - it's our first attempt { WriteDebug("failed: " + filter); } return myQuery; }
public int GetCardbyCode(string referencedClassName, string code) { int returnvalue = 0; var myQuery = new query(); var fil = new filter { @operator = "LIKE", name = "Code", value = new string[] { "%" + code + "%" } }; myQuery.filter = fil; var cardfound = _clientconnection.getCardList(referencedClassName, null, myQuery, null, 1, 0, null, null); if (cardfound.cards != null) { var r = cardfound.cards.FirstOrDefault(); returnvalue = r.id; } return returnvalue; }
public static IEnumerable<string> getUrls(filter filt) { return getDpls(filt).SelectMany(dpl => filesFromDpl(dpl, filt.langs)); }
/// <summary> /// 子孙节点筛选 /// </summary> /// <param name="path">筛选器</param> /// <param name="value">筛选节点集合</param> /// <returns>匹配的HTML节点集合</returns> private static keyValue<list<htmlNode>, bool> filterNode(filter path, keyValue<list<htmlNode>, bool> value) { list<nodeIndex> values = new list<nodeIndex>(); nodeIndex index = new nodeIndex { Values = value.Key.getList() }; if (index.Values.Count != 0) { if (value.Value) { HashSet<htmlNode> newValues = new HashSet<htmlNode>(), historyNodes = new HashSet<htmlNode>(); if (path.values == null) { if (path.value != null) { string tagName = path.value; while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; if (node.TagName == tagName) newValues.Add(node); if (node.children.count() == 0 || historyNodes.Contains(node)) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); historyNodes.Add(node); index.Values = node.children; index.Index = 0; } } } else { while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; newValues.Add(node); if (node.children.count() == 0 || historyNodes.Contains(node)) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); historyNodes.Add(node); index.Values = node.children; index.Index = 0; } } } } else { staticHashSet<string> tagNames = path.values; while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; if (tagNames.Contains(node.TagName)) newValues.Add(node); if (node.children.count() == 0 || historyNodes.Contains(node)) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); historyNodes.Add(node); index.Values = node.children; index.Index = 0; } } } if (newValues.Count != 0) { return new keyValue<list<htmlNode>, bool>(new list<htmlNode>(newValues), newValues.Count > 1); } } else { list<htmlNode> newValues = new list<htmlNode>(); if (path.values == null) { if (path.value != null) { string tagName = path.value; while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; if (node.TagName == tagName) newValues.Add(node); if (node.children.count() == 0) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); index.Values = node.children; index.Index = 0; } } } else { while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; newValues.Add(node); if (node.children.count() == 0) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); index.Values = node.children; index.Index = 0; } } } } else { staticHashSet<string> tagNames = path.values; while (true) { if (index.Values == null) { if (values.Count == 0) break; else index = values.Pop(); } htmlNode node = index.Values[index.Index]; if (tagNames.Contains(node.TagName)) newValues.Add(node); if (node.children.count() == 0) { if (++index.Index == index.Values.Count) index.Values = null; } else { if (++index.Index != index.Values.Count) values.Add(index); index.Values = node.children; index.Index = 0; } } } if (newValues.Count != 0) { return new keyValue<list<htmlNode>, bool>(newValues, newValues.Count > 1); } } } return new keyValue<list<htmlNode>, bool>(null, false); }
private void on_change(filter.change_type change) { logger.Debug("[view] change: " + change + " on " + name); switch (change) { case filter.change_type.new_lines: // ... so that we're showing the new lines instantly this.async_call(refresh); break; case filter.change_type.changed_filter: this.async_call(() => render_.clear_format_cache("changed filter")); this.async_call(refresh); break; case filter.change_type.file_rewritten: this.async_call(clear); break; default: Debug.Assert(false); break; } }
public log_view(Form parent, string name) { Debug.Assert(parent is log_view_parent); filter_ = new filter(this.create_match_object); filter_.on_change = on_change; InitializeComponent(); this.parent = parent; ++ignore_change_; viewName.Text = name; --ignore_change_; model_ = new log_view_data_source(this.list, this ) { name = name }; list.VirtualListDataSource = model_; load_font(); lv_parent.handle_subcontrol_keys(this); render_ = new log_view_render(this); foreach (var col in list.AllColumns) { col.Renderer = render_; col.Tag = new log_view_column_tag(this); } right_click_ = new log_view_right_click(this); cur_col_ = msgCol.fixed_index(); edit.on_sel_changed = on_edit_sel_changed; edit.on_search_ahead = search_ahead; edit.init(this); edit.BringToFront(); list.ColumnRightClick += list_ColumnRightClick; list.ColumnWidthChanged += List_on_column_width_changed; list.ColumnWidthChanging += List_on_column_width_changing; msgCol.FillsFreeSpace = !app.inst.show_horizontal_scrollbar; }
private void on_change(filter.change_type change) { logger.Debug("[view] change: " + change + " on " + name); switch (change) { case filter.change_type.new_lines: case filter.change_type.changed_filter: this.async_call(refresh); break; case filter.change_type.file_rewritten: this.async_call(clear); break; default: Debug.Assert(false); break; } }
/// <summary> /// 子节点筛选 /// </summary> /// <param name="path">筛选器</param> /// <param name="value">筛选节点集合</param> /// <returns>匹配的HTML节点集合</returns> private static keyValue<list<htmlNode>, bool> filterChild(filter path, keyValue<list<htmlNode>, bool> value) { if (path.index < 0) { if (path.indexs == null) { if (path.values == null) { if (path.value != null) { string tagName = path.value; list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; foreach (htmlNode nodes in value.Key) { if (nodes.children.count() > 0) { foreach (htmlNode node in nodes.children) { if (node.TagName == tagName) newValues.Add(node); } } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); } else { int index = 0; foreach (htmlNode nodes in value.Key) if (nodes.children != null) index += nodes.children.Count; if (index != 0) { htmlNode[] newValues = new htmlNode[index]; index = 0; foreach (htmlNode nodes in value.Key) { if (nodes.children != null) { nodes.children.CopyTo(newValues, index); index += nodes.children.Count; } } return new keyValue<list<htmlNode>, bool>(new list<htmlNode>(newValues, true), value.Value && newValues.Length != 1); } return new keyValue<list<htmlNode>, bool>(null, false); } } else { staticHashSet<string> tagNames = path.values; list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; foreach (htmlNode nodes in value.Key) { if (nodes.children.count() != 0) { foreach (htmlNode node in nodes.children) { if (tagNames.Contains(node.TagName)) newValues.Add(node); } } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); } } else { list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; if (path.value != null) { string tagName = path.value; staticHashSet<int> indexs = path.indexs; foreach (htmlNode nodes in value.Key) { if (nodes.children.count() != 0) { int index = 0; foreach (htmlNode node in nodes.children) { if (node.TagName == tagName) { if (indexs.Contains(index)) newValues.Add(node); ++index; } } } } } else { int[] indexs = path.indexs.GetList().ToArray(); foreach (htmlNode nodes in value.Key) { int count = nodes.children.count(); if (count > 0) { list<htmlNode> children = nodes.children; for (int index = indexs.Length; --index >= 0; ) { if (index < count) newValues.Add(children[index]); } } } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); } } else { list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; if (path.value != null) { string tagName = path.value; int index = path.index; foreach (htmlNode nodes in value.Key) { if (nodes.children.count() != 0) { int count = 0; foreach (htmlNode node in nodes.children) { if (node.TagName == tagName) { if (count == index) { newValues.Add(node); break; } ++count; } } } } } else { int index = path.index; foreach (htmlNode nodes in value.Key) { if (index < nodes.children.count()) newValues.List.Add(nodes.children[index]); } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); } }
public Attribute_Filter(string n, filter _f) { f = _f; name = n; }
private static string GetFilter(FetchEntityType entity, filter filteritem, FetchXmlBuilder sender) { var result = ""; if (filteritem.Items == null || filteritem.Items.Length == 0) { return ""; } var logical = filteritem.type == filterType.or ? " or " : " and "; if (filteritem.Items.Length > 1) { result = "("; } foreach (var item in filteritem.Items) { if (item is condition) { result += GetCondition(entity, item as condition, sender); } else if (item is filter) { result += GetFilter(entity, item as filter, sender); } result += logical; } if (result.EndsWith(logical)) { result = result.Substring(0, result.Length - logical.Length); } if (filteritem.Items.Length > 1) { result += ")"; } return result; }
/// <summary> /// 属性值筛选 /// </summary> /// <param name="path">筛选器</param> /// <param name="value">筛选节点集合</param> /// <returns>匹配的HTML节点集合</returns> private static keyValue<list<htmlNode>, bool> filterValue(filter path, keyValue<list<htmlNode>, bool> value) { string name = path.name; list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; if (path.values == null && path.value == null) { foreach (htmlNode node in value.Key) { if (node.attributes != null && node.attributes.ContainsKey(name)) newValues.Add(node); } } else { if (path.values == null) { string nameValue = path.value; foreach (htmlNode node in value.Key) { if (node[name] == nameValue) newValues.Add(node); } } else { staticHashSet<string> values = path.values; foreach (htmlNode node in value.Key) { if (values.Contains(node[name])) newValues.Add(node); } } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); }
/// <summary> /// 解析下一个筛选功能 /// </summary> /// <param name="start">起始字符位置</param> /// <param name="end">结束字符位置</param> /// <returns>字符位置</returns> private char* next(char* start, char* end) { start = unsafer.String.findAscii(start, end, filterFixedMap, Filters[0]); if (start != null) { nextFilter = new filter(start, end); return start; } return end; }
/// parse string which contains rotation /// </summary> /// <param name="f"></param> /// <param name="s1"></param> /// <returns></returns> public bool instring(filter f, String s1) { String s; try { x = Double.Parse(s1); s = f.nextToken(); y = Double.Parse(s); s = f.nextToken(); z = Double.Parse(s); s = f.nextToken(); angle = Double.Parse(s); } catch (Exception e) { Console.WriteLine("sfrotation.instring {0}", e); } return true; }
/// <summary> /// class样式筛选 /// </summary> /// <param name="path">筛选器</param> /// <param name="value">筛选节点集合</param> /// <returns>匹配的HTML节点集合</returns> private static keyValue<list<htmlNode>, bool> filterClass(filter path, keyValue<list<htmlNode>, bool> value) { list<htmlNode>.unsafer newValues = new list<htmlNode>(value.Key.Count).Unsafer; if (path.values == null) { string name = path.value; foreach (htmlNode node in value.Key) { string className = node["class"]; if (className != null && className.Split(' ').indexOf(name) != -1) newValues.Add(node); } } else { staticHashSet<string> names = path.values; foreach (htmlNode node in value.Key) { string className = node["class"]; if (className != null) { foreach(string name in className.Split(' ')) { if (names.Contains(name)) { newValues.Add(node); break; } } } } } return new keyValue<list<htmlNode>, bool>(newValues.List.Count != 0 ? newValues.List : null, value.Value && newValues.List.Count > 1); }
public log_view(Form parent, string name) { Debug.Assert(parent is log_view_parent); filter_ = new filter(this.create_match_object); filter_.on_change = on_change; InitializeComponent(); this.parent = parent; ++ignore_change_; viewName.Text = name; --ignore_change_; model_ = new log_view_data_source(this.list, this ) { name = name }; list.VirtualListDataSource = model_; load_font(); lv_parent.handle_subcontrol_keys(this); render_ = new log_view_render(this); foreach (var col in list.AllColumns) (col as OLVColumn).Renderer = render_; right_click_ = new log_view_right_click(this); // just an example: //render_.set_override("settings", new log_view_render.print_info { fg = Color.Blue, bold = true }); cur_col_ = msgCol.fixed_index(); edit.on_sel_changed = on_edit_sel_changed; edit.on_search_ahead = search_ahead; edit.init(this); edit.BringToFront(); list.ColumnRightClick += list_ColumnRightClick; list.ColumnWidthChanged += List_on_column_width_changed; list.ColumnWidthChanging += List_on_column_width_changing; }
/// <summary> /// 根据筛选路径解析筛选器 /// </summary> /// <param name="path">筛选路径</param> /// <returns>筛选器</returns> private static filter get(string path) { filter value; if (!cache.TryGetValue(path, out value)) { fixed (char* pathFixed = path) { cache[path] = value = new filter(pathFixed, pathFixed + path.Length); } } return value; }
static IEnumerable<string> getDpls(filter filt = null) { Func<servConfig.Apps, IEnumerable<string>> allApp = app => { var fix = existedDpls(app, filt.allFixs, null); var brend = filt.allBrendMasks.SelectMany(m => existedDpls(app, filt.allBrands, m)); var skin = filt.allSkinMasks.SelectMany(m => existedDpls(app, filt.allSkins, m)); return fix.Concat(brend).Concat(skin); }; var res = filt.apps.SelectMany(app => allApp(app)); return res; }
/// write to file /// </summary> /// <param name="f">information about output</param> /// <param name="mode">mode values /// 0 - output VRML97 modified values /// 1 - output VRML97 original values /// 2 - output xml (x3d) /// 3 - output attribute in brackets /// 4 - output with f prefix</param> /// <param name="indent"></param> public override void write(filter f, int mode, int indent) { toAxisAngle(); f.write(outstring(mode)); }