private void tileDeleteUser_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (userBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { BarcoS.Classes.Views.MainForms.frmLogin.Log.Info("a user has been deleted, Name:" + (userBindingSource.Current as user).auth_name); db.users.Remove(userBindingSource.Current as user); userBindingSource.RemoveCurrent(); db.SaveChanges(); } } }
private void tileDeleteUser_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (currentDetailsBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Currenty editCari = db.Currenties.Where(u => u.id == cariIDGlobal).SingleOrDefault(); editCari.bakiye += -1 * Convert.ToDecimal((currentDetailsBindingSource.Current as Current_Details).price); frmLogin.Log.Info(string.Format("a Current Detail has been deleted, Deleted Bakiye:{0}", (currentDetailsBindingSource.Current as Current_Details).price)); db.Current_Details.Remove(currentDetailsBindingSource.Current as Current_Details); currentDetailsBindingSource.RemoveCurrent(); db.SaveChanges(); } } }
private void GetNotify(object sender, TileItemEventArgs e) { this.Cursor = Cursors.WaitCursor; bool cariContain = e.Item.Text2.Contains("cari"); if (cariContain) { var result = db.Features.SingleOrDefault(b => b.name == e.Item.Text2); result.company_id = 3; frmCari cariForm = new frmCari(); cariForm.ShowDialog(); } bool stokContain = e.Item.Text2.Contains("stok"); if (stokContain) { var result = db.Features.SingleOrDefault(b => b.name == e.Item.Text2); result.company_id = 3; frmStock stokForm = new frmStock(); stokForm.ShowDialog(); } db.SaveChanges(); this.Cursor = Cursors.Default; }
private void frmEditCariDetail_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { if (string.IsNullOrEmpty(txtText.Text) && !cancel) { MessageBox.Show("Lütfen Açıklama Giriniz", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtText.Focus(); e.Cancel = true; return; } db.SaveChanges(); e.Cancel = false; } e.Cancel = false; }
private void tileDeleteUser_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (currentyBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { frmLogin.Log.Info("a Currenty has been deleted, Name:" + (currentyBindingSource.Current as Currenty).auth_name + ", Bakiye:" + (currentyBindingSource.Current as Currenty).bakiye); foreach (Current_Details detailsOfCurrenty in db.Current_Details) { if ((detailsOfCurrenty as Current_Details).current_id == (currentyBindingSource.Current as Currenty).id) { db.Current_Details.Remove(detailsOfCurrenty); } } db.Currenties.Remove(currentyBindingSource.Current as Currenty); currentyBindingSource.RemoveCurrent(); db.SaveChanges(); } } }
private void frmEditProduct_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { if ((string.IsNullOrEmpty(txtBrandID.Text) || string.IsNullOrEmpty(txtCatID.Text) || string.IsNullOrEmpty(txtName.Text)) && !cancel) { MessageBox.Show("Lütfen zorunlu alanları giriniz.", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); e.Cancel = true; return; } db.SaveChanges(); e.Cancel = false; } e.Cancel = false; }
private void frmEditCari_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { if (string.IsNullOrEmpty(txtName.Text) && !cancel) { MessageBox.Show("Lütfen yetkili adı giriniz.", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); e.Cancel = true; return; } if (string.IsNullOrEmpty(txtBakiye.Text)) { (currentyBindingSource.Current as Currenty).bakiye = 0; } db.SaveChanges(); e.Cancel = false; } e.Cancel = false; }
private void frmEditUser_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { int password = 0; if (!String.IsNullOrEmpty(txtPass.Text)) { password = Convert.ToInt32(txtPass.Text); } if (string.IsNullOrEmpty(txtName.Text) && !cancel) { MessageBox.Show("Lütfen kullanıcı adı giriniz.", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); e.Cancel = true; return; } else if (string.IsNullOrEmpty(txtPass.Text) && !cancel) { MessageBox.Show("Lütfen kullanıcı şifresi giriniz.", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPass.Focus(); e.Cancel = true; return; } else if (db.users.Where(u => u.password == password).ToList().Count > 0 && db.users.Where(u => u.auth_name == txtName.Text).ToList().Count == 0 && !cancel) { MessageBox.Show("Aynı şifreye sahip kullanıcı mevcut!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPass.Focus(); e.Cancel = true; return; } db.SaveChanges(); e.Cancel = false; } e.Cancel = false; }
private void tileDeleteUser_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e) { if (isProductGrid) { if (productBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { frmLogin.Log.Info("a Product has been deleted, Name:" + (productBindingSource.Current as Product).name); db.Products.Remove(productBindingSource.Current as Product); productBindingSource.RemoveCurrent(); db.SaveChanges(); } } } else if (isBrandGrid) { if (brandBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { frmLogin.Log.Info("a Brand has been deleted, Name:" + (brandBindingSource.Current as Brand).name); db.Brands.Remove(brandBindingSource.Current as Brand); brandBindingSource.RemoveCurrent(); db.SaveChanges(); } } } else if (isCategoriesGrid) { if (categoryBindingSource.Current != null) { if (MessageBox.Show("Bu kayıdı silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { frmLogin.Log.Info("a Category has been deleted, Name:" + (categoryBindingSource.Current as category).name); db.categories.Remove(categoryBindingSource.Current as category); categoryBindingSource.RemoveCurrent(); db.SaveChanges(); } } } }
private void PurchaseToDB(Current_Details dailySellDetail) { db.Current_Details.Add(dailySellDetail); db.SaveChanges(); ListCurrenties(); }
private void CheckNotifications() { int notifyCount = 0; this.Cursor = Cursors.WaitCursor; List <Currenty> currenties = new List <Currenty>(); currenties = db.Currenties.ToList(); List <Product> products = new List <Product>(); products = db.Products.ToList(); foreach (Currenty currenty in currenties) { if (currenty.bakiye < currenty.risk_limit) { Feature notify = new Feature() { name = string.Format("{0} cari hesabının bakiyesi risk limitinin altındadır! Bakiye:{1} Limit:{2}", currenty.auth_name, currenty.bakiye, currenty.risk_limit), company_id = 2 }; Feature notifyToFind = new Feature(); notifyToFind = db.Features.Where(u => u.name == notify.name).SingleOrDefault() as Feature; if (notifyToFind == null) { db.Features.Add(notify); } } } foreach (Product product in products) { if (product.stock < product.risk_limit) { Feature notify = new Feature() { name = string.Format("{0} ürününün stok sayısı risk limitinin altındadır! Stok Sayısı:{1} Risk Limiti:{2}", product.name, product.stock, product.risk_limit), company_id = 2 }; Feature notifyToFind = new Feature(); notifyToFind = db.Features.Where(u => u.name == notify.name).SingleOrDefault() as Feature; if (notifyToFind == null) { db.Features.Add(notify); } } } db.SaveChanges(); List <Feature> features = new List <Feature>(); features = db.Features.ToList(); foreach (Feature feature in features) { if (feature.company_id == 2) { notifyCount++; } } if (notifyCount > 0) { tileNotif.AppearanceItem.Normal.ForeColor = Color.Red; tileNotif.Text = notifyCount + " BİLDİRİM BULUNMAKTA!"; } else { tileNotif.Text = "BİLDİRİM YOK"; } this.Cursor = Cursors.Default; }