Пример #1
0
        public void DisplayData(string transactionID = "-1")
        {
            try
            {
                ClearControl();

                //Master Data
                TransactionInMaster objMasterHandler = new TransactionInMaster();
                TransactionInMaster objMaster        = objMasterHandler.GetTransactionInMaster(transactionID);

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

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

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

                            foreach (TransactionInDetails 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);
            }
        }