コード例 #1
0
        public List <BooksTransactionOutMaster> GetTransactionOutMasterList()
        {
            List <BooksTransactionOutMaster> list = null;

            string commandText = OleDBHelper.GetQueryText("BooksTransactionOutMaster_SelectAll", QueryType.Views);


            using (DataTable table = OleDBHelper.ExecuteSelectCommand(commandText, CommandType.Text))
            {
                //check if any record exist or not
                if (table.Rows.Count > 0)
                {
                    //Lets go ahead and create the list of employees
                    list = new List <BooksTransactionOutMaster>();

                    //Now lets populate the employee details into the list of employees
                    foreach (DataRow row in table.Rows)
                    {
                        BooksTransactionOutMaster obj = new BooksTransactionOutMaster();
                        obj.TransactionID   = Convert.ToString(row["TransactionID"]);
                        obj.TransactionDate = Convert.ToDateTime(row["TransactionDate"]);
                        obj.Remarks         = Convert.ToString(row["Remarks"]);

                        list.Add(obj);
                    }
                }
            }

            return(list);
        }
コード例 #2
0
        public BooksTransactionOutMaster GetTransactionOutMaster(string transactionID)
        {
            BooksTransactionOutMaster obj = null;

            string commandText = OleDBHelper.GetQueryText("BooksTransactionOutMaster_SelectID", QueryType.Procedures);

            OleDbParameter[] parameters = new OleDbParameter[]
            {
                new OleDbParameter("@TransactionID", transactionID)
            };

            using (DataTable table = OleDBHelper.ExecuteParamerizedSelectCommand(commandText, CommandType.Text, parameters))
            {
                //check if any record exist or not
                if (table.Rows.Count > 0)
                {
                    //Lets go ahead and create the list of employees
                    obj = new BooksTransactionOutMaster();

                    obj.TransactionID   = Convert.ToString(table.Rows[0]["TransactionID"]);
                    obj.TransactionDate = Convert.ToDateTime(table.Rows[0]["TransactionDate"]);
                    obj.Remarks         = Convert.ToString(table.Rows[0]["Remarks"]);
                }
            }

            return(obj);
        }
コード例 #3
0
        public void DisplayData(string transactionID = "-1")
        {
            try
            {
                //Master Data

                BooksTransactionOutMaster objMaster = new BooksTransactionOutMaster();
                objMaster = objMaster.GetTransactionOutMaster(transactionID);

                if (objMaster != null)
                {
                    ClearControl();

                    txtTranID.Text      = objMaster.TransactionID;
                    dtpTranInDate.Value = objMaster.TransactionDate;
                    txtRemarks.Text     = objMaster.Remarks;

                    //Transaction Data
                    BooksTransactionOutDetails        tranDetails = new BooksTransactionOutDetails();
                    List <BooksTransactionOutDetails> list        = new List <BooksTransactionOutDetails>();

                    list = tranDetails.GetTransactionInList(transactionID);

                    if (list.Count > 0)
                    {
                        int i;

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

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

                            dgvMain.Rows[i].Cells[BookID].Value      = obj.BookMaster.BookID;
                            dgvMain.Rows[i].Cells[Subject].Value     = obj.BookMaster.Subject;
                            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);
                }
                else
                {
                    MessageBox.Show("No Record found");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n" + ex.Message);
            }
        }
コード例 #4
0
        private void Save()
        {
            bool result = false;
            BooksTransactionOutMaster objOutMaster = GetTransactionOutMasterInterface();


            List <BooksTransactionOutDetails> objDetailsList = GetTransactionInDetailsOutiterface();
            BooksTransactionOutDetails        objDetails     = new BooksTransactionOutDetails();

            if (AddMode)
            {
                result = objOutMaster.AddNewTransactionOutMaster(objOutMaster);

                if (result)
                {
                    result = objDetails.AddNewTransactionOutDetails(objDetailsList);
                }
                if (result)
                {
                    result = GlobalFunction.UpdateUniqueCode("BooksTransactionOutMaster");
                }
            }
            else if (EditMode)
            {
                result = objOutMaster.UpdateTransactionOutMaster(objOutMaster);
                if (result)
                {
                    result = objDetails.DeleteTransactionOutMaster(objOutMaster.TransactionID);

                    if (result)
                    {
                        result = objDetails.AddNewTransactionOutDetails(objDetailsList);
                    }
                }
            }

            if (result == true)
            {
                if (AddMode)
                {
                    MessageBox.Show("New Record added successfully");
                }
                else
                {
                    MessageBox.Show("Record updated successfully");
                }

                ControlStatus(true);
            }
            else
            {
                MessageBox.Show("Errror Occurs!");
            }
        }
コード例 #5
0
        public bool UpdateTransactionOutMaster(BooksTransactionOutMaster obj)
        {
            OleDbParameter[] parameters = new OleDbParameter[]
            {
                new OleDbParameter("@TransactionDate", obj.TransactionDate),
                new OleDbParameter("@Remarks", obj.Remarks),
                new OleDbParameter("@CreatedOn", GlobalFunction.GetDateTimeWithoutMiliSecond(DateTime.Now)),
                new OleDbParameter("@TransactionID", obj.TransactionID)
            };

            string commandText = OleDBHelper.GetQueryText("BooksTransactionOutMaster_Update", QueryType.Procedures);

            return(OleDBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters));
        }
コード例 #6
0
        private BooksTransactionOutMaster GetTransactionOutMasterInterface()
        {
            BooksTransactionOutMaster obj = new BooksTransactionOutMaster();

            obj.TransactionID   = txtTranID.Text;
            obj.TransactionDate = GlobalFunction.GetDateTimeWithoutMiliSecond(dtpTranInDate.Value);
            obj.Remarks         = txtRemarks.Text;
            //book.Subject = txtSubject.Text;
            //book.Author = txtAuthorName.Text;
            //book.Publication = txtPublication.Text;
            //book.EditionNo = Convert.ToInt32(txtEditionNo.Text);
            //book.EditionYear = Convert.ToInt32(txtEditionYear.Text);
            //book.Price = Convert.ToInt32(txtPrice.Text);
            return(obj);
        }
コード例 #7
0
        public void DisplayTrasactionList()
        {
            //string fromDate = dtpFromDate.Value.ToString("MM/dd/yyyy");
            //string toDate = dtpToDate.Value.AddDays(1).ToString("MM/dd/yyyy");

            //if (!dateFilter)
            //{
            //    dtpFromDate.Value = DateTime.Now.Date.AddDays(-7);
            //    dtpToDate.Value = DateTime.Now.Date;
            //    fromDate = dtpFromDate.Value.ToString("MM/dd/yyyy");
            //    toDate = DateTime.Now.Date.AddDays(1).ToString("MM/dd/yyyy");
            //}

            try
            {
                List <BooksTransactionOutMaster> list      = new List <BooksTransactionOutMaster>();
                BooksTransactionOutMaster        objMaster = new BooksTransactionOutMaster();

                list = objMaster.GetTransactionOutMasterList();

                ListViewItem lvi = new ListViewItem();

                if ((list != null) && list.Count > 0)
                {
                    foreach (BooksTransactionOutMaster obj in list)
                    {
                        lvi = new ListViewItem(obj.TransactionID);
                        lvi.SubItems.Add(Convert.ToString(obj.TransactionDate));
                        lvi.SubItems.Add(obj.Remarks);

                        listView1.Items.Add(lvi);
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "\n" + ex.Message);
            }
        }
コード例 #8
0
 // Same can be used for deactive user
 public bool DeleteTransactionOutMaster(BooksTransactionOutMaster book)
 {
     return(true);
 }