public CashRepository() { this.Order = 301; this.Name = Titles.CreateCashRepositories; this.Category = Titles.FirstTasks; this.CategoryAlias = "first-tasks"; this.Description = Labels.CreateCashRepositoriesDescription; this.Icon = "payment icon"; this.NavigateUrl = "/Modules/BackOffice/CashRepositories.mix"; int count = this.CountRepositories(); if (count > 0) { this.Status = true; this.Message = string.Format(CultureManager.GetCurrent(), Labels.NCashRepositoriesInThisOffice, count); return; } this.Message = Labels.NoCashRepositoryDefnied; }
private void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { for (int i = 0; i < e.Row.Cells.Count; i++) { string cellText = e.Row.Cells[i].Text; string className = ConfigurationHelper.GetReportParameter("ResourceClassName"); string localized = ResourceManager.GetString(className, cellText); cellText = localized; e.Row.Cells[i].Text = cellText; } } if (e.Row.RowType == DataControlRowType.DataRow) { GridView grid = (GridView)sender; int arg = Conversion.TryCastInteger(grid.ID.Replace("GridView", "")); //Apply formatting on decimal fields if (string.IsNullOrWhiteSpace(this.decimalFieldIndicesCollection[arg])) { return; } string decimalFields = this.decimalFieldIndicesCollection[arg]; foreach (string fieldIndex in decimalFields.Split(',')) { int index = Conversion.TryCastInteger(fieldIndex); decimal value = Conversion.TryCastDecimal(e.Row.Cells[index].Text); e.Row.Cells[index].Text = string.Format(CultureManager.GetCurrent(), "{0:N}", value); e.Row.Cells[index].CssClass = "text right"; } } }
public Salesperson() { this.Order = 110; this.Name = Titles.CreateSalespersons; this.Category = Titles.FirstTasks; this.CategoryAlias = "first-tasks"; this.Description = Labels.CreateSalespersonsDescription; this.Icon = "users icon"; this.NavigateUrl = "/Modules/Sales/Setup/Salespersons.mix"; int count = this.CountParties(); if (count > 0) { this.Status = true; this.Message = string.Format(CultureManager.GetCurrent(), Labels.NSalespersonsFound, count); return; } this.Message = Labels.NoSalespersonFound; }
public static DataTable GetDataTable(NpgsqlCommand command, string connectionString) { try { if (command != null) { if (ValidateCommand(command)) { using (NpgsqlConnection connection = new NpgsqlConnection(connectionString)) { command.Connection = connection; using (NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(command)) { using (DataTable dataTable = new DataTable()) { dataTable.Locale = CultureManager.GetCurrent(); adapter.Fill(dataTable); return(dataTable); } } } } } return(null); } catch (NpgsqlException ex) { if (ex.Code.StartsWith("P")) { string errorMessage = GetDBErrorResource(ex); throw new MixERPException(errorMessage, ex); } throw; } }
public Frequency() { this.Order = 122; this.Name = Titles.CreateFrequencies; this.Category = Titles.FirstTasks; this.CategoryAlias = "first-tasks"; this.Description = Labels.CreateFrequenciesDescription; this.Icon = "circle notched icon"; this.NavigateUrl = "/Modules/BackOffice/Frequency.mix"; int count = this.CountFrequencySetups(); if (count % 12 == 0) { this.Status = true; this.Message = Labels.FrequencySetupIsComplete; return; } this.Message = string.Format(CultureManager.GetCurrent(), Labels.NOutOfNFrequenciesDefined, count); }
public VerificationPolicy() { this.Order = 10; this.Name = Titles.VoucherVerificationPolicy; this.Category = Titles.UserManagement; this.CategoryAlias = "user-management"; this.Description = Labels.VoucherVerificationPolicyDescription; this.Icon = "privacy icon"; this.NavigateUrl = "/Modules/BackOffice/Policy/VoucherVerification.mix"; int count = this.CountPolicy(); if (count > 0) { this.Message = string.Format(CultureManager.GetCurrent(), Labels.NotDefinedForNUsers, count); return; } this.Status = true; this.Message = Titles.OK; }
public User() { this.Order = 0; this.Name = Titles.AddNewUsers; this.Category = Titles.UserManagement; this.CategoryAlias = "user-management"; this.Description = Labels.AddNewUsersDescription; this.Icon = "user icon"; this.NavigateUrl = "/Modules/BackOffice/Users.mix"; int count = this.CountUsers(); if (count > 2) { this.Status = true; this.Message = string.Format(CultureManager.GetCurrent(), Labels.TotalUsersN, count); return; } this.Message = Labels.NoAdditionalUserFound; }
public IEnumerable <MigrationFile> Backup() { List <MigrationFile> migrationFiles = new List <MigrationFile>(); foreach (string file in files) { string filePath = PathHelper.Combine(path, file.Trim()); string contents = File.ReadAllText(filePath); MigrationFile migrationFile = new MigrationFile { FilePath = filePath, Contents = contents }; string message = string.Format(CultureManager.GetCurrent(), Labels.BackingUpForMigration, filePath); this.OnProgress(new ProgressInfo(this.Description, message)); migrationFiles.Add(migrationFile); } return(migrationFiles); }
private void AddMaxDateValidator() { if (this.MaxDate == null) { return; } this.maxDateCompareValidator = new CompareValidator(); this.maxDateCompareValidator.Display = ValidatorDisplay.Static; this.maxDateCompareValidator.ID = this.ID + "MaxDateCompareValidator"; this.maxDateCompareValidator.ControlToValidate = this.ID; this.maxDateCompareValidator.Type = ValidationDataType.Date; this.maxDateCompareValidator.Operator = ValidationCompareOperator.LessThan; this.maxDateCompareValidator.EnableClientScript = true; this.maxDateCompareValidator.CssClass = this.ValidatorCssClass; this.maxDateCompareValidator.SetFocusOnError = true; this.maxDateCompareValidator.ValueToCompare = this.MaxDate.ToString(); this.maxDateCompareValidator.ErrorMessage = string.Format(CultureManager.GetCurrent(), CommonResource.DateMustBeLessThan, this.MinDate); }
protected override void OnRowDataBound(GridViewRowEventArgs e) { if (e == null) { return; } foreach (TableCell cell in e.Row.Cells) { DataControlFieldCell dataControlField = cell as DataControlFieldCell; if (dataControlField != null) { AutoGeneratedField field = dataControlField.ContainingField as AutoGeneratedField; if (field != null) { field.HeaderStyle.CssClass = "text left"; switch (field.DataType.FullName) { case "System.String": field.HtmlEncode = this.htmlEncode; break; case "System.Decimal": case "System.Double": case "System.Single": cell.CssClass = "text right"; field.HeaderStyle.CssClass = "text right"; if (e.Row.RowType == DataControlRowType.DataRow) { decimal value = Conversion.TryCastDecimal(cell.Text); if (!value.Equals(0)) { CultureInfo culture = CultureManager.GetCurrent(); cell.Text = value.ToString("C", culture).Replace(culture.NumberFormat.CurrencySymbol, ""); } } break; case "System.DateTime": if (e.Row.RowType == DataControlRowType.DataRow) { DateTime date = Conversion.TryCastDate(cell.Text); if (date.Date == date) { cell.Text = Conversion.TryCastDate(cell.Text).ToString("D", CultureManager.GetCurrent()); } else { cell.Text = Conversion.TryCastDate(cell.Text).ToString("F", CultureManager.GetCurrent()); } } break; } } } } base.OnRowDataBound(e); }
public static DataTable GetTable(string catalog, string tableSchema, string tableName, string columnNames, string columnValuesLike, int limit, string orderBy) { if (columnNames == null) { columnNames = string.Empty; } if (columnValuesLike == null) { columnValuesLike = string.Empty; } var columns = columnNames.Split(','); var values = columnValuesLike.Split(','); if (!columns.Length.Equals(values.Length)) { return(null); } var counter = 0; var sql = "SELECT * FROM @TableSchema.@TableName "; foreach (var column in columns) { if (!string.IsNullOrWhiteSpace(column)) { if (counter.Equals(0)) { sql += " WHERE "; } else { sql += " AND "; } sql += " lower(" + DbFactory.Sanitizer.SanitizeIdentifierName(column.Trim()) + "::text) LIKE @" + DbFactory.Sanitizer.SanitizeIdentifierName(column.Trim()); counter++; } } sql += " ORDER BY @OrderBy ASC LIMIT @Limit;"; using (var command = new NpgsqlCommand()) { sql = sql.Replace("@TableSchema", DbFactory.Sanitizer.SanitizeIdentifierName(tableSchema)); sql = sql.Replace("@TableName", DbFactory.Sanitizer.SanitizeIdentifierName(tableName)); sql = sql.Replace("@OrderBy", DbFactory.Sanitizer.SanitizeIdentifierName(orderBy)); command.CommandText = sql; counter = 0; foreach (var column in columns) { if (!string.IsNullOrWhiteSpace(column)) { command.Parameters.AddWithValue("@" + DbFactory.Sanitizer.SanitizeIdentifierName(column.Trim()), "%" + values[counter].ToLower(CultureManager.GetCurrent()) + "%"); counter++; } } command.Parameters.AddWithValue("@Limit", limit); return(DbOperation.GetDataTable(catalog, command)); } }
public SignIn() { Challenge = Guid.NewGuid().ToString(); Culture = CultureManager.GetCurrent().Name; HttpContext.Current.Session["Challenge"] = Challenge; }
internal HtmlGenericControl GetPager() { if (this.PageSize.Equals(0)) { this.PageSize = this.BlockCount; } this.TotalPages = (int)Decimal.Ceiling(Decimal.Divide(this.TotalRecords, this.PageSize)); int start = 1 + (int)Decimal.Ceiling(Decimal.Divide(this.CurrentPage, this.BlockCount) - 1) * this.BlockCount; int end = start + this.BlockCount - 1; if (end > this.TotalPages) { end = this.TotalPages; } using (HtmlGenericControl paginationMenu = new HtmlGenericControl("div")) { paginationMenu.Attributes.Add("class", this.CssClass); paginationMenu.Controls.Add(this.FirstItem()); paginationMenu.Controls.Add(this.PreviousItem()); paginationMenu.Controls.Add(this.GetAnchor(1)); //The previous page block string title; if (start - this.BlockCount > 0) { using (HtmlAnchor anchor = this.GetIconAnchor("icon item", "", start - 1)) { title = string.Format(CultureManager.GetCurrent(), Titles.PageN, start - 1); anchor.Attributes.Add("title", title); anchor.InnerText = "..."; paginationMenu.Controls.Add(anchor); } } //Paged items for (int i = start; i <= end; i++) { //Do not create the first and last page //because we will create them explicitly //which will be followed/led //by next/previous page blocks if (i.Equals(1) || i.Equals(this.TotalPages)) { continue; } paginationMenu.Controls.Add(this.GetAnchor(i)); } //The next page block if (start + this.BlockCount < this.TotalPages) { using (HtmlAnchor anchor = this.GetIconAnchor("icon item", "", end + 1)) { title = string.Format(CultureManager.GetCurrent(), Titles.PageN, end + 1); anchor.Attributes.Add("title", title); anchor.InnerText = "..."; paginationMenu.Controls.Add(anchor); } } paginationMenu.Controls.Add(this.GetAnchor(this.TotalPages)); paginationMenu.Controls.Add(this.NextItem()); paginationMenu.Controls.Add(this.LastItem()); return(paginationMenu); } }
public long Save(DateTime valueDate, int storeId, string partyCode, int priceTypeId, int paymentTermId, string referenceNumber, string data, string statementReference, int salespersonId, int shipperId, string shippingAddressCode, decimal shippingCharge, int costCenterId, string transactionIds, string attachmentsJSON, bool nonTaxable) { try { Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId); Collection <long> tranIds = new Collection <long>(); Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON); if (!Stores.IsSalesAllowed(AppUsers.GetCurrentUserDB(), storeId)) { throw new InvalidOperationException("Sales is not allowed here."); } foreach (StockDetail model in details) { if (Items.IsStockItem(AppUsers.GetCurrentUserDB(), model.ItemCode)) { decimal available = Data.Helpers.Items.CountItemInStock(AppUsers.GetCurrentUserDB(), model.ItemCode, model.UnitName, model.StoreId); if (available < model.Quantity) { throw new InvalidOperationException(string.Format(CultureManager.GetCurrent(), Warnings.InsufficientStockWarning, available, model.UnitName, model.ItemCode)); } } } if (!string.IsNullOrWhiteSpace(transactionIds)) { foreach (string transactionId in transactionIds.Split(',')) { tranIds.Add(Common.Conversion.TryCastLong(transactionId)); } } int officeId = AppUsers.GetCurrent().View.OfficeId.ToInt(); int userId = AppUsers.GetCurrent().View.UserId.ToInt(); long loginId = AppUsers.GetCurrent().View.LoginId.ToLong(); long tranId = Data.Transactions.Delivery.Add(AppUsers.GetCurrentUserDB(), officeId, userId, loginId, valueDate, storeId, partyCode, priceTypeId, paymentTermId, details, shipperId, shippingAddressCode, shippingCharge, costCenterId, referenceNumber, salespersonId, statementReference, tranIds, attachments, nonTaxable); Verification status = TransactionGovernor.Verification.Status.GetVerificationStatus( AppUsers.GetCurrentUserDB(), tranId, false); if (status.VerificationStatusId > 0) { Notification.Delivery notification = new Notification.Delivery(); notification.Send(tranId); } return(tranId); } catch (Exception ex) { Log.Warning("Could not save sales delivery entry. {Exception}", ex); throw; } }
public SignIn() { Culture = CultureManager.GetCurrent().Name; }
internal static void AddListItems(ListControl control, string keys, string values, string selectedValues) { if (control == null) { return; } if (string.IsNullOrWhiteSpace(keys)) { return; } if (string.IsNullOrWhiteSpace(values)) { return; } char separator = ",".ToString(CultureManager.GetCurrent()).ToCharArray()[0]; string[] key = keys.Split(separator); string[] value = values.Split(','); if (key.Count() != value.Count()) { throw new InvalidOperationException(Errors.KeyValueMismatch); } for (int i = 0; i < key.Length; i++) { ListItem item = new ListItem(key[i].Trim(), value[i].Trim()); control.Items.Add(item); } foreach (ListItem item in control.Items) { if (control is CheckBoxList) { if (!string.IsNullOrWhiteSpace(selectedValues)) { foreach (string selectedValue in selectedValues.Split(',')) { if (item.Value.Trim().Equals(selectedValue.Trim())) { item.Selected = true; } } } } else { if (!string.IsNullOrWhiteSpace(selectedValues)) { if (item.Value.Trim().Equals(selectedValues.Split(',').Last().Trim())) { item.Selected = true; break; } } } } }
public static bool IsNumeric(string value) { double number; return(double.TryParse(value, NumberStyles.Any, CultureManager.GetCurrent(), out number)); }
public static List <object> Import <T>(string catalog, T poco, List <dynamic> entities, EntityView entityView, int userId) { string primaryKeyName = PocoHelper.GetKeyName(poco); string tableName = PocoHelper.GetTableName(poco); List <dynamic> items = new List <dynamic>(); List <object> result = new List <object>(); int line = 0; foreach (dynamic entity in entities) { if (entity == null) { continue; } ExpandoObject item = new ExpandoObject(); foreach (dynamic o in entity) { string key = o.Key; object value = o.Value; EntityColumn column = entityView.Columns.FirstOrDefault(c => c.ColumnName.Equals(key)); if (column != null) { bool isNullable = column.IsNullable || primaryKeyName.Equals(key); AddProperty(ref item, column.DataType, isNullable, key, value); } } if (((ICollection <KeyValuePair <string, object> >)item).Count > 1) { line++; if (((IDictionary <string, object>)item).ContainsKey("entered_by")) { ((IDictionary <string, object>)item)["entered_by"] = userId; } ((IDictionary <string, object>)item)["audit_user_id"] = userId; ((IDictionary <string, object>)item)["audit_ts"] = DateTime.UtcNow; items.Add(item); } } line = 0; try { using (Database db = new Database(Factory.GetConnectionString(catalog), Factory.ProviderName)) { using (Transaction transaction = db.GetTransaction()) { foreach (ExpandoObject item in items) { line++; object primaryKeyValue = ((IDictionary <string, object>)item)[primaryKeyName]; if (primaryKeyValue != null) { db.Update(tableName, primaryKeyName, item, primaryKeyValue); } else { primaryKeyValue = db.Insert(tableName, primaryKeyName, item); } result.Add(primaryKeyValue); } transaction.Complete(); } } } catch (NpgsqlException ex) { string errorMessage = string.Format(CultureManager.GetCurrent(), "Error on line {0}.", line); if (ex.Code.StartsWith("P")) { errorMessage += Factory.GetDBErrorResource(ex); throw new MixERPException(errorMessage, ex); } errorMessage += ex.Message; throw new MixERPException(errorMessage, ex); } catch (Exception ex) { string errorMessage = string.Format(CultureManager.GetCurrent(), "Error on line {0}.", line); throw new MixERPException(errorMessage, ex); } return(result); }
// ReSharper disable once UnusedParameter.Local private void Save(bool closeForm) { int userId = this.UserId; if (userId <= 0) { throw new InvalidOperationException(Errors.InvalidUserId); } Collection <KeyValuePair <string, object> > list = this.GetFormCollection(true); Collection <KeyValuePair <string, object> > customFields = this.GetCustomFieldCollection(); string id = this.GetSelectedValue(); this.lastValueHiddenTextBox.Text = id; if (string.IsNullOrWhiteSpace(id)) { try { if (this.DenyAdd) { throw new MixERPException(Titles.AccessIsDenied); } long lastValue = FormHelper.InsertRecord(this.Catalog, userId, this.TableSchema, this.Table, this.KeyColumn, list, this.imageColumn); FormHelper.SaveCustomFields(this.Catalog, this.TableSchema, this.Table, lastValue.ToString(CultureInfo.InvariantCulture), customFields); if (lastValue > 0) { if (this.RedirectToReturnUrl()) { return; } this.lastValueHiddenTextBox.Text = lastValue.ToString(CultureInfo.InvariantCulture); //Clear the form container. this.formContainer.Controls.Clear(); using (DataTable table = new DataTable()) { //Load the form again. this.LoadForm(this.formContainer, table); } //Refresh the grid. this.BindGridView(); this.DisplaySuccess(); } } catch (MixERPException ex) { this.DisplayError(ex); } } else { try { if (this.DenyEdit) { throw new MixERPException(Titles.AccessIsDenied); } string[] exclusion = { "" }; if (!string.IsNullOrWhiteSpace(this.ExcludeEdit)) { exclusion = this.ExcludeEdit.Split(',').Select(x => x.Trim().ToUpperInvariant()).ToArray(); } if (FormHelper.UpdateRecord(this.Catalog, userId, this.TableSchema, this.Table, list, this.KeyColumn, id, this.imageColumn, exclusion)) { FormHelper.SaveCustomFields(this.Catalog, this.TableSchema, this.Table, id.ToString(CultureInfo.InvariantCulture), customFields); if (this.RedirectToReturnUrl()) { return; } //Clear the form container. this.formContainer.Controls.Clear(); //Load the form again. using (DataTable table = new DataTable()) { table.Locale = CultureManager.GetCurrent(); this.LoadForm(this.formContainer, table); } //Refresh the grid. this.BindGridView(); this.DisplaySuccess(); } else { this.DisplayError(new MixERPException(Titles.UnknownError)); } } catch (MixERPException ex) { this.DisplayError(ex); } } }
private void RegisterJavascript() { string script = JSUtility.GetVar("culture", CultureManager.GetCurrent().Name); script += JSUtility.GetVar("language", CultureManager.GetCurrent().TwoLetterISOLanguageName); script += JSUtility.GetVar("jqueryUIi18nPath", this.Page.ResolveUrl("~/Scripts/jquery-ui/i18n")); script += JSUtility.GetVar("today", string.Format(CultureManager.GetCurrent(), CultureManager.GetCurrent().DateTimeFormat.ShortDatePattern, DateTime.Now)); script += JSUtility.GetVar("now", DateTime.Now.ToString(CultureManager.GetCurrent())); script += JSUtility.GetVar("date", DateTime.Now.ToString(CultureInfo.InvariantCulture)); script += JSUtility.GetVar("reportTemplatePath", PageUtility.ResolveUrl(DbConfig.GetScrudParameter(AppUsers.GetCurrentUserDB(), "TemplatePath"))); script += JSUtility.GetVar("reportExportTemplatePath", PageUtility.ResolveUrl(DbConfig.GetScrudParameter(AppUsers.GetCurrentUserDB(), "ExportTemplatePath"))); script += JSUtility.GetVar("reportHeaderPath", PageUtility.ResolveUrl(DbConfig.GetScrudParameter(AppUsers.GetCurrentUserDB(), "HeaderPath"))); script += JSUtility.GetVar("userId", AppUsers.GetCurrent().View.UserId); script += JSUtility.GetVar("user", AppUsers.GetCurrent().View.UserName); script += JSUtility.GetVar("officeCode", AppUsers.GetCurrent().View.OfficeCode); script += JSUtility.GetVar("office", AppUsers.GetCurrent().View.OfficeName); script += JSUtility.GetVar("applicationDates", JsonConvert.SerializeObject(DatePersister.GetFrequencyDates(AppUsers.GetCurrentUserDB(), AppUsers.GetCurrent().View.OfficeId.ToInt())), false); script += JSUtility.GetVar("metaView", JsonConvert.SerializeObject(AppUsers.GetCurrent().View), false); script += JSUtility.GetVar("overridePath", this.OverridePath); script += JSUtility.GetVar("shortDateFormat", CultureManager.GetShortDateFormat()); script += JSUtility.GetVar("longDateFormat", CultureManager.GetLongDateFormat()); script += JSUtility.GetVar("thousandSeparator", CultureManager.GetThousandSeparator()); script += JSUtility.GetVar("decimalSeparator", CultureManager.GetDecimalSeparator()); script += JSUtility.GetVar("currencyDecimalPlaces", CultureManager.GetCurrencyDecimalPlaces()); script += JSUtility.GetVar("currencySymbol", CultureManager.GetCurrencySymbol()); script += JSUtility.GetVar("today", DateTime.Now.ToShortDateString()); script += JSUtility.GetVar("shortDateFormat", CultureManager.GetShortDateFormat()); script += JSUtility.GetVar("thousandSeparator", CultureManager.GetThousandSeparator()); script += JSUtility.GetVar("decimalSeparator", CultureManager.GetDecimalSeparator()); script += JSUtility.GetVar("currencyDecimalPlaces", CultureManager.GetCurrencyDecimalPlaces()); script += JSUtility.GetVar("baseCurrencyCode", AppUsers.GetCurrent().View.CurrencyCode); script += JSUtility.GetVar("catalog", AppUsers.GetCurrentUserDB()); script += JSUtility.GetVar("update", this.Update()); script += JSUtility.GetVar("firstStepsPending", this.Context.Session["FirstStepsPending"]); script += JSUtility.GetVar("datepickerFormat", jQueryUI.GetDatePickerFormat()); script += JSUtility.GetVar("datepickerShowWeekNumber", jQueryUI.ShowWeekNumber()); script += JSUtility.GetVar("datepickerWeekStartDay", jQueryUI.GetWeekStartDay()); script += JSUtility.GetVar("datepickerNumberOfMonths", jQueryUI.GetNumberOfMonths()); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "MixERPMasterPage", script, true); }
private void RegisterJavascript() { string script = JSUtility.GetVar("culture", CultureManager.GetCurrent().Name); script += JSUtility.GetVar("language", CultureManager.GetCurrent().TwoLetterISOLanguageName); script += JSUtility.GetVar("jqueryUIi18nPath", this.Page.ResolveUrl("~/Scripts/jquery-ui/i18n/")); script += JSUtility.GetVar("today", string.Format(CultureManager.GetCurrent(), CultureManager.GetCurrent().DateTimeFormat.ShortDatePattern, DateTime.Now)); script += JSUtility.GetVar("now", DateTime.Now.ToString(CultureManager.GetCurrent())); script += JSUtility.GetVar("user", AppUsers.GetCurrent().View.UserName); script += JSUtility.GetVar("office", AppUsers.GetCurrent().View.OfficeName); script += JSUtility.GetVar("shortDateFormat", CultureManager.GetShortDateFormat()); script += JSUtility.GetVar("longDateFormat", CultureManager.GetLongDateFormat()); script += JSUtility.GetVar("thousandSeparator", CultureManager.GetThousandSeparator()); script += JSUtility.GetVar("decimalSeparator", CultureManager.GetDecimalSeparator()); script += JSUtility.GetVar("currencyDecimalPlaces", CultureManager.GetCurrencyDecimalPlaces()); script += JSUtility.GetVar("currencySymbol", CultureManager.GetCurrencySymbol()); script += JSUtility.GetVar("today", DateTime.Now.ToShortDateString()); script += JSUtility.GetVar("shortDateFormat", CultureManager.GetShortDateFormat()); script += JSUtility.GetVar("thousandSeparator", CultureManager.GetThousandSeparator()); script += JSUtility.GetVar("decimalSeparator", CultureManager.GetDecimalSeparator()); script += JSUtility.GetVar("currencyDecimalPlaces", CultureManager.GetCurrencyDecimalPlaces()); script += JSUtility.GetVar("baseCurrencyCode", AppUsers.GetCurrent().View.CurrencyCode); script += JSUtility.GetVar("catalog", AppUsers.GetCurrentUserDB()); script += JSUtility.GetVar("update", this.Update()); script += JSUtility.GetVar("firstStepsPending", this.Context.Session["FirstStepsPending"]); script += JSUtility.GetVar("datepickerFormat", jQueryUI.GetDatePickerFormat()); script += JSUtility.GetVar("datepickerShowWeekNumber", jQueryUI.ShowWeekNumber()); script += JSUtility.GetVar("datepickerWeekStartDay", jQueryUI.GetWeekStartDay()); script += JSUtility.GetVar("datepickerNumberOfMonths", jQueryUI.GetNumberOfMonths()); PageUtility.RegisterJavascript("MixERPMasterPage", script, this.Page, true); }
private void OnDownloadProgress(object sender, DownloadProgressChangedEventArgs e) { string message = string.Format(CultureManager.GetCurrent(), Labels.PercentCompleted, e.ProgressPercentage); this.OnProgress(new ProgressInfo(this.Description, message)); }
public static void AddFilters <T>(ref Sql sql, T poco, List <Filter> filters) { if (filters == null || filters.Count.Equals(0)) { return; } foreach (var filter in filters) { if (string.IsNullOrWhiteSpace(filter.ColumnName)) { if (!string.IsNullOrWhiteSpace(filter.PropertyName)) { filter.ColumnName = filter.PropertyName.ToUnderscoreCase(); } } string column = Sanitizer.SanitizeIdentifierName(filter.ColumnName); if (string.IsNullOrWhiteSpace(column)) { continue; } string statement = filter.FilterStatement; if (statement == null || statement.ToUpperInvariant() != "OR") { statement = "AND"; } statement += " "; switch ((FilterCondition)filter.FilterCondition) { case FilterCondition.IsEqualTo: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " = @0", filter.FilterValue); break; case FilterCondition.IsNotEqualTo: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " != @0", filter.FilterValue); break; case FilterCondition.IsLessThan: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " < @0", filter.FilterValue); break; case FilterCondition.IsLessThanEqualTo: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " <= @0", filter.FilterValue); break; case FilterCondition.IsGreaterThan: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " > @0", filter.FilterValue); break; case FilterCondition.IsGreaterThanEqualTo: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " >= @0", filter.FilterValue); break; case FilterCondition.IsBetween: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " BETWEEN @0 AND @1", filter.FilterValue, filter.FilterAndValue); break; case FilterCondition.IsNotBetween: sql.Append(statement + Sanitizer.SanitizeIdentifierName(column) + " NOT BETWEEN @0 AND @1", filter.FilterValue, filter.FilterAndValue); break; case FilterCondition.IsLike: sql.Append(statement + " lower(" + Sanitizer.SanitizeIdentifierName(column) + ") LIKE @0", "%" + filter.FilterValue.ToLower(CultureManager.GetCurrent()) + "%"); break; case FilterCondition.IsNotLike: sql.Append(statement + " lower(" + Sanitizer.SanitizeIdentifierName(column) + ") NOT LIKE @0", "%" + filter.FilterValue.ToLower(CultureManager.GetCurrent()) + "%"); break; } } }
internal static void AddDropDownList(HtmlTable htmlTable, string label, DropDownList dropDownList, HtmlAnchor itemSelectorAnchor, RequiredFieldValidator required) { if (htmlTable == null) { return; } if (dropDownList == null) { return; } using (HtmlTableCell labelCell = new HtmlTableCell()) { using (HtmlTableCell controlContainer = new HtmlTableCell()) { using (Literal labelLiteral = new Literal()) { labelLiteral.Text = string.Format(CultureManager.GetCurrent(), "<label for='{0}'>{1}</label>", dropDownList.ID, label); labelCell.Attributes.Add("class", "label-cell"); labelCell.Controls.Add(labelLiteral); controlContainer.Attributes.Add("class", "control-cell"); using (HtmlTable controlTable = new HtmlTable()) { using (HtmlTableRow row = new HtmlTableRow()) { using (HtmlTableCell controlCell = new HtmlTableCell()) { controlCell.Controls.Add(dropDownList); if (required != null) { controlCell.Controls.Add(required); } row.Cells.Add(controlCell); } using (HtmlTableCell itemSelectorCell = new HtmlTableCell()) { if (itemSelectorAnchor != null) { itemSelectorCell.Controls.Add(itemSelectorAnchor); itemSelectorCell.Style.Add("width", "24px"); } row.Cells.Add(itemSelectorCell); } controlTable.Style.Add("width", "100%"); controlTable.Style.Add("border-collapse", "collapse"); controlTable.Rows.Add(row); controlTable.Attributes.Add("role", "item-selector-table"); controlContainer.Controls.Add(controlTable); using (HtmlTableRow newRow = new HtmlTableRow()) { newRow.Cells.Add(labelCell); newRow.Cells.Add(controlContainer); htmlTable.Rows.Add(newRow); } } } } } } }