private void addRestriction() { try { validationTable valid = new validationTable(); DateTime endTime = endDateTimePickerX1.SelectedDateInDateTime; StartEndMonthClass date = new StartEndMonthClass(); date.endDate = Convert.ToInt64(endTime.ToFa("yyyyMMdd")); valid.startDate = startendDate.min; valid.enDate = date.endDate; valid.City = Convert.ToInt64(validCityComboBox.SelectedValue); SqlManipulator sql = new SqlManipulator(); //if (this.lockAllCitiesCheckBox.Checked == true) //{ // var cities = sql.getDataCity(); // foreach(var city in cities) // { // } //} var cityName = sql.getCityName(valid.City); FarsiDateUtil startDate = new FarsiDateUtil(startendDate.min.ToString()); FarsiDateUtil endDate = new FarsiDateUtil(date.endDate.ToString()); valid.description = "قفل" + " " + cityName + " " + endDate.MonthName + endDate.Year; Reporter rpt = new Reporter(sql.addValidation(valid), (int)errorImages.info); rpt.Show(); makeValidationTable(sql.getValidationData()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void loginButton_Click(object sender, EventArgs e) { try { var cn = Properties.Settings.Default.MainConnectionString; if (IsServerConnected(cn)) { UserManagerDataClassesDataContext db = new UserManagerDataClassesDataContext(cn); foreach (var q in db.UserTables) { if (q.User == this.UserNametextBox.Text && q.Password == this.PasswordTextBox.Text) { this.Hide(); LoginInfo login = new LoginInfo(); login.cityID = q.City; login.Name = q.Name; login.Id = q.Id; login.family = q.Family; login.permission = q.Permission.Value; login.user = q.User; login.update = q.Update.Value; login.messages = q.Messages; login.version = q.Version ?? default(int); login.adminVersion = q.AdminVersion ?? default(bool); if (login.version > currentVersion && !login.adminVersion) { MessageBox.Show("نسخه شما بروز نیست . آخرین نسخه بروز شده را نصب کنید ", "پیغام", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } SqlManipulator sql = new SqlManipulator(); if (!login.adminVersion) { if (login.update) { MessageBox.Show(login.messages, "پیغام ", MessageBoxButtons.OK, MessageBoxIcon.Information); try { sql.MessagesSeenStatus(false, login); } catch (Exception) { MessageBox.Show("خطا در پیغام"); } } } string cityName = sql.getCityName(login.cityID); login.cityName = cityName; form.setLoginData(login); Properties.Settings.Default.LastUser = this.UserNametextBox.Text; tmr = new Timer(); //set time interval 3 sec tmr.Interval = 3500; //starts the timer formwait = new SplashScreenForm(); formwait.Show(); tmr.Start(); tmr.Tick += tmr_Tick; permission = q.Permission.Value; Properties.Settings.Default.Save(); return; } } MessageBox.Show("نام کاربری و گذر واژه فاقد اعتبار است", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show("ارتباط با سرور قطع است ، تنظیمات سرور را بررسی کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }