Beispiel #1
0
        public void DisplayData(string transactionID = "-1")
        {
            try
            {
                ClearControl();

                //Master Data
                TransactionOutMaster objMasterHandler = new TransactionOutMaster();
                TransactionOutMaster objMaster        = objMasterHandler.GetTransactionOutMaster(transactionID);

                if (objMaster != null)
                {
                    txtTranID.Text      = objMaster.TransactionID;
                    dtpTranInDate.Value = objMaster.TransactionDate;
                    txtRemarks.Text     = objMaster.Remarks;

                    //Transaction Data
                    TransactionOutDetails        tranDetailsHandler = new TransactionOutDetails();
                    List <TransactionOutDetails> list = new List <TransactionOutDetails>();

                    list = tranDetailsHandler.GetTransactionInList(transactionID);
                    if ((list != null))
                    {
                        if (list.Count > 0)
                        {
                            int i;

                            foreach (TransactionOutDetails obj in list)
                            {
                                i = dgvMain.RowCount;

                                dgvMain.RowCount = i + 1;
                                dgvMain.Rows[i].Cells[SNo].Value = i + 1;

                                dgvMain.Rows[i].Cells[ItemID].Value   = obj.ItemMaster.ItemID;
                                dgvMain.Rows[i].Cells[ItemName].Value = obj.ItemMaster.ItemName;
                                //dgvMain.Rows[i].Cells[Author].Value = obj.BookMaster.Author;
                                //dgvMain.Rows[i].Cells[EditionYear].Value = obj.BookMaster.EditionYear;
                                //dgvMain.Rows[i].Cells[EditionNo].Value = obj.BookMaster.EditionNo;
                                dgvMain.Rows[i].Cells[Unit].Value = obj.Unit;
                            }
                        }
                    }
                    ControlStatus(true);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n" + ex.Message);
            }
        }
        public void DisplayData(string transactionID = "-1")
        {
            try
            {
                ClearControl();

                //Master Data
                TransactionOutMaster objMasterHandler = new TransactionOutMaster();
                TransactionOutMaster objMaster        = objMasterHandler.GetTransactionOutMaster(transactionID);

                if (objMaster != null)
                {
                    txtTranID.Text      = objMaster.TransactionID;
                    dtpTranInDate.Value = objMaster.TransactionDate;

                    if (objMaster.Amount > 0)
                    {
                        txtAmount.Text = Convert.ToString(objMaster.Amount);
                    }

                    txtRemarks.Text = objMaster.Remarks;

                    PartyID = objMaster.PartyID;
                    //Party details
                    PartyMaster objPartyMaster = new PartyMaster();
                    PartyMaster partyMaster    = new PartyMaster();
                    partyMaster = objPartyMaster.GetPartyMasterDetails(PartyID);
                    if (partyMaster != null)
                    {
                        txtPartyName.Text = partyMaster.PartyName;
                        txtContactNo.Text = partyMaster.ContactNo;
                        txtAddress.Text   = partyMaster.Address;
                    }
                    else
                    {
                        txtPartyName.Text = "";
                        txtContactNo.Text = "";
                        txtAddress.Text   = "";
                    }

                    //Transaction Data
                    TransactionOutDetails        tranDetailsHandler = new TransactionOutDetails();
                    List <TransactionOutDetails> list = new List <TransactionOutDetails>();

                    list = tranDetailsHandler.GetTransactionInList(transactionID);
                    if ((list != null))
                    {
                        if (list.Count > 0)
                        {
                            int i;

                            foreach (TransactionOutDetails obj in list)
                            {
                                i = dgvMain.RowCount;

                                dgvMain.RowCount = i + 1;
                                dgvMain.Rows[i].Cells[SNo].Value = i + 1;

                                dgvMain.Rows[i].Cells[ItemID].Value   = obj.ItemMaster.ItemID;
                                dgvMain.Rows[i].Cells[ItemName].Value = obj.ItemMaster.ItemName;
                                //dgvMain.Rows[i].Cells[Author].Value = obj.BookMaster.Author;
                                //dgvMain.Rows[i].Cells[EditionYear].Value = obj.BookMaster.EditionYear;
                                //dgvMain.Rows[i].Cells[EditionNo].Value = obj.BookMaster.EditionNo;
                                dgvMain.Rows[i].Cells[Unit].Value = obj.Unit;
                                if (obj.Rate > 0)
                                {
                                    dgvMain.Rows[i].Cells[Rate].Value = obj.Rate;
                                }
                                if (obj.Amount > 0)
                                {
                                    dgvMain.Rows[i].Cells[Amount].Value = obj.Amount;
                                }
                            }
                        }
                    }
                }

                ControlStatus(true);
            }

            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n" + ex.Message);
            }
        }