Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 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);
     }
 }
        private void FrmClassDetailList_Load(object sender, EventArgs e)
        {
            db.AddParameterValue("@ref", this._Ref);
            db.AddParameterValue("@status", true);
            DataTable dtDetail = db.GetDataTable("SELECT Ref, code as [Özellik Kodu],name as [Özellik Adı],status as [Özellik Durumu] FROM StStockCardClassDetail where classRef=@ref and status=@status");

            dgwGrid.DataSource         = dtDetail;
            grdGrid.Columns[0].Visible = false;
        }
Exemple #5
0
        private void treeSell_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeListHitInfo hi = treeSell.CalcHitInfo(e.Location);

            if (hi.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell)
            {
                // TreeList'ten marka seçildiğnide yapılacak işlemler.
                if (hi.Node[cololaylar].ToString() == "Müşteri Cari Hesapları")
                {
                    Sell.FrmCurrentList list = new Sell.FrmCurrentList();
                    list.MdiParent = this;
                    list.Show();
                }
                else if (hi.Node[cololaylar].ToString() == "Satış Fiyat Listeleri")
                {
                    Sell.FrmSellPrices list = new Sell.FrmSellPrices();
                    FormFill(@"SELECT        PL.Ref as Ref, PL.code AS [Liste Kodu], PL.name AS [Liste Adı]
                    FROM            StSellPriceList PL with(nolock)
                    WHERE PL.active = 1 /*AND  @date between PL.startDate and PL.finishDate*/
                    ", "Satış Fiyatları", list);
                }
                else if (hi.Node[cololaylar].ToString() == "Satış Kampanyaları")
                {
                    Sell.FrmCampaings list = new Sell.FrmCampaings();
                    FormFill(@"SELECT        PL.Ref as Ref, PL.code AS [Liste Kodu], PL.name AS [Liste Adı]
                    FROM            StSellCampaing PL with(nolock)         
                    WHERE PL.active = 1/* AND  {0} between PL.startDate and PL.finishDate*/
                    ", "Satış Kampanyaları", list);
                }

                else if (hi.Node[cololaylar].ToString() == "İndirimler")
                {
                    Sell.FrmDiscount list = new Sell.FrmDiscount();
                    db.AddParameterValue("@date", DateTime.Now.ToShortDateString(), SqlDbType.Date);
                    FormFill(@"SELECT        PL.Ref as Ref, PL.code AS [Liste Kodu], PL.name AS [Liste Adı]
                    FROM            StSellDiscount PL with(nolock)         
                    WHERE PL.active = 1 /*AND  GETDATE() between PL.startDate and PL.finishDate*/
                    ", "İndirimler", list);
                }
                else if (hi.Node[cololaylar].ToString() == "Satış Siparişleri")
                {
                    Sell.FrmSellOrder list = new Sell.FrmSellOrder();
                    db.AddParameterValue("@date", DateTime.Now.ToShortDateString(), SqlDbType.Date);
                    FormFill(@"					SELECT SO.Ref,SO.Code as Kod,SO.name as [Adı],SO.date as [Tarih],SW.name as Şube,SB.name as Depo,
                    CA.name as Müşteri, SO.totalPrice as [Toplam Tutar]
                    FROM StSellOrder as SO
                    INNER JOIN StCustomerAccount as CA ON SO.customerRef = CA.Ref
                    INNER JOIN AtlasSys.dbo.sysWhouse as SW on SO.WhouseRef = SW.Ref
                    INNER JOIN AtlasSys.dbo.sysBranch as SB ON SO.BranchRef = SB.Ref ", "Satış Siparişleri", list);
                }
            }
        }
Exemple #6
0
        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());
            }
        }
