/// Thêm quyền người dùng /// <param name="RoleFunction"></param> /// <returns></returns> public int UserFunctionInsert(UserFunction RoleFunction) { try { var pars = new SqlParameter[8]; pars[0] = new SqlParameter("@_UserID", RoleFunction.UserID); pars[1] = new SqlParameter("@_FunctionID", RoleFunction.FunctionID); pars[2] = new SqlParameter("@_IsGrant", RoleFunction.IsGrant); pars[3] = new SqlParameter("@_IsInsert", RoleFunction.IsInsert); pars[4] = new SqlParameter("@_IsUpdate", RoleFunction.IsUpdate); pars[5] = new SqlParameter("@_IsDelete", RoleFunction.IsDelete); pars[6] = new SqlParameter("@_CreatedUserID", RoleFunction.CreatedUserID); pars[7] = new SqlParameter("@_ResponseCode", SqlDbType.Int) { Direction = ParameterDirection.Output }; new DBHelper(Config.Site1400ConnectionString).ExecuteNonQuerySP("SP_UserFunction_InsertOne", pars); return(Convert.ToInt32(pars[7].Value)); } catch (Exception ex) { NLogLogger.LogInfo(ex.ToString()); return(-99); } }
public void CanFailToGetSpecificUserFunction() { UserFunctionsList lst = new UserFunctionsList(); UserFunction actual = lst.GetUserFunction("bogus"); Assert.IsNull(actual); }
public Simulator(string path) { graph = new FileParser().ParseFile(path); network = new BayesianNetwork(graph); evidences = new List <Evidence>(); commandsMapper = new[] { UserAction.Of("Reset", Reset), UserAction.Of("Add Evidence", AddEvidence), UserAction.Of("Probabilistic Reasoning", ProbabilisticReasoning), UserAction.Of("Quit", Quit) }; probabilisticReasoning = new[] { UserFunction.Of("What is the probability that each of the vertices contains evacuees?", () => QueryNodes(network.EvacueeNodes)), UserFunction.Of("What is the probability that each of the vertices is flooded?", () => QueryNodes(network.FloodingNodes)), UserFunction.Of("What is the probability that each of the edges is blocked?", () => QueryNodes(network.BlockageNodes)), UserFunction.Of("What is the probability that a certain path is free from blockages?", IsPathFree), UserFunction.Of( "What is the path from a given location to a goal that has the highest probability of being free from blockages?", BestPath), UserFunction.Of("All", () => probabilisticReasoning[0].Action() .Concat(probabilisticReasoning[1].Action()).ToList() .Concat(probabilisticReasoning[2].Action()).ToList()) }; Start(); }
public KeyPayApiV2Client(string baseUrl, AuthenticationDetails authenticationDetails) { var api = new ApiRequestExecutor(baseUrl) { Authenticator = authenticationDetails.Authenticator }; Business = new BusinessFunction(api); PayCategory = new PayCategoryFunction(api); PaySchedule = new PayScheduleFunction(api); Employee = new EmployeeFunction(api); Location = new LocationFunction(api); PayRun = new PayRunFunction(api); LeaveCategory = new LeaveCategoryFunction(api); Report = new ReportFunction(api); Timesheet = new TimesheetFunction(api); User = new UserFunction(api); PayRateTemplates = new PayRateTemplateFunction(api); DeductionCategory = new DeductionCategoryFunction(api); ExpenseCategory = new ExpenseCategoryFunction(api); WorkType = new WorkTypeFunction(api); Document = new DocumentFunction(api); EmployeeGroup = new EmployeeGroupFunction(api); EmployingEntity = new EmployingEntityFunction(api); PaymentSummary = new PaymentSummaryFunction(api); RosterShift = new RosterShiftFunction(api); Manager = new ManagerFunction(api); Kiosk = new KioskFunction(api); TimeAndAttendance = new TimeAndAttendanceFunction(api); Unavailability = new UnavailabilityFunction(api); }
public MessageService() { BlogContext dbContext = new BlogContext(); messageRepositories = new MessageFunction(dbContext); userRepositories = new UserFunction(dbContext); }
public static Token ExecuteUserFunction(string funcName, List <Token> arguments) { functionCallNumber++; Token result = Token.Error("Invalid call to user function"); if (!userFunctions.ContainsKey(variables.GetStringData(funcName))) { return(result); } UserFunction userFunc = userFunctions[variables.GetStringData(funcName)]; Dictionary <string, string> names = new Dictionary <string, string>(); for (int i = 0; i < arguments.Count; i++) { //var tempName = "_" + Guid.NewGuid().ToString("N"); var tempName = GenerateRandomName(); //This is much faster than Guid due to smaller string length names.Add(tempName, arguments[i].TokenName); arguments[i].TokenName = tempName; variables.AddToken(arguments[i]); } string executbleCode = ReplaceNames(arguments, userFunc); Token temp = new Token(TokenType.Block, "", executbleCode); callDepth++; if (callDepth == 0) { variables.RemoveReservedWord("return"); } try { temp = BlockCommands.ExecuteBlock(temp); } catch (Exception) { temp = Token.Error("An error occured while performaing the operation"); } callDepth--; if (callDepth < 0) { variables.AddReservedWord("return"); } foreach (var pair in names) { var item = variables.GetToken(pair.Key); item.TokenName = pair.Value; variables.Remove(pair.Key); } if (userFunc.returns && temp.TokenType != TokenType.Error) { try { temp = variables.GetToken("return"); } catch (Exception) { temp = Token.Error("Return value not valid in function definition"); } } return(temp); }
private void inputOSToolStripMenuItem_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { DataTable excelTable = new DataTable(); openFileDialog1.Multiselect = false; string filePath = openFileDialog1.FileName; string fileType = System.IO.Path.GetExtension(filePath); string SheetName1 = "手术医生编号"; if (string.IsNullOrEmpty(fileType)) { return; } excelTable = UserFunction.GetDataFromExcel(fileType, filePath, SheetName1); excelTable = UserFunction.removeEmptyRow(excelTable); string OsNo = ""; string OsName = ""; string NameSuoxie = ""; foreach (DataRow drE in excelTable.Rows) { string OS = drE[0].ToString(); string[] OSlist = OS.Split('_'); OsNo = OSlist[0]; OsName = OSlist[1]; NameSuoxie = OSlist[2]; dal.InsertShoushuYisheng(OsNo, OsName, NameSuoxie); } MessageBox.Show("导入完成"); } }
public AdminSevrice() { BlogContext dbContext = new BlogContext(); topicRepositories = new TopicFunction(dbContext); userRepositories = new UserFunction(dbContext); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns>The result of analysis.</returns> public string Analyze(UserFunction exp) { var sb = new StringBuilder(); sb.Append(exp.Function).Append('('); if (exp.Arguments != null && exp.Arguments.Length > 0) { foreach (var item in exp.Arguments) { sb.Append(item).Append(", "); } sb.Remove(sb.Length - 2, 2); } else if (exp.ParametersCount > 0) { for (int i = 1; i <= exp.ParametersCount; i++) { sb.AppendFormat("x{0}, ", i); } sb.Remove(sb.Length - 2, 2); } sb.Append(')'); return(sb.ToString()); }
public void CloneTest() { var exp = new UserFunction("f", new[] { new Number(5) }); var clone = exp.Clone(); Assert.Equal(exp, clone); }
public void CanGetSpecificUserFunction() { UserFunctionsList lst = new UserFunctionsList(); UserFunction actual = lst.GetUserFunction("HtmlEncode"); Assert.AreEqual("Encodes to html", actual.Description); }
//--------------------------------------------------------------------------- private void btBZoff_Click(object sender, RoutedEventArgs e) { //Buzzer Off LAMP.fn_BuzzOff(); UserFunction.fn_WriteLog("ALARM - BuzzerOff Click"); }
/// <summary> /// 查看玩家功能是否开启 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static List <UserFunction> GetFunctionList(string userID) { List <UserFunction> functionsList = new List <UserFunction>(); //命运水晶 UserFunction function_Crystal = GetUserFunction(userID, FunctionEnum.Mingyunshuijing); if (function_Crystal != null) { functionsList.Add(function_Crystal); } //装备封灵 UserFunction function_Spare = GetUserFunction(userID, FunctionEnum.Fengling); if (function_Spare != null) { functionsList.Add(function_Spare); } //武器附魔 UserFunction function_Enchant = GetUserFunction(userID, FunctionEnum.Enchant); if (function_Enchant != null) { functionsList.Add(function_Enchant); } return(functionsList); }
public virtual void ProcessElement(StreamRecord <T> record) { var element = record.Value; var newTimestamp = UserFunction.ExtractTimestamp(element, record.HasTimestamp ? record.Timestamp : long.MinValue); Output.Collect(record.Replace(record.Value, newTimestamp)); }
public static object run_e(String path, Node <Object> baseScope, char lineSpilt, Encoding encoding) { if (onLoad) { throw new Exception("禁止在加载期间加载"); } else { Node <Object> x = Node <Object> .kvs_find1st(core, path) as Node <Object>; if (x != null) { return(x.First()); } else { onLoad = true; String sb = Util.readTxt(path, lineSpilt, encoding); Node <Object> scope = Node <Object> .kvs_extend("load", new Load(baseScope, path, lineSpilt, encoding), baseScope); scope = Node <Object> .kvs_extend("pathOf", new PathOf(path), scope); Node <Token> tokens = Token.run(sb, lineSpilt); Exp exp = Exp.Parse(tokens); UserFunction f = new UserFunction(exp, scope); Object b = f.exec(null); core = Node <Object> .kvs_extend(path, Node <Object> .extend(b, null), core); onLoad = false; return(b); } } }
public void UserFunc() { var exp = new UserFunction("f", new IExpression[] { new Mul(new Number(2), new Number(2)) }, 1); var expected = new UserFunction("f", new IExpression[] { new Number(4) }, 1); SimpleTest(exp, expected); }
private void BindGridView() { DataTable dt = dal.GetByMzjldId(MzjldId); if (dt.Rows.Count == 0) { DataTable dtCon = dal.GetConsumablesAll(); foreach (DataRow dr in dtCon.Rows) { ConsumablesUseModel cu = new ConsumablesUseModel(); cu.MzjldId = MzjldId; cu.PatId = PatId; cu.Name = Convert.ToString(dr["Name"]); cu.Dosage = 0; cu.Price = UserFunction.ToDouble(dr["Price"]); cu.Unit = Convert.ToString(dr["Unit"]); cu.IsCost = 1; dal.Insert(cu); } dt = dal.GetByMzjldId(MzjldId); this.dgvUseList.DataSource = dt; } else { this.dgvUseList.DataSource = dt; } }
private UserFunction CreateObject(NullHandler oReader) { UserFunction oUserFunction = new UserFunction(); MapObject(oUserFunction, oReader); return(oUserFunction); }
//--------------------------------------------------------------------------- private void btStart_Click(object sender, RoutedEventArgs e) { // if (SEQ._bRun || SEQ._bAuto) { UserFunction.fn_UserMsg("Can't Work while RUN or Auto"); return; } if (FM.fn_GetLevel() != (int)EN_USER_LEVEL.lvMaster) { UserFunction.fn_UserMsg("Please Change Master Level."); return; } int nDly = 0; int.TryParse(upStopDelay.UPValue, out nDly); bool isOk = ACTR.MoveCyl(m_nSelIndex, (int)EN_ACTR_CMD.Fwd); if (isOk) { ACTR.fn_Reset(); MAN.fn_SetRptAct(-1, false, nDly); MAN.fn_SetRptAct(m_nSelIndex, true, nDly); } }
private void btnSave_Click(object sender, EventArgs e) { int res = 0; foreach (DataGridViewRow dr in dgvUseList.Rows) { ConsumablesUseModel cu = new ConsumablesUseModel(); cu.MzjldId = MzjldId; cu.PatId = PatId; cu.Id = UserFunction.ToInt32(dr.Cells["Id"].Value); cu.Name = Convert.ToString(dr.Cells["Name"].Value); cu.Dosage = UserFunction.ToInt32(dr.Cells["Dosage"].Value); cu.Price = UserFunction.ToDouble(dr.Cells["Price"].Value); cu.Unit = Convert.ToString(dr.Cells["Unit"].Value); cu.IsCost = UserFunction.ToInt32(dr.Cells["IsCost"].Value); res = dal.Update(cu); res += 1; } if (res == 0) { MessageBox.Show("保存失败!"); } else { MessageBox.Show("保存成功!"); BindGridView(); } }
private void functionList_SelectedIndexChanged(object sender, EventArgs e) { if (_functions.CommandExists(functionList.Text)) { UserFunction func = _functions.GetUserFunction(functionList.Text); fxDescription.Text = func.Description; StringBuilder subFunctions = new StringBuilder(); foreach (string subfunc in func.SubFunctions) { subFunctions.AppendLine(subfunc); } fxCommands.Text = subFunctions.ToString(); foreach (var param in func.Parameters) { udParms.Rows.Add(param.Name, param.DefaultValue, param.Required); } CommandListLeave(fxCommands, EventArgs.Empty); return; } fxCommands.Text = String.Empty; fxDescription.Text = String.Empty; udParms.Rows.Clear(); }
//--------------------------------------------------------------------------- private void btReset_Click(object sender, RoutedEventArgs e) { //Reset Click UserFunction.fn_WriteLog("ALARM - Reset Click"); SEQ.fn_Reset(); this.Hide(); }
public TopicService() { BlogContext dbContext = new BlogContext(); topicRepositiries = new TopicFunction(dbContext); messageRepositories = new MessageFunction(dbContext); userRepositories = new UserFunction(dbContext); }
public FunctionCallNode(UserFunction userFunc, List <List <Token <TokenType> > > args, LexerPosition linePosition) : base(linePosition) { func = null; this.userFunc = userFunc; isUserFunc = true; this.args = args; name = userFunc.Name; }
public ChatService() { BlogContext dbContext = new BlogContext(); ChatRepositiries = new ChatFunction(dbContext); messageRepositories = new ChatMessageFunction(dbContext); userRepositories = new UserFunction(dbContext); }
public void ThenUserStillExists() { var allUsers = UserFunction.GetAllUsers(); var matchingUser = allUsers.SingleWithId(ScenarioCache.GetUserId()); Assert.IsNotNull(matchingUser); }
//--------------------------------------------------------------------------- private void btClose_Click(object sender, RoutedEventArgs e) { // UserFunction.fn_WriteLog("ALARM - Close Click"); this.Hide(); m_UpdateTimer.IsEnabled = false; }
public UdfEditor(string udfName) : this() { _udfName = udfName; _selectedFunction = _userFunctions.GetUserFunction(udfName); ConvertUserParameterToParameter(_selectedFunction); //DiscoverUnnamedParameters(_selectedFunction); //DefineParameters(); }
public void ExecuteTest2() { var functions = new FunctionCollection(); var func = new UserFunction("f", new IExpression[] { new Number(1) }); Assert.Throws <KeyNotFoundException>(() => func.Execute(functions)); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns> /// The result of analysis. /// </returns> public override IExpression Analyze(UserFunction exp) { if (Parameters == null) { throw new ArgumentNullException(nameof(Parameters)); } return(Parameters.Functions[exp].Analyze(this)); }
public AssignmentClass(string cap, UserFunction f) { caption = cap; func = f; tooltip = ""; }
public static AssignmentClass FindAssignmentClass(UserFunction val) { for (int i = 0; i < AllAssignments.Length; ++i) if (AllAssignments[i].func == val) return AllAssignments[i]; return AllAssignments[0]; }
public bool PersistProfile(bool Save) { UserFunction[] button_mappings = new UserFunction[ButtonGrid.Rows.Count]; if (Save) { for (int i = 0; i < ButtonGrid.Rows.Count; ++i) { AssignmentClass ac = ButtonGrid.Rows[i].Cells[1].Value as AssignmentClass; if (ac != null) button_mappings[i] = ac.func; else button_mappings[i] = (int)UserFunction.Unassigned; } GeminiHardware.Instance.JoystickButtonMap = button_mappings; GeminiHardware.Instance.JoystickIsAnalog = rbAnalog.Checked; if (cmbAxisRA.SelectedIndex >= 0) { GeminiHardware.Instance.JoystickAxisRA = cmbAxisRA.SelectedIndex; } if (cmbAxisDEC.SelectedIndex >= 0) { GeminiHardware.Instance.JoystickAxisDEC = cmbAxisDEC.SelectedIndex; } GeminiHardware.Instance.JoystickFlipRA = ckFlipRA.Checked; GeminiHardware.Instance.JoystickFlipDEC = ckFlipDec.Checked; try { GeminiHardware.Instance.JoystickSensitivity = (double)txtSensitivity.Value; } catch { } GeminiHardware.Instance.Profile = null; return true; } else { button_mappings = GeminiHardware.Instance.JoystickButtonMap; if (button_mappings.Length < 36) Array.Resize<UserFunction>(ref button_mappings, 36); // increase to include POV settings for profiles written with an older driver for (int i = 0; i < ButtonGrid.Rows.Count; ++i) { AssignmentClass ac = FindAssignmentClass(button_mappings[i]); ButtonGrid.Rows[i].Cells[1].Value = ac; } rbAnalog.Checked = GeminiHardware.Instance.JoystickIsAnalog; rbFixed.Checked = !GeminiHardware.Instance.JoystickIsAnalog; if (cmbAxisRA.Items.Count > GeminiHardware.Instance.JoystickAxisRA) cmbAxisRA.SelectedIndex = GeminiHardware.Instance.JoystickAxisRA; if (cmbAxisDEC.Items.Count > GeminiHardware.Instance.JoystickAxisDEC) cmbAxisDEC.SelectedIndex = GeminiHardware.Instance.JoystickAxisDEC; ckFlipRA.Checked = GeminiHardware.Instance.JoystickFlipRA; ckFlipDec.Checked = GeminiHardware.Instance.JoystickFlipDEC; try { txtSensitivity.Value = (decimal)GeminiHardware.Instance.JoystickSensitivity; } catch { txtSensitivity.Value = 100; } GeminiHardware.Instance.Profile = null; return true; } }
/// <summary> /// Execute gemini function on a button press (joystick) /// </summary> /// <param name="func">function to execute</param> /// <param name="keyDown">true if key is pressed, false if it's released</param> /// <returns></returns> public static bool Execute(UserFunction func, bool keyDown) { switch (func) { case UserFunction.Unassigned: return true; //nothing to do /* case UserFunction.GuidingSpeed: if (!keyDown) return Cmd(""); break; case UserFunction.CenteringSpeed: if (!keyDown) return Cmd(""); break; case UserFunction.SlewingSpeed: if (!keyDown) return Cmd(""); break; case UserFunction.ToggleSpeed: if (!keyDown) return Cmd(""); break; */ case UserFunction.AccelerateSlew: if (!keyDown) { int acc = GeminiHardware.Instance.JoystickFixedSpeed + 1; if (acc > 2) acc = 2; GeminiHardware.Instance.JoystickFixedSpeed = acc; Speech.SayIt("Accelerate", Speech.SpeechType.Command); } break; case UserFunction.DecelerateSlew: if (!keyDown) { int dec = GeminiHardware.Instance.JoystickFixedSpeed - 1; if (dec < 0) dec = 0; GeminiHardware.Instance.JoystickFixedSpeed = dec; Speech.SayIt("Decelerate", Speech.SpeechType.Command); } break; case UserFunction.MeridianFlip: if (!keyDown) return Cmd(":Mf"); break; case UserFunction.HandUp: { SendKeyCmd(4, keyDown); if (keyDown) Speech.SayIt(Resources.UpKey, Speech.SpeechType.Command); return true; } case UserFunction.HandDown: { SendKeyCmd(2, keyDown); if (keyDown) Speech.SayIt(Resources.DownKey, Speech.SpeechType.Command); return true; } case UserFunction.HandLeft: { SendKeyCmd(1, keyDown); if (keyDown) Speech.SayIt(Resources.LeftKey, Speech.SpeechType.Command); return true; } case UserFunction.HandRight: { SendKeyCmd(8, keyDown); if (keyDown) Speech.SayIt(Resources.RightKey, Speech.SpeechType.Command); return true; } case UserFunction.HandMenu: //SendKeyCmd(16, keyDown); //menu button doesn't work if Gemini is in local control mode! if (!keyDown) { m_InMenu = !m_InMenu; if (m_InMenu) { Cmd(":HM"); Speech.SayIt(Resources.EnterMenu, Speech.SpeechType.Command); return true; } else { Cmd(":Hm"); Cmd(":Hm"); Speech.SayIt(Resources.ExitMenu, Speech.SpeechType.Command); return true; } } break; case UserFunction.ParkCWD: if (!keyDown) { GeminiHardware.Instance.DoParkAsync(GeminiHardwareBase.GeminiParkMode.SlewCWD); Speech.SayIt(Resources.ParkCWD, Speech.SpeechType.Command); return true; } break; case UserFunction.GoHome: if (!keyDown) { Cmd(":hP"); Speech.SayIt(Resources.GoHome, Speech.SpeechType.Command); return true; } break; case UserFunction.StopSlew: if (keyDown) { Cmd(":Q"); Speech.SayIt(Resources.StopSlew, Speech.SpeechType.Command); return true; } break; case UserFunction.StopTrack: if (keyDown) { Cmd(":hN"); Speech.SayIt(Resources.StopTracking, Speech.SpeechType.Command); return true; } break; case UserFunction.StartTrack: if (keyDown) { Cmd(":hW"); Speech.SayIt(Resources.StartTracking, Speech.SpeechType.Command); return true; } break; case UserFunction.AllSpeedMode: if (!keyDown) { Cmd(">163:"); Speech.SayIt(Resources.AllSpeedsMode, Speech.SpeechType.Command); return true; } break; case UserFunction.PhotoMode: if (!keyDown) { Cmd(">162:"); Speech.SayIt(Resources.PhotoMode, Speech.SpeechType.Command); return true; } break; case UserFunction.VisualMode: if (!keyDown) { Cmd(">161:"); Speech.SayIt(Resources.VisualMode, Speech.SpeechType.Command); return true; } break; case UserFunction.ToggleMode: if (!keyDown) { ToggleMode(); Speech.SayIt("Toggle mode", Speech.SpeechType.Command); return true; } break; case UserFunction.FocuserIn: if (keyDown) { Cmd(":F+"); Speech.SayIt("Focuser In", Speech.SpeechType.Command); return true; } else { Cmd(":FQ"); return true; } case UserFunction.FocuserOut: if (keyDown) { Cmd(":F-"); Speech.SayIt("Focuser Out", Speech.SpeechType.Command); return true; } else { Cmd(":FQ"); return true; } case UserFunction.FocuserFast: if (!keyDown) { m_FocuserSpeed = 0; Cmd(":FF"); Speech.SayIt(Resources.FocuserFast, Speech.SpeechType.Command); return true; } break; case UserFunction.FocuserMedium: if (!keyDown) { m_FocuserSpeed = 1; Cmd(":FM"); Speech.SayIt(Resources.FocuserMedium, Speech.SpeechType.Command); return true; } break; case UserFunction.FocuserSlow: if (!keyDown) { m_FocuserSpeed = 2; Cmd(":FS"); Speech.SayIt(Resources.FocuserSlow, Speech.SpeechType.Command); return true; } break; case UserFunction.ToggleFocuserSpeed: if (!keyDown) { if (++m_FocuserSpeed > 2) m_FocuserSpeed = 0; Cmd(m_FocuserCmds[m_FocuserSpeed]); Speech.SayIt("Focuser Speed Toggle", Speech.SpeechType.Command); return true; } break; case UserFunction.Search2: if (!keyDown) { Cmd(":MF6"); Speech.SayIt(Resources.ObjectSearch2, Speech.SpeechType.Command); return true; } break; case UserFunction.Search1: if (!keyDown) { Cmd(":MF8"); Speech.SayIt(Resources.ObjectSearch1, Speech.SpeechType.Command); return true; } break; case UserFunction.Sync: if (!keyDown){Cmd(":CM"); Speech.SayIt(Resources.Sync, Speech.SpeechType.Command); return true; }; break; case UserFunction.Align: if (!keyDown) { Cmd(":Cm"); Speech.SayIt(Resources.Align, Speech.SpeechType.Command); return true; }; break; case UserFunction.LimitSwitchOff: if (keyDown) { Cmd(">15:"); Speech.SayIt(Resources.LimitOff, Speech.SpeechType.Command); return true; } else { Cmd(">14:"); Speech.SayIt(Resources.LimitOn, Speech.SpeechType.Command); return true; } } return false; }
public NetServer( UserFunction callback, Context context ) { // have to set this stuff up. not sure why yet Context = context; Prototype = context.ObjectConstructor.Object_prototype; Class = ObjClass.Array; Console.WriteLine( "creating NetServer" ); this.SetOwnProperty( "listen", new Action<object, string>( listen ) ); this.addListener( "connection", callback ); }
public static extern Error clEnqueueNativeKernel(OpenCLCommandQueue command_queue, UserFunction user_func, [In] IntPtr[] args, IntPtr cb_args, Int32 num_mem_objects, [In] OpenCLMem[] mem_list, [In] IntPtr[] args_mem_loc, Int32 num_events_in_wait_list, [In] OpenCLEvent[] event_wait_list, OpenCLEvent e);
public UserFunction CreateFunction(Scope scope, Lambda lambda) { var obj = new UserFunction(scope, lambda); var protoObj = ObjectConstructor.Construct(); protoObj.SetOwnProperty("constructor", obj); obj.Context = this; obj.Class = ObjClass.Function; obj.Prototype = FunctionConstructor.Function_prototype; obj.SetOwnProperty("prototype", protoObj); return obj; }
/// <summary> /// Add a new function (prefix, postfix or infix), to the scope /// </summary> /// <param name="scope">scope to add function definition to</param> /// <param name="name">name of the new function</param> /// <param name="pattern1">null, variable name, or pattern to match for previous token</param> /// <param name="pattern2">null, variable name, or pattern to match for next token</param> /// <param name="rawLines">lines to parse and run when function is invoked</param> /// <param name="precedence">the order in which function should be evaled</param> internal static void Do(IScope scope, string name, Value pattern1, Value pattern2, List<Value> rawLines, Order precedence) { ValueFunction func = new UserFunction(pattern1, pattern2, rawLines, precedence); scope.SetValue(name, func); }
private UserFunction(UserFunction other) { m_usePrevious = other.m_usePrevious; m_useNext = other.m_useNext; m_pattern1 = other.m_pattern1; m_pattern2 = other.m_pattern2; m_rawLines = other.m_rawLines; m_parsedLines = other.m_parsedLines; m_passed = other.m_passed; m_fullPattern = other.m_fullPattern; m_passedScope = other.m_passedScope; }
/// <summary> /// Create a partial function based on another user defined function that only needs a body /// </summary> /// <param name="func">function to build off of</param> /// <param name="passedScope">partially filled in scope</param> internal UserFunction(UserFunction func, IScope passedScope) { m_usePrevious = false; m_useNext = false; m_pattern1 = null; m_rawLines = func.m_rawLines; m_parsedLines = func.m_parsedLines; Init(null, null, func.Order); if (func.Metadata.GetOptionalT<bool>("body?", false)) WritableMetadata["body?"] = ValueBool.True; m_passed = null; m_fullPattern = null; m_passedScope = passedScope; }
/// <summary> /// Create a partial function based on another user defined function /// </summary> /// <param name="func">function to build off of</param> /// <param name="passed">values that were passed to function already</param> /// <param name="pattern1">values that still need to be passed if it uses previous</param> /// <param name="pattern2">values that still need to be passed if it uses next</param> internal UserFunction(UserFunction func, Value passed, Value pattern1, Value pattern2) { m_usePrevious = (pattern1 != null && !pattern1.IsNil); m_useNext = (pattern2 != null && !pattern2.IsNil); m_pattern1 = pattern1; m_pattern2 = pattern2; m_rawLines = func.m_rawLines; m_parsedLines = func.m_parsedLines; Init(pattern1, pattern2, func.Order); if (func.Metadata.GetOptionalT<bool>("body?", false)) WritableMetadata["body?"] = ValueBool.True; m_passed = passed; m_fullPattern = (m_usePrevious ? func.Metadata[keyPreviousPattern] : func.Metadata[keyNextPattern]); }
public AssignmentClass(string cap, UserFunction f, string tt) { caption = cap; func = f; tooltip = tt; }
public static Error clEnqueueNativeKernel(OpenCLCommandQueue command_queue, UserFunction user_func, [In] IntPtr[] args, IntPtr cb_args, Int32 num_mem_objects, [In] OpenCLMem[] mem_list, [In] IntPtr[] args_mem_loc, Int32 num_events_in_wait_list, [In] OpenCLEvent[] event_wait_list, OpenCLEvent e) { Console.WriteLine("Calling Error clEnqueueNativeKernel(OpenCLCommandQueue command_queue, UserFunction user_func, [In] IntPtr[] args, IntPtr cb_args, Int32 num_mem_objects, [In] OpenCLMem[] mem_list, [In] IntPtr[] args_mem_loc, Int32 num_events_in_wait_list, [In] OpenCLEvent[] event_wait_list, OpenCLEvent e)"); return default(Error); }
internal static extern CLError clEnqueueNativeKernel(CLCommandQueue command_queue, UserFunction user_func, [In] IntPtr[] args, SizeT cb_args, int num_mem_objects, [In] CLMem[] mem_list, [In] IntPtr[] args_mem_loc, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
public void RegisterUserFunction(string funcName, UserFunction proc) { string tmp = funcName.ToUpper(); //if (!CaseSensitive) // tmp = funcName.ToUpper(); if ((funcName.Length > 0) && (funcName[0] >= 'a' && funcName[0] <= 'z') || (funcName[0] >= 'A' && funcName[0] <= 'Z') || (funcName[0] == '_')) { if (!UserFuncList.ContainsKey(tmp)) { UserFunction ufunc = new UserFunction(proc); UserFuncList.Add(tmp, ufunc); } else throw new MathParserError("语法解析错误!"); } }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; string subAct = Request["subAct"]; switch (subAct) { case "menu": //List<Function> MenuList = getTree(FunctionDal.SelectByUser(Security.Username)); //List<jgridRow> ListRow = new List<jgridRow>(); //foreach (Function fn in MenuList) //{ // if (fn.Loai != 3) // { // ListRow.Add(new jgridRow(fn.ID.ToString(), new string[] { fn.ID.ToString(), fn.Ten, fn.Url, fn.Level.ToString(), fn.PID.ToString(), fn.Level == 1 ? "false" : "true", "false" })); // } //} //jgrid grid = new jgrid("1", "1", MenuList.Count.ToString(), ListRow); //sb.Append(JavaScriptConvert.SerializeObject(grid)); sb.AppendFormat(getTop(getTree(FunctionDal.SelectByUser(Security.Username,"0")))); break; case "desk": sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>" , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.plugManager.admin.js")); sb.AppendFormat(@"<div id=""desktopMdl-content-head""> <a href=""javascript:;"" id=""desktopMdl-content-head-showbtn""> <span id=""desktopMdl-content-head-showbtn-title"" class=""ui-widget-content ui-corner-top""> Thêm Module </span> <span id=""desktopMdl-content-head-showbtn-box""> <span class=""ui-widget-content ui-corner-all"" id=""desktopMdl-content-head-showbtn-boxPnl""> <span class=""ui-widget-content ui-corner-all"" id=""desktopMdl-content-head-showbtn-boxPnl-content"">"); FunctionCollection UFC = FunctionDal.SelectByUser(Security.Username, "1"); foreach (Function ufcItem in UFC) { sb.AppendFormat(@"<span onclick=""myModule.add('{0}','{1}')"" class=""desktopMdl-content-head-showbtn-boxPnl-content-item""><span onclick=""myModule.add('{0}','{1}')"" class=""desktopMdl-content-button-add"">Add</span>{2}</span>", ufcItem.ID, ufcItem.Url, ufcItem.Ten); } sb.AppendFormat(@"</span> </span> </span> </a>"); Member mMember = MemberDal.SelectAllByUserName(Security.Username); sb.AppendFormat(@"<b id=""desktopMdl-content-head-title"">Phiên làm việc: {0} <span id=""desktopMdl-content-head-date"">{1}</span></b> </div>", mMember.Ten.ToString(), string.Format("{0:dd/MM/yyyy}",DateTime.Now)); sb.AppendFormat(@"<div id=""desktopMdl-content-body"">"); foreach (linhLayout LAY in linhLayoutDal.SelectByUsername(Security.Username)) { sb.AppendFormat(@"<div name=""{1}"" class=""LayOut"" style=""width:{0};"">" , LAY.Width , LAY.Ten); sb.AppendFormat(@"<div modify=""{1}"" layout=""{3}"" name=""{0}"" class=""contentNull{2}"">" , LAY.ID, true, " content", LAY.ID); foreach (UserFunction UF in UserFunctionDal.SelecbyLayOutId(LAY.ID)) { if (UF.LAY_ID == LAY.ID) { XmlDocument doc = new XmlDocument(); doc.LoadXml(UF.Doc); if (doc.LastChild != null) { sb.Append(PlugHelper.RenderHtml(doc.LastChild, UF.ID)); } else { sb.Append("Setting missed"); } } } sb.Append("</div>"); sb.Append("</div>"); } sb.Append("</div>"); break; case "Update": if (!string.IsNullOrEmpty(Request["layplug"])) { string layplug = Request["layplug"]; XmlDocument doc = new XmlDocument(); XmlNode node = doc.ImportNode(PlugHelper.RenderXml(toList(Request["iList"]), Request["plugtype"]), true); doc.AppendChild(node); UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug)); itemUpdate.Doc = linh.common.Lib.GetXmlString(doc); itemUpdate = UserFunctionDal.Update(itemUpdate); sb.Append(PlugHelper.RenderHtml(doc)); } break; case "ReOrder": if (!string.IsNullOrEmpty(Request["NewZoneIndex"])) { string layplug = Request["layplug"]; string layid = Request["NewZoneIndex"]; UserFunction itemUpdate = UserFunctionDal.SelectById(Convert.ToInt32(layplug)); itemUpdate.LAY_ID = Convert.ToInt32(layid); itemUpdate.ThuTu = Convert.ToInt32(Request["NewModuleIndex"]); itemUpdate = UserFunctionDal.Update(itemUpdate); UserFunctionDal.UpdateReorder(Request["NewZoneOrderList"]); } break; case "Remove": if (!string.IsNullOrEmpty(Request["layplug"])) { string layplug = Request["layplug"]; UserFunction itemRemove = UserFunctionDal.SelectById(Convert.ToInt32(layplug)); UserFunctionDal.DeleteById(itemRemove.ID); } break; case "Add": string _FN_ID = Request["FN_ID"]; string _Url = Request["Url"]; string _LayID = Request["LayID"]; string _DocValue = ""; try { XmlDocument doc = new XmlDocument(); XmlNode node = doc.ImportNode(PlugHelper.RenderXml(_Url), true); doc.AppendChild(node); _DocValue = linh.common.Lib.GetXmlString(doc); UserFunction ItemSave = new UserFunction(); ItemSave.FN_ID = Convert.ToInt32(_FN_ID); ItemSave.FN_Url = _Url; ItemSave.LAY_ID = Convert.ToInt32(_LayID); ItemSave.NgayTao = DateTime.Now; ItemSave.NguoiTao = Security.Username; ItemSave.Username = Security.Username; ItemSave.ThuTu = 1; ItemSave.RowId = Guid.NewGuid(); ItemSave.Doc = _DocValue; ItemSave = UserFunctionDal.Insert(ItemSave); sb.Append(PlugHelper.RenderHtml(doc.LastChild, ItemSave.ID)); } catch (Exception ex) { } break; default: break; } sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>" , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.plugManager.admin.js")); writer.Write(sb.ToString()); base.Render(writer); }