public static SingleColumn GetSingleColumn(dynamic _this, User UserObj, Eb_Solution SoluObj, object Value) { object _formattedData; string _displayMember; string padding = _this.DecimalPlaces > 0 ? ".".PadRight(_this.DecimalPlaces + 1, '0') : string.Empty; if (Value == null) { _formattedData = 0; _displayMember = "0" + padding; } else { if (double.TryParse(Convert.ToString(Value), out double _t)) _formattedData = _t; else throw new FormException($"Invalid numeric value found({_this.Name})", (int)HttpStatusCode.InternalServerError, $"Unable to parse '{Convert.ToString(Value)}' as numeric value for {_this.Name}", "From EbNumeric.GetSingleColumn()"); _displayMember = string.Format("{0:0" + padding + "}", _formattedData); } return new SingleColumn() { Name = _this.Name, Type = (int)_this.EbDbType, Value = _formattedData, Control = _this, ObjType = _this.ObjType, F = _displayMember }; }
public SearchRsltData(EbDataRow dr, Eb_Solution SolutionObj, User UserObj) { this.DisplayName = Convert.ToString(dr[1]); this.Data = JsonConvert.DeserializeObject <Dictionary <string, string> >(Convert.ToString(dr[2])); List <string> keys = this.Data.Keys.ToList(); foreach (string k in keys) { this.Data[k] = this.Data[k].Replace("\n", "<br>"); } int linkType = Convert.ToInt32(dr[9]); if (linkType == (int)SH_LinkType.LM) { this.Link = $"/leadmanagement/{Convert.ToString(dr[4])}"; } else { string param = JsonConvert.SerializeObject(new Param[] { new Param() { Name = "id", Type = "7", Value = Convert.ToString(dr[4]) } }).ToBase64(); this.Link = $"/WebForm/Index?_r={Convert.ToString(dr[3])}&_p={param}&_m=1"; } int createdBy = Convert.ToInt32(dr[5]); this.CreatedBy = SolutionObj.Users.ContainsKey(createdBy) ? SolutionObj.Users[createdBy] : "No Name"; this.CreatedAt = Convert.ToDateTime(dr[6]).ConvertFromUtc(UserObj.Preference.TimeZone).ToString(UserObj.Preference.GetShortDatePattern() + " " + UserObj.Preference.GetShortTimePattern(), CultureInfo.InvariantCulture); int modifiedBy = Convert.ToInt32(dr[7]); this.ModifiedBy = SolutionObj.Users.ContainsKey(modifiedBy) ? SolutionObj.Users[modifiedBy] : "No Name"; this.ModifiedAt = Convert.ToDateTime(dr[8]).ConvertFromUtc(UserObj.Preference.TimeZone).ToString(UserObj.Preference.GetShortDatePattern() + " " + UserObj.Preference.GetShortTimePattern(), CultureInfo.InvariantCulture); }
private async Task SetSolutionObject(Eb_Solution solution) { if (solution == null) { return; } try { this.CurrentSolution.SolutionObject = solution; List <SolutionInfo> allSolutions = Utils.Solutions; SolutionInfo current = allSolutions.Find(x => x.SolutionName == CurrentSolution.SolutionName && x.RootUrl == CurrentSolution.RootUrl); if (current != null) { current.SolutionObject = solution; await Store.SetJSONAsync(AppConst.MYSOLUTIONS, allSolutions); await Store.SetJSONAsync(AppConst.SOLUTION_OBJ, current); } } catch (Exception ex) { EbLog.Error("failed to set solution object, " + ex.Message); } }
public override SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { return(new SingleColumn() { Name = this.Name, Type = (int)this.EbDbType, Value = "[]", Control = this, ObjType = this.ObjType, F = string.Empty }); }
public override SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { if (Value != null && int.TryParse(Convert.ToString(Value), out int _t)) { Value = _t; } return(new SingleColumn() { Name = this.Name, Type = (int)this.EbDbType, Value = Value == null ? 0 : Value, Control = this, ObjType = this.ObjType, F = "{}" }); }
public void InitFromDataBase(User _user, Eb_Solution _sol, string ParentRefid) { string _html = string.Empty; try { if (_sol?.Locations == null) { Console.WriteLine("Solution/Locations is null"); throw new Exception("Solution/Locations is null"); } List <int> locList = (ParentRefid == null) ? new List <int> { -1 } : _user.GetLocationsByObject(ParentRefid); List <KeyValuePair <int, string> > pairs = new List <KeyValuePair <int, string> >(); if (locList.Contains(-1)) { this.IsGlobalLocAvail = true; foreach (KeyValuePair <int, EbLocation> item in _sol.Locations) { pairs.Add(new KeyValuePair <int, string>(item.Value.LocId, item.Value.ShortName)); } } else { foreach (int loc in locList) { pairs.Add(new KeyValuePair <int, string>(_sol.Locations[loc].LocId, _sol.Locations[loc].ShortName)); } } pairs.Sort((pair1, pair2) => pair1.Value.CompareTo(pair2.Value)); foreach (KeyValuePair <int, string> item in pairs) { _html += $"<option value='{item.Key}'>{item.Value}</option>"; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } this.OptionHtml = _html; }
//--------Hide in property grid------------end public override SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { object _formattedData = Value; string _displayMember = string.Empty; if (Value == null && this.LoadCurrentUser) { _formattedData = UserObj.UserId.ToString(); } return(new SingleColumn() { Name = this.Name, Type = (int)this.EbDbType, Value = _formattedData, Control = this, ObjType = this.ObjType, F = _displayMember }); }
//public override string GetToolHtml() //{ // return @"<div eb-type='@toolName' class='tool'><i class='fa fa-user'></i><i class='fa fa-map-marker'></i> @toolName</div>".Replace("@toolName", this.GetType().Name.Substring(2)); //} public void InitFromDataBase(JsonServiceClient ServiceClient, User _user, Eb_Solution _sol, string ParentRefid) { try { List <int> locations = (ParentRefid == null) ? new List <int> { -1 } : _user.GetLocationsByObject(ParentRefid); if (locations.Contains(-1)) { Console.WriteLine("Location: Only -1 " + locations.ToString()); if (_sol == null) { Console.WriteLine("Solution null"); throw new Exception("Solution null"); } else { foreach (var key in _sol.Locations) { this.LocData.Add(new LocTreeData { id = key.Value.LocId, pid = key.Value.ParentId, name = key.Value.LongName }); } } } else { Console.WriteLine("===========ObjectId: " + ParentRefid + "Locations: "); foreach (int loc in locations) { this.LocData.Add(new LocTreeData { id = _sol.Locations[loc].LocId, pid = _sol.Locations[loc].ParentId, name = _sol.Locations[loc].LongName }); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static SingleColumn GetSingleColumn(EbControl _this, User UserObj, Eb_Solution SoluObj, object Value) { object _formattedData = Value; string _displayMember = Value == null ? string.Empty : Value.ToString(); if (_this.EbDbType == EbDbTypes.Decimal || _this.EbDbType == EbDbTypes.Int32) { if (Value == null) { _formattedData = 0; _displayMember = "0"; } else { _displayMember = Convert.ToString(Value); if (double.TryParse(_displayMember, out double _t)) { _formattedData = _t; } else { throw new Exception($"Invalid numeric value({_displayMember}) for '{_this.Name}'"); } } } else if (_this.EbDbType == EbDbTypes.String && _formattedData != null) { _formattedData = Convert.ToString(_formattedData); } return(new SingleColumn() { Name = _this.Name, Type = (int)_this.EbDbType, Value = _formattedData, Control = _this, ObjType = _this.ObjType, F = _displayMember }); }
public Eb_Solution GetSolutionObject(string cid) { Eb_Solution s_obj = null; try { s_obj = this.Redis.Get <Eb_Solution>(String.Format("solution_{0}", cid)); if (s_obj == null) { Gateway.Send <UpdateSolutionObjectResponse>(new UpdateSolutionObjectRequest() { SolnId = cid }); s_obj = this.Redis.Get <Eb_Solution>(String.Format("solution_{0}", cid)); } } catch (Exception e) { Console.WriteLine(e.Message + e.StackTrace); } return(s_obj); }
public void SendWelcomeMail(RabbitMqProducer MessageProducer3, User user, Eb_Solution solution) { string Html = this.MailHtml .Replace("{SolutionName}", solution.SolutionName) .Replace("{eSolutionId}", solution.ExtSolutionID) .Replace("{iSolutionId}", solution.SolutionID) .Replace("{UserName}", this.UserCredentials.Name) .Replace("{Email}", this.UserCredentials.Email) .Replace("{Password}", this.UserCredentials.Pwd) .Replace("{SolutionAdmin}", string.IsNullOrEmpty(user.FullName) ? $"{solution.SolutionName} Team" : user.FullName); //this.EbConnectionFactory.EmailConnection.Send("*****@*****.**", "test", "Hiii", null, null, null, ""); MessageProducer3.Publish(new EmailServicesRequest() { To = this.UserCredentials.Email, Message = Html, Subject = $"Welcome to {solution.SolutionName} Solution", UserId = user.UserId, UserAuthId = user.AuthId, SolnId = solution.SolutionID }); }
public static string GetSearchResults(IDatabase DataDB, Eb_Solution SolutionObj, User UserObj, string searchTxt) { List <SearchRsltData> _data = new List <SearchRsltData>(); string Qry = @"SELECT COUNT(*) FROM eb_index_table eit WHERE COALESCE(eit.eb_del, 'F') = 'F' AND (SELECT COUNT(*) from json_each_text(eit.data_json :: JSON) WHERE LOWER(value) like '%' || @searchTxt || '%') > 0; SELECT eit.id, eit.display_name, eit.data_json, eit.ref_id, eit.data_id, eit.created_by, eit.created_at, eit.modified_by, eit.modified_at, eit.link_type FROM eb_index_table eit WHERE COALESCE(eit.eb_del, 'F') = 'F' AND (SELECT COUNT(*) from json_each_text(eit.data_json :: JSON) WHERE LOWER(value) like '%' || @searchTxt || '%') > 0 ORDER BY eit.modified_at DESC LIMIT 100; "; EbDataSet ds = DataDB.DoQueries(Qry, new DbParameter[] { DataDB.GetNewParameter("searchTxt", EbDbTypes.String, string.IsNullOrEmpty(searchTxt) ? "" : searchTxt.ToLower()) }); int rowCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]); foreach (EbDataRow dr in ds.Tables[1].Rows) { _data.Add(new SearchRsltData(dr, SolutionObj, UserObj)); } return(JsonConvert.SerializeObject(new SearchResponse() { Data = _data, RowCount = rowCount })); }
public override SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { object _formattedData = null; string _displayMember = string.Empty; if (Value != null) { _formattedData = Value; if (!this.IsDynamic && !this.MultiSelect) { _displayMember = this.Options.Find(e => e.Value == Convert.ToString(Value))?.DisplayName ?? string.Empty; } } return(new SingleColumn() { Name = this.Name, Type = (int)this.EbDbType, Value = _formattedData, Control = this, ObjType = this.ObjType, F = _displayMember }); }
private void InitDatabases() { Console.WriteLine("Initialising Connections"); // the code that you want to measure comes here if (this.Redis != null) { Eb_Solution s_obj = this.Redis.Get <Eb_Solution>(String.Format("solution_{0}", this.SolutionId)); if (s_obj != null) { this.SolutionType = s_obj.SolutionType; this.RouterSolution = s_obj.PrimarySolution; } } if (this.Connections != null) { string _userName = string.Empty; string _passWord = string.Empty; // DATA DB if (Connections.DataDbConfig != null) { _userName = Connections.DataDbConfig.UserName; _passWord = Connections.DataDbConfig.Password; if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { DataDB = new PGSQLDatabase(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { DataDB = new OracleDB(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { DataDB = new MySqlDB(Connections.DataDbConfig); } DataDB.ConId = Connections.DataDbConfig.Id; // DATA DB RO if (!(string.IsNullOrEmpty(Connections.DataDbConfig.ReadOnlyUserName) || string.IsNullOrEmpty(Connections.DataDbConfig.ReadOnlyPassword))) { Connections.DataDbConfig.UserName = Connections.DataDbConfig.ReadOnlyUserName; Connections.DataDbConfig.Password = Connections.DataDbConfig.ReadOnlyPassword; if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { DataDBRO = new PGSQLDatabase(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { DataDBRO = new OracleDB(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { DataDBRO = new MySqlDB(Connections.DataDbConfig); } } else if (DataDBRO == null) { DataDBRO = DataDB; } // DATA DB RW if (!(string.IsNullOrEmpty(Connections.DataDbConfig.ReadWriteUserName) || string.IsNullOrEmpty(Connections.DataDbConfig.ReadWritePassword))) { Connections.DataDbConfig.UserName = Connections.DataDbConfig.ReadWriteUserName; Connections.DataDbConfig.Password = Connections.DataDbConfig.ReadWritePassword; if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { DataDBRW = new PGSQLDatabase(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { DataDBRW = new OracleDB(Connections.DataDbConfig); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { DataDBRW = new MySqlDB(Connections.DataDbConfig); } } else if (DataDBRW == null) { DataDBRW = DataDB; } if (Connections.ObjectsDbConfig == null) { Connections.DataDbConfig.UserName = _userName; Connections.DataDbConfig.Password = _passWord; Connections.ObjectsDbConfig = Connections.DataDbConfig; } } else { throw new Exception("No Data DB Integrated!"); } //Supporting DataDB if (Connections.SupportingDataDbConfig != null && Connections.SupportingDataDbConfig.Count > 0) { if (SupportingDataDB == null) { SupportingDataDB = new Dictionary <int, IDatabase>(); } for (int i = 0; i < Connections.SupportingDataDbConfig.Count; i++) { if (Connections.SupportingDataDbConfig[i].DatabaseVendor == DatabaseVendors.PGSQL) { SupportingDataDB.Add(Connections.SupportingDataDbConfig[i].Id, new PGSQLDatabase(Connections.SupportingDataDbConfig[i])); } else if (Connections.SupportingDataDbConfig[i].DatabaseVendor == DatabaseVendors.ORACLE) { SupportingDataDB.Add(Connections.SupportingDataDbConfig[i].Id, new OracleDB(Connections.SupportingDataDbConfig[i])); } else if (Connections.SupportingDataDbConfig[i].DatabaseVendor == DatabaseVendors.MYSQL) { SupportingDataDB.Add(Connections.SupportingDataDbConfig[i].Id, new MySqlDB(Connections.SupportingDataDbConfig[i])); } else if (Connections.SupportingDataDbConfig[i].DatabaseVendor == DatabaseVendors.MSSQL) { SupportingDataDB.Add(Connections.SupportingDataDbConfig[i].Id, new MSSQLDatabase(Connections.SupportingDataDbConfig[i])); } } } //OBJECTS DB if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { ObjectsDB = new PGSQLDatabase(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { ObjectsDB = new OracleDB(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { ObjectsDB = new MySqlDB(Connections.ObjectsDbConfig); } // OBJECTS DB RO if (!(string.IsNullOrEmpty(Connections.ObjectsDbConfig.ReadOnlyUserName) || string.IsNullOrEmpty(Connections.ObjectsDbConfig.ReadOnlyPassword))) { Connections.ObjectsDbConfig.UserName = Connections.ObjectsDbConfig.ReadOnlyUserName; Connections.ObjectsDbConfig.Password = Connections.ObjectsDbConfig.ReadOnlyPassword; if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { ObjectsDBRO = new PGSQLDatabase(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { ObjectsDBRO = new OracleDB(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { ObjectsDBRO = new MySqlDB(Connections.ObjectsDbConfig); } } else if (ObjectsDBRO == null) { ObjectsDBRO = ObjectsDB; } // OBJECTS DB RW if (!(string.IsNullOrEmpty(Connections.ObjectsDbConfig.ReadWriteUserName) || string.IsNullOrEmpty(Connections.ObjectsDbConfig.ReadWritePassword))) { Connections.ObjectsDbConfig.UserName = Connections.ObjectsDbConfig.ReadWriteUserName; Connections.ObjectsDbConfig.Password = Connections.ObjectsDbConfig.ReadWritePassword; if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { ObjectsDBRW = new PGSQLDatabase(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { ObjectsDBRW = new OracleDB(Connections.ObjectsDbConfig); } else if (Connections.ObjectsDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { ObjectsDBRW = new MySqlDB(Connections.ObjectsDbConfig); } } else if (ObjectsDBRW == null) { ObjectsDBRW = ObjectsDB; } // LOGS DB LogsDB = new PGSQLDatabase(EbConnectionsConfigProvider.InfraConnections.LogsDbConfig); //Files DB FilesDB = new FilesCollection(); bool IsDefaultConIdCorrect = false; if (Connections.FilesDbConfig == null) { Connections.FilesDbConfig = new FilesConfigCollection(); } if (Connections.FilesDbConfig.Integrations.Count == 0) { Connections.DataDbConfig.UserName = _userName; Connections.DataDbConfig.Password = _passWord; if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.PGSQL) { FilesDB.Add(new PGSQLFileDatabase(Connections.DataDbConfig)); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.ORACLE) { FilesDB.Add(new OracleFilesDB(Connections.DataDbConfig)); } else if (Connections.DataDbConfig.DatabaseVendor == DatabaseVendors.MYSQL) { FilesDB.Add(new MySQLFilesDB(Connections.DataDbConfig)); } FilesDB.DefaultConId = Connections.DataDbConfig.Id; Console.WriteLine("No files Db. set :" + Connections.DataDbConfig.DatabaseName); } else { for (int i = 0; i < Connections.FilesDbConfig.Integrations.Count; i++) { if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.MongoDB) { FilesDB.Add(new MongoDBDatabase(this.SolutionId, Connections.FilesDbConfig.Integrations[i] as EbMongoConfig)); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.DropBox) { FilesDB.Add(new DropBox.DropBoxDatabase(Connections.FilesDbConfig.Integrations[i] as EbDropBoxConfig)); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.AWSS3) { FilesDB.Add(new AWSS3.AWSS3(Connections.FilesDbConfig.Integrations[i] as EbAWSS3Config)); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.GoogleDrive) { FilesDB.Add(new GoogleDrive.GoogleDriveDatabase(Connections.FilesDbConfig.Integrations[i] as EbGoogleDriveConfig)); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.PGSQL) { FilesDB.Add(new PGSQLFileDatabase(Connections.FilesDbConfig.Integrations[i] as PostgresConfig)); Console.WriteLine("Postgres Files Db found:" + (Connections.FilesDbConfig.Integrations[i] as PostgresConfig).DatabaseName); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.ORACLE) { FilesDB.Add(new OracleFilesDB(Connections.FilesDbConfig.Integrations[i] as OracleConfig)); } else if (Connections.FilesDbConfig.Integrations[i].Type == EbIntegrations.MYSQL) { FilesDB.Add(new MySQLFilesDB(Connections.FilesDbConfig.Integrations[i] as MySqlConfig)); } if (Connections.FilesDbConfig.DefaultConId == Connections.FilesDbConfig.Integrations[i].Id) { IsDefaultConIdCorrect = true; } Console.WriteLine("Files Db. set :" + Connections.FilesDbConfig.Integrations[i].Type + Connections.FilesDbConfig.Integrations[i].NickName); } if (IsDefaultConIdCorrect) { FilesDB.DefaultConId = Connections.FilesDbConfig.DefaultConId; } else { throw new Exception("DefaultConId doesn't found in the files-config list..!!"); } } Console.WriteLine("Files DB Collection Count(Init DB) : " + FilesDB.Count); ChatConnection = new ChatConCollection(); //if (Connections.ChatConfigs == null) // Connections.ChatConfigs = new ChatConfigCollection(); if (Connections.ChatConfigs != null) { ChatConnection.Default = new EbSlack(Connections.ChatConfigs.Default as EbSlackConfig); for (int i = 0; i < Connections.ChatConfigs.Fallback.Count; i++) { if (Connections.ChatConfigs.Fallback[i].Type == EbIntegrations.Slack) { ChatConnection.Add(new EbSlack(Connections.ChatConfigs.Fallback[i] as EbSlackConfig)); } if (Connections.ChatConfigs.Default.Id == Connections.ChatConfigs.Fallback[i].Id) { IsDefaultConIdCorrect = true; } } if (IsDefaultConIdCorrect) { ChatConnection.Default = new EbSlack(Connections.ChatConfigs.Default as EbSlackConfig); } else { throw new Exception("DefaultConId doesn't found in the files-config list..!!"); } } Console.WriteLine("Chat connection Collection Count(Init DB) : " + ChatConnection.Count); //EmailConfigs if (Connections.EmailConfigs != null) { EmailConnection = new EbMailConCollection(Connections.EmailConfigs); EmailRetrieveConnection = new EBMailRetrieveConCollection(Connections.EmailConfigs); } else if (this.SolutionType == SolutionType.REPLICA && MasterConnections != null && MasterConnections.EmailConfigs != null) { EmailConnection = new EbMailConCollection(MasterConnections.EmailConfigs); } //SmsConfigs if (Connections.SMSConfigs != null) { SMSConnection = new EbSmsConCollection(Connections.SMSConfigs); } else if (this.SolutionType == SolutionType.REPLICA && MasterConnections != null && MasterConnections.SMSConfigs != null) { SMSConnection = new EbSmsConCollection(MasterConnections.SMSConfigs); } //if (Connections.ChatConfigs != null) //{ // ChatConnection = new ChatCollection(Connections.ChatConfigs); //} if (Connections.CloudinaryConfigs != null && Connections.CloudinaryConfigs.Count > 0) { if (ImageManipulate == null) { ImageManipulate = new List <IImageManipulate>(); } for (int i = 0; i < Connections.CloudinaryConfigs.Count; i++) { ImageManipulate.Add(new EbCloudinary(Connections.CloudinaryConfigs[i])); } } if (Connections.MapConfigs != null && Connections.MapConfigs.Integrations.Count > 0) { MapConnection = new EbMapConCollection(); for (int i = 0; i < Connections.MapConfigs.Integrations.Count; i++) { if (Connections.MapConfigs.Integrations[i].Type == EbIntegrations.GoogleMap) { MapConnection.Add(new EbGoogleMap(Connections.MapConfigs.Integrations[i])); } } MapConnection.DefaultConId = Connections.MapConfigs.DefaultConId; } if (Connections.MobileConfig != null) { MobileAppConnection = new MobileAppConnection(Connections.MobileConfig); } else if (this.SolutionType == SolutionType.REPLICA && MasterConnections != null && MasterConnections.MobileConfig != null) { MobileAppConnection = new MobileAppConnection(MasterConnections.MobileConfig); } //if (Connections.FTPConnection != null) // FTP = new EbFTP(Connections.FTPConnection); } else { throw new Exception("Fatal Error :: Connection is null or Empty! . Solnname = " + SolutionId); } Console.WriteLine("Connections Initialised Successfully"); }
public override SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { return(EbDate.GetSingleColumn(this, UserObj, SoluObj, Value)); }
public static SingleColumn GetSingleColumn(dynamic _this, User UserObj, Eb_Solution SoluObj, object Value) { object _formattedData = Value; string _displayMember = Value == null ? string.Empty : Value.ToString(); bool skip = false; if (_this is EbDate || _this is EbDGDateColumn) { if (Value == null && _this.IsNullable) { skip = true; } } if (!skip) { DateTime dt; try { if (Value == null) { dt = DateTime.UtcNow; if (_this.EbDateType == EbDateType.Time) { dt = dt.ConvertFromUtc(UserObj.Preference.TimeZone); } } else { if (Value.GetType() == typeof(TimeSpan)) { dt = DateTime.MinValue + (TimeSpan)Value; } else { dt = Convert.ToDateTime(Value); } } if (_this.EbDateType == EbDateType.Date) { if (!(_this is EbDate)) //EbSysCreatedAt EbSysModifiedAt EbDGDateColumn EbDGCreatedAtColumn EbDGModifiedAtColumn { DateTime dt_cov = dt.ConvertFromUtc(UserObj.Preference.TimeZone); _formattedData = dt_cov.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); _displayMember = dt_cov.ToString(UserObj.Preference.GetShortDatePattern(), CultureInfo.InvariantCulture); } else //EbDate { if (_this.ShowDateAs_ == DateShowFormat.Year) { _formattedData = dt.ToString("yyyy", CultureInfo.InvariantCulture); _displayMember = _formattedData.ToString(); } else if (_this.ShowDateAs_ == DateShowFormat.Year_Month) { _formattedData = dt.ToString("MM/yyyy", CultureInfo.InvariantCulture); _displayMember = _formattedData.ToString(); } else { _formattedData = dt.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); _displayMember = dt.ToString(UserObj.Preference.GetShortDatePattern(), CultureInfo.InvariantCulture); } } } else if (_this.EbDateType == EbDateType.DateTime) { DateTime dt_cov = dt.ConvertFromUtc(UserObj.Preference.TimeZone); _formattedData = dt_cov.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); _displayMember = dt_cov.ToString(UserObj.Preference.GetShortDatePattern() + " " + UserObj.Preference.GetShortTimePattern(), CultureInfo.InvariantCulture); } else// EbDateType.Time { _formattedData = dt.ToString("HH:mm:ss", CultureInfo.InvariantCulture); _displayMember = dt.ToString(UserObj.Preference.GetShortTimePattern(), CultureInfo.InvariantCulture); } } catch (Exception e) { throw new FormException($"Unable to process {_this.Name}(date control) with value: {Value}", (int)HttpStatusCode.InternalServerError, e.Message, "From EbDate.GetSingleColumn()\n" + e.StackTrace); } } return(new SingleColumn() { Name = _this.Name, Type = (int)_this.EbDbType, Value = _formattedData, Control = _this, ObjType = _this.ObjType, F = _displayMember }); }
//get data model of the control(formatted) // Value = null => to get default SingleColumn public virtual SingleColumn GetSingleColumn(User UserObj, Eb_Solution SoluObj, object Value, bool Default) { return(EbControl.GetSingleColumn(this, UserObj, SoluObj, Value)); }