public string DeleteCmd(string TableName, object[] key, object[] value) { string sql = ""; string val_str = ""; if (NTool.hasData(key) && NTool.hasData(value)) { string Delete_str = string.Format("@{0}", key[0]); for (int i = 0; i < value.Length; i++) { if (value.Length - 1 <= i || value.Length <= 1) { val_str += Delete_str + i; } else if (value.Length > 1) { val_str += Delete_str + i + ","; } listDelete_str.Add(Delete_str + i); listSqlParam.Add(listDelete_str[i], value[i] + ""); } sql = string.Format("delete from {0} where {1} in({2})", TableName, key[0], val_str); } else { sql = string.Format("DELETE FROM {0}", TableName); } return(sql); }
public string UpdateCmd(string TableName, object[] key, object[] value, string where) { string sql = ""; if (NTool.isLenEquals(key, value)) { string val_str = ""; for (int i = 0; i < key.Length; i++) { string upDate_Str = string.Format("@{0}", key[i]); string _upDate_Str = string.Format("{0}", key[i]); if (value.Length - 1 <= i || value.Length <= 1) { val_str += _upDate_Str + "=" + upDate_Str; } else if (value.Length > 1) { val_str += _upDate_Str + "=" + upDate_Str + ","; } listSqlParam.Add(upDate_Str, value[i] + ""); } if (!string.IsNullOrEmpty(where)) { where = " where " + where; } sql = string.Format("update {0} set {1} {2} ", TableName, val_str, where); //UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson' } return(sql); }
private void OnCheckBoxCheckedChanged(NValueChangeEventArgs arg) { // Enable/Disable the tool based on the new value of the check box's Check property NTool tool = (NTool)arg.CurrentTargetNode.Tag; tool.Enabled = (bool)arg.NewValue; }
protected override NWidget CreateExampleControls() { NStackPanel stack = (NStackPanel)base.CreateExampleControls(); // Add a check box for each tool of the schedule view NStackPanel toolsStack = new NStackPanel(); for (int i = 0; i < m_ScheduleView.Interactor.Count; i++) { NTool tool = m_ScheduleView.Interactor[i]; NCheckBox checkBox = new NCheckBox(tool.ToString(), tool.Enabled); checkBox.Tag = tool; checkBox.CheckedChanged += OnCheckBoxCheckedChanged; toolsStack.Add(checkBox); } stack.Add(new NGroupBox("Tools", toolsStack)); // Add a setting for the mouse button event of the Click Select tool NStackPanel clickSelectStack = new NStackPanel(); NScheduleClickSelectTool clickSelectTool = (NScheduleClickSelectTool)m_ScheduleView.Interactor.GetTool( NScheduleClickSelectTool.NScheduleClickSelectToolSchema); clickSelectStack.Add(NDesigner.GetDesigner(clickSelectTool).CreatePropertyEditor( clickSelectTool, NScheduleClickSelectTool.MouseButtonEventProperty)); stack.Add(new NGroupBox("Click Select Tool", clickSelectStack)); return(stack); }
public string InsertCmd(string TableName, List <object> _key, List <object> _value) { object[] key = _key.ToArray(); object[] value = _value.ToArray(); string sql = ""; if (NTool.isLenEquals(key, value)) { string val_str = ""; string _val_str = ""; for (int i = 0; i < key.Length; i++) { string insert_Str = string.Format("@{0}", key[i]); string _insert_Str = string.Format("{0}", key[i]); if (value.Length - 1 <= i || value.Length <= 1) { _val_str += _insert_Str; val_str += insert_Str; } else if (value.Length > 1) { val_str += insert_Str + ","; _val_str += _insert_Str + ","; } listSqlParam.Add(insert_Str, value[i] + ""); } sql = string.Format("insert into {0}({1}) values({2}) ", TableName, _val_str, val_str); } return(sql); }
/// <summary> /// 储存过程 /// </summary> /// <param name="idList"></param> /// <returns></returns> public T GetNameModel(string name) { string execSql = string.Format("Exec {0}_GetNameModel @Name=N'{1}' ", ETblName, name); List <T> Tmodel = base.GetList(execSql); if (NTool.IsLtNULL <T>(Tmodel)) { return(Tmodel[0]); } return(default(T)); }
public NModel.DB_Image GetModelByBelongsID(long?id) { string execSql = string.Format("Exec {0}_ GetModelByBelongsID @ID={1} ", ETblName, id); List <NModel.DB_Image> Tmodel = base.GetList(execSql); if (NTool.IsLtNULL <NModel.DB_Image>(Tmodel)) { return((NModel.DB_Image)Tmodel[0]); } return(null); }
/// <summary> /// 储存过程 /// </summary> /// <param name="idList"></param> /// <returns></returns> public T GetModel(long?id) { string execSql = string.Format("Exec {0}_GetModel @ID={1} ", ETblName, id); List <T> Tmodel = base.GetList(execSql); if (NTool.IsLtNULL <T>(Tmodel)) { return(Tmodel[0]); } return(default(T)); }
/// <summary> /// 储存过程上个 /// </summary> /// <param name="idList"></param> /// <returns></returns> public T GetPrevModel(long?id, string where = "1=1") { string execSql = string.Format("Exec {0}_GetPrevModel @ID={1},@Where=N'{2}' ", ETblName, id, where); List <T> Tmodel = base.GetList(execSql); if (NTool.IsLtNULL <T>(Tmodel)) { return(Tmodel[0]); } return(default(T)); }
public override bool Connect(string sql) { sql = sql.Replace(SQLITE_LOCAL_DD, NTool.getProjectPath()); this.SQLiteCon = new SQLiteConnection(sql); if (this.SQLiteCon != null && SQLiteCon.State == ConnectionState.Closed) { this.SQLiteCon.Open(); return(true); } return(false); }
protected override void LoadExample() { // begin view init view.BeginInit(); view.DocumentPadding = new Nevron.Diagram.NMargins(20); view.Grid.Visible = false; // replace the default drag drop target tool with your own one // to extend the drop capabilities of the view NTool tool = view.Controller.Tools.GetToolByName(NDWFR.ToolDragDropTarget); int index = view.Controller.Tools.IndexOf(tool); view.Controller.Tools.Remove(tool); tool = new NMyDragDropTargetTool(); tool.Enabled = true; view.Controller.Tools.Insert(index, tool); // init document document.BeginInit(); // create and add your own data object adaptor // to extend the default set of supported data object formats document.DataObjectAdaptors.Add(new NMyDataObjectAdaptor()); // create a simple group for demonstration NGroup group = new NGroup(); group.Shapes.AddChild(new NRectangleShape(100, 100, 200, 200)); group.CreateShapeElements(ShapeElementsMask.Labels); NRotatedBoundsLabel label = new NRotatedBoundsLabel("Drop items from the tree view in me", group.UniqueId, new Nevron.Diagram.NMargins(0)); group.Labels.AddChild(label); group.Labels.DefaultLabelUniqueId = label.UniqueId; group.Text = "Drop items from the tree view in me"; group.UpdateModelBounds(); document.ActiveLayer.AddChild(group); document.EndInit(); // init form controls InitFormControls(); // end view init view.EndInit(); }
public ActionResult UserYesNoCode() { string validatecode = this.Request.Form["param"]; bool isCodeYesNo = (NTool.IsSessionEquals(NModel.EnObject.UserCodeSessionName, validatecode)); if (!isCodeYesNo) { this.Response.Write("{ \"info\":\"验证码不正确\", \"status\":\"n\" }"); } else { this.Response.Write("{ \"info\":\"验证码已通验证\", \"status\":\"y\" }"); } return(View()); }
private void MouseModeComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { NTool tool = null; bool bEnableCreatePointControls = false; switch (MouseModeComboBox.SelectedIndex) { // Create Point case 0: bEnableCreatePointControls = true; break; // Trackball case 1: tool = new NTrackballTool(); break; // Zoom case 2: tool = new NZoomTool(); break; // Offset case 3: tool = new NOffsetTool(); break; } nChartControl1.Controller.Tools.Clear(); if (tool != null) { nChartControl1.Controller.Tools.Add(tool); } CreatePointAtPlaneComboBox.Enabled = bEnableCreatePointControls; if (CreatePointAtPlaneComboBox.SelectedIndex == 0) { XZPlaneValueNumericUpDown.Enabled = bEnableCreatePointControls; XYPlaneValueNumericUpDown.Enabled = false; } else { XZPlaneValueNumericUpDown.Enabled = false; XYPlaneValueNumericUpDown.Enabled = bEnableCreatePointControls; } }
public bool CheckLogin(string name, string pw, string code) { if (NTool.IsSessionEquals(NModel.EnObject.CaptchaSessionName, code)) { NCaptcha.Generate(true); NModel.Admin_User cModel_User = this.ExistsNamePw((name + "").ToLower(), NMd5.GetMd5Hash(pw).ToLower()); if (cModel_User != null && cModel_User.User_ID > 0) { HttpContext.Current.Session[NModel.EnObject.LoginSessionName] = cModel_User.User_Name; HttpContext.Current.Session[NModel.EnObject.CurrentLoginSessionName] = cModel_User; BLL.DB_Session cModel = new DB_Session(); NModel.DB_Session cModel_Session = new NModel.DB_Session(); cModel_Session.Session_DB_Name = base.TableName; cModel_Session.Session_UserID = cModel_User.User_ID; cModel_Session.Session_CID = (HttpContext.Current.Session.SessionID + ""); cModel_Session.Session_Status = 1; cModel_Session.Session_EndTime = DateTime.Parse(DateTime.Now.AddHours(60).ToString("s")); ///DateTime.Parse(DateTime.Now.AddHours(60).ToString("yyyy-MM-dd hh:mm:ss")); cModel_Session.Session_AddTime = DateTime.Parse(DateTime.Now.ToString("s")); if (cModel.Add(cModel_Session) > 0) { cModel.Close(); Tool.NTool.AddCookie(base.TableName, cModel_Session.Session_CID + "_" + cModel_User.User_ID, 60); return(true); } ; cModel.Close(); } } return(false); }
protected override void InitSchedule(NSchedule schedule) { DateTime start = DateTime.Now; // Replace the default Add Appointment command action with a custom one NCommandAction addAppointmentCommandAction = m_ScheduleView.Commander.GetCommandAction(NScheduleView.AddAppointmentCommand); m_ScheduleView.Commander.Remove(addAppointmentCommandAction); m_ScheduleView.Commander.Add(new CustomAddAppointmentCommandAction()); // Replace the default Appointment Edit tool with a custom one NTool appointmentEditTool = m_ScheduleView.Interactor.GetTool(NAppointmentEditTool.NAppointmentEditToolSchema); int index = m_ScheduleView.Interactor.IndexOf(appointmentEditTool); m_ScheduleView.Interactor.RemoveAt(index); NTool customEditAppointmentTool = new CustomAppointmentEditTool(); customEditAppointmentTool.Enabled = true; m_ScheduleView.Interactor.Insert(index, customEditAppointmentTool); // Create some custom appointments AppointmentWithLocation appointmentWithLocation = new AppointmentWithLocation( "Appointment with Location", start, start.AddHours(2)); appointmentWithLocation.Location = "New York"; schedule.Appointments.Add(appointmentWithLocation); AppointmentWithImage appointmentWithImage = new AppointmentWithImage( "Appointment with Image", start.AddHours(3), start.AddHours(5)); appointmentWithImage.Image = NResources.Image_MobileComputers_UMPC_jpg; appointmentWithImage.Category = NLoc.Get("Orange"); schedule.Appointments.Add(appointmentWithImage); schedule.ScrollToTime(start.TimeOfDay); }
public override bool Open() { try { this.SQLiteCon = new SQLiteConnection(base.ConfigStr.Replace(SQLITE_LOCAL_DD, NTool.getProjectPath())); if (this.SQLiteCon != null && SQLiteCon.State == ConnectionState.Closed) { this.SQLiteCon.Open(); this.msg = "第一步打开数库库据成功……请继续第二步"; base.isOpenDataBase = true; return(true); } else { this.msg = "第一步打开数据库失败……请查看 ConfigStr:" + this.ConfigStr + "没有异常信息 "; base.isOpenDataBase = false; }; //this.Open(); } catch (Exception ex) { base.isOpenDataBase = false; this.msg = "第一步打开数据库失败……请查看 ConfigStr:" + this.ConfigStr + " 异常信息: " + ex.Message; } return(false); }
private void ConfigureTools(ToolsConfiguration config) { // initially remove all tools from the view tools collection view.Controller.Tools.Clear(); // determine which tools must be created and in what order bool createPointer = false; bool createDelegators = false; bool pointerBeforeDelegator = false; switch (config) { case ToolsConfiguration.OnlyEventDelagators: createPointer = false; createDelegators = true; break; case ToolsConfiguration.OnlyPointer: createPointer = true; createDelegators = false; break; case ToolsConfiguration.PointerBeforeEventDelagators: createPointer = true; createDelegators = true; pointerBeforeDelegator = true; break; case ToolsConfiguration.EventDelagatorsBeforePointer: createPointer = true; createDelegators = true; pointerBeforeDelegator = false; break; default: Debug.Assert(false, "New tools config?"); break; } // create the needed tools NTool[] pointerTools = null, delegatorTools = null; if (createPointer) { pointerTools = new NTool[] { new NCreateGuidelineTool(), new NHandleTool(), new NMoveTool(), new NSelectorTool(), new NContextMenuTool(), new NKeyboardTool(), new NInplaceEditTool() }; } if (createDelegators) { delegatorTools = new NTool[] { new NMouseEventDelegatorTool(), new NKeyboardEventDelegatorTool(), new NDragDropEventDelegatorTool() }; } // add them in the proper order if (pointerBeforeDelegator) { if (pointerTools != null) { foreach (NTool tool in pointerTools) { view.Controller.Tools.Add(tool); } } if (delegatorTools != null) { foreach (NTool tool in delegatorTools) { view.Controller.Tools.Add(tool); } } } else { if (delegatorTools != null) { foreach (NTool tool in delegatorTools) { view.Controller.Tools.Add(tool); } } if (pointerTools != null) { foreach (NTool tool in pointerTools) { view.Controller.Tools.Add(tool); } } } // enable all tools view.Controller.Tools.EnableAllTools(); }