/// <summary> /// add system settings /// </summary> /// <param name="setting"></param> /// <returns></returns> public bool InsertSystemSettings(AdminUserProp setting) { try { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); bool result = false; using (PortStorageEntities objAppWorksEntities = new PortStorageEntities()) { SettingTable newSetting = new SettingTable(); newSetting.ValueKey = setting.ValueKey; newSetting.ValueDescription = setting.ValueDescription; objAppWorksEntities.SettingTables.Add(newSetting); objAppWorksEntities.SaveChanges(); result = true; } return(result); } catch (Exception) { throw; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }
async void OnSettingsClicked(object sender, EventArgs e) { SettingTable _table = new SettingTable(); //await DisplayAlert("Sql Admin", SettingTable, "ok"); if (SettingTable == null || SettingTable.Equals(string.Empty)) { _table.CurrentLingo = App.CurrentLingo; _table.ExpDate = System.DateTime.Now.AddDays(60); App.LocalDatabase.CreateSettingTableAsync(); var results = await App.LocalDatabase.SaveSettingAsync(_table); Notes = results.ToString(); } else { var results = await App.LocalDatabase.GetSettingsAsync(); if (results != null) { _table.CurrentLingo = results.CurrentLingo; _table.ExpDate = results.ExpDate; } Notes = results.ToString(); } await DisplayAlert(SettingTable, Notes, "ok"); }
public App() { InitializeComponent(); using (var database = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "git.db"), SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.ProtectionComplete)) { database.CreateTable <SettingTable>(); #region 테마 초기화 if (database.Table <SettingTable>().ToList().Where(s => s.Key == "Theme").Count() == 0) { var theme = new SettingTable { Key = "Theme", Value = "System" }; database.Insert(theme); } switch (database.Table <SettingTable>().ToList().Where(s => s.Key == "Theme").FirstOrDefault().Value) { case "Light": Current.RequestedTheme = ApplicationTheme.Light; break; case "Dark": Current.RequestedTheme = ApplicationTheme.Dark; break; } #endregion } this.Suspending += OnSuspending; }
public static void toggleNotifications(bool enabled) { SettingTable.Set(new Setting() { key = "notification", value = enabled.ToString() }); }
/// <summary> /// Update table for next batch id /// </summary> /// <param name="BatchId"></param> /// <returns></returns> public bool SetPortStorageVehiclesNextBatchId(int BatchId) { bool Result = false; try { // creating the object of PortStorageEntities Database using (PortStorageEntities objAppWorksEntities = new PortStorageEntities()) { SettingTable settingTable = objAppWorksEntities.SettingTables.Where(v => v.ValueKey.Equals("NextPortStorageVehicleImportBatchID")).FirstOrDefault(); settingTable.ValueDescription = Convert.ToString(BatchId + 1); objAppWorksEntities.SaveChanges(); /// Check the Chenges in Table After Record update. Result = true; } } catch (Exception) { throw; } finally { CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } return(Result); }
protected override void Seed(DatabaseContext context) { SettingTable.Initialize(context); FileTypeTable.Initialize(context); LanguageTable.Initialize(context); CategoryTable.Initialize(context); UserMessageCreationModeTable.Initialize(context); UserMessageStateTable.Initialize(context); MessageStateTable.Initialize(context); CategoryFavouriteLevelTable.Initialize(context); }
private void BtnBuildingTable_Click(object sender, EventArgs e) { if (this.currentParcel == null) { return; } BlockTableLand table = new BlockTableLand(); foreach (string keyTable in this.checkedListBox_TypeTable.CheckedItems) { SettingTable setTable = this.tableSettings.FindKeyTable(keyTable); table.Setting = setTable; table.Scale = this.formSettings.ScaleDrawing; if (table.Setting == null) { return; } if (table.StrategyTable.GetType().Equals(typeof(StrategyTableBorderParcel))) { table.Parcel = this.currentParcel; table.сreate(); } else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableBorderLimiting))) { foreach (LandPolygon polygon in this.currentParcel.Limiting) { LandParcel parcel = new LandParcel { Info = polygon.Info, Points = polygon.Points }; table.Parcel = parcel; table.сreate(); } } else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableLimiting))) { table.Parcel = this.currentParcel; table.сreate(); } else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableStakeOutPoints))) { table.Parcel = this.currentParcel; table.сreate(); } } }
protected override void OnCreate(Bundle savedInstanceState) { InitFontScale(); base.OnCreate(savedInstanceState); #region 테마 초기화 using (var database = new SQLiteConnection(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "git.db"), SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.ProtectionComplete)) { database.CreateTable <SettingTable>(); if (database.Table <SettingTable>().ToList().Where(s => s.Key == "Theme").Count() == 0) { var theme = new SettingTable { Key = "Theme", Value = "System" }; database.Insert(theme); } switch (database.Table <SettingTable>().ToList().Where(s => s.Key == "Theme").FirstOrDefault().Value) { case "Light": SetTheme(Resource.Style.Base_Theme_AppCompat_Light); break; case "Dark": SetTheme(Resource.Style.Base_Theme_AppCompat); break; } } #endregion Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Rg.Plugins.Popup.Popup.Init(this); NotificationCenter.CreateNotificationChannel(); LoadApplication(new App()); Instance = this; }
/// <summary> /// Замінює у заголовку таблиці кода на відповідні їм значення. /// </summary> /// <param name="polygon">Ділянка, що є вихідною для таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:System.Sting"/> після заміни кодів на відповідні їм значення. /// </returns> internal static String ReplaceValueCodeInTitle(LandParcel polygon, SettingTable settingTable) { string titleTable = settingTable.Title; List <string> keys = settingTable.GetCodeAddTitle(); foreach (string key in keys) { LandInfo info = polygon.FindInfo(key); if (info != null) { titleTable = titleTable.Replace("/*" + info.Key + "*/", info.Value); } else { titleTable = titleTable.Replace("/*" + key + "*/", "< Невірний код /*" + key + "*/>"); } } return(titleTable); }
/// <summary> /// Створює коллекцію мультітекстових обектів заголовку таблиці та заголовків колонок таблиці. /// </summary> /// <param name="titleTable">Заголовок таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить мультитекстові обекти заголовку таблиці та заголовків колонок таблиці /// </returns> internal static AcDb.DBObjectCollection GetCapTables(string titleTable, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.MText textValue; AcGe.Point3d insertPoint = AcGe.Point3d.Origin; /*Заголовок таблиці*/ textValue = new AcDb.MText(); textValue.TextHeight = settingTable.TextHeight; textValue.LineSpaceDistance = settingTable.TextHeight * 0.7; textValue.Attachment = AcDb.AttachmentPoint.BottomCenter; textValue.Contents = titleTable; textValue.Location = settingTable.BasePointDrawing .Add(new AcGe.Vector3d(settingTable.GetWidthTable() / 2, settingTable.TextHeight, 0)); objects.Add(textValue); /*Заголовоки колонок таблиці*/ double colWidth = 0; foreach (ColumnTable value in settingTable.Columns) { colWidth += value.Width; insertPoint = new AcGe.Point3d(colWidth - value.Width / 2, settingTable.TextHeight / 2 * -1, 0); textValue = new AcDb.MText(); textValue.TextHeight = settingTable.TextHeight; textValue.LineSpaceDistance = settingTable.TextHeight * 2; textValue.Attachment = AcDb.AttachmentPoint.TopCenter; textValue.Contents = value.Name; textValue.Location = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); objects.Add(textValue); } return(objects); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці обмежень земельної ділянки. /// </summary> /// <param name="parcel">Ділянка, що є вихідною для таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці обмежень земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableLimiting(LandParcel parcel, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.MText valueMText; AcGe.Point3d insertPoint; AcDb.Line lineRows; LandPolygon polygonLimiting; double steepRow = settingTable.TextHeight * 6; double heightTable = settingTable.GetHeightCapTable() * -1; List <HatchPolygon> listMissingHatch = new List <HatchPolygon>(); for (int index = 0; index < parcel.Limiting.Count; index++) { polygonLimiting = parcel.Limiting.ToArray()[index]; double colWidth = 0; if (index > 0) { lineRows = new AcDb.Line( new AcGe.Point3d(0, heightTable, 0), new AcGe.Point3d(settingTable.GetWidthTable(), heightTable, 0)); objects.Add(lineRows); } heightTable -= steepRow; foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (heightTable + steepRow / 2), 0); valueMText = new AcDb.MText(); valueMText.Width = col.Width * 0.9; valueMText.TextHeight = settingTable.TextHeight; valueMText.LineSpaceDistance = settingTable.TextHeight * 1.5; valueMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; valueMText.Location = insertPoint; if (col.Format.IndexOf("LegendLimiting") > -1) { AcGe.Point2dCollection pointsHatch = new AcGe.Point2dCollection(new AcGe.Point2d[] { new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + steepRow - 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + 2), new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + steepRow - 2) }); AcDb.Polyline2d polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true); AcDb.Hatch hatch = ServiceSimpleElements.CreateHatch(ServiceCAD.InsertObject(polylineLimiting), true); HatchPolygon hatchLimiting = HatchPolygon.GetHatchLimiting(polygonLimiting); if (hatchLimiting != null) { hatch.ColorIndex = hatchLimiting.ColorIndex; hatch.SetHatchPattern(AcDb.HatchPatternType.UserDefined, hatchLimiting.Pattern.Name); hatch.PatternAngle = hatchLimiting.Pattern.Angle; hatch.PatternSpace = hatchLimiting.Pattern.Space; } else { string type = polygonLimiting.FindInfo("OK").Value; string name = polygonLimiting.FindInfo("OX").Value; listMissingHatch.Add(new HatchPolygon(type, name, 0, PatternHatch.DEFAULT)); } objects.Add(hatch); polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true); objects.Add(polylineLimiting); } else if (col.Format.IndexOf("CodeLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OK").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("NameLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OX").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("LegalActsLimiting") > -1) { valueMText.Contents = polygonLimiting.FindInfo("OD").Value; objects.Add(valueMText); } else if (col.Format.IndexOf("AreaLimiting") > -1) { double area = Convert.ToDouble(polygonLimiting.FindInfo("AO").Value.Replace(".", ",")); valueMText.Contents = (area / 10000).ToString("0.0000").Replace(",", ".");; objects.Add(valueMText); } } } if (listMissingHatch.Count > 0) { CurrentCAD.Editor.WriteMessage("\n\nПобудова таблиці омеженнь\n Не визначено штриховку: \n"); CurrentCAD.Editor.WriteMessage(ServiceXml.GetStringXml <List <HatchPolygon> >(listMissingHatch)); } return(objects); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці виносу внатуру меж земельної ділянки. /// </summary> /// <param name="polygon">Земельна ділянка.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці виносу внатуру меж земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableStakeOutParcelPoints(LandParcel polygon, SettingTable settingTable) { List <StakeOutParcelPoint> stakeoutPoints = polygon.StakeOutParcelPoints; //stakeoutPoints.Sort((x, y) => y.PointStation.Name.CompareTo(x.PointStation.Name)); AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.DBText textValue; AcGe.Point3d insertPoint; //AcGe.Point2d backPoint, stationPoint, parcelPoint; double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1; int index = -1; foreach (StakeOutParcelPoint stakeoutPoint in stakeoutPoints) { index++; double colWidth = 0; heightTable += settingTable.TextHeight * 2 * index; foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d ( colWidth - col.Width / 2, (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1, 0 ); textValue = new AcDb.DBText(); textValue.Height = settingTable.TextHeight; textValue.Justify = AcDb.AttachmentPoint.BottomCenter; textValue.Position = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); textValue.AlignmentPoint = textValue.Position; if (col.Format.IndexOf("Number") > -1) { textValue.TextString = stakeoutPoint.Name; } else if (col.Format.IndexOf("X") > -1) { textValue.TextString = stakeoutPoint.Coordinates.X.ToString("0.00"); } else if (col.Format.IndexOf("Y") > -1) { textValue.TextString = stakeoutPoint.Coordinates.Y.ToString("0.00"); } else if (col.Format.IndexOf("LengthLine") > -1) { textValue.TextString = stakeoutPoint.Distance.ToString("0.00"); } else if (col.Format.IndexOf("DirAngle") > -1) { textValue.TextString = stakeoutPoint.DirAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds); } else if (col.Format.IndexOf("InnerAngle") > -1) { textValue.TextString = stakeoutPoint.LeftlAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds); } else if (col.Format.IndexOf("BasePoints_dirAngle") > -1) { textValue.TextString = stakeoutPoint.PointStation.Name; } else if (col.Format.IndexOf("BasePoints_innerAngle") > -1) { textValue.TextString = stakeoutPoint.PointStation.Name + " -> " + stakeoutPoint.PointOrientation.Name; } else { textValue.TextString = "None"; } textValue.TextString = textValue.TextString.Replace(",", "."); textValue.TextString = FormatAngleValue(textValue.TextString); objects.Add(textValue); } } return(objects); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці межі земельної ділянки. /// </summary> /// <param name="polygon">Ділянка, що є вихідною для таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці межі земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableBorderPolygon(LandParcel polygon, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.DBText textValue; AcGe.Point3d insertPoint; AcGe.Point2d backPoint, currentPoint, frontPoint; double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1; for (int index = 0; index <= polygon.Points.Count; index++)//(Point2d point in polygon.Points) { double colWidth = 0; heightTable += settingTable.TextHeight * 2 * index; if (index == 0) { backPoint = polygon.Points.ToArray()[polygon.Points.Count - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[index + 1]; } else if (index == polygon.Points.Count - 1) { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[0]; } else if (index == polygon.Points.Count) { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[0]; frontPoint = polygon.Points.ToArray()[1]; } else { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[index + 1]; } foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1, 0); textValue = new AcDb.DBText(); textValue.Height = settingTable.TextHeight; textValue.Justify = AcDb.AttachmentPoint.BottomCenter; textValue.Position = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); textValue.AlignmentPoint = textValue.Position; if (col.Format.IndexOf("Number") > -1) { if (index == polygon.Points.Count) { textValue.TextString = "1"; } else { textValue.TextString = Math.Abs(index + 1).ToString(); } } else if (col.Format.IndexOf("X") > -1) { textValue.TextString = currentPoint.X.ToString("0.00"); } else if (col.Format.IndexOf("Y") > -1) { textValue.TextString = currentPoint.Y.ToString("0.00"); } else if (col.Format.IndexOf("LengthLine") > -1) { if (index < polygon.Points.Count) { textValue.Position = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0)); textValue.AlignmentPoint = textValue.Position; textValue.TextString = currentPoint.GetDistanceTo(frontPoint).ToString("0.00"); } } else if (col.Format.IndexOf("DirAngle") > -1) { if (index < polygon.Points.Count) { textValue.Position = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0)); textValue.AlignmentPoint = textValue.Position; double angle = ServiceGeodesy.GetDirAngle(currentPoint, frontPoint); textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3); } } else if (col.Format.IndexOf("InnerAngle") > -1) { double angle = ServiceGeodesy.GetRightAngle(backPoint, currentPoint, frontPoint); textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3); } else { textValue.TextString = "None"; } textValue.TextString = textValue.TextString.Replace(",", "."); for (int i = 0; i < 10; i++) { textValue.TextString = textValue.TextString .Replace("°" + i.ToString() + "'", "°" + i.ToString("00") + "'"); } for (int i = 0; i < 10; i++) { textValue.TextString = textValue.TextString .Replace("'" + i.ToString() + "\"", "'" + i.ToString("00") + "\""); } objects.Add(textValue); } } return(objects); }
/// <summary> /// Створює коллекцію лінійних обектів таблиці. /// </summary> /// <param name="numberRows">Кількість рядків таблиці.</param> /// <param name="stepRows">Крок рядків таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить лінійні обекти таблиці. /// </returns> internal static AcDb.DBObjectCollection GetBoundTable(int numberRows, double stepRows, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); double hTable = settingTable.GetHeightTable(numberRows, stepRows) * -1; double wTable = settingTable.GetWidthTable(); AcGe.Point2dCollection pointsBoundTable = new AcGe.Point2dCollection(new AcGe.Point2d[] { settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(0, 0)), settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(wTable, 0)), settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(wTable, hTable)), settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(0, hTable)) }); objects.Add(ServiceSimpleElements.CreatePolyline2d(pointsBoundTable, true)); AcGe.Point2dCollection pointsLine = new AcGe.Point2dCollection(new AcGe.Point2d[] { settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(wTable, settingTable.GetHeightCapTable() * -1)), settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(0, settingTable.GetHeightCapTable() * -1)) }); objects.Add(ServiceSimpleElements.CreatePolyline2d(pointsLine, false)); double widthCur = 0; for (int i = 0; i < settingTable.Columns.Count - 1; i++) { ColumnTable value = settingTable.Columns.ToArray()[i]; widthCur += value.Width; pointsLine = new AcGe.Point2dCollection(new AcGe.Point2d[] { settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(widthCur, 0)), settingTable.BasePointDrawing.Convert2d(new AcGe.Plane()) .Add(new AcGe.Vector2d(widthCur, hTable)) }); objects.Add(ServiceSimpleElements.CreatePolyline2d(pointsLine, false)); } return(objects); }
public static bool notificationsEnbabled() { var result = SettingTable.Get("notification"); return(result == "True"); }