//此方法在值失效之前调用,可以用于在失效之前更新数据库,或从数据库重新获取数据 private static void onRemove(string strIdentify, object talkInfo, CacheItemRemovedReason reason) { if (reason.ToString() == "Expired") { ServiceCommon sc = new ServiceCommon(); string strSerializer = XmlSerializerHelper.XmlSerializer(talkInfo); sc.ExecuteSql("insert into OrderMessage(OrderNumber,TalkContent,ModifyDate,BelongFactory)values('" + strIdentify.Split('|')[1] + "','" + strSerializer + "',getdate(),'" + strIdentify.Split('|')[0] + "')"); } }
/// <summary> /// Debugging output event handler, to show progress status. /// </summary> /// <param name="sourceId">The id of the record with progress.</param> /// <param name="record">The record itself.</param> public void NotifyOutputProgress(long sourceId, ProgressRecord record) { ServiceCommon.LogCallbackEvent("Callback to client to show progress"); if (_callback != null) { _callback.OutputProgress(sourceId, record); } }
private void SetExecutionPolicy(ExecutionPolicy policy, ExecutionPolicyScope scope) { ExecutionPolicy machinePolicy = ExecutionPolicy.Undefined; ExecutionPolicy userPolicy = ExecutionPolicy.Undefined; ServiceCommon.Log("Setting execution policy"); using (PowerShell ps = PowerShell.Create()) { ps.Runspace = _runspace; ps.AddCommand("Get-ExecutionPolicy") .AddParameter("Scope", "MachinePolicy"); foreach (var result in ps.Invoke()) { machinePolicy = ((ExecutionPolicy)result.BaseObject); break; } ps.Commands.Clear(); ps.AddCommand("Get-ExecutionPolicy") .AddParameter("Scope", "UserPolicy"); foreach (var result in ps.Invoke()) { userPolicy = ((ExecutionPolicy)result.BaseObject); break; } ps.Commands.Clear(); if (machinePolicy != ExecutionPolicy.Undefined || userPolicy != ExecutionPolicy.Undefined) { return; } ps.Commands.Clear(); ps.AddCommand("Set-ExecutionPolicy") .AddParameter("ExecutionPolicy", policy) .AddParameter("Scope", scope) .AddParameter("Force"); try { //If a more restritive scope causes this to fail, this can throw //an exception and cause the host to crash. This causes it to be //recreated over and over again. This leads to performance issues in VS. ps.Invoke(); } catch (Exception ex) { ServiceCommon.Log("Failed to set execution policy. {0}", ex.Message); } } }
public static LookUpEdit LookUpItemUserIdAndName(LookUpEdit repLookUp) { ServiceCommon serviceCommon = new ServiceCommon(); DataTable dt = serviceCommon.ListDataForUserIDAndUserName().Trim(); repLookUp.SetDataTable(dt, "UPF_USER_ID", "UPF_USER_ID_NAME", TextEditStyles.DisableTextEditor, ""); repLookUp.EditValue = ""; return(repLookUp); }
public static LookUpEdit LookUpItemTxnIdAndName(LookUpEdit repLookUp) { ServiceCommon serviceCommon = new ServiceCommon(); DataTable dt = serviceCommon.ListDataForTxnIdAndName(); repLookUp.SetDataTable(dt, "TXN_ID", "TXN_ID_NAME", TextEditStyles.DisableTextEditor, ""); repLookUp.EditValue = ""; return(repLookUp); }
private void RefreshScopedVariable() { ServiceCommon.Log("Debuggger stopped, let us retreive all local variable in scope"); using (var pipeline = (_runspace.CreateNestedPipeline())) { var command = new Command("Get-Variable"); pipeline.Commands.Add(command); _varaiables = pipeline.Invoke(); } }
private void RefreshCallStack() { ServiceCommon.Log("Debuggger stopped, let us retreive all call stack frames"); using (var pipeline = (_runspace.CreateNestedPipeline())) { var command = new Command("Get-PSCallstack"); pipeline.Commands.Add(command); _callstack = pipeline.Invoke(); } }
protected void Page_Init(object sender, EventArgs e) { if (Session["factoryConnectionString"] == null) { Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + "//Weixinclient//WXLogin.aspx"); } facComm = new ServiceCommon(Session["factoryConnectionString"].ToString()); ccWhere.Clear(); ccWhere.AddComponent("ClassID", "OrderClass", SearchComponent.Equals, SearchPad.NULL); dtCategory = facComm.GetListTop(0, " Code,DictName ", "DictDetail", ccWhere); }
/// <summary> /// Dismiss the current running completion request /// </summary> private void DismissGetCompletionResults() { try { CommandCompletionHelper.DismissCommandCompletionListRequest(); } catch { ServiceCommon.Log("Failed to stop the existing one."); } }
/// <summary> /// Calculate the completion results list based on the script we have and the caret position. /// </summary> /// <param name="script">The active script.</param> /// <param name="caretPosition">The caret position.</param> /// <param name="triggerTag">Tag(incremental long) indicating the trigger sequence in client side</param> /// <returns>A completion results list.</returns> public void RequestCompletionResults(string script, int caretPosition, int requestWindowId, long triggerTag) { ServiceCommon.Log("Intellisense request received, caret position: {0}", caretPosition.ToString()); if (_requestTrigger == 0 || triggerTag > _requestTrigger) { ServiceCommon.Log("Procesing request, caret position: {0}", caretPosition.ToString()); DismissGetCompletionResults(); ProcessCompletion(script, caretPosition, requestWindowId, triggerTag); // triggering new request processing } }
/// <summary> /// Breakpoint updates (such as enabled/disabled) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Debugger_BreakpointUpdated(object sender, BreakpointUpdatedEventArgs e) { // Not in-use for now, leave it as place holder for future support on powershell debugging command in REPL ServiceCommon.Log("Breakpoint updated: {0} {1}", e.UpdateType, e.Breakpoint); //if (_callback != null) //{ // var lbp = e.Breakpoint as LineBreakpoint; // _callback.BreakpointUpdated(new DebuggerBreakpointUpdatedEventArgs(new PowershellBreakpoint(e.Breakpoint.Script, lbp.Line, lbp.Column), e.UpdateType)); //} }
protected void Page_Load(object sender, EventArgs e) { servCommfac = new ServiceCommon(base.factoryConnectionString); orderID = Request["orderID"]; if (yeyRequest.Params("type") == "GetJson") { if (orderID != "") { GetPatientList(orderID); } } }
public WZ0010(string programID, string programName) : base(programID, programName) { InitializeComponent(); GridHelper.SetCommonGrid(gvMain, true, new GridColumn[] { UPF_USER_ID }); PrintableComponent = gcMain; this.Text = _ProgramID + "─" + _ProgramName; daoUPF = new UPF(); daoUTP = new UTP(); serviceCommon = new ServiceCommon(); }
protected void Page_Load(object sender, EventArgs e) { servComm = new ServiceCommon(base.factoryConnectionString); if (!IsPostBack) { } ccWhere.Clear(); hddpnumbers = Request["hpnumbers"]; int iCount = 10; //if (!string.IsNullOrEmpty(hddpnumbers)) //{ // iCount = Convert.ToInt32(hddpnumbers); //} int iPageIndex = string.IsNullOrEmpty(Request["sPageID"]) ? 1 : Convert.ToInt32(Request["sPageID"]); int iPageCount = string.IsNullOrEmpty(Request["sPageNum"]) ? 0 : Convert.ToInt32(Request["sPageNum"]); string txttxtPatient = Request["txtPatient"]; if (!string.IsNullOrEmpty(txttxtPatient)) { ccWhere.AddComponent("patient ", txttxtPatient, SearchComponent.Like, SearchPad.And); } string selectedID = Request["selectedID"]; string selectedLevel = Request["selectedLevel"]; if (!String.IsNullOrEmpty(selectedLevel) && !String.IsNullOrEmpty(selectedID)) { if (selectedLevel == "0") { ccWhere.AddComponent("sellerid ", selectedID, SearchComponent.Equals, SearchPad.And); } else if (selectedLevel == "1") { ccWhere.AddComponent("HospitalID ", selectedID, SearchComponent.Equals, SearchPad.And); } else if (selectedLevel == "2") { ccWhere.AddComponent("DoctorID ", selectedID, SearchComponent.Equals, SearchPad.And); } } GetFilterByKind(ref ccWhere, "orders"); servComm.strOrderString = " regtime desc "; IList <ORDERSDETAIL> ilist = servComm.GetList <ORDERSDETAIL>(ORDERSDETAIL.STRTABLENAME, "regtime,Order_ID,seller,sellerid,hospital,hospitalid,doctor,patient,productName,Valid", ORDERSDETAIL.STRKEYNAME, iCount, iPageIndex, iPageCount, ccWhere); this.repOrderList.DataSource = ilist; repOrderList.DataBind(); pagecut1.iPageNum = servComm.PageCount; }
/// <summary> /// /// </summary> /// <param name="strUserName"></param> /// <param name="strPassword"></param> /// <param name="bolAutoSave"></param> /// <returns>0:成功 1:失败</returns> public static int doLoginEx(string strUserName, string strPassword, bool bolAutoSave) { ServiceCommon servComm = new ServiceCommon(); ConditionComponent condComponent = new ConditionComponent(); if (strUserName.IndexOf("@") > 0) { condComponent.AddComponent("UPPER(email)", strUserName.ToUpper(), SearchComponent.Equals, SearchPad.NULL); } else { condComponent.AddComponent("UPPER(username)", strUserName.ToUpper(), SearchComponent.Equals, SearchPad.NULL); } condComponent.AddComponent("password", strPassword, SearchComponent.Equals, SearchPad.And); loan_user objUser = servComm.GetEntity <loan_user>(null, condComponent); //查询用户大于0 if (objUser.uid > 0) { HttpCookie cookie = new HttpCookie("d2012"); //写入Cookie cookie.Values["EMAIL"] = objUser.email.ToString(); cookie.Values["PASSWORD"] = objUser.password.ToString(); LOGINUSERINFO loginUser = new LOGINUSERINFO(); loginUser._USERINFO = objUser; HttpContext.Current.Session[UserConstant.SESSION_USERINFO] = loginUser; HttpContext.Current.Session["email"] = objUser.email; HttpContext.Current.Session["userid"] = objUser.uid; HttpContext.Current.Session["emailvalid"] = objUser.emailvalid; HttpContext.Current.Session["username"] = objUser.username; HttpContext.Current.Session["password"] = objUser.password; HttpContext.Current.Session["ulevel"] = objUser.ulevel; //更新最后登录时间 最后登录IP 总登录次数 loan_user luser = servComm.GetEntity <loan_user>(objUser.uid); luser.lastloginIP = HttpContext.Current.Request.UserHostAddress; luser.lastlogintime = DateTime.Now; luser.logintimes = luser.logintimes + 1; servComm.Update(luser); } else { return(1); } return(0); }
private void Runspace_StateChanged(object sender, RunspaceStateEventArgs e) { ServiceCommon.Log("Remote runspace State Changed: {0}", e.RunspaceStateInfo.State); switch (e.RunspaceStateInfo.State) { case RunspaceState.Broken: case RunspaceState.Closed: case RunspaceState.Disconnected: PopRunspace(); break; } }
private void InitializeRunspace(PSHost psHost) { ServiceCommon.Log("Initializing run space with debugger"); InitialSessionState iss = InitialSessionState.CreateDefault(); iss.ApartmentState = ApartmentState.STA; iss.ThreadOptions = PSThreadOptions.ReuseThread; _runspace = RunspaceFactory.CreateRunspace(psHost, iss); _runspace.Open(); ProvideProfileVariable(); ServiceCommon.Log("Done initializing runspace"); }
public ServicePrefix1() { daoTXF = new TXF(); daoLOGSP = new LOGSP(); daoLOGS = new LOGS(); daoTXEMAIL = new TXEMAIL(); daoTXF1 = new TXF1(); daoTXF2 = new TXF2(); daoJRF = new JRF(); daoOCF = new OCF(); serviceCommon = new ServiceCommon(); daoFutAHOCFUPD = new OCFUPD("futAH"); daoOptAHOCFUPD = new OCFUPD("optAH"); }
/// <summary> /// 业务逻辑 /// </summary> protected override void ExecuteMethod() { Random rd = new Random(); var MerchantCode = ChineseSpellHelp.GetChineseSpell(this.Parameter.MerchantName) + rd.Next(100, 999); var MerchantPwd = Encrpty.MD5Pwd(this.Parameter.MerchantPwd); registeredMerchantProcessor.InitData(this.Parameter.ReapayMerchantNo, this.Parameter.MerchantPwd, MerchantCode, this.Parameter.MerchantName, this.Parameter.Contact, "", "", this.Parameter.ReapayMerchantNo, this.Parameter.ReapalMerchantId, this.Parameter.Phone, "", this.Parameter.ReapayMerchantNo, this.Parameter.ReapalMerchantPwd.Trim()); var result = registeredMerchantProcessor.Execute(); if (!result.Success) { throw new Exception(result.Message); } InterfaceAccount _InterfaceAccount = new InterfaceAccount() { Contact = this.Parameter.Contact, CreateTime = DateTime.Now, CreateUserID = 0, MerchantCode = MerchantCode, MerchantName = this.Parameter.MerchantName, MerchantPwd = MerchantPwd, Phone = this.Parameter.Phone, ReapalMerchantId = this.Parameter.ReapalMerchantId, ReapayMerchantNo = this.Parameter.ReapayMerchantNo, Status = 0, UpdateTime = DateTime.Now, UserKey = Guid.NewGuid().ToString().Replace("-", ""), CertAddress = "", UpdateUserID = 0, IsCheckPrice = 0 }; interfaceAccountRep.Insert(_InterfaceAccount); //生成证书 var interfaceAccountmodel = ServiceCommon.GenerateUserCer(_InterfaceAccount); _InterfaceAccount.CertAddress = interfaceAccountmodel.CertAddress; _InterfaceAccount.CertPassword = interfaceAccountmodel.CertPassword; int i = interfaceAccountRep.Update(_InterfaceAccount); if (i <= 0) { throw new System.Exception("更新数据库失败"); } }
protected void Page_Load(object sender, EventArgs e) { servCommfac = new ServiceCommon(base.factoryConnectionString); if (Request["type"] == "GetBatch") { string batchOrderID = Request["BatchOrderID"]; string batchSerialID = Request["BatchSerialID"]; string batchProductID = Request["BatchProductID"]; string zBatchNodes = ""; ccWhere.Clear(); ccWhere.AddComponent("Order_ID", batchOrderID, SearchComponent.Equals, SearchPad.And); ccWhere.AddComponent("serial", batchSerialID, SearchComponent.Equals, SearchPad.And); ccWhere.AddComponent("Productid", batchProductID, SearchComponent.Equals, SearchPad.And); DataTable dt = servCommfac.GetListTop(0, "isnull(Name,'') as Name,isnull(Maker,'') as Maker,isnull(batchNo,'') as batchNo", "OrdersElement", ccWhere); foreach (DataRow dr in dt.Rows) { zBatchNodes = zBatchNodes + "{" + "\"ElementName\":" + "\"" + dr["Name"].ToString() + "\"" + ",\"ElementMaker\":" + "\"" + dr["Maker"].ToString() + "\"" + ",\"BatchNo\":" + "\"" + dr["batchNo"].ToString() + "\"},"; } zBatchNodes = zBatchNodes.Trim(','); if (zBatchNodes == "") { zBatchNodes = "{}"; } else { zBatchNodes = "[" + zBatchNodes + "]"; } Response.Write(zBatchNodes); Response.End(); } else { orderID = Request["orderID"]; serialID = Request["serial"]; ccWhere.Clear(); ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL); ccWhere.AddComponent("serial", serialID, SearchComponent.Equals, SearchPad.And); IList <ORDERS> listOrder = servCommfac.GetListTop <ORDERS>(0, "hospital,doctor,Patient,Order_ID,indate,preoutDate,OutDate,Sex,Age", "orders", ccWhere); if (listOrder.Count > 0) { orderModel = listOrder[0]; } GetProcedureList(orderID, serialID); } }
private void RefreshCallStack40() { ServiceCommon.Log("Debuggger stopped, let us retreive all call stack frames"); if (_runspace.ConnectionInfo != null) { PSCommand psCommand = new PSCommand(); psCommand.AddScript("Get-PSCallstack"); var output = new PSDataCollection <PSObject>(); DebuggerCommandResults results = _runspace.Debugger.ProcessCommand(psCommand, output); _callstack = output; } else { RefreshCallStack(); } }
/// <summary> /// Runspace state change event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _runspace_StateChanged(object sender, RunspaceStateEventArgs e) { ServiceCommon.Log("Runspace State Changed: {0}", e.RunspaceStateInfo.State); switch (e.RunspaceStateInfo.State) { case RunspaceState.Broken: case RunspaceState.Closed: case RunspaceState.Disconnected: if (_callback != null) { _callback.DebuggerFinished(); } break; } }
private void RefreshScopedVariable40() { ServiceCommon.Log("Debuggger stopped, let us retreive all local variable in scope"); if (_runspace.ConnectionInfo != null) { PSCommand psCommand = new PSCommand(); psCommand.AddScript("Get-Variable"); var output = new PSDataCollection <PSObject>(); DebuggerCommandResults results = _runspace.Debugger.ProcessCommand(psCommand, output); _varaiables = output; } else { RefreshScopedVariable(); } }
private void ProcessCompletion(string script, int caretPosition, int requestWindowId, long triggerTag) { lock (_syncLock) { _requestTrigger = triggerTag; } if (_callback == null) { _callback = OperationContext.Current.GetCallbackChannel <IIntelliSenseServiceCallback>(); } // Start process the existing waiting request, should only be one Task.Run(() => { try { CommandCompletion commandCompletion = null; lock (ServiceCommon.RunspaceLock) { if (_runspace.RunspaceAvailability == RunspaceAvailability.Available) { commandCompletion = CommandCompletionHelper.GetCommandCompletionList(script, caretPosition, _runspace); } else { // we'll handle it when we work on giving intellisense for debugging command // for now we just simply return with null for this request to complete. } } ServiceCommon.LogCallbackEvent("Callback intellisense at position {0}", caretPosition); _callback.PushCompletionResult(CompletionResultList.FromCommandCompletion(commandCompletion), requestWindowId); // Reset trigger lock (_syncLock) { _requestTrigger = 0; } } catch (Exception ex) { ServiceCommon.Log("Failed to retrieve the completion list per request due to exception: {0}", ex.Message); } }); }
protected void Page_Load(object sender, EventArgs e) { if (IsCN == false) { FinanceReportViewer.LocalReport.ReportPath = FinanceReportViewer.LocalReport.ReportPath.Replace("En", "").Replace(".rdlc", "En.rdlc"); } facservComm = new ServiceCommon(base.factoryConnectionString); if (!IsPostBack) { BindDailyReport(true); } if (!String.IsNullOrEmpty(Request["refresh"])) { BindDailyReport(); } }
private void GetSceneryTypeList() { facservComm = new ServiceCommon(factoryConnectionString); DataTable dt = facservComm.ExecuteSqlDatatable("SELECT [Code] ,[DictName] as Accessory FROM [dbo].[DictDetail] where ClassID = 'Accessory' order by cast([Code] as int)"); dt.TableName = "DataAccessory"; string backstr = Json.DataTable2Json(dt); if (backstr.IndexOf("\\") >= 0) { backstr = backstr.Replace("\\", "\\\\"); } Response.Write(backstr); Response.End(); }
private async Task FindAddress(EditDetailsCompositeViewModel viewModel) { var postalCode = viewModel.Identity.PersonalDetails.HomePostCode?.Trim(); if (string.IsNullOrWhiteSpace(postalCode) || !ServiceCommon.IsValidUkPostcode(postalCode)) { const string errorMessage = "Enter a valid postal code"; ModelState.AddModelError("Identity.PersonalDetails.HomePostCode", errorMessage); } else { bool isFindAddressServiceOnError = false; try { var addresses = (await _addressSearchService.GetAddresses(postalCode)).ToList(); if (addresses.Any()) { viewModel.Items = addresses.ToList(); } } catch { viewModel.Identity.PersonalDetails.FindAddressServiceResult = ErrorMessageServiceUnavailable; isFindAddressServiceOnError = true; } if (viewModel.Items == null || viewModel.Items.Count == 0) { viewModel.Items = new List <PostalAddressModel>() { new PostalAddressModel() { Error = 0 } }; if (!isFindAddressServiceOnError) { string noResultsMessage = "We do not have any address matching this postcode. Please enter your address details in the boxes provided."; viewModel.Identity.PersonalDetails.FindAddressServiceResult = noResultsMessage; } } } }
protected void Page_Load(object sender, EventArgs e) { servFacCommfac = new ServiceCommon(base.factoryConnectionString); if (Request["action"] == "CheckOrder") { string txtOrder = Request["txtOrder"]; ccWhere.AddComponent("Order_ID", txtOrder, SearchComponent.Equals, SearchPad.And); DataTable dtUser = servFacCommfac.GetListTop(1, "orders", ccWhere); if (dtUser.Rows.Count > 0) { Response.Write("0"); } else { Response.Write("1"); } Response.End(); } if (Request["action"] == "VerifierOrder") { string txtOrder = Request["OrderNumber"]; //base.IDRule servCommfac.ExecuteSql("update W_USERS set Passwd = '123' where UserName = '******'"); Response.Write("1"); Response.End(); } if (yeyRequest.Params("haddinfo") == "1") { try { string ModelNo = Request["VerifierNo"]; ModelNo = ModelNo.Replace("Verifier", ""); string txtOrder = Request["txtOrder"]; servCommfac.ExecuteSql("exec SPVerifyOrders '" + ModelNo + "','" + txtOrder + "','" + LoginUser.BelongFactory + "','" + LoginUser.UserName + "'"); checkPass = "******"; } catch (Exception) { checkPass = "******"; } } }
private string ExecuteDebuggingCommand(string debuggingCommand, bool output) { // Need to be thread-safe here, to ensure every debugging command get processed. // e.g: Set/Enable/Disable/Remove breakpoint during debugging lock (_executeDebugCommandLock) { ServiceCommon.Log("Client asks for executing debugging command"); _debugOutput = output; _debugCommandOutput = string.Empty; _debuggingCommand = debuggingCommand; _debugCommandEvent.Reset(); _pausedEvent.Set(); _debugCommandEvent.WaitOne(); _debugOutput = true; _debuggingCommand = string.Empty; return(_debugCommandOutput); } }
protected void Page_Load(object sender, EventArgs e) { facservComm = new ServiceCommon(factoryConnectionString); BindSmallClass(); subID = Request["subid"]; if (subID == "" || subID == "0") { } else { List <WORDERSDETAIL> listOrders = (List <WORDERSDETAIL>)Session["productList"]; worderDetail = listOrders[int.Parse(subID) - 1]; if (!String.IsNullOrEmpty(worderDetail.SmallClass)) { ddlSmallClass.SelectedValue = worderDetail.SmallClass; } } }