public List <TransactionOutMaster> GetTransactionOutMasterList() { List <TransactionOutMaster> list = null; string commandText = OleDBHelper.GetQueryText("TransactionOutMaster_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 <TransactionOutMaster>(); //Now lets populate the employee details into the list of employees foreach (DataRow row in table.Rows) { TransactionOutMaster obj = new TransactionOutMaster(); obj.TransactionID = Convert.ToString(row["TransactionID"]); obj.TransactionDate = Convert.ToDateTime(row["TransactionDate"]); obj.Remarks = Convert.ToString(row["Remarks"]); list.Add(obj); } } } return(list); }
public TransactionOutMaster GetTransactionOutMaster(string transactionID) { TransactionOutMaster obj = null; string commandText = OleDBHelper.GetQueryText("TransactionOutMaster_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 TransactionOutMaster(); 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); }
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 bool UpdateTransactionOutMaster(TransactionOutMaster 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("TransactionOutMaster_Update", QueryType.Procedures); return(OleDBHelper.ExecuteNonQuery(commandText, CommandType.Text, parameters)); }
private TransactionOutMaster GetTransactionOutMasterInterface() { TransactionOutMaster obj = new TransactionOutMaster(); 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); }
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 <TransactionOutMaster> list = new List <TransactionOutMaster>(); TransactionOutMaster masterHandler = new TransactionOutMaster(); list = masterHandler.GetTransactionOutMasterList(); ListViewItem lvi = new ListViewItem(); if ((list != null)) { if (list.Count > 0) { foreach (TransactionOutMaster 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); } }
private void Save() { bool result = false; TransactionOutMaster objTransactionOutMaster = GetTransactionOutMasterInterface(); TransactionOutMaster masterhandler = new TransactionOutMaster(); List <TransactionOutDetails> objDetailsList = GetTransactionOutDetailsInterface(); TransactionOutDetails objDetailsHandler = new TransactionOutDetails(); //Inventory obj; if (AddMode) { result = masterhandler.AddNewTransactionOutMaster(objTransactionOutMaster); if (result) { result = objDetailsHandler.AddNewTransactionOutDetails(objDetailsList); } if (result) { result = GlobalFunction.UpdateUniqueCode("TransactionOutMaster"); } // obj = new Inventory(); //if (result) //{ // result = obj.AddInventory(objDetailsList); //} } else if (EditMode) { // obj = new Inventory(); result = masterhandler.UpdateTransactionOutMaster(objTransactionOutMaster); //if (result) //{ // result = obj.UpdateInventory(objBooksTransactionOutMaster.TransactionID, objDetailsList); //} if (result) { result = objDetailsHandler.DeleteTransactionOutMaster(objTransactionOutMaster.TransactionID); if (result) { result = objDetailsHandler.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!"); } }
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); } }
// Same can be used for deactive user public bool DeleteTransactionOutMaster(TransactionOutMaster book) { return(true); }