public string[] ColumnNames(string sheetName) { List <string> columns = new List <string>(); IWorksheet worksheet = Workbook.Worksheets[sheetName]; // GetDataTable is used to enforce unique column names //DataTable t = worksheet.UsedRange.GetDataTable(SpreadsheetGear.Data.GetDataFlags.None); int c0 = worksheet.UsedRange.Column; int cN = worksheet.UsedRange.ColumnCount + c0; IValues values = (IValues)worksheet; IRange range = worksheet.Cells; for (int i = c0; i < cN; i++) { // find column headers on first row. if (values[0, i] == null) { continue; } string name = values[0, i].Text; if (name != null) { if (columns.Contains(name)) { throw new DuplicateNameException("the column '" + name + "' exists more than once in the spreasheet."); } columns.Add(name); } } return(columns.ToArray()); }
public void Execute(IContext context) { Module module = ModuleUtilities.LoadModule(this.modname, context); IValues values = context; int nname = 0; foreach (var name in this.names) { string normname = name.Trim(); if (nname == this.names.Length - 1) { values.SetValue(normname, module); } else if (!values.HasValue(normname)) { var mod = new Module(context.GlobalContext); values.SetValue(normname, mod); values = mod; } else { values = (IValues)values.GetValue(normname); } nname++; } }
internal void UpdateCoeficients(string sheetName, double[] newCoeficients) { wbView.GetLock(); try { worksheet = (IWorksheet)workbook.Sheets[sheetName]; IValues values = (IValues)worksheet; for (int rowIndex = 0; rowIndex < worksheet.UsedRange.RowCount; rowIndex++) { if (values[rowIndex, 0].Text == "Coefficients") { for (int j = 0; j < newCoeficients.Length; j++) { values.SetNumber(rowIndex, j + 1, newCoeficients[j]); } break; } } //workbook.SaveAs(fileName, FileFormat.CSV); } finally { wbView.ReleaseLock(); } }
/// <summary> /// Initializes a new instance of the ContactsAppV2 class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public ContactsAppV2(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { this._contacts = new Contacts(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp0d23bc15bbfd4f84a69311ec9d8fa2bb.azurewebsites.net"); }
/// <summary> /// Initializes a new instance of the EngineDataAPI class. /// </summary> public EngineDataAPI() : base() { this._productCategories = new ProductCategories(this); this._values = new Values(this); this._baseUri = new Uri("http://engineapi.azurewebsites.net:80"); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.Arm = new Arm(this); this.TestTarget = new TestTarget(this); this.Values = new Values(this); this.BaseUri = new Uri("http://127.0.0.1:8182"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Initializes a new instance of the ContactWebAPI class. /// </summary> public ContactWebAPI() : base() { this._contacts = new Contacts(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp18c6bebb4a8041d1a7be786b277138ba.azurewebsites.net"); }
private ProjectionContext(IServiceLocator services, IValues <T> values, Lazy <IUrlRegistry> urls, Lazy <IDisplayFormatter> formatter) { _services = services; _values = values; _urls = urls; _formatter = formatter; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <string> GetByidAsync(this IValues operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByidWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes a new instance of the EngineDataAPI class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public EngineDataAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { this._productCategories = new ProductCategories(this); this._values = new Values(this); this._baseUri = new Uri("http://engineapi.azurewebsites.net:80"); }
static double CreateWorkbook(string filename, int rows, int cols) { IWorkbook workbook = Factory.GetWorkbook(); IWorksheet worksheet = workbook.Worksheets[0]; IValues values = (IValues)worksheet; double sum = 0.0; Random rand = new Random(); // Put labels in the first row. foreach (IRange cell in worksheet.Cells[0, 0, 0, cols - 1]) { cell.Value = "Cell-" + cell.Address; } // Using IRange and foreach be less code, // but we'll do it the fast way. for (int row = 1; row <= rows; row++) { for (int col = 0; col < cols; col++) { double number = rand.NextDouble(); sum += number; values.SetNumber(row, col, number); } } workbook.SaveAs(filename, FileFormat.Excel8); return(sum); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { User = new User(this); UserGroup = new UserGroup(this); Values = new Values(this); BaseUri = new System.Uri("http://usermanagement.web"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Initializes a new instance of the ContactsAppV2 class. /// </summary> public ContactsAppV2() : base() { this._contacts = new Contacts(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp0d23bc15bbfd4f84a69311ec9d8fa2bb.azurewebsites.net"); }
/// <summary> /// Retrieves the list of values /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <ValueObj> > GetAsync(this IValues operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public void ExecuteImportCommand() { ImportCommand importcmd = new ImportCommand("setvar"); Machine machine = new Machine(); importcmd.Execute(machine.Environment); object setvar = machine.Environment.GetValue("setvar"); Assert.IsNotNull(setvar); Assert.IsInstanceOfType(setvar, typeof(IValues)); IValues setvarenv = (IValues)setvar; object var = setvarenv.GetValue("a"); Assert.IsNotNull(var); Assert.AreEqual(1, var); object doc = setvarenv.GetValue("__doc__"); Assert.IsNotNull(doc); Assert.AreEqual("setvar module", doc); }
/// <summary> /// Initializes a new instance of the Pltkw3msApiShipping class. /// </summary> public Pltkw3msApiShipping() : base() { this._shipping = new Shipping(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp1068aac855d345fab80f472bc3ee8518.azurewebsites.net"); }
/// <summary> /// Initializes a new instance of the Pltkw3msApiShipping class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public Pltkw3msApiShipping(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { this._shipping = new Shipping(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp1068aac855d345fab80f472bc3ee8518.azurewebsites.net"); }
/// <summary> /// Initializes a new instance of the EngineApiClient class. /// </summary> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public EngineApiClient(params DelegatingHandler[] handlers) : base(handlers) { this._productCategories = new ProductCategories(this); this._values = new Values(this); this._baseUri = new Uri("https://engineapiclient.azurewebsites.net:443"); }
/// <summary> /// Initializes a new instance of the EngineApiClient class. /// </summary> public EngineApiClient() : base() { this._productCategories = new ProductCategories(this); this._values = new Values(this); this._baseUri = new Uri("https://engineapiclient.azurewebsites.net:443"); }
/// <summary> /// Initializes proxyClient properties. /// </summary> private void Initialize() { this.Values = new Values(this); this.BaseUri = new Uri("http://localhost:80/SwaggerWebApp"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Initializes a new instance of the ContactWebAPI class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public ContactWebAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { this._contacts = new Contacts(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp18c6bebb4a8041d1a7be786b277138ba.azurewebsites.net"); }
static double ReadWithSpreadsheetGear(string filename) { IWorkbook workbook = Factory.GetWorkbook(filename); IWorksheet worksheet = workbook.Worksheets[0]; IValues values = (IValues)worksheet; IRange usedRahge = worksheet.UsedRange; int rowCount = usedRahge.RowCount; int colCount = usedRahge.ColumnCount; double sum = 0.0; // We could use foreach (IRange cell in usedRange) for cleaner // code, but this is faster. for (int row = 1; row <= rowCount; row++) { for (int col = 0; col < colCount; col++) { IValue value = values[row, col]; if (value != null && value.Type == SpreadsheetGear.Advanced.Cells.ValueType.Number) { sum += value.Number; } } } return(sum); }
private static Boolean SearchForColumnNames(IWorksheet worksheet, string dateColumn, string valueColumn, string siteColumn, out int idxDate, out int idxValue, out int idxSiteName) { idxDate = -1; idxValue = -1; idxSiteName = -1; int c0 = worksheet.UsedRange.Column; int cN = worksheet.UsedRange.ColumnCount + c0; IValues values = (IValues)worksheet; for (int i = c0; i < cN; i++) { // find column headers on first row. if (values[0, i] != null) { string name = values[0, i].Text; if (String.Compare(dateColumn, name, true) == 0) { idxDate = i; } if (String.Compare(valueColumn, name, true) == 0) { idxValue = i; } if (string.Compare(siteColumn, name, true) == 0) { idxSiteName = i; } } } if (idxDate < 0) { idxDate = SpreadsheetGearSeries.ColumnIndexFromRef(dateColumn); } if (idxValue < 0) { idxValue = SpreadsheetGearSeries.ColumnIndexFromRef(valueColumn); } if (idxSiteName < 0) { idxSiteName = SpreadsheetGearSeries.ColumnIndexFromRef(siteColumn); } if (idxDate < 0) { Logger.WriteLine("Error: could not find column named '" + dateColumn + "'"); return(false); } if (idxValue < 0) { Logger.WriteLine("Error: could not find column named '" + valueColumn + "'"); return(false); } return(true); }
/// <param name='operations'> /// Reference to the ContactsConsoleApplication.IValues. /// </param> /// <param name='value'> /// Required. /// </param> public static object PostByValue(this IValues operations, string value) { return(Task.Factory.StartNew((object s) => { return ((IValues)s).PostByValueAsync(value); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <param name='operations'> /// Reference to the ContactsConsoleApplication.IValues. /// </param> /// <param name='id'> /// Required. /// </param> public static string GetById(this IValues operations, int id) { return(Task.Factory.StartNew((object s) => { return ((IValues)s).GetByIdAsync(id); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Initializes a new instance of the Pltkw3msApiPayment class. /// </summary> public Pltkw3msApiPayment() : base() { this._payment = new Payment(this); this._paymentStatus = new PaymentStatus(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp6c15607b882d4821888b71d1deb4d725.azurewebsites.net"); }
/// <summary> /// Stores a color setting. /// </summary> /// <param name="values"> /// The settings. /// </param> /// <param name="name"> /// The name of the setting. /// </param> /// <param name="color"> /// The color to be stored. /// </param> public static void SetColorSetting(this IValues <string> values, string name, Color32 color) { // convert to string var value = string.Format("{0} {1} {2} {3}", color.a, color.r, color.g, color.b); // store setting values.SetValue(name, value); }
/// <summary> /// Initializes a new instance of the Pltkw3msApiPayment class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The set of delegating handlers to insert in the http /// client pipeline. /// </param> public Pltkw3msApiPayment(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { this._payment = new Payment(this); this._paymentStatus = new PaymentStatus(this); this._values = new Values(this); this._baseUri = new Uri("https://microsoft-apiapp6c15607b882d4821888b71d1deb4d725.azurewebsites.net"); }
/// <summary> /// Sets value in spreadsheet, also updates underlying DataTable /// </summary> /// <param name="rowIndex"></param> /// <param name="columnIndex"></param> /// <param name="val"></param> public void SetCellValue(int rowIndex, int columnIndex, double val) { IValues values = (IValues)worksheet; m_dataTable.Rows[rowIndex][columnIndex] = val; values.SetNumber(rowIndex + 1, columnIndex, val); //worksheet.Select(); }
public ProjectionContext(IServiceLocator services, IValues <T> values) { _services = services; _values = values; _urls = new Lazy <IUrlRegistry>(() => services.GetInstance <IUrlRegistry>()); _formatter = new Lazy <IDisplayFormatter>(() => services.GetInstance <IDisplayFormatter>()); }
private static void SetDeviceLocation(string hubName, IValues values) { values.Devices.ForEach(device => device.HubName = hubName); }
public StaticProvider(IValues values) { _values = values; }