private void btnSave_Click(object sender, EventArgs e) { DataBaseDataContext myConnection = Setting.DataBase; if (string.IsNullOrEmpty(txtTitle.Text) || string.IsNullOrWhiteSpace(txtTitle.Text)) { DataValidationMesaage.BlankTextBox("عنوان"); return; } if (myConnection.Phones.Any(a => a.Title == txtTitle.Text.Trim())) { DataValidationMesaage.DuplicateData(txtTitle.Text); return; } Phone phone = Phone.Insert(txtTitle.Text.Trim(), myConnection); clearTextBox(); DataValidationMesaage.AcceptMessage(phone.Title); Phone.LoadGrid(gridPhone, myConnection); }
static void Main() { DataBaseDataContext myConnection = Setting.DataBase; if (!myConnection.DatabaseExists()) { myConnection.CreateDatabase(); #region Insert RaspberryPins for (int i = 1; i <= 24; i++) { RaspberryPin.Insert(i.ToString(), true, myConnection); } #endregion #region Insert SocialNetworkTypes SocialNetworkType.Insert("اینستاگرام", myConnection); SocialNetworkType.Insert("تلگرام", myConnection); SocialNetworkType.Insert("وایبر", myConnection); SocialNetworkType.Insert("وی چت", myConnection); SocialNetworkType.Insert("توییتر", myConnection); SocialNetworkType.Insert("لینکداین", myConnection); SocialNetworkType.Insert("فیسبوک", myConnection); #endregion #region Insert PhoneOperators Phone.Insert("ایرانسل", myConnection); Phone.Insert("همراه اول", myConnection); Phone.Insert("رایتل", myConnection); Phone.Insert("تالیا", myConnection); Phone.Insert("تلفن ثابت", myConnection); #endregion #region Insert Levels Level.Insert("طلایی", myConnection); Level.Insert("نقره ای", myConnection); Level.Insert("برنزی", myConnection); Level.Insert("VIP", myConnection); #endregion #region BankAccounts BankAccount.Insert("کشاورزی", "", "", myConnection); BankAccount.Insert("ملی", "", "", myConnection); BankAccount.Insert("ملت", "", "", myConnection); #endregion } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmMain()); }