private void btnDeleteLine_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { System.Data.DataRow row = grdGrid.GetDataRow(grdGrid.FocusedRowHandle); if (!string.IsNullOrEmpty(row[0].ToString()) && row[0].ToString() != "0") { result = XtraMessageBox.Show("Seçili kaydı silmek istediğinize emin misiniz?\n\rKaydet işlemi yapılmadan son düzenlemeler geçerli olmayacaktır.", "Soru?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { REf = int.Parse(row[0].ToString()); grdGrid.DeleteRow(grdGrid.FocusedRowHandle); db.AddParameterValue("@Ref", REf); db.RunCommand("delete from StStockCardModel where Ref=@Ref"); XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (row[0].ToString() != "0") { grdGrid.DeleteRow(grdGrid.FocusedRowHandle); } } catch (Exception ex) { helper.WriteLog(ex); } }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { for (int i = 0; i < grdGrid.RowCount - 1; i++) { if (string.IsNullOrEmpty(grdGrid.GetRowCellValue(i, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdGrid.GetRowCellValue(i, "Ref").ToString()); } code = grdGrid.GetRowCellValue(i, "code").ToString(); name = grdGrid.GetRowCellValue(i, "name").ToString(); db.AddParameterValue("@ref", REf); db.AddParameterValue("@code", code); db.AddParameterValue("@name", name); db.RunCommand("sp_StockCardBrand", CommandType.StoredProcedure); } XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); FillData(); RowCount = grdGrid.RowCount; this.Close(); } catch (Exception ex) { helper.WriteLog(ex); db.parameterDelete(); } }
void DeleteLine(GridView grd, string sql) { try { if (grd.RowCount > 0 && grd.FocusedRowHandle != -1) { System.Data.DataRow row = grd.GetDataRow(grd.FocusedRowHandle); if (!string.IsNullOrEmpty(row[0].ToString()) && row[0].ToString() != "0") { result = XtraMessageBox.Show("Seçili kaydı silmek istediğinize emin misiniz?\n\rKaydet işlemi yapılmadan son düzenlemeler geçerli olmayacaktır.", "Soru?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { REf = int.Parse(row[0].ToString()); grd.DeleteRow(grd.FocusedRowHandle); db.AddParameterValue("@Ref", REf); db.RunCommand(sql + " where Ref=@Ref"); XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (row[0].ToString() != "0") { grd.DeleteRow(grd.FocusedRowHandle); } } } catch (Exception ex) { helper.WriteLog(ex); } }
private void bbiOrderAccept_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { grdGrid.FocusedRowHandle = -1; if (grdGrid.RowCount > 0) { for (int i = 0; i < grdGrid.RowCount; i++) { if (grdGrid.GetRowCellValue(i, "Seçim").ToString() == "True") { int REf = int.Parse(grdGrid.GetRowCellValue(i, "Ref").ToString()); db.AddParameterValue("@state", false); db.AddParameterValue("@ref", REf); db.AddParameterValue("@date", DateTime.Now.ToShortDateString(), SqlDbType.Date); db.RunCommand("update StBuyOrder set state=@state,okDate=@date where Ref=@ref"); } } XtraMessageBox.Show("İşlem başarıyla kaydedildi.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); FillData(); } } catch (Exception ex) { helper.WriteLog(ex); } }
public void ActivePassive(int id, string tabloadi, string alanadi, string kosulid) { db.AddParameterValue("@Id", id); string status = db.GetScalarValue("select " + alanadi + " from " + tabloadi + " where " + kosulid + "=@Id").ToString(); db.AddParameterValue("@Id", id); if (status == "False") { db.RunCommand("update " + tabloadi + " set " + alanadi + " = 1 where " + kosulid + "=@Id"); } else if (status == "True") { db.RunCommand("update " + tabloadi + " set " + alanadi + " = 0 where " + kosulid + "=@Id"); } DevExpress.XtraEditors.XtraMessageBox.Show("İşlem başarıyla kaydedildi.", "Başarılı İşlem!" , MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (Control()) { db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@active", chkActive.GetBoolValue()); db.AddParameterValue("@nationality", flashCheckEdit1.GetBoolValue()); db.AddParameterValue("@person", chkPerson.GetBoolValue()); db.AddParameterValue("@type", ledType.GetValue()); db.AddParameterValue("@code", txtCode.GetString()); db.AddParameterValue("@name", txtName.GetString()); db.AddParameterValue("@country", txtCountry.GetString()); db.AddParameterValue("@city", txtCity.GetString()); db.AddParameterValue("@district", txtDistirct.GetString()); db.AddParameterValue("@gsm", txtGsm.GetString()); db.AddParameterValue("@tel", txtTel.GetString()); db.AddParameterValue("@mail", txtMail.GetString(), SqlDbType.NVarChar); db.AddParameterValue("@address", txtAdress.GetString(), SqlDbType.NVarChar); db.AddParameterValue("@Ftax", txtVD.GetString()); db.AddParameterValue("@ftaxNo", txtVNo.GetString()); db.AddParameterValue("@Fcountry", txtFCountry.GetString()); db.AddParameterValue("@Fcity", txtFCity.GetString()); db.AddParameterValue("@Fdistrict", txtFDistirct.GetString()); db.AddParameterValue("@Fgsm", txtFGsm.GetString()); db.AddParameterValue("@Ftel", txtFTel.GetString()); db.AddParameterValue("@Fmail", txtFMail.GetString(), SqlDbType.NVarChar); db.AddParameterValue("@Faddress", txtFAdress.GetString(), SqlDbType.NVarChar); db.RunCommand("sp_Customer", CommandType.StoredProcedure); XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); helper.ClearForm(this); c.StateStabil(this); this.DialogResult = DialogResult.OK; this.Close(); } else { FrmErrorForm form = new FrmErrorForm(); form.flashMemoEdit1.SetString(stb.ToString()); form.ShowDialog(); } } catch (Exception ex) { helper.WriteLog(ex); } }
private void bbiDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdStock.RowCount > 0) { if (grdStock.FocusedRowHandle != -1 && !string.IsNullOrEmpty(grdStock.GetFocusedRowCellValue("Ref").ToString())) { int Ref = int.Parse(grdStock.GetFocusedRowCellValue("Ref").ToString()); string stockName = grdStock.GetFocusedRowCellValue("Stok Adı").ToString(); DialogResult answer; answer = XtraMessageBox.Show(stockName + " adlı ürünü pasife çekmek istediğinize emin misiniz?\n\rPasife çekilen stoklara ait tüm veriler pasif duruma geçecektir.\n\rPasife geçen stokları daha sonra tekrar aktif edebilirsiniz.", "Soru?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { db.AddParameterValue("@ref", Ref); db.AddParameterValue("@act", false, SqlDbType.Bit); db.RunCommand("update StStockCard set active=@act where Ref=@ref"); XtraMessageBox.Show("İşlem başarıyla gerçekleştirildi.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); FillData(); } } } }
void Save() { if (Control()) { db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@code", txtCode.GetString()); db.AddParameterValue("@name", txtName.GetString()); db.AddParameterValue("@date", dtpPlugDate.GetDate().ToShortDateString(), SqlDbType.Date); db.AddParameterValue("@branch", branch); db.AddParameterValue("@whouse", wHouse); db.AddParameterValue("@desc", txtDesc.GetString()); db.AddParameterValue("@state", true); db.AddParameterValue("@totalPrice", allTotal, SqlDbType.Decimal); db.AddParameterValue("@customerRef", ledCustomer.GetValue()); db.RunCommand("sp_BuyOrder", CommandType.StoredProcedure); db.parameterDelete(); if (this._FormMod == Enums.enmFormMod.Yeni) { this._Ref = int.Parse(db.GetScalarValue("select MAX(Ref) from StBuyOrder").ToString()); } grdGrid.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None; grdGrid.OptionsView.ShowAutoFilterRow = false; for (int i = 0; i < grdGrid.RowCount; i++) { if (string.IsNullOrEmpty(grdGrid.GetRowCellValue(i, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdGrid.GetRowCellValue(i, "Ref").ToString()); } int cardRef = int.Parse(grdGrid.GetRowCellValue(i, "Kart Ref").ToString()); string cardCode = grdGrid.GetRowCellValue(i, "Kart Kodu").ToString(); string barcode = grdGrid.GetRowCellValue(i, "Barkod").ToString(); int unitRef = int.Parse(grdGrid.GetRowCellValue(i, "Birim Ref").ToString()); int quantity = int.Parse(grdGrid.GetRowCellValue(i, "Miktar").ToString()); string lineDesc = grdGrid.GetRowCellValue(i, "Satır Açıklaması").ToString(); decimal unitPrice = decimal.Parse(grdGrid.GetRowCellValue(i, "Birim Fiyat").ToString()); decimal linePrice = decimal.Parse(grdGrid.GetRowCellValue(i, "Toplam Tutar").ToString()); db.AddParameterValue("@ref", REf); db.AddParameterValue("@orderRef", this._Ref); db.AddParameterValue("@cardRef", cardRef); db.AddParameterValue("@cardCode", cardCode); db.AddParameterValue("@barcode", barcode); db.AddParameterValue("@unitRef", unitRef); db.AddParameterValue("@quantity", quantity); db.AddParameterValue("@unitPrice", unitPrice, SqlDbType.Decimal); db.AddParameterValue("@linePrice", linePrice, SqlDbType.Decimal); db.AddParameterValue("@direc", direc); db.AddParameterValue("@desc", lineDesc); db.RunCommand("sp_BuyOrderDetails", CommandType.StoredProcedure); } XtraMessageBox.Show("İşlem başarılı bir şekilde kaydedildi.", "Başarılı işlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); ok = true; } else { FrmErrorForm form = new FrmErrorForm(); form.flashMemoEdit1.SetString(stb.ToString()); form.ShowDialog(); } }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (Control()) { db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@active", chkActive.GetBoolValue()); db.AddParameterValue("@code", txtCode.GetString()); db.AddParameterValue("@name", txtName.GetString()); db.AddParameterValue("@currencyRef", ledCurr.GetValue()); db.AddParameterValue("@start", dtpStart.GetDate(), SqlDbType.Date); db.AddParameterValue("@finish", dtpFinish.GetDate(), SqlDbType.Date); db.RunCommand("sp_SellPriceList", CommandType.StoredProcedure); db.parameterDelete(); if (this._FormMod == Enums.enmFormMod.Yeni) { this._Ref = int.Parse(db.GetScalarValue("select MAX(ref) from StSellPriceList").ToString()); } for (int a = 0; a < grdGrid.RowCount - 1; a++) { if (string.IsNullOrEmpty(grdGrid.GetRowCellValue(a, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdGrid.GetRowCellValue(a, "Ref").ToString()); } decimal price = decimal.Parse(grdGrid.GetRowCellValue(a, "Fiyat").ToString()); db.AddParameterValue("@ref", REf); db.AddParameterValue("@listRef", this._Ref); db.AddParameterValue("@cardRef", grdGrid.GetRowCellValue(a, "Kart Ref")); db.AddParameterValue("@unitRef", grdGrid.GetRowCellValue(a, "Birim Ref")); db.AddParameterValue("@barcode", grdGrid.GetRowCellValue(a, "Barkod")); db.AddParameterValue("@price", price, SqlDbType.Decimal); db.RunCommand("sp_SellPriceListDetails", CommandType.StoredProcedure); db.parameterDelete(); } for (int i = 0; i < grdBranch.RowCount - 1; i++) { if (string.IsNullOrEmpty(grdBranch.GetRowCellValue(i, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdBranch.GetRowCellValue(i, "Ref").ToString()); } db.AddParameterValue("@ref", REf); db.AddParameterValue("@listRef", this._Ref); db.AddParameterValue("@branchRef", grdBranch.GetRowCellValue(i, "branchRef")); db.RunCommand("sp_SellPriceListBranch", CommandType.StoredProcedure); db.parameterDelete(); } XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); helper.ClearForm(this); c.StateStabil(this); this.DialogResult = DialogResult.OK; this.Close(); } else { FrmErrorForm form = new FrmErrorForm(); form.flashMemoEdit1.SetString(stb.ToString()); form.ShowDialog(); } } catch (Exception ex) { helper.WriteLog(ex); } }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //try //{ if (state) { for (int i = 0; i < grdGrid.RowCount; i++) { this._Ref = 0; db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@code", grdGrid.GetFocusedRowCellValue("Code").ToString()); db.AddParameterValue("@active", true); db.AddParameterValue("@name", grdGrid.GetFocusedRowCellValue("Name").ToString()); db.AddParameterValue("@desc", grdGrid.GetFocusedRowCellValue("[Desc]").ToString()); db.AddParameterValue("@oldCode", grdGrid.GetFocusedRowCellValue("oldCardCode").ToString()); db.AddParameterValue("@erpCode", grdGrid.GetFocusedRowCellValue("erpCode").ToString()); db.AddParameterValue("@start", grdGrid.GetFocusedRowCellValue("startDate"), SqlDbType.Date); db.AddParameterValue("@finish", grdGrid.GetFocusedRowCellValue("finishDate"), SqlDbType.Date); db.AddParameterValue("@colorLot", 0); db.AddParameterValue("@sizeLot", 0); db.AddParameterValue("@brandRef", 0); db.AddParameterValue("@modelRef", 0); db.AddParameterValue("@producerRef", 0); db.AddParameterValue("@seasonRef", 0); db.AddParameterValue("@groupRef", 0); db.AddParameterValue("@specialCode", /*txtSpecialCode.GetString()*/ ""); db.AddParameterValue("@auth1", /*txtAuth1.GetString()*/ ""); db.AddParameterValue("@auth2", /*txtAuth2.GetString()*/ ""); db.AddParameterValue("@auth3", /* txtAuth3.GetString()*/ ""); db.AddParameterValue("@auth4", /*txtAuth4.GetString()*/ ""); db.AddParameterValue("@local", grdGrid.GetRowCellValue(i, "Yerli Üretim")); db.RunCommand("sp_StockCard", CommandType.StoredProcedure); string code = ""; int cardRef = 0; int unitRef = 0, REf = 0, lenght = 0, weight = 0, width = 0, desi = 0; unitRef = 1; lenght = 0; weight = 0; width = 0; desi = 0; code = "Adet"; db.AddParameterValue("@code", grdGrid.GetFocusedRowCellValue("Code").ToString()); cardRef = int.Parse(db.GetScalarValue("select ref from StStockCard where code=@code").ToString()); db.AddParameterValue("@ref", REf); db.AddParameterValue("@cardRef", cardRef); db.AddParameterValue("@unitRef", unitRef); db.AddParameterValue("@code", code); db.AddParameterValue("@lenght", lenght); db.AddParameterValue("@weight", weight); db.AddParameterValue("@width", width); db.AddParameterValue("@desi", desi); db.RunCommand("sp_StockCardUnit", CommandType.StoredProcedure); db.parameterDelete(); } XtraMessageBox.Show("İşlem başarıyla tamamlandı.", "Başarılı İşlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); helper.ClearForm(this); c.StateStabil(this); this.DialogResult = DialogResult.OK; this.Close(); } else { XtraMessageBox.Show("Kart adı boş geçilen satırların Ad kısmı BOŞ olarak değiştirilmiştir.\n\rBu kayıtlar düzeltilmeden aktarım yapılmayacaktır.", "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Error); grdGrid.Columns[3].OptionsColumn.AllowEdit = true; } //} //catch (Exception ex) //{ // helper.WriteLog(ex); // db.parameterDelete(); //} }
private void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int maxSiraNo = 0, count = 0; try { for (int i = 0; i < grdClassValue.RowCount - 1; i++) { if (string.IsNullOrEmpty(grdClassValue.GetRowCellValue(i, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdClassValue.GetRowCellValue(i, "Ref").ToString()); } db.AddParameterValue("@ref", REf); db.AddParameterValue("@no", int.Parse(grdClassValue.GetRowCellValue(i, "Sıra No").ToString())); db.AddParameterValue("@name", grdClassValue.GetRowCellValue(i, "Sınıf Adı").ToString().ToUpper()); db.RunCommand("sp_StockCardClass", CommandType.StoredProcedure); } int eksikKalan = 11 - grdClassValue.RowCount; for (int i = 0; i < eksikKalan; i++) { count = int.Parse(db.GetScalarValue("Select COUNT(*) from StStockCardClass").ToString()); if (count > 0) { maxSiraNo = int.Parse(db.GetScalarValue("select MAX(no) from StStockCardClass").ToString()); } maxSiraNo++; db.AddParameterValue("@ref", 0); db.AddParameterValue("@no", maxSiraNo); db.AddParameterValue("@name", "BOŞ"); db.RunCommand("sp_StockCardClass", CommandType.StoredProcedure); } for (int i = 0; i < grdValue.RowCount - 1; i++) { if (string.IsNullOrEmpty(grdValue.GetRowCellValue(i, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdValue.GetRowCellValue(i, "Ref").ToString()); } db.AddParameterValue("@ref", REf); db.AddParameterValue("@classRef", selectedClassRef); db.AddParameterValue("@code", grdValue.GetRowCellValue(i, "Özellik Kodu").ToString()); db.AddParameterValue("@name", grdValue.GetRowCellValue(i, "Özellik Adı").ToString().ToUpper()); db.AddParameterValue("@status", bool.Parse(grdValue.GetRowCellValue(i, "Özellik Durumu").ToString()), SqlDbType.Bit); db.RunCommand("sp_StockCardClassDetail", CommandType.StoredProcedure); } XtraMessageBox.Show("İşlem başarılı bir şekilde kaydedildi.", "Başarılı işlem!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; helper.ClearForm(this); c.StateStabil(this); FillData(); } catch (Exception ex) { helper.WriteLog(ex); } }