/// <summary> /// 设置 /// </summary> public override void EntitySet() { WH entity = new WH(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); HTDataFormNo = entity.WHID; txtWHID.Text = entity.WHID.ToString(); //drpCompanyTypeID.EditValue = entity.CompanyTypeID; txtWHNM.Text = entity.WHNM.ToString(); txtWHStartDate.DateTime = entity.WHStartDate; drpIsUseable.EditValue = entity.IsUseable; drpWHPosMethodID.EditValue = entity.WHPosMethodID; drpISJK.EditValue = entity.ISJK; //drpNegativeFlag.EditValue = entity.NegativeFlag; //drpZeroExitFlag.EditValue = entity.ZeroExitFlag; //txtItemUnit.Text = entity.ItemUnit.ToString(); txtRemark.Text = entity.Remark.ToString(); //txtWHtel.Text = entity.WHTel.ToString(); //drpISOth.EditValue = entity.ISOth; //txtWHAddress.Text = entity.WHAddress; //txtWHAttn.Text = entity.WHAttn.ToString(); drpWHCalMethodID.EditValue = entity.WHCalMethodID; drpWHType.EditValue = SysConvert.ToInt32(entity.WHType.ToString()); HTDataDelFlag = entity.DelFlag; if (!findFlag) { } BindGridDts(); }
/// <summary> /// 删除 /// </summary> public override void EntityDelete() { WHRule rule = new WHRule(); WH entity = EntityGet(); rule.RDelete(entity); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WH EntityGet() { WH entity = new WH(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { WH MasterEntity = (WH)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM WH_WH WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WH entity = (WH)p_BE; WHCtl control = new WHCtl(sqlTrans); string sql = string.Empty; sql = " SELECT 1 FROM WH_WH WHERE WHID= " + SysString.ToDBString(entity.WHID); if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("仓库编码已经存在,请重新输入!"); } sql = " SELECT 1 FROM WH_WH WHERE WHNM= " + SysString.ToDBString(entity.WHNM); if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("仓库名称已经存在,请重新输入!"); } entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_WH, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { WHRule rule = new WHRule(); WH entity = EntityGet(); Section[] entitydts = EntityDtsGet(); rule.RUpdate(entity, entitydts); }
public override global::System.Data.DataSet Clone() { WH cln = ((WH)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public ValueTask DisposeAsync() { if (!_disposed) { _disposed = true; return(WH.HideTooltipAsync()); } return(default);
public ValueTask DisposeAsync() { if (!_disposed) { _disposed = true; GC.SuppressFinalize(this); return(WH.HideTooltipAsync()); } return(default);
private void Game_OnUpdate() { if (Player.IsDead || MenuGUI.IsChatOpen() || Player.IsRecalling()) { return; } switch (Orbwalker.Mode) { case OrbwalkingMode.Combo: OnCombo(); break; case OrbwalkingMode.Mixed: OnHarass(); break; case OrbwalkingMode.Laneclear: Jungle(); break; } Killsteal(); if (Menu["misc"]["autoq"].Enabled && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss") { foreach (var target in GameObjects.EnemyHeroes.Where( t => (t.HasBuffOfType(BuffType.Charm) || t.HasBuffOfType(BuffType.Stun) || t.HasBuffOfType(BuffType.Fear) || t.HasBuffOfType(BuffType.Snare) || t.HasBuffOfType(BuffType.Taunt) || t.HasBuffOfType(BuffType.Knockback) || t.HasBuffOfType(BuffType.Suppression)) && t.IsValidTarget(QH.Range) && !Invulnerable.Check(t, DamageType.Magical))) { QH.Cast(target); } } if (Menu["misc"]["autow"].Enabled && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack") { foreach (var target in GameObjects.EnemyHeroes.Where( t => (t.HasBuffOfType(BuffType.Charm) || t.HasBuffOfType(BuffType.Stun) || t.HasBuffOfType(BuffType.Fear) || t.HasBuffOfType(BuffType.Snare) || t.HasBuffOfType(BuffType.Taunt) || t.HasBuffOfType(BuffType.Knockback) || t.HasBuffOfType(BuffType.Suppression)) && t.IsValidTarget(WH.Range) && !Invulnerable.Check(t, DamageType.Magical))) { WH.Cast(target); } } float hp = Menu["misc"]["autoeh"].As <MenuSlider>().Value; if (Menu["misc"]["autoe"].Enabled && EH.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "PrimalSurge" && Player.HealthPercent() <= hp) { EH.Cast(Player); } if (Menu["flee"]["key"].Enabled) { Flee(); } }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { WHRule rule = new WHRule(); WH entity = EntityGet(); Section[] entitydts = EntityDtsGet(); rule.RAdd(entity, entitydts); return(entity.ID); }
public static IntPtr SetHook(WH hookType, HOOKPROC proc) { using (var curProcess = Process.GetCurrentProcess()) { using (var curModule = curProcess.MainModule) { return(SetWindowsHookExW(hookType, proc, Kernel32.GetModuleHandleW(curModule.ModuleName), 0)); } } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { WH ds = new WH(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public override void ViewDidLoad() { base.ViewDidLoad(); SCNView = WH.GetOrSet(nameof(SCNView), new ARSCNView { Frame = View.Frame }); View.AddSubview(SCNView); TrackingConfiguration = new ARWorldTrackingConfiguration { }; SCNView.Session.Run(TrackingConfiguration, ARSessionRunOptions.RemoveExistingAnchors | ARSessionRunOptions.ResetTracking); }
public bool UpdateContext(object context, bool set = false) { var changed = _context != context; _context = context; WH.Set(_sessionGuid, context); if (set) { SetContext(); } return(changed); }
public override void ViewDidLoad() { base.ViewDidLoad(); TableView = WH.GetOrSet("tableView", GetTableView); TableViewDataSource = WH.GetOrSet("dataSource", GetDiffableDataSource); ApplyButton = GetApplyButton(); View.FillWith(TableView); View.InsertSubviewAbove(ApplyButton, TableView); ApplyButton.TouchUpInside += ApplyButtonClicked; }
///// <summary> /////通用 重新设置实体 ///// </summary> //private void gridViewRowChanged2(object sender) //{ // try // { // ColumnView view = sender as ColumnView; // txtWHIDP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "WHID")); // txtWHPicIDP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "WHPicID")); // txtPosXP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "PosX")); // txtPosYP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "PosY")); // txtSizeWidthP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "SizeWidth")); // txtSizeHeightP.Text = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "SizeHeight")); // } // catch (Exception E) // { // this.ShowMessage(E.Message); // } //} #endregion #region 自定义方法 /// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WH EntityGet() { WH entity = new WH(); entity.ID = HTDataID; entity.SelectByID(); entity.WHID = txtWHID.Text.Trim(); entity.WHNM = txtWHNM.Text.Trim(); entity.WHStartDate = txtWHStartDate.DateTime.Date; entity.IsUseable = SysConvert.ToInt32(drpIsUseable.EditValue); entity.WHPosMethodID = SysConvert.ToInt32(drpWHPosMethodID.EditValue); entity.ISJK = SysConvert.ToInt32(drpISJK.EditValue); entity.Remark = txtRemark.Text.Trim(); entity.WHCalMethodID = SysConvert.ToInt32(drpWHCalMethodID.EditValue); entity.WHType = drpWHType.EditValue.ToString(); return(entity); }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WH entity = (WH)p_BE; Section entity2 = new Section(sqlTrans); entity2.MainID = entity.ID; entity2.SelectByID(); string sql = string.Empty; sql = " SELECT 1 FROM WH_WH WHERE WHID= " + SysString.ToDBString(entity.WHID); sql += " AND ID <>" + entity.ID; if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("仓库编码已经存在,请重新输入!"); } sql = " SELECT 1 FROM WH_WH WHERE WHNM= " + SysString.ToDBString(entity.WHNM); sql += " AND ID <>" + entity.ID; if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("仓库名称已经存在,请重新输入!"); } //sql = "SELECT 1 FROM WH_Section WHERE MainID=" + entity.ID.ToString(); //sql += " AND SectionID=" + SysString.ToDBString(entity2.SectionID); //if (sqlTrans.Fill(sql).Rows.Count != 0) //{ // throw new Exception("区编号已经存在,请重新输入!"); //} WHCtl control = new WHCtl(sqlTrans); control.Update(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WH entity = (WH)p_BE; WHCtl control = new WHCtl(sqlTrans); string sql = "DELETE FROM WH_Section WHERE MainID=" + entity.ID.ToString(); sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据 control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 保存(传入事务处理) /// </summary> /// <param name="p_Entity"></param> /// <param name="p_BE"></param> /// <param name="sqlTrans"></param> public void RSave(WH p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans) { try { string sql = "DELETE FROM WH_Section WHERE MainID=" + p_Entity.ID.ToString(); sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据 for (int i = 0; i < p_BE.Length; i++) { Section entitydts = (Section)p_BE[i]; sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM WH_Section WHERE MainID=" + p_Entity.ID.ToString(); entitydts.Seq = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq entitydts.MainID = p_Entity.ID; this.RAdd(entitydts, sqlTrans); } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
private void Jungle() { foreach (var jungle in GameObjects.Jungle.Where(m => m.IsValidTarget(QH.Range)).ToList()) { if (!jungle.IsValidTarget() || !jungle.IsValidSpellTarget()) { return; } float manapercent = Menu["jungleclear"]["manaj"].As <MenuSlider>().Value; if (Player.ManaPercent() >= manapercent) { bool useQ = Menu["jungleclear"]["usejq"].Enabled; if (useQ) { switch (Menu["jungleclear"]["qo"].As <MenuList>().Value) { case 0: if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && jungle.IsValidTarget(QH.Range)) { QH.Cast(jungle); } else if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && jungle.IsValidTarget(QC.Range)) { QC.Cast(); } break; case 1: if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && jungle.IsValidTarget(QH.Range)) { QH.Cast(jungle); } break; case 2: if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && jungle.IsValidTarget(QC.Range)) { QC.Cast(); } break; } } bool useW = Menu["jungleclear"]["usejw"].Enabled; if (useW) { switch (Menu["jungleclear"]["wo"].As <MenuList>().Value) { case 0: if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && jungle.IsValidTarget(WH.Range)) { WH.Cast(jungle); } else if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && jungle.IsValidTarget(WC.Range)) { WC.Cast(jungle); } break; case 1: if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && jungle.IsValidTarget(WH.Range)) { WH.Cast(jungle); } break; case 2: if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && jungle.IsValidTarget(WC.Range)) { WC.Cast(jungle); } else if (WCL.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && jungle.IsValidTarget(WCL.Range) && jungle.HasBuff("NidaleePassiveHunted")) { WCL.Cast(jungle); } break; } } bool useE = Menu["jungleclear"]["usejce"].Enabled; if (useE && Player.SpellBook.GetSpell(SpellSlot.E).Name == "Swipe" && EC.Ready && jungle.IsValidTarget(EC.Range)) { EC.Cast(jungle); } bool useR = Menu["jungleclear"]["usejr"].Enabled; if (useR) { switch (Menu["combo"]["ro"].As <MenuList>().Value) { case 0: if (R.Ready && !QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && jungle.IsValidTarget(QC.Range)) { R.Cast(); } else if (R.Ready && !QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && jungle.IsValidTarget(QH.Range)) { R.Cast(); } else if (R.Ready && !jungle.IsValidTarget(WCL.Range) && Player.SpellBook.GetSpell(SpellSlot.Q).Name != "JavelinToss" || jungle == null) { R.Cast(); } break; } } } } }
private void OnCombo() { bool useQ = Menu["combo"]["useq"].Enabled; if (useQ) { var QHuman = GetBestEnemyHeroTargetInRange(QH.Range); var QCougar = GetBestEnemyHeroTargetInRange(QC.Range); switch (Menu["combo"]["qo"].As <MenuList>().Value) { case 0: if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && QHuman.IsValidTarget(QH.Range)) { QH.Cast(QHuman); } else if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && QCougar.IsValidTarget(QC.Range)) { QC.Cast(); } break; case 1: if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && QHuman.IsValidTarget(QH.Range)) { QH.Cast(QHuman); } break; case 2: if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && QCougar.IsValidTarget(QC.Range)) { QC.Cast(); } break; } } bool useW = Menu["combo"]["usew"].Enabled; if (useW) { var WHuman = GetBestEnemyHeroTargetInRange(WH.Range); var WCougar = GetBestEnemyHeroTargetInRange(WC.Range); switch (Menu["combo"]["wo"].As <MenuList>().Value) { case 0: if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && WHuman.IsValidTarget(WH.Range)) { WH.Cast(WHuman); } else if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WC.Range)) { WC.Cast(WCougar); } break; case 1: if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && WHuman.IsValidTarget(WH.Range)) { WH.Cast(WHuman); } break; case 2: if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WC.Range)) { WC.Cast(WCougar); } else if (WCL.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WCL.Range) && WCougar.HasBuff("NidaleePassiveHunted")) { WCL.Cast(WCougar); } break; } } bool useE = Menu["combo"]["usee"].Enabled; float hpe = Menu["combo"]["useeh"].As <MenuSlider>().Value; float manae = Menu["combo"]["useehm"].As <MenuSlider>().Value; if (useE) { var ECougar = GetBestEnemyHeroTargetInRange(EC.Range); switch (Menu["combo"]["eo"].As <MenuList>().Value) { case 0: if (EH.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "PrimalSurge" && Player.ManaPercent() >= manae && Player.HealthPercent() <= hpe) { EH.Cast(Player); } else if (EC.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "Swipe" && ECougar.IsValidTarget(EC.Range)) { EC.Cast(ECougar); } break; case 1: if (EH.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "PrimalSurge" && Player.ManaPercent() >= manae && Player.HealthPercent() <= hpe) { EH.Cast(Player); } break; case 2: if (EC.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "Swipe" && ECougar.IsValidTarget(EC.Range)) { EC.Cast(ECougar); } break; } } bool useR = Menu["combo"]["user"].Enabled; float rangeR = Menu["combo"]["userr"].As <MenuSlider>().Value; if (useR) { var RTarget = GetBestEnemyHeroTargetInRange(rangeR); switch (Menu["combo"]["ro"].As <MenuList>().Value) { case 0: if (R.Ready && !QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && RTarget.IsValidTarget(WC.Range)) { R.Cast(); } else if (R.Ready && !QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && RTarget.IsValidTarget(QH.Range)) { R.Cast(); } else if (R.Ready && !RTarget.IsValidTarget(WCL.Range) && Player.SpellBook.GetSpell(SpellSlot.Q).Name != "JavelinToss") { R.Cast(); } break; } } }
static extern IntPtr SetWindowsHookEx(WH idHook, KeyHookHandler lpfn, IntPtr module, uint dwThreadId);
static extern IntPtr SetWindowsHookEx(WH hookType, MouseHookHandler hookDelegate, IntPtr module, uint threadId);
protected WindowsHook(WH hookType) { HookProc = OnHookTriggered; HookType = hookType; }
protected WindowsHook(WH hookType) { _hookProc = OnHookTriggered; _hookType = hookType; }
public WindowsHookBase(WH hook) { _hookID = IntPtr.Zero; _hookType = hook; _filterFunc = new HOOKPROC(this.CoreHookProc); }
internal static extern IntPtr SetWindowsHookEx(WH idHook, HOOKPROC lpfn, IntPtr hMod, int dwThreadId);
public string Get(string reqType, string EmpIds, string dates) { DanpheHTTPResponse <object> responseData = new DanpheHTTPResponse <object>(); SchedulingDbContext schDbContext = new SchedulingDbContext(connString); MasterDbContext masterDb = new MasterDbContext(connString); try { List <DepartmentModel> allDeptsFromCache = (List <DepartmentModel>)DanpheCache.GetMasterData(MasterDataEnum.Department); List <EmployeeModel> empListFromCache = (List <EmployeeModel>)DanpheCache.GetMasterData(MasterDataEnum.Employee); #region GET: List of Employees if (reqType == "employeelist") { var result = (from e in empListFromCache join d in allDeptsFromCache on e.DepartmentId equals d.DepartmentId select new { e.EmployeeId, d.DepartmentId, d.DepartmentName, EmployeeName = e.Salutation + ". " + e.FirstName + " " + (string.IsNullOrEmpty(e.MiddleName) ? "" : e.MiddleName + " ") + e.LastName, }).ToList(); responseData.Status = "OK"; responseData.Results = result; } #endregion #region GET: Employee Schedules else if (reqType == "getEmpSchedule") { string[] employeeIDs = EmpIds.Split(','); string[] curDates = dates.Split(','); List <object> res = new List <object>(); var abc = (from emp in empListFromCache join dept in allDeptsFromCache on emp.DepartmentId equals dept.DepartmentId join e in employeeIDs on emp.EmployeeId.ToString() equals e select new { emp.EmployeeId, EmployeeName = emp.Salutation + ". " + emp.FirstName + " " + (string.IsNullOrEmpty(emp.MiddleName) ? "" : emp.MiddleName + " ") + emp.LastName, DepartmentName = dept.DepartmentName, defSCH = (from daywise in schDbContext.DayWiseAvailability where daywise.EmployeeId == emp.EmployeeId select new { daywise.DayName, IsWorkingDay = daywise.IsWorking }).ToList(), loadSCH = (from em in schDbContext.Employee join sch in schDbContext.EmpSchedules on em.EmployeeId equals sch.EmployeeId into schTemp from s in schTemp.DefaultIfEmpty() join date in curDates on s.Date.ToString() equals date where em.EmployeeId == emp.EmployeeId select new { Id = s.EmployeeSCHId, TxnType = "Update", Date = s.Date.Value, s.DayName, s.IsWorkingDay }).ToList(), }).ToList(); responseData.Status = "OK"; responseData.Results = abc; } #endregion #region GET: list of shifts master else if (reqType == "getShiftList") { var shiftList = schDbContext.ShiftsMaster.OrderByDescending(a => a.IsDefault).ToList(); responseData.Status = "OK"; responseData.Results = shiftList; } #endregion #region GET: list of Employee working hours else if (reqType == "getEmpWHList") { List <object> res = new List <object>(); var empDetails = (from emp in masterDb.Employees join dept in masterDb.Departments on emp.DepartmentId equals dept.DepartmentId join role in masterDb.EmployeeRole on emp.EmployeeRoleId equals role.EmployeeRoleId select new { emp.EmployeeId, EmployeeName = emp.Salutation + ". " + emp.FirstName + " " + (string.IsNullOrEmpty(emp.MiddleName) ? "" : emp.MiddleName + " ") + emp.LastName, emp.DepartmentId, dept.DepartmentName, emp.EmployeeRoleId, role.EmployeeRoleName }).ToList(); var empWorkingHours = (from emp in empDetails join m in schDbContext.EmpShiftMAP on emp.EmployeeId equals m.EmployeeId into mTemp from map in mTemp.DefaultIfEmpty() join shift in schDbContext.ShiftsMaster on(map != null ? map.ShiftId : 0) equals shift.ShiftId where (map != null ? map.IsActive : false) == true group new { emp, map, shift } by new { emp.EmployeeId, emp.EmployeeName, emp.EmployeeRoleName, emp.DepartmentName } into WH select new { WH.Key.EmployeeId, WH.Key.EmployeeName, WH.Key.DepartmentName, WH.Key.EmployeeRoleName, NoOfShifts = WH.Select(a => a.map.ShiftId).Count(), Shifts = WH.Select(a => new { a.map.EmployeeShiftMapId, a.map.ShiftId, a.shift.ShiftName, a.shift.StartTime, a.shift.EndTime, a.shift.TotalHrs, a.map.IsActive, a.shift.IsDefault //,IsEditable = (from m in schDbContext.EmpShiftMAP // where m.ShiftId == a.map.ShiftId // select new { m.ShiftId }).Count().Equals(1) }).OrderBy(z => z.StartTime).ToList(), TotalWorkingHrs = WH.Sum(a => a.shift.TotalHrs) }).ToList(); var empNOworkingHours = (from emp in empDetails where !schDbContext.EmpShiftMAP.Any(x => x.EmployeeId == emp.EmployeeId && x.IsActive == true) select new { emp.EmployeeId, emp.EmployeeName, emp.EmployeeRoleName, emp.DepartmentName, NoOfShifts = 0, TotalWorkingHrs = 0 }).ToList(); foreach (var x in empWorkingHours) { res.Add(x); } foreach (var x in empNOworkingHours) { res.Add(x); } //var workingHours = (from map in schDbContext.EmpShiftMAP // join e in schDbContext.Employee on map.EmployeeId equals e.EmployeeId // join d in allDepts on e.DepartmentId equals d.DepartmentId // join s in schDbContext.ShiftsMaster on map.ShiftId equals s.ShiftId // join r in schDbContext.EmpRole on e.EmployeeRoleId equals r.EmployeeRoleId // where map.IsActive == true // group new { map, e, s } by new // { // e.EmployeeId, // EmployeeName = e.Salutation + ". " + e.FirstName + " " + (string.IsNullOrEmpty(e.MiddleName) ? "" : e.MiddleName + " ") + e.LastName, // d.DepartmentId, // d.DepartmentName, // r.EmployeeRoleName // } into x // select new // { // x.Key.EmployeeId, // x.Key.EmployeeName, // x.Key.DepartmentId, // x.Key.DepartmentName, // x.Key.EmployeeRoleName, // NoOfShifts = x.Select(a => a.map.ShiftId).Count(), // Shifts = x.Select(a => new // { // a.map.EmployeeShiftMapId, // a.map.ShiftId, // a.s.ShiftName, // a.s.StartTime, // a.s.EndTime, // a.s.TotalHrs, // a.map.IsActive, // a.s.IsDefault // //,IsEditable = (from m in schDbContext.EmpShiftMAP // // where m.ShiftId == a.map.ShiftId // // select new { m.ShiftId }).Count().Equals(1) // }).OrderBy(z => z.StartTime).ToList(), // TotalWorkingHrs = x.Sum(a => a.s.TotalHrs) // }).ToList(); responseData.Status = "OK"; responseData.Results = res; } #endregion #region GET: list of default shifts master else if (reqType == "getDefaultShifts") { var defShifts = (from s in schDbContext.ShiftsMaster where s.IsDefault == true select s).OrderBy(x => x.StartTime).ToList(); responseData.Status = "OK"; responseData.Results = defShifts; } #endregion #region else if (reqType == "getEmployeeNoShift") { //getting employee that doesnt have any active shift assigned to him/her (from EmployeeShiftMAP table) var empList = (from e in empListFromCache where !schDbContext.EmpShiftMAP.Any(x => x.EmployeeId == e.EmployeeId && x.IsActive == true) select e).ToList(); responseData.Status = "OK"; responseData.Results = empList; } #endregion } catch (Exception ex) { responseData.Status = "Failed"; responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString(); } return(DanpheJSONConvert.SerializeObject(responseData, true)); }
public static extern HOOK SetWindowsHookEx(WH idHook, CALLBACK lpfn, IntPtr hMod, int dwThreadId);
public static extern IntPtr SetWindowsHookEx(WH hookType, HookProc lpfn, IntPtr hMod, uint dwThreadId);
public WindowsHookBase(WH hook, HOOKPROC func) { _hookID = IntPtr.Zero; _hookType = hook; _filterFunc = func; }