/// <summary> /// 将一个扩展转换成WinShellApplication对象。 /// </summary> /// <param name="extension">指定的扩展对象。</param> /// <returns>返回的WinShellApplication对象。</returns> public WinShellApplication AddApplicationForExtension(Extension extension) { WinShellApplication app = null; List<XmlNode> data = extension.Data; if (data != null && data.Count > 0) { // 1 将扩展的Application XML节点转换成WinShellApplication对象。 XmlNode topNode = data[0]; if (topNode.NodeType == XmlNodeType.Element && topNode.Attributes != null && topNode.Attributes["Title"] != null) { string appTitle = topNode.Attributes["Title"].Value; string appToolTip = topNode.Attributes["ToolTip"].Value; string appIcon = topNode.Attributes["Icon"].Value; if (!string.IsNullOrEmpty(appTitle)) { string parentGuid = Guid.NewGuid().ToString(); int topNodeLevel = 0; app = new WinShellApplication(appTitle, appToolTip, appIcon, extension.Owner); // 2 递归的将扩展的Menu XML节点及其子节点转换成WinShellMenu对象。 CreateWinShellMenusFromXmlNode(app.Menus, app, null, topNode, topNodeLevel); // 3 将Application对象保存起来。 _instance.AddApplication(app); } } } return app; }
void HandleSelectionChange(object sender, Extension.SelectionChangeEventArgs e) { // check to see if there is a map feature selected log.Debug("Verifying map feature selected."); if (e.isSelected) { // verify the extension is enabled and there is auth // also, only when there is one feature selected...do not handle multiple features if (ext.isExtensionEnabled() && ext.isAuthorizationAvailable() && e.selectedFeaturesCount == 1) { // there is a map feature selected, enable this button for user to click log.Debug("there is a map feature selected, enable this button for user to click"); this.Enabled = true; } else { // the extension or authorization is not enabled, diable button log.Debug("the extension or authorization is not enabled, diable button."); this.Enabled = false; } } else { // disable this button as no feature selected log.Debug("There is no feature selected, disable button."); this.Enabled = false; } }
public static void WriteLog(Extension.CustomPatternMessage message, LogLevel level,Exception ex) { message = message ?? new Extension.CustomPatternMessage { Message = "Message", CityCode = "10", AppName = "AppName", SysName = "SysName", Machine = Environment.MachineName ?? String.Empty }; switch(level) { case LogLevel.Debug: Log.Debug(message, ex); break; case LogLevel.Error: Log.Error(message, ex); break; case LogLevel.Fatal: Log.Fatal(message, ex); break; case LogLevel.Info: Log.Info(message, ex); break; case LogLevel.Warn: Log.Warn(message, ex); break; default: Log.Info(message, ex); break; } }
/// <summary> /// Attempt to create a Windows Shell extension for *.s3sr /// </summary> public static void CreateExtension() { Settings.RemoveExtension(); try { Extension ext = new Extension("mktm.ts3tools.s3sr", "s3sr", "s3sr-script", Application.ExecutablePath + ",0"); if (ext.CreateExtension()) { ext.AddCommand(new ExtensionCommand( "*Run", "&Run script", new ExtensionShellCommand(Application.ExecutablePath, new string[] { "%1" }), Application.ExecutablePath + ",0") ); ext.AddCommand(new ExtensionCommand( "Configure", "&Configure s3sr", new ExtensionShellCommand(Application.ExecutablePath, new string[] {}), Application.ExecutablePath + ",0") ); ext.CreateCommands(); } ext = null; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Exception while Saving", MessageBoxButtons.OK, MessageBoxIcon.Error); ExceptionReport.Create(ex, "Exception @ <Settings.CreateExtension>"); return; } }
void HandleDownloadProgressStateChangeEvent(object sender, Extension.DownloadProgressChangeEventArgs e) { // determine if the download is complete if (e.isComplete) { // close the dialog this.Close(); } else if (e.index == -1 || e.total == -1) { // update the message to the event message this.tbProgress.Text = e.message; // force an update of the dialog this.Update(); } else { // update the message to the event message this.tbProgress.Text = e.message; // update the progress bar this.progressBar.Minimum = 0; this.progressBar.Maximum = e.total; this.progressBar.Value = e.index; // force an update of the dialog this.Update(); } }
protected override void action(Extension e) { if (e.parent != null) { Console.WriteLine("My parent is " + e.parent.tag + "!"); e.parent.removeExtension(e); } }
void HandleAuthenticationStateChangeEvent(object sender, Extension.Auth.AuthenticationStateChangeEventArgs e) { // an authentication event occured, determine which one and act accordingly if (e.isAuthorized) { // TODO: Handle authorization event. } }
public ExcelFileParser(string _filePath, Extension ext) { filePath = _filePath; extension = ext; _customAttributes = new Hashtable(); OpenFile(filePath); prepareFile(); }
public Input( XElement element, Extension<EventTarget> eventTarget) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(eventTarget != null); this.eventTarget = eventTarget; }
public ElementEvaluationContextResolver( XElement element, Extension<CommonAttributes> attributes) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); this.attributes = attributes; }
public TableRow( XElement element, Extension<TableRowAttributes> attributes) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); this.attributes = attributes; }
public UINode( XElement element, Extension<CommonAttributes> attributes) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); this.attributes = attributes; }
public ServerHello(ProtocolVersion ver, byte[] random, byte[] sessionID, CipherSuite suite, CompressionMethod compression, Extension[] extensions) : base(HandshakeType.ServerHello) { _version = ver; _random = random; _sessionID = sessionID; _cipherSuite = suite; _compression = compression; _extensions = extensions; }
public DataNode( XElement element, Extension<IUIBindingNode> uiBindingNode) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(uiBindingNode != null); this.uiBindingNode = uiBindingNode; this.uiBinding = new Lazy<UIBinding>(() => uiBindingNode.Value.UIBinding); }
public HeaderName( XElement element, HeaderNameAttributes attributes, Extension<IBindingNode> bindingNode) : base(element) { Contract.Requires<ArgumentNullException>(element != null); this.attributes = attributes; this.bindingNode = bindingNode; this.valueBinding = new Lazy<Binding>(() => BindingUtil.ForAttribute(attributes.ValueAttribute)); }
public Include( XElement element, Extension<IncludeProperties> properties, ITraceService trace, IIOService io) : base(element, () => properties.Value, trace, io) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentNullException>(io != null); }
public Submit( XElement element, SubmitAttributes attributes, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); Contract.Requires<ArgumentNullException>(context != null); this.attributes = attributes; this.context = context; }
public BindingNode( XElement element, Extension<BindingProperties> properties, Extension<EvaluationContextResolver> resolver) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(resolver != null); this.properties = properties; this.resolver = resolver; this.binding = new Lazy<Binding>(() => GetOrCreateBinding()); }
public SetValueProperties( XElement element, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(context != null); this.attributes = element.AnnotationOrCreate<SetValueAttributes>(() => new SetValueAttributes(element)); this.context = context; this.value = new Lazy<XPathExpression>(() => !string.IsNullOrEmpty(attributes.Value) ? context.Value.Context.CompileXPath(element, attributes.Value) : null); }
void HandleAuthenticationStateChangeEvent(object sender, Extension.Auth.AuthenticationStateChangeEventArgs e) { // an authentication event occured, determine which one and act accordingly if (e.isAuthorized) { // suppress/check the button this.Enabled = true; } else { // unsupress/uncheck the button this.Enabled = false; } }
public Var( XElement element, VarProperties properties, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(context != null); this.properties = properties; this.context = context; this.value = new Lazy<Binding>(() => properties.Value != null ? new Binding(Element, context.Value.Context, properties.Value) : null); }
public CommonProperties( XElement element, CommonAttributes attributes, Extension<EvaluationContextResolver> contextResolver) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(contextResolver != null); this.attributes = attributes; this.contextResolver = contextResolver; this.context = new Lazy<XPathExpression>(() => !string.IsNullOrEmpty(attributes.Context) ? contextResolver.Value.Context.CompileXPath(element, attributes.Context) : null); }
void HandleAuthenticationStateChangeEvent(object sender, Extension.Auth.AuthenticationStateChangeEventArgs e) { // an authentication event occured, determine which one and act accordingly if (e.isAuthorized && ext.isExtensionEnabled() && ext.hasAtLeastOneLayer()) { // the user is authorized, verify the button is also enabled log.Debug("Extension is enabled, enable button and check to verify the user has an auth token."); this.Enabled = true; } else { // unsupress/uncheck the button this.Enabled = false; } }
public Submission( XElement element, SubmissionProperties properties, Extension<EvaluationContextResolver> context, IModelRequestService requestService) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(context != null); Contract.Requires<ArgumentNullException>(requestService != null); this.requestService = requestService; this.properties = properties; this.context = context; }
public Select1( XElement element, Select1Attributes attributes, Extension<IBindingNode> bindingNode, Extension<IUIBindingNode> uiBindingNode) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); Contract.Requires<ArgumentNullException>(bindingNode != null); Contract.Requires<ArgumentNullException>(uiBindingNode != null); this.attributes = attributes; this.bindingNode = bindingNode; this.uiBindingNode = uiBindingNode; }
public LoadProperties( XElement element, LoadAttributes attributes, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); Contract.Requires<ArgumentNullException>(context != null); this.attributes = attributes; this.context = context; this.show = new Lazy<LoadShow>(() => !string.IsNullOrEmpty(attributes.Show) ? (LoadShow)Enum.Parse(typeof(LoadShow), attributes.Show, true) : LoadShow.Replace); }
void HandleExtensionStateChange(object sender, Extension.StateChangeEventArgs e) { // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (e.State && ext.isAuthorizationAvailable()) { // the extension is enabled, verify the button is also enabled log.Debug("Extension is enabled, enable button and check to verify the user has an auth token."); this.Enabled = true; } else { // disable this button log.Debug("The extension is disabled, disable this button."); this.Enabled = false; } }
public MainForm() { // intialize the components and set stuff that can be set in the designer InitializeComponent(); var icon = IntPtr.Zero; NotifyIcon.Icon = ExtractIconEx(Application.ExecutablePath, 0, IntPtr.Zero, out icon, 1) == 1 ? Icon.FromHandle(icon) : Icon; modifyMaskedTextBox.ValidatingType = typeof(TimeSpan); // create the clients and their restart buttons clients = Settings.Default.Servers.Cast<string>().Select(s => new ExtensionSyncClient(new Uri(s))).ToArray(); foreach (var client in clients) restartToolStripMenuItem.DropDownItems.Add(client.BaseUri.ToString()).Tag = client; // set the grid datasource and create the work extension stateDataGridView.DataSource = Extension.All; workExtension = Extension.FromNumber(Settings.Default.Extension, this); }
public Bind( XElement element, BindAttributes attributes, Extension<IBindingNode> bindingNode, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); Contract.Requires<ArgumentNullException>(bindingNode != null); Contract.Requires<ArgumentNullException>(context != null); this.id = (string)element.Attribute("id"); this.attributes = attributes; this.bindingNode = bindingNode; this.context = new Lazy<EvaluationContext>(() => context.Value.Context); }
public BindingProperties( XElement element, BindingAttributes attributes, Extension<EvaluationContextResolver> context) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(context != null); this.attributes = attributes; this.context = context; this.ref_ = new Lazy<XPathExpression>(() => !string.IsNullOrEmpty(attributes.Ref) ? context.Value.Context.CompileXPath(element, attributes.Ref) : null); this.nodeset = new Lazy<XPathExpression>(() => !string.IsNullOrEmpty(attributes.NodeSet) ? context.Value.Context.CompileXPath(element, attributes.NodeSet) : null); }
public static void Here_I_Am <TBase, T>(this Extension <TBase> ext, Pointer <T> oldPtr, ref T obj) { SwizzleManagerClass.Instance.Here_I_Am(oldPtr, ref obj); }
public void Process(Dictionary <string, object> parameters) { Message message = null; List <string> botParameters = null; Stats stats = null; SlackClient slackClient = null; TimerPipeline timerPipeline = null; string userName = null; string userId = null; foreach (var item in parameters) { switch (item.Key) { case "stats": stats = (Stats)item.Value; break; case "userName": userName = (string)item.Value; break; case "userId": userId = (string)item.Value; break; case "message": message = (Message)item.Value; break; case "parameters": botParameters = (List <string>)item.Value; break; case "_timerPipeline": timerPipeline = (TimerPipeline)item.Value; break; case "_slackClient": slackClient = (SlackClient)item.Value; break; default: break; } } if (botParameters[1] == "stayhydrated" && botParameters[2] == "subscribe" && botParameters.Count == 4) { foreach (var item in timerPipeline._pipelineElemets) { if (item.GetType() == typeof(StayHydratedTimerMiddleware)) { if (!item.SubscribersList.Exists(obj => obj.UserId == userId)) { Pair newPair = new Pair { UserId = userId, SubscriptionDate = DateTime.Now, LastReminded = DateTime.Now, Interval = Int32.Parse(botParameters[3]), UserName = userName }; item.SubscribersList.Add(newPair); Models.Attachment attachment = new Models.Attachment { Color = "#04DF00", Text = "You are added to subscription list of Stay Hydrated. You will be notified every " + Int32.Parse(botParameters[3]) + " minute(s) to drink water. Wish you a nice day.", Footer = "BordaBot", Ts = Extension.ToProperTimeStamp(DateTime.Now) }; string attachments = "[" + JsonConvert.SerializeObject(attachment) + "]"; slackClient.PostMessage(message.Channel, "@" + userName + ":", false, attachments); } else { slackClient.PostMessage(message.Channel, "@" + userName + ", you have already subscribed for this service."); } } } } else if (botParameters[1] == "stayhydrated" && botParameters[2] == "unsubscribe") { foreach (var item in timerPipeline._pipelineElemets) { if (item.GetType() == typeof(StayHydratedTimerMiddleware)) { if (item.SubscribersList.Exists(obj => obj.UserId == userId)) { item.SubscribersList.RemoveAll(obj => obj.UserId == userId); Models.Attachment attachment = new Models.Attachment { Color = "danger", Text = "You are removed from subscription list of Stay Hydrated.", Footer = "BordaBot", Ts = Extension.ToProperTimeStamp(DateTime.Now) }; string attachments = "[" + JsonConvert.SerializeObject(attachment) + "]"; slackClient.PostMessage(message.Channel, "@" + userName + ":", false, attachments); } else { slackClient.PostMessage(message.Channel, "@" + userName + ", you are not subscribed for this service."); } } } } }
public static void Save <TBase, T>(this Extension <TBase> ext, IStream stream, PointerHandle <T> ptr) { stream.Write(ptr.Pointer); }
public void Bootstrap(string connectionString) { using (var db = CMSContextFactory.Create(connectionString)) { //init extendsion var extension = db.Extensions.SingleOrDefault(ext => ext.Namespace == "Components.SingleArticle.SingleArticleComponentController"); if (extension == null) { extension = new Extension() { Id = 1, Namespace = "Components.SingleArticle.SingleArticleComponentController" }; db.Add(extension); } //init 'Single Article' menu type var menuItemType = db.MenuItemTypes.SingleOrDefault(type => type.Id == 1); if (menuItemType == null) { menuItemType = new MenuItemType() { Id = 1, Name = "Single Article", ExtensionId = 1 }; db.Add(menuItemType); } //init menu-item var menuItem = db.MenuItems.SingleOrDefault(item => item.Id == 1); if (menuItem == null) { menuItem = new MenuItem() { Id = 1, Link = "home", MenuItemTypeId = 1, Params = "{ItemId : 1}", // item will be initialized next IsMenu = false, ChildMenuId = 1, //TODO: this should be zero MenuId = 1, IsIndexPage = true, Role = db.Roles.SingleOrDefault(role => role.Name.Equals("Public")) }; db.Add(menuItem); MenuItem_Language menuItem_laguage = new MenuItem_Language() { Id = 1, LanguageId = 1, Label = "Home", MenuItemId = 1 }; db.Add(menuItem_laguage); menuItem_laguage = new MenuItem_Language() { Id = 2, LanguageId = 2, Label = "الرئيسية", MenuItemId = 1 }; db.Add(menuItem_laguage); } //init an item var _item = db.Items.SingleOrDefault(item => item.Id == 1); if (_item == null) { _item = new Item() { Id = 1, CategoryId = 1, Role = db.Roles.SingleOrDefault(role => role.Name.Equals("Public")) }; db.Add(_item); Item_Language _item_language = new Item_Language() { ItemId = 1, LanguageId = 1, Title = "Welcome To LightCMS", ShortContent = "Welcome to LightCMS", FullContent = @"Thank you for using LightCMS, you can access the <strong>Admin Panel</strong> by navigating to <strong>/admin</admin><br>. This is a sample page which was generated automatically by LightCMS." }; db.Add(_item_language); _item_language = new Item_Language() { ItemId = 1, LanguageId = 2, Title = "LightCMS أهلاً بك في ", ShortContent = "LightCMS أهلاً بك في", FullContent = @"نشكر ثقتك بنا.. يمكنك إضافة المزيد باستخدام admin" }; db.Add(_item_language); } db.SaveChanges(); } }
public void SetUpAndTearDown() { Extension.EnableAll(); Log.Formatters.Clear(); Log.UnsubscribeAllFromEntryPosted(); }
private static void GenerateExtensionsSupportClass(RegistryProcessor glRegistryProcessor, RegistryContext ctx) { string path = String.Format("{0}/{1}.Extensions.cs", _OutputBasePath, ctx.Class); Console.WriteLine("Generate registry khronosExtensions to {0}.", path); SortedList <int, List <IFeature> > khronosExtensions = new SortedList <int, List <IFeature> >(); SortedList <int, List <IFeature> > vendorExtensions = new SortedList <int, List <IFeature> >(); foreach (IFeature feature in ctx.Registry.Extensions) { SortedList <int, List <IFeature> > extensionDict; List <IFeature> extensionFeatures; if (Extension.IsArbVendor(feature.Name)) { extensionDict = khronosExtensions; } else { extensionDict = vendorExtensions; } int index = ExtensionIndices.GetIndex(feature.Name); if (extensionDict.TryGetValue(index, out extensionFeatures) == false) { extensionFeatures = new List <IFeature>(); extensionDict.Add(index, extensionFeatures); } extensionFeatures.Add(feature); } using (SourceStreamWriter sw = new SourceStreamWriter(Path.Combine(BasePath, path), false)) { RegistryProcessor.GenerateLicensePreamble(sw); sw.WriteLine("using System;"); sw.WriteLine(); sw.WriteLine("namespace {0}", _Namespace); sw.WriteLine("{"); sw.Indent(); sw.WriteLine("public partial class {0}", ctx.Class); sw.WriteLine("{"); sw.Indent(); sw.WriteLine("/// <summary>"); sw.WriteLine("/// Extension support listing."); sw.WriteLine("/// </summary>"); sw.WriteLine("public partial class Extensions : ExtensionsCollection"); sw.WriteLine("{"); sw.Indent(); foreach (KeyValuePair <int, List <IFeature> > pair in khronosExtensions) { IFeature mainFeature = pair.Value[0]; string extensionFieldName = SpecificationStyle.GetExtensionBindingName(mainFeature.Name); sw.WriteLine("/// <summary>"); sw.WriteLine("/// Support for extension {0}.", mainFeature.Name); sw.WriteLine("/// </summary>"); foreach (IFeature feature in pair.Value) { if (feature.Api != null && feature.Api != ctx.Class.ToLower()) { sw.WriteLine("[Extension(\"{0}\", Api = \"{1}\")]", feature.Name, feature.Api); } else { sw.WriteLine("[Extension(\"{0}\")]", feature.Name); } } Extension mainExtension = (Extension)mainFeature; if (String.IsNullOrEmpty(mainExtension.Supported) == false) { sw.WriteLine("[ExtensionSupport(\"{0}\")]", mainExtension.Supported); } sw.WriteLine("public bool {0};", extensionFieldName); sw.WriteLine(); } foreach (KeyValuePair <int, List <IFeature> > pair in vendorExtensions) { IFeature mainFeature = pair.Value[0]; string extensionFieldName = SpecificationStyle.GetExtensionBindingName(mainFeature.Name); sw.WriteLine("/// <summary>"); sw.WriteLine("/// Support for extension {0}.", mainFeature.Name); sw.WriteLine("/// </summary>"); foreach (IFeature feature in pair.Value) { if (feature.Api != null && feature.Api != ctx.Class.ToLower()) { sw.WriteLine("[Extension(\"{0}\", Api = \"{1}\")]", feature.Name, feature.Api); } else { sw.WriteLine("[Extension(\"{0}\")]", feature.Name); } } sw.WriteLine("public bool {0};", extensionFieldName); sw.WriteLine(); } sw.Unindent(); sw.WriteLine("}"); sw.Unindent(); sw.Unindent(); sw.WriteLine("}"); sw.Unindent(); sw.WriteLine(); sw.WriteLine("}"); } }
// Convenience methods for accessing extensions, where repeated extensions // return an empty repeated field instead of null if they're absent. internal static T GetExtension <T>(this FileDescriptor descriptor, Extension <FileOptions, T> extension) => descriptor.GetOptions() is FileOptions options?options.GetExtension(extension) : default;
public override void OnActionExecuting(ActionExecutingContext filterContext) { User u = (User)filterContext.ActionParameters["u"]; if (u.NAME == null || u.CUSTOMERCODE == null) { return; } UserChangePWD ucp = new UserChangePWD(); ucp.NAME = u.NAME; ucp.PASSWORD = u.PASSWORD; ucp.CUSTOMERCODE = u.CUSTOMERCODE; bool valid = filterContext.Controller.ValidateRequest; if (valid) { DataTable dt_user = new DataTable(); dt_user = DBMgr.GetDataTable("select a.*,b.code from sys_user a inner join cusdoc.sys_customer b on a.customerid=b.id where lower(a.name) = '" + u.NAME.ToLower() + "' and lower(b.code)='" + u.CUSTOMERCODE.ToLower() + "'"); if (dt_user.Rows.Count > 0) { if (dt_user.Rows[0]["TYPE"] + "" != "4" && dt_user.Rows[0]["ENABLED"] + "" == "1") { DataTable dt_superpwd = new DataTable(); dt_superpwd = DBMgr.GetDataTable("select * from sys_superpwd where PWD='" + u.PASSWORD + "'"); if (dt_superpwd.Rows.Count <= 0)//超级管理员 { if (dt_user.Rows[0]["POINTS"] + "" != "1") { //filterContext.Result = new RedirectResult("/Home/Modpwd"); //ViewEngineCollection vec = new ViewEngineCollection(); //RazorViewEngine razorViewEngine=new RazorViewEngine(); //razorViewEngine.ViewLocationFormats = new[] { "~/Views/Home/Modpwd.cshtml" }; //vec.Add(razorViewEngine); filterContext.Result = new ViewResult { ViewName = "Modpwd", ViewData = new ViewDataDictionary <UserChangePWD>(ucp) // ViewEngineCollection = vec }; if (ucp.PASSWORD != null) { string sql = @"select a.*,b.code from sys_user a inner join cusdoc.sys_customer b on a.customerid=b.id where lower(a.name) = '" + u.NAME.ToLower() + "' and a.password = '******' and lower(b.code)='" + u.CUSTOMERCODE.ToLower() + "'"; DataTable dt = DBMgr.GetDataTable(sql); if (dt.Rows.Count <= 0) { ucp.PASSWORD = string.Empty; } } } } } } } }
public static void ValidateResponseJsonSaveNetworkStatsMainMethod(IRestResponse restResponse, string URL, int loop, string jsonRequest, string apiName) { //variable decleration var contentType = ""; var responseContent = ""; //variable decleratio char[] splitCharacter = { ',' }; char[] splitCharacterColon = { ':' }; char[] splitCharacterCurlyBracket = { '}' }; string[] splitValue = null; char[] splitCharacterCommas = { '"' }; //verifying status code and other major responses from API specifically status code if (restResponse.StatusCode.ToString() != "OK") { if (restResponse.StatusCode.ToString() == "Forbidden") { Debug.WriteLine("Status code forbidden, internet connectivity not available" + URL + " please check your internet connection " + loop, jsonRequest); } if (restResponse.StatusCode.ToString() == "0") { Debug.WriteLine("Status code 0, the underlying connection was closed at " + URL + " " + loop); } if (restResponse.StatusCode.ToString() == "internal server error") { Debug.WriteLine("Body contains internal server error, hence" + URL + " API is failed, pleaes check your internet connection " + loop, jsonRequest); } else { Debug.WriteLine("Status code not OK," + URL + " API has failed at " + loop + " " + restResponse.StatusCode.ToString(), jsonRequest); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } } contentType = restResponse.ContentType.ToString(); responseContent = restResponse.Content.ToString(); string[] separatedKeyValues = responseContent.Split(splitCharacter); if (responseContent.Contains("\"Page not found\"")) { Debug.WriteLine("Body contains page not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jsonRequest); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (responseContent.Contains("\"appJson not found\"")) { Debug.WriteLine("Body contains json not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jsonRequest); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (separatedKeyValues[0].ToString().Equals("\"Invalid Request\"")) { Debug.WriteLine("Body contains json not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jsonRequest); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (responseContent.ToString().Contains("A PHP Error was encountered")) { Debug.WriteLine(URL + "API failed as it is not correct json response in content type. A PHP error has encoutered " + loop + responseContent.ToString(), jsonRequest); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (responseContent.Contains("{\"message\":\"Sync Successful! Please note that changes will not be applied to Live App.You must make changes live from portal in App Placeholders & Ads tab.\"}")) { Debug.WriteLine(URL + "exeuction successful"); Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } else { Extension.CreateLogFile(loop, jsonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } //Starting key level validations for all key values separatedKeyValues = responseContent.Split(splitCharacter); foreach (var item in separatedKeyValues) { splitValue = item.Split(splitCharacterColon); //validating message should not be null if (splitValue[0].ToString().Contains("\"message\"")) { if (splitValue[1].ToString().Contains("completed")) { Debug.WriteLine("message value is correct"); } else { Debug.WriteLine("Message value not appearing correctly"); } } // session token should not be null if (splitValue[0].ToString().Contains("\"sessionToken\"")) { Debug.WriteLine("Session token value is set\n"); string[] curly = splitValue[1].Split(splitCharacterCurlyBracket); string[] commas = curly[0].Split(splitCharacterCommas); SessionToken.sessionToken = commas[1]; if (splitValue[1] == null) { Debug.WriteLine("sessionToken value appearing as null," + URL + "api is failed", jsonRequest); } } } }
/// <include file='doc\ProvideEditorExtensionAttribute.uex' path='docs/doc[@for="Register"]' /> /// <devdoc> /// Called to register this attribute with the given context. The context /// contains the location where the registration inforomation should be placed. /// it also contains such as the type being registered, and path information. /// /// This method is called both for registration and unregistration. The difference is /// that unregistering just uses a hive that reverses the changes applied to it. /// </devdoc> public override void Register(RegistrationContext context) { context.Log.WriteLine(string.Format(Resources.Culture, Resources.Reg_NotifyEditorExtension, Extension, Factory.ToString("B"))); using (Key editorKey = context.CreateKey(RegKeyName)) { if (!string.IsNullOrEmpty(DefaultName)) { editorKey.SetValue(null, DefaultName); } if (0 != resId) { editorKey.SetValue("DisplayName", "#" + resId.ToString(CultureInfo.InvariantCulture)); } editorKey.SetValue("Package", context.ComponentType.GUID.ToString("B")); } using (Key extensionKey = context.CreateKey(RegKeyName + "\\Extensions")) { extensionKey.SetValue(Extension.Substring(1), Priority); } // Build the path of the registry key for the "Add file to project" entry if (project != Guid.Empty) { string prjRegKey = ProjectRegKeyName(context) + "\\/1"; using (Key projectKey = context.CreateKey(prjRegKey)) { if (0 != resId) { projectKey.SetValue("", "#" + resId.ToString(CultureInfo.InvariantCulture)); } if (templateDir.Length != 0) { Uri url = new Uri(context.ComponentType.Assembly.CodeBase); string templates = url.LocalPath; templates = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(templates), templateDir); templates = context.EscapePath(System.IO.Path.GetFullPath(templates)); projectKey.SetValue("TemplatesDir", templates); } projectKey.SetValue("SortPriority", Priority); } } // Register the EditorFactoryNotify if (EditorFactoryNotify) { // The IVsEditorFactoryNotify interface is called by the project system, so it doesn't make sense to // register it if there is no project associated to this editor. if (project == Guid.Empty) { throw new ArgumentException(Resources.Attributes_NoPrjForEditorFactoryNotify); } // Create the registry key using (Key edtFactoryNotifyKey = context.CreateKey(EditorFactoryNotifyKey)) { edtFactoryNotifyKey.SetValue("EditorFactoryNotify", Factory.ToString("B")); } } }
public bool AuthenticateUser(string username, string password) { try { var query = from u in dataContext.Logins where u.Extension == username && u.Secret == password select u; if (Enumerable.Count(query) > 0) { LoginName = query.Single().Name; Extension = query.Single().Extension; LoginTime = DateTime.Now; currState = dataContext.CurrStateInfos.Single(u => u.Extension == Extension.Trim()); currState.LoginTime = LoginTime.ToString("yyyyMMddHHmmss"); currState.IsLogin = true; //Adding Account Info this.accountConfig.AccountName = LoginName; this.accountConfig.DisplayName = LoginName; this.accountConfig.DomainName = "*"; this.accountConfig.HostName = GetProxyIP() + ":5060"; this.accountConfig.Id = LoginName; this.accountConfig.Password = password.Trim(); this.accountConfig.ProxyAddress = ""; this.accountConfig.UserName = Extension; this.accountConfig.AsteriskIP = GetProxyIP(); //Adding Phone Config this.phoneConfig.AAFlag = GetSettings(Extension).AAFlag; this.phoneConfig.CFBFlag = GetSettings(Extension).CFBFlag; this.phoneConfig.CFNRFlag = GetSettings(Extension).CFNRFlag; this.phoneConfig.CFUFlag = GetSettings(Extension).CFUFlag; this.phoneConfig.DNDFlag = GetSettings(Extension).DNDFlag; this.phoneConfig.SIPPort = GetSettings(Extension).Port; this.phoneConfig.CFBNumber = GetSettings(Extension).CFBNumber; this.phoneConfig.CFNRNumber = GetSettings(Extension).CFNRNumber; this.phoneConfig.CFUNumber = GetSettings(Extension).CFUNumber; this.phoneConfig.Accounts[0] = accountConfig; } return(Enumerable.Count(query) > 0); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString(), "Error# 4001: " + ex.Message); return(false); } }
/// <summary> /// Returns true if Attachment instances are equal /// </summary> /// <param name="other">Instance of Attachment to be compared</param> /// <returns>Boolean</returns> public bool Equals(Attachment other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( Extension == other.Extension || Extension != null && Extension.Equals(other.Extension) ) && ( ContentType == other.ContentType || ContentType != null && ContentType.Equals(other.ContentType) ) && ( Language == other.Language || Language != null && Language.Equals(other.Language) ) && ( Data == other.Data || Data != null && Data.Equals(other.Data) ) && ( Url == other.Url || Url != null && Url.Equals(other.Url) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( Hash == other.Hash || Hash != null && Hash.Equals(other.Hash) ) && ( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
public async void RemoveExtension(Extension ext) { await _catalog.RequestRemovePackageAsync(ext.AppExtension.Package.Id.FullName); }
public ActionResult LoadFile(LoadDonorPartnersViewModel model, HttpPostedFileBase imageFile) { JSonResult objResult = new JSonResult(); string fileName = string.Empty; string Ext = string.Empty; byte[] imgData = null;//; new byte[0]; string path = string.Empty; string basePath; // basePath = "E:\\TFS_Fuentes\\UnitLite\\Fuentes CMS Net\\CMSWeb\\File"; basePath = Server.MapPath("~/File"); DataTable dt; var include = new[] { "A", "B", "D" }; try { if (imageFile != null) { fileName = imageFile.FileName; Ext = Path.GetExtension(imageFile.FileName); // imgData = Extension.FileToByteArray(imageFile); path = string.Format("{0}\\{1}", basePath, imageFile.FileName); } if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } imageFile.SaveAs(path); try { using (SpreadsheetDocument doc = SpreadsheetDocument.Open(path, false)) { //Read the first Sheet from Excel file. Sheet sheet = doc.WorkbookPart.Workbook.Descendants <Sheet>().FirstOrDefault(s => s.Name == "UNCDF"); //Get the Worksheet instance. Worksheet worksheet = (doc.WorkbookPart.GetPartById(sheet.Id.Value) as WorksheetPart).Worksheet; //Fetch all the rows present in the Worksheet. IEnumerable <Row> rows = worksheet.GetFirstChild <SheetData>().Descendants <Row>(); dt = new DataTable(); //Loop through the Worksheet rows. foreach (Row row in rows) { //Use the first row to add columns to DataTable. if (row.RowIndex.Value == 2) { foreach (Cell cell in row.Descendants <Cell>()) { string cel = cell.CellReference; cel = cel.Substring(0, 1); if (include.Any(x => cel.Contains(x))) {//Continue adding the row to the table dt.Columns.Add(OpenXMLUtil.GetValue(doc, cell)); } } } else if (row.RowIndex.Value > 2) { //Add rows to DataTable. dt.Rows.Add(); int i = 0; foreach (Cell cell in row.Descendants <Cell>()) { string cel2 = cell.CellReference; cel2 = cel2.Substring(0, 1); if (include.Any(x => cel2.Contains(x))) { dt.Rows[dt.Rows.Count - 1][i] = OpenXMLUtil.GetValue(doc, cell); i++; } } } } } } catch (Exception ex) { objResult.isError = true; objResult.data = null; objResult.message = string.Format("Error: Please check the template for this upload ", "Funds"); return(Json(objResult)); } if (dt.Rows.Count <= 0) { objResult.isError = true; objResult.data = null; objResult.message = string.Format("The uploaded file has no rows", "Funds"); return(Json(objResult)); } try { var dtResultado = dt.Rows.Cast <DataRow>().Where(row => !Array.TrueForAll(row.ItemArray, value => { return(value.ToString().Length == 0); })); dt = dtResultado.CopyToDataTable(); List <ModelDonorPartnerResult> entlist = new List <ModelDonorPartnerResult>(); for (int i = 0; i < dt.Rows.Count; i++) { ModelDonorPartnerResult ent = new ModelDonorPartnerResult(); ent.DonorCode = Extension.ToEmpty(dt.Rows[i][0].ToString());//Convert.ToInt32(dt.Rows[i]["StudentId"]); ent.DonorName = Extension.ToEmpty(dt.Rows[i][1].ToString()); ent.FundingPartner = Extension.ToEmpty(dt.Rows[i][2].ToString()); ent.AlertMessage = string.Empty; ent.WithAlert = "N"; if (ent.DonorCode.Length > 10) { ent.AlertMessage += "<tr><td> - the Donor Code column must not must not exceed 10 characters </td></tr> "; } if (ent.DonorCode.Length == 0) { ent.AlertMessage += "<tr><td> - the Donor Code column is required </td></tr> "; } if (ent.DonorName.Length > 255) { ent.AlertMessage += "<tr><td> - the Donor Name column must not must not exceed 255 characters </td></tr> "; } if (ent.DonorName.Length == 0) { ent.AlertMessage += "<tr><td> - the Donor Name column is required </td></tr> "; } if (ent.FundingPartner.Length > 100) { ent.AlertMessage += "<tr><td> - the Funding Partner column must not must not exceed 100 characters </td></tr> "; } if (ent.AlertMessage.Length > 0) { ent.AlertMessage = "<table>" + ent.AlertMessage + "</table>"; ent.WithAlert = "S"; } entlist.Add(ent); } Session["ListDonors"] = entlist; objResult.data = entlist; } catch (Exception ex) { objResult.isError = true; objResult.data = null; objResult.message = "Donors :" + "Format error, check records"; return(Json(objResult)); } objResult.isError = false; objResult.message = null; // string.Format(MessageResource.SaveSuccess, "Load File save"); } catch (Exception ex) { objResult.isError = true; objResult.data = null; objResult.message = "Error loading Donors"; } return(Json(objResult)); }
public static void Swizzle <TBase, T>(this Extension <TBase> ext, ref T obj) { SwizzleManagerClass.Instance.Swizzle(ref obj); }
public string Save() { string filedata = Request["filedata"]; string action = Request["action"]; JObject json = (JObject)JsonConvert.DeserializeObject(Request["formdata"]); JObject json_user = Extension.Get_UserInfo(HttpContext.User.Identity.Name); string sql = ""; string ordercode = string.Empty; bool IsSubmitAfterSave = false; if (Request["action"] + "" == "submit") { json.Remove("STATUS"); json.Remove("SUBMITTIME"); json.Remove("SUBMITUSERNAME"); json.Remove("SUBMITUSERID"); json.Add("STATUS", 10); json.Add("SUBMITTIME", "sysdate"); json.Add("SUBMITUSERNAME", json_user.Value <string>("REALNAME")); json.Add("SUBMITUSERID", json_user.Value <string>("ID")); } else { if (string.IsNullOrEmpty(json.Value <string>("SUBMITTIME"))) //有可能提交以后再对部分字段进行修改后保存 { json.Remove("SUBMITTIME"); //委托时间 因为该字段需要取ORACLE的时间,而非系统时间 所以需要特殊处理,格式化时并没有加引号 json.Add("SUBMITTIME", "null"); } else { string submittime = json.Value <string>("SUBMITTIME"); json.Remove("SUBMITTIME");//委托时间 因为该字段需要取ORACLE的时间,而非系统时间 所以需要特殊处理 json.Add("SUBMITTIME", "to_date('" + submittime + "','yyyy-MM-dd HH24:mi:ss')"); IsSubmitAfterSave = true; } } if (json.Value <string>("ENTRUSTTYPE") == "01") { json.Add("DECLSTATUS", json.Value <string>("STATUS")); json.Add("INSPSTATUS", null); } if (json.Value <string>("ENTRUSTTYPE") == "02") { json.Add("DECLSTATUS", null); json.Add("INSPSTATUS", json.Value <string>("STATUS")); } if (json.Value <string>("ENTRUSTTYPE") == "03") { json.Add("DECLSTATUS", json.Value <string>("STATUS")); json.Add("INSPSTATUS", json.Value <string>("STATUS")); } if (string.IsNullOrEmpty(json.Value <string>("CODE")))//新增 { ordercode = Extension.getOrderCode(); sql = @"INSERT INTO LIST_ORDER (ID ,BUSITYPE,CODE,CUSNO,BUSIUNITCODE,BUSIUNITNAME,CONTRACTNO ,TOTALNO,DIVIDENO,TURNPRENO,GOODSNUM,ARRIVEDNO ,CLEARANCENO,LAWFLAG,ENTRUSTTYPE,REPWAYID,CUSTOMAREACODE ,REPUNITCODE,REPUNITNAME,DECLWAY,PORTCODE,INSPUNITCODE ,INSPUNITNAME,ORDERREQUEST,CREATEUSERID,CREATEUSERNAME,STATUS ,SUBMITUSERID,SUBMITUSERNAME,CUSTOMERCODE,CUSTOMERNAME,DECLCARNO ,TRADEWAYCODES,GOODSGW,GOODSNW,PACKKIND,BUSIKIND ,ORDERWAY,CLEARUNIT,CLEARUNITNAME,CREATETIME,SUBMITTIME,SPECIALRELATIONSHIP ,PRICEIMPACT,PAYPOYALTIES,WEIGHTCHECK,ISWEIGHTCHECK,DECLSTATUS ,INSPSTATUS,DOCSERVICECODE ) VALUES (LIST_ORDER_id.Nextval , '{0}','{1}','{2}','{3}','{4}','{5}' ,'{6}','{7}','{8}','{9}','{10}' ,'{11}','{12}','{13}','{14}','{15}' , '{16}','{17}','{18}','{19}','{20}' ,'{21}','{22}','{23}','{24}','{25}' ,'{26}','{27}','{28}','{29}','{30}' ,'{31}','{32}','{33}','{34}','{35}' ,'{36}','{37}','{38}', sysdate,{39},'{40}' ,'{41}','{42}','{43}','{44}','{45}' ,'{46}','{47}')"; sql = string.Format(sql , "10", ordercode, json.Value <string>("CUSNO"), json.Value <string>("BUSIUNITCODE"), json.Value <string>("BUSIUNITNAME"), json.Value <string>("CONTRACTNO") , json.Value <string>("TOTALNO"), json.Value <string>("DIVIDENO"), json.Value <string>("TURNPRENO"), json.Value <string>("GOODSNUM"), json.Value <string>("ARRIVEDNO") , json.Value <string>("CLEARANCENO"), GetChk(json.Value <string>("LAWFLAG")), json.Value <string>("ENTRUSTTYPE"), json.Value <string>("REPWAYID"), json.Value <string>("CUSTOMAREACODE") , GetCode(json.Value <string>("REPUNITCODE")), GetName(json.Value <string>("REPUNITCODE")), json.Value <string>("DECLWAY"), json.Value <string>("PORTCODE"), GetCode(json.Value <string>("INSPUNITCODE")) , GetName(json.Value <string>("INSPUNITCODE")), json.Value <string>("ORDERREQUEST"), json_user.Value <string>("ID"), json_user.Value <string>("REALNAME"), json.Value <string>("STATUS") , json.Value <string>("SUBMITUSERID"), json.Value <string>("SUBMITUSERNAME"), json_user.Value <string>("CUSTOMERCODE"), json_user.Value <string>("CUSTOMERNAME"), json.Value <string>("DECLCARNO") , json.Value <string>("TRADEWAYCODES"), json.Value <string>("GOODSGW"), json.Value <string>("GOODSNW"), json.Value <string>("PACKKIND"), "001" , "1", json_user.Value <string>("CUSTOMERCODE"), json_user.Value <string>("CUSTOMERNAME"), json.Value <string>("SUBMITTIME"), GetChk(json.Value <string>("SPECIALRELATIONSHIP")) , GetChk(json.Value <string>("PRICEIMPACT")), GetChk(json.Value <string>("PAYPOYALTIES")), GetChk(json.Value <string>("WEIGHTCHECK")), GetChk(json.Value <string>("ISWEIGHTCHECK")), json.Value <string>("DECLSTATUS") , json.Value <string>("INSPSTATUS"), json.Value <string>("DOCSERVICECODE") ); } else//修改 { ordercode = json.Value <string>("CODE"); /*sql = @"UPDATE LIST_ORDER * SET BUSITYPE='{1}',CUSNO='{2}',BUSIUNITCODE='{3}',BUSIUNITNAME='{4}',CONTRACTNO='{5}' * ,TOTALNO='{6}',DIVIDENO='{7}',TURNPRENO='{8}',GOODSNUM='{9}',ARRIVEDNO='{10}' * ,CLEARANCENO='{11}',LAWFLAG='{12}',ENTRUSTTYPE='{13}',REPWAYID='{14}',CUSTOMAREACODE='{15}' * ,REPUNITCODE='{16}',REPUNITNAME='{17}',DECLWAY='{18}',PORTCODE='{19}',INSPUNITCODE='{20}' * ,INSPUNITNAME='{21}' ,ORDERREQUEST='{22}',STATUS='{23}',SUBMITUSERID='{24}',SUBMITUSERNAME='******' * ,CUSTOMERCODE='{26}',CUSTOMERNAME='{27}',DECLCARNO='{28}',TRADEWAYCODES='{29}',SUBMITTIME={30} * ,GOODSGW='{31}',GOODSNW='{32}',PACKKIND='{33}',BUSIKIND='{34}',ORDERWAY='{35}' * ,CLEARUNIT='{36}',CLEARUNITNAME='{37}',SPECIALRELATIONSHIP='{38}',PRICEIMPACT='{39}',PAYPOYALTIES='{40}' * ,WEIGHTCHECK='{41}',ISWEIGHTCHECK='{42}',DOCSERVICECODE='{43}' * "; * * if (IsSubmitAfterSave == false)//提交之后保存,就不更新报关报检状态; * { * sql += @",DECLSTATUS='{44}',INSPSTATUS='{45}'"; * } * sql += @" WHERE CODE = '{0}'"; */ string allcol = @"CODE ,BUSITYPE,CUSNO,BUSIUNITCODE,BUSIUNITNAME,CONTRACTNO ,TOTALNO,DIVIDENO,TURNPRENO,GOODSNUM,ARRIVEDNO ,CLEARANCENO,LAWFLAG,ENTRUSTTYPE,REPWAYID,CUSTOMAREACODE ,REPUNITCODE,REPUNITNAME,DECLWAY,PORTCODE,INSPUNITCODE ,INSPUNITNAME,ORDERREQUEST,STATUS,SUBMITUSERID,SUBMITUSERNAME ,CUSTOMERCODE,CUSTOMERNAME,DECLCARNO,TRADEWAYCODES,SUBMITTIME ,GOODSGW,GOODSNW,PACKKIND,BUSIKIND,ORDERWAY ,CLEARUNIT,CLEARUNITNAME,SPECIALRELATIONSHIP,PRICEIMPACT,PAYPOYALTIES ,WEIGHTCHECK,ISWEIGHTCHECK,DOCSERVICECODE,DECLSTATUS,INSPSTATUS "; sql = Extension.getUpdateSql(allcol, ordercode, IsSubmitAfterSave); if (sql != "") { sql = string.Format(sql, ordercode , "10", json.Value <string>("CUSNO"), json.Value <string>("BUSIUNITCODE"), json.Value <string>("BUSIUNITNAME"), json.Value <string>("CONTRACTNO") , json.Value <string>("TOTALNO"), json.Value <string>("DIVIDENO"), json.Value <string>("TURNPRENO"), json.Value <string>("GOODSNUM"), json.Value <string>("ARRIVEDNO") , json.Value <string>("CLEARANCENO"), GetChk(json.Value <string>("LAWFLAG")), json.Value <string>("ENTRUSTTYPE"), json.Value <string>("REPWAYID"), json.Value <string>("CUSTOMAREACODE") , GetCode(json.Value <string>("REPUNITCODE")), GetName(json.Value <string>("REPUNITCODE")), json.Value <string>("DECLWAY"), json.Value <string>("PORTCODE"), GetCode(json.Value <string>("INSPUNITCODE")) , GetName(json.Value <string>("INSPUNITCODE")), json.Value <string>("ORDERREQUEST"), json.Value <string>("STATUS"), json.Value <string>("SUBMITUSERID"), json.Value <string>("SUBMITUSERNAME") , json_user.Value <string>("CUSTOMERCODE"), json_user.Value <string>("CUSTOMERNAME"), json.Value <string>("DECLCARNO"), json.Value <string>("TRADEWAYCODES"), json.Value <string>("SUBMITTIME") , json.Value <string>("GOODSGW"), json.Value <string>("GOODSNW"), json.Value <string>("PACKKIND"), "001", "1" , json_user.Value <string>("CUSTOMERCODE"), json_user.Value <string>("CUSTOMERNAME"), GetChk(json.Value <string>("SPECIALRELATIONSHIP")), GetChk(json.Value <string>("PRICEIMPACT")), GetChk(json.Value <string>("PAYPOYALTIES")) , GetChk(json.Value <string>("WEIGHTCHECK")), GetChk(json.Value <string>("ISWEIGHTCHECK")) , json.Value <string>("DOCSERVICECODE"), json.Value <string>("DECLSTATUS"), json.Value <string>("INSPSTATUS") ); } } if (sql != "") { int result = DBMgr.ExecuteNonQuery(sql); if (result == 1) { //集装箱及报关车号列表更新 Extension.predeclcontainer_update(ordercode, json.Value <string>("CONTAINERTRUCK")); //更新随附文件 Extension.Update_Attachment(ordercode, filedata, json.Value <string>("ORIGINALFILEIDS"), json_user); //插入订单状态变更日志 Extension.add_list_time(json.Value <Int32>("STATUS"), ordercode, json_user); if (json.Value <Int32>("STATUS") > 10) { Extension.Insert_FieldUpdate_History(ordercode, json, json_user, "10"); } return("{success:true,ordercode:'" + ordercode + "'}"); } else { return("{success:false}"); } } else { return("{success:false}"); } }
public static void ValidateResponseJsonRecordCickFromDevice(IRestResponse restResponse, string URL, int loop, string jSonRequest, string apiName) { //variable decleration var contentType = restResponse.ContentType.ToString(); var responseContent = restResponse.Content.ToString(); char[] splitCharacter = { ',' }; char[] splitCharacterColon = { ':' }; string[] splitValue = null; //verifying status code and other major responses from API specifically status code if (restResponse.StatusCode.ToString() != "OK") { if (restResponse.StatusCode.ToString() == "Forbidden") { Debug.WriteLine("Status code forbidden, internet connectivity not available" + URL + " please check your internet connection " + loop, jSonRequest); } if (restResponse.StatusCode.ToString() == "0") { Debug.WriteLine("Status code 0, the underlying connection was closed at " + URL + " " + loop); } if (restResponse.StatusCode.ToString() == "internal server error") { Debug.WriteLine("Body contains internal server error, hence" + URL + " API is failed, pleaes check your internet connection " + loop, jSonRequest); } else { Debug.WriteLine("Status code not OK," + URL + " API has failed at " + loop + " " + restResponse.StatusCode.ToString() + restResponse.Content.ToString(), jSonRequest); Extension.CreateLogFile(loop, jSonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } } string[] separatedKeyValues = responseContent.Split(splitCharacter); if (responseContent.Contains("\"Page not found\"")) { Debug.WriteLine("Body contains page not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jSonRequest); Extension.CreateLogFile(loop, jSonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (responseContent.Contains("\"appJson not found\"")) { Debug.WriteLine("Body contains json not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jSonRequest); Extension.CreateLogFile(loop, jSonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } if (separatedKeyValues[0].ToString().Equals("\"Invalid Request\"")) { Debug.WriteLine("Body contains json not found error, hence" + URL + " API is failed " + loop + responseContent.ToString(), jSonRequest); Extension.CreateLogFile(loop, jSonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } else { Extension.CreateLogFile(loop, jSonRequest, restResponse.Content.ToString(), restResponse.StatusCode.ToString(), apiName, URL); } //Starting key level validations for all key values separatedKeyValues = responseContent.Split(splitCharacter); foreach (var item in separatedKeyValues) { splitValue = item.Split(splitCharacterColon); //validating appid should not be null if (splitValue[0].ToString().Contains("\"Update\"")) { if (splitValue[1].ToString().Contains("Date and status updated App already instlled")) { Debug.WriteLine(URL + "Update Date and status updated App already instlled, API is successful."); } else { Debug.WriteLine("Appid value appearing as null," + URL + "api is failed", jSonRequest); } } if (splitValue[0].ToString().Contains("\"sessionToken\"")) { SessionToken.sessionToken = splitValue[1]; if (splitValue[1] == null) { Debug.WriteLine("sessionToken value appearing as null," + URL + "api is failed", jSonRequest); } } } }
public void SetUp() { Extension.EnableAll(); Log.UnsubscribeAllFromEntryPosted(); }
public async Task LoadExtensionAsync(StorageFolder extensionLocation, string libraryScript) { // Check if the manifest exists in the root location, if not, throw // an exception. var doesManifestExist = await extensionLocation.FileExistsAsync("manifest.yaml"); if (!doesManifestExist) { throw new ManifestInvalidException(InvalidManifestError.Missing); } // Temp class that we will deserialize into ExtensionManifest extensionManifest; try { // Load the manifest stream and deserialize the contents using var manifestStream = await extensionLocation.OpenStreamForReadAsync("manifest.yaml"); using var streamReader = new StreamReader(manifestStream); // Deserialize and set the manifest class var deserializer = new DeserializerBuilder() .WithNamingConvention(new CamelCaseNamingConvention()) .Build(); extensionManifest = deserializer.Deserialize <ExtensionManifest>(streamReader); } catch (Exception ex) { // An error occurred while reading the manifest, the manifest is invalid throw new ManifestInvalidException(InvalidManifestError.Invalid, ex); } // Where we will store the script once loaded from the file string script; // Check to see if the user has provided a script if (string.IsNullOrEmpty(extensionManifest.Script)) { throw new ManifestInvalidException(InvalidManifestError.MissingScript); } // Try load the source code file try { var sourceCodeFile = await extensionLocation.GetFileByPathAsync(extensionManifest.Script); using var sourceStream = await sourceCodeFile.OpenStreamForReadAsync(); using var streamReader = new StreamReader(sourceStream); script = await streamReader.ReadToEndAsync(); } catch (Exception ex) { // The script is missing or unreadable throw new ManifestInvalidException(InvalidManifestError.MissingScript, ex); } // Create the extension and validate the rest of the manifest file var extension = new Extension(extensionLocation, extensionManifest, true, script, libraryScript); // Add to list Extensions.Add(extension); }
public override void Import(EditorImporter importer, UnityEngine.Material material, GLTF.Schema.Material gltfMat, Extension extension) { if (material.HasProperty("unlit")) { material.SetInt("unlit", 1); } }
/// <summary> /// The run internal. /// </summary> /// <param name="args"> /// The args. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> private int RunInternal(string[] args) { CefRuntime.Load(); var configuration = Extension.GetConfiguration(); var ResourcesDir = Path.GetDirectoryName(new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath); var settings = new CefSettings { MultiThreadedMessageLoop = false, SingleProcess = false, LogSeverity = CefLogSeverity.Error, LogFile = this.HostConfig.LogFile, ResourcesDirPath = ResourcesDir, BackgroundColor = new CefColor(255, 32, 31, 41), LocalesDirPath = Path.Combine(ResourcesDir, "locales"), RemoteDebuggingPort = configuration.RemoteDebuggingPort, NoSandbox = true, Locale = this.HostConfig.Locale }; var argv = args; if (CefRuntime.Platform != CefRuntimePlatform.Windows) { argv = new string[args.Length + 1]; Array.Copy(args, 0, argv, 1, args.Length); argv[0] = "-"; } // Update configuration settings settings.Update(this.HostConfig.CustomSettings); var mainArgs = new CefMainArgs(argv); var app = new CefGlueApp(this.HostConfig); var exitCode = CefRuntime.ExecuteProcess(mainArgs, app, IntPtr.Zero); Log.Info(string.Format("CefRuntime.ExecuteProcess() returns {0}", exitCode)); if (exitCode != -1) { // An error has occured. return(exitCode); } // guard if something wrong foreach (var arg in args) { if (arg.StartsWith("--type=")) { return(-2); } } CefRuntime.Initialize(mainArgs, settings, app, IntPtr.Zero); this.RegisterSchemeHandlers(); this.RegisterMessageRouters(); this.PlatformInitialize(); this.MainView = this.CreateMainView(); this.PlatformRunMessageLoop(); this.MainView.Dispose(); this.MainView = null; CefRuntime.Shutdown(); this.PlatformShutdown(); return(0); }
/// <summary>Test if the given device can be extended to the requested extension.</summary> /// <param name="extension">The extension to which the device should be tested if it is extendable</param> /// <returns>Non-zero value iff the device can be extended to the given extension</returns> public bool Is(Extension extension) { object error; return(NativeMethods.rs2_is_device_extendable_to(Handle, extension, out error) != 0); }
/// <summary> /// Saves the model. /// </summary> /// <returns>Whether the action was successful or not</returns> public bool SaveAll(bool draft = true) { using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) { try { bool permalinkfirst = Post.IsNew; // Save permalink before the post if this is an insert if (permalinkfirst) { // Permalink if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name)) { Permalink.Name = Permalink.Generate(Post.Title); } Permalink.Save(tx); } // Post if (draft) { Post.Save(tx); } else { Post.SaveAndPublish(tx); } // Save permalink after the post if this is an update if (!permalinkfirst) { Permalink.Save(tx); } // Properties Properties.ForEach(p => { p.IsDraft = true; p.Save(tx); if (!draft) { if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0) { p.IsNew = true; } p.IsDraft = false; p.Save(tx); } }); // Save extensions foreach (var ext in Extensions) { ext.ParentId = Post.Id; ext.Save(tx); if (!draft) { if (Extension.GetScalar("SELECT COUNT(extension_id) FROM extension WHERE extension_id=@0 AND extension_draft=0", ext.Id) == 0) { ext.IsNew = true; } ext.IsDraft = false; ext.Save(tx); } } // Update categories Relation.DeleteByDataId(Post.Id, tx, true); List <Relation> relations = new List <Relation>(); PostCategories.ForEach(pc => relations.Add(new Relation() { DataId = Post.Id, RelatedId = pc, Type = Relation.RelationType.POSTCATEGORY }) ); relations.ForEach(r => r.Save(tx)); // Publish categories if (!draft) { Relation.DeleteByDataId(Post.Id, tx, false); relations.ForEach(r => { r.IsDraft = false; r.IsNew = true; }); relations.ForEach(r => r.Save(tx)); } tx.Commit(); } catch { tx.Rollback(); throw; } } return(true); }
/// <summary> /// 渲染单元格管道 /// </summary> /// <param name="target"></param> /// <param name="sheet"></param> /// <param name="expressonStr"></param> /// <param name="cellAddress"></param> /// <param name="cellFunc"></param> /// <param name="parameters"></param> /// <param name="dataVar"></param> /// <param name="invokeParams"></param> private bool RenderCellPipeline(Interpreter target, ExcelWorksheet sheet, ref string expressonStr, string cellAddress, Lambda cellFunc, Parameter[] parameters, string dataVar, object[] invokeParams) { if (!expressonStr.Contains("::")) { return(false); } //匹配所有的管道变量 var matches = _pipeLineVariableRegex.Matches(expressonStr); foreach (Match item in matches) { var typeKey = Regex.Split(item.Value, "::").First().TrimStart('{').ToLower(); //参数使用Url参数语法,不支持编码 //Demo: //{{Image::ImageUrl?Width=50&Height=120&Alt=404}} //处理特殊字段 //自定义渲染,以“::”作为切割。 //TODO:允许注入自定义管道逻辑 //支持: //图:{{Image::ImageUrl?Width=250&Height=70&Alt=404}} string body, expresson; switch (typeKey) { case "image": case "img": { body = Regex.Split(item.Value, "::").Last().TrimEnd('}'); var alt = string.Empty; var height = 0; var width = 0; if (body.Contains("?") && body.Contains("=")) { var arr = body.Split('?'); expresson = arr[0]; //从表达式提取Url参数语法内容 var values = GetNameVaulesFromQueryStringExpresson(arr[1]); //获取高度 var heightStr = values["h"] ?? values["height"]; if (!string.IsNullOrWhiteSpace(heightStr)) { height = int.Parse(heightStr); } //获取宽度 var widthStr = values["w"] ?? values["width"]; if (!string.IsNullOrWhiteSpace(widthStr)) { width = int.Parse(widthStr); } //获取alt文本 alt = values["alt"]; } else { expresson = body; } expresson = (dataVar + (IsDynamicSupportTypes ? ("[\"" + expresson + "\"]") : (expresson))).Trim('\"').Trim().Trim('+'); cellFunc = CreateOrGetCellFunc(target, cellFunc, expresson, parameters); //获取图片地址 var imageUrl = cellFunc.Invoke(invokeParams)?.ToString(); var cell = sheet.Cells[cellAddress]; if (imageUrl == null || (!File.Exists(imageUrl) && !imageUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))) { cell.Value = alt; } else { try { var bitmap = Extension.GetBitmapByUrl(imageUrl); if (bitmap == null) { cell.Value = alt; } else { if (height == default) { height = bitmap.Height; } if (width == default) { width = bitmap.Width; } cell.Value = string.Empty; var excelImage = sheet.Drawings.AddPicture(Guid.NewGuid().ToString(), bitmap); var address = new ExcelAddress(cell.Address); excelImage.SetPosition(address.Start.Row - 1, 0, address.Start.Column - 1, 0); excelImage.SetSize(width, height); } } catch (Exception) { cell.Value = alt; } } expressonStr = expressonStr.Replace(item.Value, string.Empty); } break; case "formula": body = Regex.Split(item.Value, "::").Last().TrimEnd('}'); if (body.Contains("?") && body.Contains("=")) { var arr = body.Split('?'); var @function = arr[0]; var @params = arr[1].Replace("params=", "").Replace("&", ","); var cell = sheet.Cells[cellAddress]; cell.Formula = $"={@function}({@params})"; expressonStr = expressonStr.Replace(item.Value, string.Empty); } break; default: break; } } return(true); }
public SqlExtensionParam AddParameter(string name, ISqlExpression expr) { return(Extension.AddParameter(name, expr)); }
public static ListedCapabilityStatement AddOAuthSecurityService(this ListedCapabilityStatement statement, string authority, IHttpClientFactory httpClientFactory, ILogger logger) { EnsureArg.IsNotNull(statement, nameof(statement)); EnsureArg.IsNotNull(authority, nameof(authority)); EnsureArg.IsNotNull(httpClientFactory, nameof(httpClientFactory)); var restComponent = statement.GetListedRestComponent(); var security = restComponent.Security ?? new CapabilityStatement.SecurityComponent(); security.Service.Add(Constants.RestfulSecurityServiceOAuth); var openIdConfigurationUrl = $"{authority}/.well-known/openid-configuration"; HttpResponseMessage openIdConfigurationResponse; using (var httpClient = httpClientFactory.CreateClient()) { try { openIdConfigurationResponse = httpClient.GetAsync(new Uri(openIdConfigurationUrl)).GetAwaiter().GetResult(); } catch (Exception ex) { logger.LogWarning(ex, $"There was an exception while attempting to read the OpenId Configuration from \"{openIdConfigurationUrl}\"."); throw new OpenIdConfigurationException(); } } if (openIdConfigurationResponse.IsSuccessStatusCode) { var openIdConfiguration = JObject.Parse(openIdConfigurationResponse.Content.ReadAsStringAsync().GetAwaiter().GetResult()); string tokenEndpoint, authorizationEndpoint; try { tokenEndpoint = openIdConfiguration["token_endpoint"].Value <string>(); authorizationEndpoint = openIdConfiguration["authorization_endpoint"].Value <string>(); } catch (Exception ex) { logger.LogWarning(ex, $"There was an exception while attempting to read the endpoints from \"{openIdConfigurationUrl}\"."); throw new OpenIdConfigurationException(); } var smartExtension = new Extension() { Url = Constants.SmartOAuthUriExtension, Extension = new List <Extension> { new Extension(Constants.SmartOAuthUriExtensionToken, new FhirUri(tokenEndpoint)), new Extension(Constants.SmartOAuthUriExtensionAuthorize, new FhirUri(authorizationEndpoint)), }, }; security.Extension.Add(smartExtension); } else { logger.LogWarning($"The OpenId Configuration request from \"{openIdConfigurationUrl}\" returned an {openIdConfigurationResponse.StatusCode} status code."); throw new OpenIdConfigurationException(); } restComponent.Security = security; return(statement); }
/// <summary> /// <Description>Bind the list view grid with the data from database.</Description> /// <Author>Pradeep</Author> /// <CreatedOn>8 Sept 2011</CreatedOn> /// </summary> /// <returns></returns> public override DataTable BindGrid() { string sessionId; int instanceId = 0; int pageNumber = 0; int pageSize = 0; string sortExpression = ""; int otherFilter = 0; int recordedByStaffId = 0; int assignedToStaffId = 0; int dispositions = 0; int inquieryStatus = 0; DateTime?inquiryFrom = null; DateTime?inquiryTo = null; string memberLatName = null; string memberFirstName = null; //using (SHS.UserBusinessServices.MemberInquiriesKalamazoo objectMemberInquiries = new SHS.UserBusinessServices.MemberInquiriesKalamazoo()) //{ DataSet dataSetInquries = null; sessionId = Session.SessionID; int.TryParse(ParentPageListObject.CurrentHistoryId, out instanceId); pageNumber = ParentPageListObject.CurrentPage; pageSize = ParentPageListObject.PageSize; sortExpression = ParentPageListObject.SortExpression; PeriodStartDate = GetFilterValue("InquiriesFrom", "01/01/1900"); PeriodEndDate = GetFilterValue("InquiriesTo", "12/31/9999"); if (Extension.IsDropDownHaveItems(DropDownList_AssignedToStaffId)) { int.TryParse(GetFilterValue("AssignedToStaffId", DropDownList_AssignedToStaffId.SelectedValue), out assignedToStaffId); } else { int.TryParse(GetFilterValue("AssignedToStaffId"), out assignedToStaffId); } if (Extension.IsDropDownHaveItems(DropDownList_RecordedByStaffId)) { int.TryParse(GetFilterValue("RecordedByStaffId", DropDownList_RecordedByStaffId.SelectedValue), out recordedByStaffId); } else { int.TryParse(GetFilterValue("RecordedByStaffId"), out recordedByStaffId); } if (Extension.IsDropDownHaveItems(DropDownList_Dispositions)) { int.TryParse(GetFilterValue("Dispositions", DropDownList_Dispositions.SelectedValue), out dispositions); } else { int.TryParse(GetFilterValue("Dispositions"), out dispositions); } if (Extension.IsDropDownHaveItems(DropDownList_InquiryStatus)) { int.TryParse(GetFilterValue("InquiryStatus", DropDownList_InquiryStatus.SelectedValue), out inquieryStatus); } else { int.TryParse(GetFilterValue("InquiryStatus"), out inquieryStatus); } if (Extension.IsDropDownHaveItems(DropDownList_CustomFilter)) { int.TryParse(GetFilterValue("CustomFilter", DropDownList_CustomFilter.SelectedValue), out otherFilter); } else { int.TryParse(GetFilterValue("CustomFilter"), out otherFilter); } if (GetFilterValue("InquiriesFrom") != null && GetFilterValue("InquiriesFrom") != "") { inquiryFrom = Convert.ToDateTime(GetFilterValue("InquiriesFrom")); } else { inquiryFrom = Convert.ToDateTime(GetFilterValue("InquiriesFrom", "01/01/1900")); } if (GetFilterValue("InquiriesTo") != null && GetFilterValue("InquiriesTo") != "") { inquiryTo = Convert.ToDateTime(GetFilterValue("InquiriesTo")); } else { inquiryTo = Convert.ToDateTime(GetFilterValue("InquiriesTo", "12/31/9999")); } if (GetFilterValue("MemberLatName") != "") { memberLatName = GetFilterValue("MemberLatName").ToString(); } if (GetFilterValue("MemberFirstName") != "") { memberFirstName = GetFilterValue("MemberFirstName").ToString(); } //dataSetInquries = objectMemberInquiries.GetInquriesList(sessionId,instanceId, pageNumber, pageSize, sortExpression, recordedByStaffId, assignedToStaffId, inquiryFrom, inquiryTo, memberLatName, memberFirstName, dispositions,inquieryStatus,otherFilter); dataSetInquries = GetInquriesList(instanceId, pageNumber, pageSize, sortExpression, recordedByStaffId, assignedToStaffId, inquiryFrom, inquiryTo, memberLatName, memberFirstName, dispositions, inquieryStatus, otherFilter); if (dataSetInquries.Tables.Count > 0) { if (dataSetInquries.Tables.Contains("CustomInquiries") == true) { //GridViewInquriesListRadGrid.SettingsPager.PageSize = pageSize; //Set the page size ListViewInquriesListRadGrid.DataSource = dataSetInquries.Tables["CustomInquiries"]; //Extension.SetDevXGridSortIcon(sortExpression, GridViewInquriesListRadGrid); ListViewInquriesListRadGrid.DataBind(); //GridViewInquriesListRadGrid.Settings.ShowVerticalScrollBar = true; } } return(dataSetInquries.Tables["TablePagingInformation"]); //} }
protected void Page_Load(object sender, EventArgs e) { string action = Request["action"]; string cusno = Request["CUSNO"] + ""; string approvalcode = Request["APPROVALCODE"] + ""; string inspectioncode = Request["INSPECTIONCODE"] + ""; string fenkey = Request["FENKEY"]; // fenkey = "declareall"; int totalProperty = 0; long totalProperty_fenkey = 0; string where = string.Empty; DataTable dt; string json = string.Empty; string json_fenkey = string.Empty; string sql = "select * from redis_inspectionall where 1=1"; IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式 iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; switch (action) { case "loadattach": if (!string.IsNullOrEmpty(cusno)) { where += " and CUSNO like '%" + cusno + "%'"; } if (!string.IsNullOrEmpty(approvalcode)) { where += " and APPROVALCODE like '%" + approvalcode + "%'"; } if (!string.IsNullOrEmpty(inspectioncode)) { where += " and INSPECTIONCODE like '%" + inspectioncode + "%'"; } if (!string.IsNullOrEmpty(fenkey)) { where += " and DIVIDEREDISKEY like '%" + fenkey + "%'"; } sql += where; sql = Extension.GetPageSql(sql, "ID", "desc", ref totalProperty, Convert.ToInt32(Request["start"]), Convert.ToInt32(Request["limit"])); dt = DBMgr.GetDataTable(sql); json = JsonConvert.SerializeObject(dt, iso); Response.Write("{rows:" + json + ",total:" + totalProperty + "}"); Response.End(); break; case "loadattach1": IDatabase db = SeRedis.redis.GetDatabase(); json_fenkey = "[]"; if (fenkey != string.Empty && db.KeyExists(fenkey)) { json_fenkey = ""; long start = Convert.ToInt64(Request["start"]); long end = Convert.ToInt64(Request["start"]) + Convert.ToInt64(Request["limit"]); if (cusno == string.Empty && approvalcode == string.Empty && inspectioncode == string.Empty) { RedisValue[] jsonlist = db.ListRange(fenkey, start, end - 1); totalProperty_fenkey = db.ListLength(fenkey); for (long i = 0; i < jsonlist.Length; i++) { json_fenkey += jsonlist[i]; if (i < jsonlist.Length - 1) { json_fenkey += ","; } } json_fenkey = "[" + json_fenkey + "]"; } else { long len = db.ListLength(fenkey); long tempi = 200; long i = 0; List <string> jsonlist_t = new List <string>(); for (; i < len; i = i + tempi) { if ((i + tempi) >= len) { tempi = (len - i); } RedisValue[] StatusList = db.ListRange(fenkey, i, i + (tempi - 1)); StatusList.Where <RedisValue>(st => { if (st.ToString().Contains(cusno) && st.ToString().Contains(approvalcode) && st.ToString().Contains(inspectioncode)) { jsonlist_t.Add(st.ToString()); return(true); } return(false); }).ToList <RedisValue>(); tempi = 200; } totalProperty_fenkey = (long)jsonlist_t.Count; if (totalProperty_fenkey < end) { end = totalProperty_fenkey; } for (long j = start; j < end; j++) { if (totalProperty_fenkey <= start) { break; } if (jsonlist_t[(int)j] != "") { json_fenkey += jsonlist_t[(int)j]; if (j < (end - 1)) { json_fenkey += ","; } } } json_fenkey = "[" + json_fenkey + "]"; } } Response.Write("{rows:" + json_fenkey + ",total:" + totalProperty_fenkey + "}"); Response.End(); break; //IDatabase db = SeRedis.redis.GetDatabase(); //if (fenkey != string.Empty && db.KeyExists(fenkey)) //{ // long start = Convert.ToInt64(Request["start"]); // long end = Convert.ToInt64(Request["start"]) + Convert.ToInt64(Request["limit"]); // RedisValue[] jsonlist = db.ListRange(fenkey, start, end - 1); // totalProperty_fenkey = db.ListLength(fenkey); // for (long i = 0; i < jsonlist.Length; i++) // { // json_fenkey += jsonlist[i]; // if (i < jsonlist.Length - 1) { json_fenkey += ","; } // } // json_fenkey = "[" + json_fenkey + "]"; //} //else //{ // json_fenkey = "[]"; //} //Response.Write("{rows:" + json_fenkey + ",total:" + totalProperty_fenkey + "}"); //Response.End(); //break; } }
public IEnumerable <WarehouseData> getWarehouseData(ParamWarehouse paramWarehouse) { IEnumerable <WarehouseData> result = null; using (IDbConnection connection = Extension.GetConnection(1)) { try { string paramKdRegion = null; if (!string.IsNullOrEmpty(paramWarehouse.kd_region) && paramWarehouse.kd_region != "string") { paramKdRegion = " AND T_STORAGE_CARGO_DETAIL.KD_REGION='" + paramWarehouse.kd_region + "'"; } string paramKdCabang = null; if (!string.IsNullOrEmpty(paramWarehouse.kd_cabang) && paramWarehouse.kd_cabang != "string") { paramKdCabang = " AND T_STORAGE_CARGO_DETAIL.KD_CABANG='" + paramWarehouse.kd_cabang + "'"; } string paramKdTerminal = null; if (!string.IsNullOrEmpty(paramWarehouse.kd_terminal) && paramWarehouse.kd_terminal != "string") { paramKdTerminal = " AND T_STORAGE_CARGO_DETAIL.KD_TERMINAL='" + paramWarehouse.kd_terminal + "'"; } string paramSearch = null; if (!string.IsNullOrEmpty(paramWarehouse.search_key) && paramWarehouse.search_key != "string" && paramWarehouse.is_searching == true) { paramSearch = " WHERE PELANGGAN LIKE '" + paramWarehouse.search_key + "%'"; } string paramSort = null; if (!string.IsNullOrEmpty(paramWarehouse.order_by_column) && paramWarehouse.order_by_column != "string" && !string.IsNullOrEmpty(paramWarehouse.order_by_sort) && paramWarehouse.order_by_sort != "string") { paramSort = " ORDER BY T_STORAGE_CARGO_DETAIL." + paramWarehouse.order_by_column + " " + paramWarehouse.order_by_sort; } string sql = "SELECT * FROM (" + "SELECT " + "DISTINCT(T_STORAGE_CARGO_DETAIL.PELANGGAN), " + "COUNT(T_STORAGE_CARGO_DETAIL.NAMA_BARANG) JUMLAH_BARANG, " + "T_STORAGE_CARGO_DETAIL.NAMA_VAK, " + "T_STORAGE_CARGO_DETAIL.KD_REGION, " + "T_STORAGE_CARGO_DETAIL.KD_TERMINAL, " + "T_STORAGE_CARGO_DETAIL.KD_CABANG, " + "APP_REGIONAL.REGIONAL_NAMA NAMA_REGIONAL " + "FROM T_STORAGE_CARGO_DETAIL JOIN APP_REGIONAL " + "ON T_STORAGE_CARGO_DETAIL.KD_REGION=APP_REGIONAL.ID " + "AND APP_REGIONAL.PARENT_ID IS NULL " + "AND APP_REGIONAL.ID NOT IN (12300000,20300001)" + paramKdRegion + paramKdCabang + paramKdTerminal + " GROUP BY PELANGGAN, KD_REGION, KD_CABANG, KD_TERMINAL, NAMA_VAK, REGIONAL_NAMA " + paramSort + ")" + paramSearch; result = connection.Query <WarehouseData>(sql); } catch (Exception) { result = null; } } return(result); }
/// <summary> /// Gets a single value enum option for this descriptor /// </summary> public T GetOption <T>(Extension <ServiceOptions, T> extension) { var value = Proto.Options.GetExtension(extension); return(value is IDeepCloneable <T>?(value as IDeepCloneable <T>).Clone() : value); }