Exemple #7
0
 private void FrmPriceList_Load(object sender, EventArgs e)
 {
     if (type == "Buy Order")
     {
         db.AddParameterValue("@barcode", barcode);
         db.AddParameterValue("@branchRef", branchRef);
         dt = db.GetDataTable(@"SELECT * FROM Tools_GetBuyPriceList(@branchRef,@barcode)");
     }
     else if (type == "Sell Order")
     {
         db.AddParameterValue("@barcode", barcode);
         db.AddParameterValue("@branchRef", branchRef);
         dt = db.GetDataTable(@"SELECT * FROM Tools_GetSellPriceList(@branchRef,@barcode)");
     }
     dgwGrid.DataSource = dt;
     grdGrid.OptionsBehavior.Editable = false;
     grdGrid.BestFitColumns();
 }
Exemple #8
0
        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);
        }
Exemple #9
0
 private void fillGrid(object sender, EventArgs e)
 {
     if (ledCard.GetValue() != 0)
     {
         dtList.Rows.Clear();
         db.AddParameterValue("@ref", ledCard.GetValue());
         DataTable dt = db.GetDataTable("select * from StStockCardBarcodes where cardRef=@ref");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DataRow row = dtList.NewRow();
             row["Beden"]  = dt.Rows[i]["size"].ToString();
             row["Renk"]   = dt.Rows[i]["color"].ToString();
             row["Barkod"] = dt.Rows[i]["barcode"].ToString();
             dtList.Rows.Add(row);
             db.AddParameterValue("@ref", ledCard.GetValue());
             flashTextBox1.SetString(db.GetScalarValue("select name from StStockCard where Ref=@ref").ToString());
         }
         grdGrid.RefreshData();
         grdGrid.BestFitColumns();
     }
 }
Exemple #10
0
 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();
             }
         }
     }
 }
