} // this metod writed for Kübra Çifçi 02.12.2018 Sunday 00:41 private void FrmBuyList_Load(object sender, EventArgs e) { helper.ClearForm(this); SetForm(); FillLookUp(); if (this._FormMod == Enums.enmFormMod.Guncelle) { db.AddParameterValue("@ref", this._Ref); DataTable dt = db.GetDataTable("select * from StBuyPriceList where Ref=@ref"); chkActive.SetBoolValue(bool.Parse(dt.Rows[0][1].ToString())); txtCode.SetString(dt.Rows[0][2].ToString()); txtName.SetString(dt.Rows[0][3].ToString()); ledCurr.SetValue(int.Parse(dt.Rows[0][4].ToString())); dtpStart.SetDate(DateTime.Parse(dt.Rows[0][5].ToString())); dtpFinish.SetDate(DateTime.Parse(dt.Rows[0][6].ToString())); db.parameterDelete(); db.AddParameterValue("@ref", this._Ref); DataTable dtDetail = db.GetDataTable("Select * from StBuyPriceListDetails where listRef=@ref"); for (int i = 0; i < dtDetail.Rows.Count; i++) { DataRow row = dtBox.NewRow(); row["Ref"] = int.Parse(dtDetail.Rows[i][0].ToString()); row["Liste Ref"] = int.Parse(dtDetail.Rows[i][1].ToString()); row["Kart Ref"] = int.Parse(dtDetail.Rows[i][2].ToString()); db.AddParameterValue("@ref", dtDetail.Rows[i][2].ToString()); DataTable dtStock = db.GetDataTable("select code,name from StStockCard where Ref=@ref"); row["Kart Kodu"] = (dtStock.Rows[0][0].ToString()); row["Kart Adı"] = (dtStock.Rows[0][1].ToString()); db.AddParameterValue("@barcode", dtDetail.Rows[i][4].ToString()); DataTable dtBarcode = db.GetDataTable("select color,size from StStockCardBarcodes where barcode=@barcode"); row["Renk"] = (dtBarcode.Rows[0][0].ToString()); row["Beden"] = (dtBarcode.Rows[0][1].ToString()); row["Birim Ref"] = int.Parse(dtDetail.Rows[i][3].ToString()); sysDb.AddParameterValue("@unitRef", dtDetail.Rows[i][3].ToString()); row["Birim Kodu"] = sysDb.GetScalarValue("select symbol from SysUnit where ref=@unitRef").ToString(); row["Barkod"] = (dtDetail.Rows[i][4].ToString()); row["Fiyat"] = decimal.Parse(dtDetail.Rows[i][5].ToString()); dtBox.Rows.Add(row); } dgwGrid.DataSource = dtBox; grdGrid.RefreshData(); } GridColumn colModelPrice = grdGrid.Columns["price"]; colModelPrice.DisplayFormat.FormatType = FormatType.Numeric; colModelPrice.DisplayFormat.FormatString = "{0:n}"; c.StateStabil(this); }
void FillData() { db.AddParameterValue("@ref", this._Ref); DataTable dtPlug = db.GetDataTable("select * from StBuyOrder where Ref=@ref"); if (!string.IsNullOrEmpty(dtPlug.Rows[0][1].ToString())) { txtCode.SetString(dtPlug.Rows[0][1].ToString()); txtName.SetString(dtPlug.Rows[0][2].ToString()); dtpPlugDate.SetDate(DateTime.Parse(dtPlug.Rows[0][3].ToString())); ledBranch.SetValue(int.Parse(dtPlug.Rows[0][4].ToString())); ledWhouse.SetValue(int.Parse(dtPlug.Rows[0][5].ToString())); txtDesc.SetString(dtPlug.Rows[0][6].ToString()); ledCustomer.SetValue(int.Parse(dtPlug.Rows[0]["customerRef"].ToString())); db.AddParameterValue("@ref", this._Ref); DataTable dtPlugDetails = db.GetDataTable("select * from StBuyOrderDetails where orderRef=@ref"); for (int i = 0; i < dtPlugDetails.Rows.Count; i++) { DataRow row = dtBox.NewRow(); row["Ref"] = dtPlugDetails.Rows[i]["Ref"]; row["Fiş Ref"] = dtPlugDetails.Rows[i]["orderRef"]; row["Kart Ref"] = dtPlugDetails.Rows[i]["cardRef"]; row["Kart Kodu"] = dtPlugDetails.Rows[i]["cardCode"]; db.parameterDelete(); db.AddParameterValue("@ref", dtPlugDetails.Rows[i]["cardRef"], SqlDbType.Int); row["Kart Adı"] = db.GetScalarValue("select name from StStockCard where ref=@ref").ToString(); db.parameterDelete(); row["Barkod"] = dtPlugDetails.Rows[i]["barcode"]; db.AddParameterValue("@barcode", dtPlugDetails.Rows[i]["barcode"]); row["Renk"] = db.GetScalarValue("select color from StStockCardBarcodes where barcode=@barcode"); db.AddParameterValue("@barcode", dtPlugDetails.Rows[i]["barcode"]); row["Beden"] = db.GetScalarValue("select size from StStockCardBarcodes where barcode=@barcode"); db.parameterDelete(); row["Birim Ref"] = dtPlugDetails.Rows[i]["unitRef"]; sysDb.AddParameterValue("@ref", dtPlugDetails.Rows[i]["unitRef"], SqlDbType.Int); row["Birim Kodu"] = sysDb.GetScalarValue("select symbol from sysUnit where Ref=@ref").ToString(); sysDb.parameterDelete(); row["Miktar"] = dtPlugDetails.Rows[i]["quantity"]; row["Birim Fiyat"] = dtPlugDetails.Rows[i]["unitPrice"]; row["Toplam Tutar"] = dtPlugDetails.Rows[i]["linePrice"]; row["Satır Açıklaması"] = dtPlugDetails.Rows[i]["lineDescription"]; dtBox.Rows.Add(row); } grdGrid.RefreshData(); RowCount = grdGrid.RowCount; Calculate(); grdGrid.BestFitColumns(); } }
private void FrmDiscount_Load(object sender, EventArgs e) { helper.ClearForm(this); SetForm(); FillLookUp(); if (this._FormMod == Enums.enmFormMod.Guncelle) { db.AddParameterValue("@ref", this._Ref); DataTable dt = db.GetDataTable("select * from StSellDiscount where Ref=@ref"); chkActive.SetBoolValue(bool.Parse(dt.Rows[0][1].ToString())); txtCode.SetString(dt.Rows[0][2].ToString()); txtName.SetString(dt.Rows[0][3].ToString()); dtpStart.SetDate(DateTime.Parse(dt.Rows[0][4].ToString())); dtpFinish.SetDate(DateTime.Parse(dt.Rows[0][5].ToString())); db.parameterDelete(); db.AddParameterValue("@ref", this._Ref); dtDetail = db.GetDataTable("select * from StSellDiscountDetail where discountRef=@ref"); for (int i = 0; i < dtDetail.Rows.Count; i++) { DataRow row = dtBox.NewRow(); row["İndirim Tipi"] = dtDetail.Rows[i]["lineType"].ToString(); row["Ref"] = dtDetail.Rows[i]["Ref"].ToString(); row["Liste Ref"] = dtDetail.Rows[i]["discountRef"].ToString(); row["Kart Ref"] = dtDetail.Rows[i]["cardRef"].ToString(); db.AddParameterValue("@ref", dtDetail.Rows[i]["cardRef"].ToString()); DataTable dtStock = db.GetDataTable("select code,name from StStockCard where Ref=@ref"); row["Kart Kodu"] = (dtStock.Rows[0][0].ToString()); row["Kart Adı"] = (dtStock.Rows[0][1].ToString()); row["Barkod"] = dtDetail.Rows[i]["barcode"].ToString(); db.AddParameterValue("@barcode", dtDetail.Rows[i]["barcode"].ToString()); DataTable dtBarcode = db.GetDataTable("select color,size from StStockCardBarcodes where barcode=@barcode"); row["Renk"] = (dtBarcode.Rows[0][0].ToString()); row["Beden"] = (dtBarcode.Rows[0][1].ToString()); row["Birim Ref"] = int.Parse(dtDetail.Rows[i]["unitRef"].ToString()); sysDb.AddParameterValue("@ref", dtDetail.Rows[i]["unitRef"].ToString()); row["Birim Kodu"] = sysDb.GetScalarValue("select symbol from SysUnit where ref=@ref").ToString(); row["Oran"] = dtDetail.Rows[i]["rate"].ToString(); row["Eski Fiyat"] = dtDetail.Rows[i]["oldPrice"].ToString(); row["Yeni Fiyat"] = dtDetail.Rows[i]["newPrice"].ToString(); dtBox.Rows.Add(row); } dgwGrid.DataSource = dtBox; grdGrid.RefreshData(); } c.StateStabil(this); }
void FillData() { db.AddParameterValue("@ref", this._Ref); bindData.DataSource = db.GetDataTable("select * from StStockCardSizeDetails where SizeRef=@ref order by Ref ASC"); RowCount = grdGrid.RowCount; db.parameterDelete(); if (this._FormMod == Enums.enmFormMod.Guncelle) { db.AddParameterValue("@ref", this._Ref); DataTable dt = db.GetDataTable("select * from StStockCardSize where Ref=@ref"); txtCode.SetString(dt.Rows[0][1].ToString()); txtName.SetString(dt.Rows[0][2].ToString()); } }
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_StockCardGroup", 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(); } }
private void FrmCampaings_Load(object sender, EventArgs e) { helper.ClearForm(this); SetForm(); FillLookUp(); if (this._FormMod == Enums.enmFormMod.Guncelle) { db.AddParameterValue("@ref", this._Ref); DataTable dt = db.GetDataTable("select * from StSellCampaing where Ref=@ref"); ledType.SetValue(int.Parse(dt.Rows[0][1].ToString())); chkActive.SetBoolValue(bool.Parse(dt.Rows[0][2].ToString())); txtCode.SetString(dt.Rows[0][3].ToString()); txtName.SetString(dt.Rows[0][4].ToString()); dtpStart.SetDate(DateTime.Parse(dt.Rows[0][5].ToString())); dtpFinish.SetDate(DateTime.Parse(dt.Rows[0][6].ToString())); txtPropx.SetString(dt.Rows[0][7].ToString()); txtPropy.SetString(dt.Rows[0][8].ToString()); db.parameterDelete(); db.AddParameterValue("@ref", this._Ref); DataTable dtDetail = db.GetDataTable("Select * from StSellCampaingDetail where campaingRef=@ref"); for (int i = 0; i < dtDetail.Rows.Count; i++) { DataRow row = dtBox.NewRow(); row["Ref"] = int.Parse(dtDetail.Rows[i][0].ToString()); row["Kampanya Ref"] = int.Parse(dtDetail.Rows[i][1].ToString()); row["Kart Ref"] = int.Parse(dtDetail.Rows[i][2].ToString()); db.AddParameterValue("@ref", dtDetail.Rows[i][2].ToString()); DataTable dtStock = db.GetDataTable("select code,name from StStockCard where Ref=@ref"); row["Kart Kodu"] = (dtStock.Rows[0][0].ToString()); row["Kart Adı"] = (dtStock.Rows[0][1].ToString()); db.AddParameterValue("@barcode", dtDetail.Rows[i][3].ToString()); DataTable dtBarcode = db.GetDataTable("select color,size from StStockCardBarcodes where barcode=@barcode"); row["Renk"] = (dtBarcode.Rows[0][0].ToString()); row["Beden"] = (dtBarcode.Rows[0][1].ToString()); row["Barkod"] = (dtDetail.Rows[i][3].ToString()); dtBox.Rows.Add(row); } dgwGrid.DataSource = dtBox; grdGrid.RefreshData(); } c.StateStabil(this); }
public void WriteLog(Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show("Beklenmedik bir hatayla karşılaşıldı.", "HATA!" , MessageBoxButtons.OK, MessageBoxIcon.Error); db.parameterDelete(); WriteLogLine("Hata", "Logs//", Properties.Settings.Default.errorCount, ex.Message.ToString()); Properties.Settings.Default.errorCount++; Properties.Settings.Default.Save(); }
void Save() { if (Control()) { db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@code", txtCode.GetString()); db.AddParameterValue("@name", txtName.GetString()); db.AddParameterValue("@customerRef", ledCustomer.GetValue()); db.AddParameterValue("@date", dtpPlugDate.GetDate().ToShortDateString(), SqlDbType.Date); db.AddParameterValue("@branch", branch); db.AddParameterValue("@desc", txtDesc.GetString()); db.AddParameterValue("@state", true); db.AddParameterValue("@totalPrice", allTotal, SqlDbType.Decimal); db.RunCommand("sp_BuyServiceOrder", CommandType.StoredProcedure); db.parameterDelete(); if (this._FormMod == Enums.enmFormMod.Yeni) { this._Ref = int.Parse(db.GetScalarValue("select MAX(Ref) from StBuyServiceOrder").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 serviceRef = int.Parse(grdGrid.GetRowCellValue(i, "Hizmet Ref").ToString()); string serviceCode = grdGrid.GetRowCellValue(i, "Hizmet Kodu").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("@serviceRef", serviceRef); db.AddParameterValue("@serviceCode", serviceCode); 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_BuyServiceOrderDetails", 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 (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) { try { if (Control() == true) { calculateGain(); if (!File.Exists(goal) && !string.IsNullOrEmpty(goal)) { Directory.CreateDirectory(goal); File.Copy(MainPath, goal + newName); } db.AddParameterValue("@ref", _Ref); db.AddParameterValue("@name", txtAd.GetString()); db.AddParameterValue("@surname", txtSoyad.GetString()); db.AddParameterValue("@tc", txtTC.GetString()); db.AddParameterValue("@bdate", dtpDTarihi.GetDate(), SqlDbType.Date); db.AddParameterValue("@bPlace", txtDogumYeri.GetString()); db.AddParameterValue("@mName", txtAnneAdi.GetString()); db.AddParameterValue("@dName", txtBabaAdi.GetString()); db.AddParameterValue("@sex", cmbCinsiyet.GetString()); db.AddParameterValue("@bgroup", cmbKanGrubu.GetString()); db.AddParameterValue("@mStatus", cmbMedeni.GetString()); db.AddParameterValue("@register", txtSicil.GetString()); db.AddParameterValue("@mission", txtGorev.GetString()); db.AddParameterValue("@unit", ledBirim.GetValue()); db.AddParameterValue("@sDate", dtpIseGiris.GetDate(), SqlDbType.Date); db.AddParameterValue("@gsm", txtGSM.GetString()); db.AddParameterValue("@mail", txtMail.GetString()); db.AddParameterValue("@address", txtAdres.GetString(), SqlDbType.NVarChar); db.AddParameterValue("@cname", txtYAd.GetString()); db.AddParameterValue("@cSurname", txtYSoyad.GetString()); db.AddParameterValue("@cRank", cmbDerece.GetString()); db.AddParameterValue("@cGsm", txtYgsm.GetString()); db.AddParameterValue("@dLicence", cmbEhliyet.GetString()); db.AddParameterValue("@solider", cmbAskerlik.GetString()); db.AddParameterValue("@education", cmbOgrenim.GetString()); db.AddParameterValue("@children", cmbCocuk.GetString()); db.AddParameterValue("@imagePath", nowppPath); db.AddParameterValue("@gain", gain); db.AddParameterValue("@firm", cmbFirma.GetString()); db.AddParameterValue("@insurance", sigorta); db.AddParameterValue("@IBAN", txtIBAN.GetString()); db.AddParameterValue("@campus", txtYerleske.GetString()); db.AddParameterValue("@blood", cmbKanGrubu.GetString()); db.RunCommand("sp_Person", CommandType.StoredProcedure); #region File this._Ref = int.Parse(db.GetScalarValue("select MAX(Ref) from tbPerson").ToString()); string foldername = "", sysName = "", path = "", type = "", desc = ""; for (int k = 0; k < grdFolder.RowCount - 1; k++) { if (string.IsNullOrEmpty(grdFolder.GetRowCellValue(k, "Ref").ToString())) { REf = 0; } else { REf = int.Parse(grdFolder.GetRowCellValue(k, "Ref").ToString()); } foldername = grdFolder.GetRowCellValue(k, "Dosya Adı").ToString(); sysName = grdFolder.GetRowCellValue(k, "Sistem Dosya Adı").ToString(); path = grdFolder.GetRowCellValue(k, "Dosya Yolu").ToString(); desc = grdFolder.GetRowCellValue(k, "Açıklama").ToString(); type = grdFolder.GetRowCellValue(k, "Dosya Tipi").ToString(); db.AddParameterValue("@ref", REf); db.AddParameterValue("@cardRef", this._Ref); db.AddParameterValue("@desc", desc, SqlDbType.NVarChar); db.AddParameterValue("@name", foldername, SqlDbType.NVarChar); db.AddParameterValue("@sysName", sysName, SqlDbType.NVarChar); db.AddParameterValue("@path", path, SqlDbType.NVarChar); db.AddParameterValue("@type", type, SqlDbType.NVarChar); db.RunCommand("sp_CardFile", CommandType.StoredProcedure); if (!string.IsNullOrEmpty(path)) { string goal = Application.StartupPath + @"\Images\Person\" + txtAd.GetString() + txtSoyad.GetString() + "\\"; if (!File.Exists(goal)) { Directory.CreateDirectory(goal); } if (this._FormMod == Enums.enmFormMod.Yeni) { File.Copy(path, goal + sysName); } else if (this._FormMod == Enums.enmFormMod.Guncelle) { string newPath = path + sysName; if (!File.Exists(newPath)) { File.Copy(newPath, goal + sysName); } } db.AddParameterValue("@ref", this._Ref); db.AddParameterValue("@path", goal, SqlDbType.NVarChar); db.RunCommand("update tbCardFiles set folderPath=@path where cardRef=@ref"); } db.parameterDelete(); } #endregion if (nowppPath != oldPath && !string.IsNullOrEmpty(oldPath)) { File.Open(oldPath, FileMode.Open).Close(); File.Delete(oldPath); } 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(); } } catch (Exception ex) { helper.WriteLog(ex); db.parameterDelete(); } }