private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MsgDlg.Show("هل انت متأكد ؟", MsgDlg.MessageType.Question) == DialogResult.No) { return; } DevExpress.Xpo.AsyncCommitCallback CommitCallBack = (o) => { SplashScreenManager.CloseForm(); if (o == null) { MsgDlg.ShowAlert(Properties.Settings.Default.msg_SaveSuccess, MsgDlg.MessageType.Success, (Form)Parent.Parent.Parent); Logger.Info(Properties.Settings.Default.msg_SaveSuccess); } else { MsgDlg.ShowAlert(String.Format("{0}, {1}, {2}", Properties.Settings.Default.msg_SavingFailed, Environment.NewLine, o.Message), MsgDlg.MessageType.Error, (Form)Parent.Parent.Parent); Classes.Core.LogException(Logger, o.InnerException, Classes.Core.ExceptionLevelEnum.General, Classes.Managers.UserManager.defaultInstance.User.UserId); } }; SplashScreenManager.ShowForm(typeof(FixedAssets.Views.Main.WaitWindowFrm)); SplashScreenManager.Default.SetWaitFormDescription(Properties.Settings.Default.msg_SavingInProgress); UOW.CommitTransactionAsync(CommitCallBack); }
private void BtnUpdate_Click(object sender, EventArgs e) { using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand("", Con); SqlTransaction trn = null; try { Con.Open(); trn = Con.BeginTransaction(); Cmd.Transaction = trn; Cmd.CommandText = string.Format("Delete From UserRoles Where UserId = {0}", LUEItems.EditValue); Cmd.ExecuteNonQuery(); foreach (DataRow row in RolesTbl.Rows) { if (row["Active"].ToString() == "1") { Cmd.CommandText = String.Format("INSERT INTO UserRoles (UserId, RoleId) VALUES ({0}, {1})", LUEItems.EditValue, row["RoleID"].ToString()); Cmd.ExecuteNonQuery(); } } trn.Commit(); LoadRoles(LUEItems.EditValue.ToString()); MsgDlg.ShowAlert("تم التعديل ..", MsgDlg.MessageType.Success, this); Logger.Info("تم التعديل .."); } catch (Exception ex) { trn.Rollback(); MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }
private void BtnDelete_Click(object sender, EventArgs e) { if (MsgDlg.Show("هل انت متأكد؟", MsgDlg.MessageType.Question) == System.Windows.Forms.DialogResult.No) { return; } using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand(String.Format("DELETE FROM Users WHERE (UserID = {0})", LUEItems.EditValue), Con); try { Con.Open(); Cmd.ExecuteNonQuery(); LoadData(); LUEItems.ItemIndex = -1; MsgDlg.ShowAlert("تم الحذف ..", MsgDlg.MessageType.Success, this); Logger.Info("تم الحذف .."); } catch (Exception ex) { MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }
private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (FXFW.SqlDB.IsNullOrEmpty(bbiRule.EditValue)) { return; } int RuleID = Convert.ToInt32(bbiRule.EditValue); if (MsgDlg.Show("Are You Sure ?", MsgDlg.MessageType.Question) == DialogResult.No) { return; } SplashScreenManager.ShowForm(typeof(FixedAssets.Views.Main.WaitWindowFrm)); SplashScreenManager.Default.SetWaitFormDescription("Saving ..."); System.Threading.ThreadPool.QueueUserWorkItem((o) => { try { SaveUserData(RuleID); MsgDlg.ShowAlert("Data Saved ...", MsgDlg.MessageType.Success, (Form)Parent.Parent.Parent); Logger.Info("Data Saved ..."); } catch (System.Data.SqlClient.SqlException ex) { MsgDlg.ShowAlert(String.Format("Saving Failed ...{0}{1}", Environment.NewLine, ex.Message), MsgDlg.MessageType.Error, (Form)Parent.Parent.Parent); Classes.Core.LogException(Logger, ex, Classes.Core.ExceptionLevelEnum.General, Classes.Managers.UserManager.defaultInstance.User.UserId); } SplashScreenManager.CloseForm(); }); }
private void BtnAdd_Click(object sender, EventArgs e) { if (TxtAddPass1.Text.Trim().Length == 0 || TxtAddPass1.Text.Trim() != TxtAddPass2.Text.Trim()) { MsgDlg.Show("من فضلك ادخل كلمة المرور ..", MsgDlg.MessageType.Info); return; } using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand(String.Format(@"INSERT INTO Users (UserID, UserName, UserPass, IsActive) VALUES ({0}, N'{1}', N'{2}', N'{3}')", FXFW.SqlDB.GetNewID("Users", "UserID"), TxtAddItem.Text.Trim(), TxtAddPass1.Text.Trim(), CEAddActive.Checked.ToString()), Con); try { Con.Open(); Cmd.ExecuteNonQuery(); LoadData(); MsgDlg.ShowAlert("تم الاضافه ..", MsgDlg.MessageType.Success, this); Logger.Info("تم الاضافه .."); } catch (Exception ex) { MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }
private void BtnUpdate_Click(object sender, EventArgs e) { if (TxtEditPass1.Text.Trim().Length == 0 || TxtEditPass1.Text.Trim() != TxtEditPass2.Text.Trim()) { MsgDlg.Show("من فضلك ادخل كلمة المرور ..", MsgDlg.MessageType.Info); return; } using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand(String.Format(@"UPDATE Users SET UserName = N'{0}', UserPass = N'{1}', IsActive = N'{2}' WHERE (UserID = {3})", TxtEditItem.Text.Trim(), TxtEditPass1.Text.Trim(), CEEditActive.Checked.ToString(), LUEItems.EditValue), Con); try { Con.Open(); Cmd.ExecuteNonQuery(); LoadData(); MsgDlg.ShowAlert("تم التعديل ..", MsgDlg.MessageType.Success, this); Logger.Info("تم التعديل .."); } catch (Exception ex) { MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }
private void UOW_BeforeCommitTransaction(object sender, DevExpress.Xpo.SessionManipulationEventArgs e) { // Get NewId int id = 0; object obj = Classes.Managers.DataManager.GetNewId("TblEmp", "EmpId"); if (obj == null) { MsgDlg.ShowAlert(Properties.Settings.Default.msg_SavingFailed, MsgDlg.MessageType.Error, (Form)Parent.Parent.Parent); return; } id = Convert.ToInt32(obj); // Assgin NewId to New Rows DevExpress.Xpo.Helpers.ObjectSet Rows = (DevExpress.Xpo.Helpers.ObjectSet)e.Session.GetObjectsToSave(); foreach (DevExpress.Xpo.Metadata.XPDataTableObject item in Rows) { if (item.GetMemberValue("EmpId") == null) { item.SetMemberValue("EmpId", id); id++; } item.SetMemberValue("dateIn", Classes.Managers.DataManager.GetServerDatetime); item.SetMemberValue("UserIn", Classes.Managers.UserManager.defaultInstance.User.UserId); } }
private void bbiSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MsgDlg.Show("هل انت متأكد ؟", MsgDlg.MessageType.Question) == DialogResult.No) { return; } userRuleTableAdapter.Update(dsData.UserRoles); MsgDlg.ShowAlert("تم الحفظ ...", MsgDlg.MessageType.Success, (Form)Parent.Parent.Parent); Logger.Info("تم الحفظ ..."); }
private void btnSave_Click(object sender, EventArgs e) { try { tBLCompanyBindingSource.EndEdit(); tBLCompanyTableAdapter.Update(dsData.TBLCompany); MsgDlg.ShowAlert("تم الحفظ", MsgDlg.MessageType.Success, new Form()); } catch (Exception ex) { MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex); Logger.Error(ex); } }
private void BtnAdd_Click(object sender, EventArgs e) { using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand(String.Format("INSERT INTO Roles (RoleID, RoleName, RoleDesc) VALUES ({0}, N'{1}', N'{2}')", FXFW.SqlDB.GetNewID("Roles", "RoleID"), TxtNewItem.Text.Trim(), TxtNewDes.Text.Trim()), Con); try { Con.Open(); Cmd.ExecuteNonQuery(); LoadData(); MsgDlg.ShowAlert("تم الاضافه ..", MsgDlg.MessageType.Success, this); Logger.Info("تم الاضافه .."); } catch (Exception ex) { MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }
private void BtnUpdate_Click(object sender, EventArgs e) { using (SqlConnection Con = new SqlConnection(FXFW.SqlDB.SqlConStr)) { SqlCommand Cmd = new SqlCommand(String.Format("UPDATE Roles SET RoleName = N'{0}', RoleDesc = N'{1}' WHERE (RoleID = {2})", TxtEditItem.Text.Trim(), TxtEditDes.Text.Trim(), LUEItems.EditValue), Con); try { Con.Open(); Cmd.ExecuteNonQuery(); LoadData(); MsgDlg.ShowAlert("تم التعديل ..", MsgDlg.MessageType.Success, this); Logger.Info("تم التعديل .."); } catch (Exception ex) { MsgDlg.ShowAlert(ex.Message, MsgDlg.MessageType.Success, this); Logger.Info(ex.Message, ex); } } }