Exemple #11
0
        void fillComboAndDate()
        {
            DateTime bDate = new DateTime(1990, 1, 1);

            dtpDTarihi.SetDate(bDate);

            dtpIseGiris.SetDate(DateTime.Parse(DateTime.Now.ToShortDateString().ToString()));

            ledBirim.flaLookUp.Properties.ValueMember   = "Ref";
            ledBirim.flaLookUp.Properties.DisplayMember = "name";
            ledBirim.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "Ref", Caption = "dbNo", Visible = false
            });
            ledBirim.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "name", Caption = "Departman"
            });
            ledBirim.flaLookUp.Properties.DataSource = db.GetDataTable("Select * from tbUnit  with(nolock)");


            cmbDerece.flashCombo.Properties.Items.Add("Anne");
            cmbDerece.flashCombo.Properties.Items.Add("Baba");
            cmbDerece.flashCombo.Properties.Items.Add("Eş");
            cmbDerece.flashCombo.Properties.Items.Add("Arkadaş");
            cmbDerece.flashCombo.Properties.Items.Add("Kardeş");
            cmbDerece.flashCombo.Properties.Items.Add("Çocuk");
            cmbDerece.SetString("Kardeş");

            cmbCinsiyet.flashCombo.Properties.Items.Add("Erkek");
            cmbCinsiyet.flashCombo.Properties.Items.Add("Kadın");
            cmbCinsiyet.SetString("Erkek");

            cmbAskerlik.flashCombo.Properties.Items.Add("Yapıldı");
            cmbAskerlik.flashCombo.Properties.Items.Add("Tecilli");
            cmbAskerlik.flashCombo.Properties.Items.Add("Öğrenci");
            cmbAskerlik.flashCombo.Properties.Items.Add("Muaf");
            //cmbAskerlik.SetString("Yapıldı");

            cmbCocuk.flashCombo.Properties.Items.Add("0");
            cmbCocuk.flashCombo.Properties.Items.Add("1");
            cmbCocuk.flashCombo.Properties.Items.Add("2");
            cmbCocuk.flashCombo.Properties.Items.Add("3");
            cmbCocuk.flashCombo.Properties.Items.Add("4");
            cmbCocuk.flashCombo.Properties.Items.Add("5");
            cmbCocuk.flashCombo.Properties.Items.Add("6");
            //cmbCocuk.SetString("0");

            cmbEhliyet.flashCombo.Properties.Items.Add("Yok");
            cmbEhliyet.flashCombo.Properties.Items.Add("M");
            cmbEhliyet.flashCombo.Properties.Items.Add("A");
            cmbEhliyet.flashCombo.Properties.Items.Add("B");
            cmbEhliyet.flashCombo.Properties.Items.Add("C");
            cmbEhliyet.flashCombo.Properties.Items.Add("D");
            cmbEhliyet.flashCombo.Properties.Items.Add("F");
            cmbEhliyet.flashCombo.Properties.Items.Add("G");
            //cmbEhliyet.SetString("B");

            cmbKanGrubu.flashCombo.Properties.Items.Add("AB Rh (+)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("AB Rh (-)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("0  Rh (-)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("0  Rh (+)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("A  Rh (-)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("A  Rh (+)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("B  Rh (-)");
            cmbKanGrubu.flashCombo.Properties.Items.Add("B  Rh (+)");
            //cmbKanGrubu.SetString("AB Rh (+)");

            cmbMedeni.flashCombo.Properties.Items.Add("Bekar");
            cmbMedeni.flashCombo.Properties.Items.Add("Evli");
            //cmbMedeni.SetString("Bekar");


            cmbOgrenim.flashCombo.Properties.Items.Add("İlkokul");
            cmbOgrenim.flashCombo.Properties.Items.Add("Ortaokul");
            cmbOgrenim.flashCombo.Properties.Items.Add("Lise");
            cmbOgrenim.flashCombo.Properties.Items.Add("Ön Lisans");
            cmbOgrenim.flashCombo.Properties.Items.Add("Lisans");
            cmbOgrenim.flashCombo.Properties.Items.Add("Yüksek Lisans");
            cmbOgrenim.flashCombo.Properties.Items.Add("Doktora");
            cmbOgrenim.flashCombo.Properties.Items.Add("Master");
            //cmbOgrenim.SetString("Lisans");

            //if (!string.IsNullOrEmpty(db.GetScalarValue("Select MAX(register) from tbPerson").ToString()))
            //    register = int.Parse(db.GetScalarValue("Select MAX(register) from tbPerson").ToString());

            //register++;
            //txtSicil.SetString(register.ToString());


            cmbFirma.flashCombo.Properties.Items.Add("Badbear");
            cmbFirma.flashCombo.Properties.Items.Add("Boyner");
            cmbFirma.flashCombo.Properties.Items.Add("Gencallar");
            //cmbFirma.SetString("Badbear");

            #region Card File
            dtFOlder.Columns.Add("Ref");
            dtFOlder.Columns.Add("cardRef");
            dtFOlder.Columns.Add("Açıklama");
            dtFOlder.Columns.Add("folderName");
            dtFOlder.Columns.Add("systemFolderName");
            dtFOlder.Columns.Add("folderPath");
            dtFOlder.Columns.Add("folderType");

            dtFOlder.Columns["Ref"].ColumnName              = "Ref";
            dtFOlder.Columns["cardRef"].ColumnName          = "cardRef";
            dtFOlder.Columns["folderName"].ColumnName       = "Dosya Adı";
            dtFOlder.Columns["systemFolderName"].ColumnName = "Sistem Dosya Adı";
            dtFOlder.Columns["folderPath"].ColumnName       = "Dosya Yolu";
            dtFOlder.Columns["folderType"].ColumnName       = "Dosya Tipi";

            //db.AddParameterValue("@ref", this._Ref);


            db.AddParameterValue("@ref", this._Ref);
            dtFillFolder = db.GetDataTable("select * from tbCardFiles where cardRef=@ref");

            for (int t = 0; t < dtFillFolder.Rows.Count; t++)
            {
                DataRow row = dtFOlder.NewRow();
                row["Ref"]              = dtFillFolder.Rows[t][0].ToString();
                row["cardRef"]          = dtFillFolder.Rows[t][1].ToString();
                row["Açıklama"]         = dtFillFolder.Rows[t][2].ToString();
                row["Dosya Adı"]        = dtFillFolder.Rows[t][3].ToString();
                row["Sistem Dosya Adı"] = dtFillFolder.Rows[t][4].ToString();
                row["Dosya Yolu"]       = dtFillFolder.Rows[t][5].ToString();
                row["Dosya Tipi"]       = dtFillFolder.Rows[t][6].ToString();
                dtFOlder.Rows.Add(row);
                grdFolder.RefreshData();
            }

            dgwFolder.DataSource         = dtFOlder;
            grdFolder.Columns[0].Visible = false;
            grdFolder.Columns[1].Visible = false;
            grdFolder.BestFitColumns();

            grdFolder.Columns[3].OptionsColumn.AllowEdit = false;
            grdFolder.Columns[4].OptionsColumn.AllowEdit = false;
            grdFolder.Columns[5].OptionsColumn.AllowEdit = false;
            grdFolder.Columns[6].OptionsColumn.AllowEdit = false;


            #endregion
        }
Exemple #12
0
        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();
            }
        }
