private void ShowUpdateApp() { //اگر ورژن جدید در دیتابیس بود بررسی میکند که اگر برنامه جدید در کلاینت کاربر نصب نبود برنامه را میبندن و برنامه جدید را باز میکند if (NjitSoftware.Controller.Common.VerionAppController.Version() != txtProgramVersion.Text) { var Result = PersianMessageBox.Show("ورژن جدید برنامه آماده دانلود است آیا مایل به آپدیت برنامه هستین؟", "پیام", MessageBoxButtons.YesNoCancel); if (Result == DialogResult.Yes) { try { Model.Common.VersionClient vc = new Model.Common.VersionClient(); int userCode = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>().Code; vc.userId = userCode; vc.MashinPath = AppDomain.CurrentDomain.BaseDirectory; NjitSoftware.Controller.Common.VersionClientController.Insert(vc); //اجرا شدن برنامه برای بروزرسانی نرم افزار string AppUpdatePathExe = AppDomain.CurrentDomain.BaseDirectory; System.Diagnostics.Process.Start(AppUpdatePathExe + "Update\\MahbaUpdateApp.exe");//@"D:\WorkUpDareApp\MahbaUpdateApp.exe" Application.Exit(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
internal static bool Insert(Model.Common.VersionClient model) { try { model.ClientIP = NjitSoftware.Setting.Program.GetMacAddress(); Model.Common.ArchiveCommonDataClassesDataContext db = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString); db.VersionClients.InsertOnSubmit(model); db.SubmitChanges(); return(true); } catch { return(false); } }