Example #1
0
        private void Edit_Button_Click(object sender, EventArgs e)
        {
            if (this.Revenue_List.SelectedItems.Count > 0)
            {
                MuhasebeEntities m_Context  = new MuhasebeEntities();
                ListViewItem     m_Selected = this.Revenue_List.SelectedItems[0];
                int m_ItemID = Convert.ToInt32(m_Selected.Tag);

                if (m_ItemID > 0)
                {
                    Income m_Income = m_Context.Incomes.Where(q => q.ID == m_ItemID).FirstOrDefault();

                    if (m_Income.OwnerID != null && m_Income.OwnerID == Program.User.WorksAtID)
                    {
                        Edit_Revenue_Pop m_Pop = new Edit_Revenue_Pop();
                        m_Pop.Income         = m_Income;
                        m_Pop.RevenueEdited += Pop_RevenueEdited;
                        m_Pop.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Bu nesneyi düzenlemek için yetkiniz bulunmamaktadır", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Düzenleme sırasında bir hata oluştu", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        private void EditMovement(AccountMovement movement)
        {
            switch (movement.MovementTypeID)
            {
            case 1:     // Ticari Mat Satışı Yapıldı
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    Invoice m_Invoice = m_Context.Invoices.Where(q => q.ID == movement.ContractID).FirstOrDefault();
                    m_Context.Entry(m_Invoice).State = System.Data.Entity.EntityState.Detached;

                    if (m_Invoice != null)
                    {
                        Edit_Sale_Mdi m_Mdi = new Edit_Sale_Mdi();
                        m_Mdi.Invoice = m_Invoice;
                        m_Mdi.ShowDialog();
                    }
                }

                break;
            }

            case 2:     // Alacak tahsilatı yapıldı
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    Income m_Income = m_Context.Incomes.Where(q => q.ID == movement.ContractID).FirstOrDefault();
                    m_Context.Entry(m_Income).State = System.Data.Entity.EntityState.Detached;

                    if (m_Income != null)
                    {
                        Edit_Revenue_Pop m_Pop = new Edit_Revenue_Pop();
                        m_Pop.Income = m_Income;
                        m_Pop.ShowDialog();
                    }
                }

                break;
            }

            case 3:     //Ürün Tedariği Yapıldı
            {
                StockMovement m_StockMovement = null;

                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    m_StockMovement = m_Context.StockMovements.Where(q => q.ID == movement.ContractID).FirstOrDefault();
                    //m_Context.Entry(m_StockMovement).State = System.Data.Entity.EntityState.Detached;
                };

                if (m_StockMovement != null)
                {
                    Edit_StockMovement_Mdi m_Mdi = new Edit_StockMovement_Mdi();
                    m_Mdi.StockMovement = m_StockMovement;
                    m_Mdi.ShowDialog();
                }


                break;
            }

            case 4:     //Borç ödemesi yapıldı
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    Expenditure m_Expenditure = m_Context.Expenditures.Where(q => q.ID == movement.ContractID).FirstOrDefault();
                    m_Context.Entry(m_Expenditure).State = System.Data.Entity.EntityState.Detached;

                    if (m_Expenditure != null)
                    {
                        Edit_Expenditure_Pop m_Pop = new Edit_Expenditure_Pop();
                        m_Pop.Expenditure = m_Expenditure;
                        m_Pop.ShowDialog();
                    }
                }

                break;
            }
            }

            this.PopulateAccountHistory(movement.Account);
        }