Exemple #13
0
        void FillLookUp()
        {
            FrmErpMain main = (FrmErpMain)Application.OpenForms["FrmErpMain"];

            ledCurr.flaLookUp.Properties.Columns.Clear();
            ledCurr.flaLookUp.Properties.ValueMember   = "Ref";
            ledCurr.flaLookUp.Properties.DisplayMember = "name";
            ledCurr.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "Ref", Caption = "dbNo", Visible = false
            });
            ledCurr.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "code", Caption = "Kodu"
            });
            ledCurr.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "name", Caption = "Adı"
            });
            ledCurr.flaLookUp.Properties.DataSource = sysDb.GetDataTable("select * from sysCurrency");

            sysDb.AddParameterValue("@act", true);
            sysDb.AddParameterValue("@ref", Properties.Settings.Default.firmRef);
            riLedBranch.DataSource = main.lstBranch.ToList();

            db.AddParameterValue("@ref", this._Ref);
            dgwBranch.DataSource = db.GetDataTable("select * from StSellPriceListBranch where listRef=@ref ");
        }
Exemple #14
0
        bool Control()
        {
            stb.Clear();

            #region Code Control
            if (!string.IsNullOrEmpty(txtCode.GetString()))
            {
                dtControl.Clear();
                db.AddParameterValue("@code", txtCode.GetString());
                dtControl = db.GetDataTable("select code from StCustomerAccount where code=@code");
                if (dtControl.Rows.Count > 0)
                {
                    codeCount = int.Parse(dtControl.Rows[0][0].ToString());
                }
            }

            if (codeCount > 0 && this._FormMod == Enums.enmFormMod.Yeni)
            {
                stb.AppendLine("Böyle bir cari kodu sistemde mevcut.");
            }


            if (string.IsNullOrEmpty(txtCode.GetString()))
            {
                stb.AppendLine("Cari kodu boş geçilemez.");
            }
            else
            {
                code = txtCode.GetString();
            }


            #endregion

            if (ledType.GetValue() != 200)
            {
                if (string.IsNullOrEmpty(txtVD.GetString()))
                {
                    stb.AppendLine("Vergi dairesi boş geçilemez.");
                }
                if (string.IsNullOrEmpty(txtVNo.GetString()))
                {
                    stb.AppendLine("Vergi numarası boş geçilemez.");
                }
            }

            if (stb.ToString().Length <= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #15
0
        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();
            }
        }
Exemple #16
0
        void FillLookUp()
        {
            ledType.flaLookUp.Properties.Columns.Clear();
            ledType.flaLookUp.Properties.ValueMember   = "Key";
            ledType.flaLookUp.Properties.DisplayMember = "Value";
            ledType.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "Key", Caption = "dbNo", Visible = false
            });
            ledType.flaLookUp.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                FieldName = "Value", Caption = "Adı"
            });
            ledType.flaLookUp.Properties.DataSource = FlashDictionary.campaingTypes.ToList();

            FrmErpMain main = (FrmErpMain)Application.OpenForms["FrmErpMain"];

            riLedBranch.DataSource = main.lstBranch.ToList();

            db.AddParameterValue("@ref", this._Ref);
            dgwBranch.DataSource = db.GetDataTable("select * from StSellCampaingBranch where campaingRef=@ref ");
        }
Exemple #17
0
        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();
            //}
        }
Exemple #18
0
        private void gridView1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Space)
                {
                    if (gridView1.GetFocusedRowCellValue("Seçim").ToString() == "True")
                    {
                        gridView1.SetFocusedRowCellValue("Seçim", false);
                    }
                    else
                    {
                        gridView1.SetFocusedRowCellValue("Seçim", true);
                    }
                }
                else if (e.KeyCode == Keys.Enter)
                {
                    string  barcode = "";
                    string  oldBarcode, state = "";
                    int     miktar;
                    int     LastListRef;
                    DataRow row;
                    gridView1.Columns[2].UnGroup();

                    #region Plug
                    if (gelen == "Plug")
                    {
                        FrmOperation form = (FrmOperation)Application.OpenForms["FrmOperation"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString());
                                            miktar++;
                                            form.grdGrid.SetRowCellValue(a, "Miktar", miktar);
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row               = form.dtBox.NewRow();
                                        row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                        row["Miktar"]     = 1;
                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row               = form.dtBox.NewRow();
                                    row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                    row["Miktar"]     = 1;
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                    }
                    #endregion

                    #region Sell List
                    else if (gelen == "List")
                    {
                        Sell.FrmSellPrices form = (Sell.FrmSellPrices)Application.OpenForms["FrmSellPrices"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row               = form.dtBox.NewRow();
                                        row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                        row["Fiyat"]      = 1;
                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row               = form.dtBox.NewRow();
                                    row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                    row["Fiyat"]      = 1;
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                    }
                    #endregion

                    #region Kampanya

                    else if (gelen == "Campaing")
                    {
                        Sell.FrmCampaings form = (Sell.FrmCampaings)Application.OpenForms["FrmCampaings"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row              = form.dtBox.NewRow();
                                        row["Kart Ref"]  = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]  = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]      = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]     = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row              = form.dtBox.NewRow();
                                    row["Kart Ref"]  = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]  = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]      = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]     = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                    }

                    #endregion

                    #region İndirim

                    else if (gelen == "Discount")
                    {
                        Sell.FrmDiscount form = (Sell.FrmDiscount)Application.OpenForms["FrmDiscount"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row = form.dtBox.NewRow();
                                        row["İndirim Tipi"] = 400;
                                        row["Kart Ref"]     = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]    = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]     = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]         = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]        = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]       = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]    = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"]   = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();


                                        string paramBarcode = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        db.AddParameterValue("@branchRef", branchRef);
                                        db.AddParameterValue("@barcode", paramBarcode);
                                        row["Eski Fiyat"] = decimal.Parse(db.GetScalarValue("select  dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString());



                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row = form.dtBox.NewRow();
                                    row["İndirim Tipi"] = 400;
                                    row["Kart Ref"]     = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]    = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]     = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]         = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]        = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]       = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]    = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"]   = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();



                                    string paramBarcode = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    db.AddParameterValue("@branchRef", branchRef);
                                    db.AddParameterValue("@barcode", paramBarcode);
                                    row["Eski Fiyat"] = decimal.Parse(db.GetScalarValue("select  dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString());



                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                    }

                    #endregion

                    #region Buy List
                    else if (gelen == "Buy")
                    {
                        Buy.FrmBuyList form = (Buy.FrmBuyList)Application.OpenForms["FrmBuyList"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row               = form.dtBox.NewRow();
                                        row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                        row["Fiyat"]      = 1;
                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row               = form.dtBox.NewRow();
                                    row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                    row["Fiyat"]      = 1;
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                    }
                    #endregion

                    #region Buy Order
                    if (gelen == "Buy Order")
                    {
                        Buy.FrmBuyOrder form = (Buy.FrmBuyOrder)Application.OpenForms["FrmBuyOrder"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString());
                                            miktar++;
                                            form.grdGrid.SetRowCellValue(a, "Miktar", miktar);
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row               = form.dtBox.NewRow();
                                        row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                        row["Miktar"]     = 1;

                                        db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString());
                                        db.AddParameterValue("@branchRef", form.ledBranch.GetValue());
                                        string price = db.GetScalarValue("select  dbo.Tools_GetLastActiveBuyPrice(@barcode,@branchRef)").ToString();
                                        row["Birim Fiyat"] = price;
                                        decimal total = 1 * decimal.Parse(price);
                                        row["Toplam Tutar"] = total;

                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row               = form.dtBox.NewRow();
                                    row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                    row["Miktar"]     = 1;
                                    db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString());
                                    db.AddParameterValue("@branchRef", form.ledBranch.GetValue());
                                    string price = db.GetScalarValue("select  dbo.Tools_GetLastActiveBuyPrice(@barcode,@branchRef)").ToString();
                                    row["Birim Fiyat"] = price;
                                    decimal total = 1 * decimal.Parse(price);
                                    row["Toplam Tutar"] = total;
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                        form.Calculate();
                    }
                    #endregion

                    #region Sell Order
                    if (gelen == "Sell Order")
                    {
                        Sell.FrmSellOrder form = (Sell.FrmSellOrder)Application.OpenForms["FrmSellOrder"];
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True")
                            {
                                if (form.grdGrid.RowCount - 1 > 0)
                                {
                                    for (int a = 0; a < form.grdGrid.RowCount - 1; a++)
                                    {
                                        barcode    = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString();
                                        if (barcode == oldBarcode)
                                        {
                                            miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString());
                                            miktar++;
                                            form.grdGrid.SetRowCellValue(a, "Miktar", miktar);
                                            state = "true";
                                            break;
                                        }
                                        else
                                        {
                                            state = "false";
                                        }
                                    }
                                    if (state == "false")
                                    {
                                        row               = form.dtBox.NewRow();
                                        row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                        row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                        row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                        row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                        row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                        row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                        row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                        row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                        row["Miktar"]     = 1;

                                        db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString());
                                        db.AddParameterValue("@branchRef", form.ledBranch.GetValue());
                                        string price = db.GetScalarValue("select  dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString();
                                        row["Birim Fiyat"] = price;
                                        decimal total = 1 * decimal.Parse(price);
                                        row["Toplam Tutar"] = total;

                                        form.dtBox.Rows.Add(row);
                                    }
                                }
                                else
                                {
                                    row               = form.dtBox.NewRow();
                                    row["Kart Ref"]   = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString());
                                    row["Kart Kodu"]  = gridView1.GetRowCellValue(i, "Kart Kodu").ToString();
                                    row["Kart Adı"]   = gridView1.GetRowCellValue(i, "Kart Adı").ToString();
                                    row["Renk"]       = gridView1.GetRowCellValue(i, "Renk").ToString();
                                    row["Beden"]      = gridView1.GetRowCellValue(i, "Beden").ToString();
                                    row["Barkod"]     = gridView1.GetRowCellValue(i, "Barkod").ToString();
                                    row["Birim Ref"]  = gridView1.GetRowCellValue(i, "Birim Ref").ToString();
                                    row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString();
                                    row["Miktar"]     = 1;
                                    db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString());
                                    db.AddParameterValue("@branchRef", form.ledBranch.GetValue());
                                    string price = db.GetScalarValue("select  dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString();
                                    row["Birim Fiyat"] = price;
                                    decimal total = 1 * decimal.Parse(price);
                                    row["Toplam Tutar"] = total;
                                    form.dtBox.Rows.Add(row);
                                }
                            }
                        }
                        form.Calculate();
                    }
                    #endregion

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                helper.WriteLog(ex);
            }
        }
Exemple #19
0
        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);
            }
        }