IDataController m_data;          //Reference to the server

        /*Initialise the components and loads the data in textboxes, when it is the case*/
        public DialogWindow(int option, dbRecord record, UpdateResponse updateFunction, IDataController data)
        {
            InitializeComponent();
            m_updateFunction = updateFunction;
            m_option         = option;
            m_record         = record;
            m_data           = data;
            LoadInformation();
        }
 /*Loads data from the record to textboxes*/
 private void LoadInfo()
 {
     m_record          = m_data.GetItemRecord(m_record.ItemID);
     txtBrand.Text     = m_record.Brand;
     txtCategory.Text  = m_record.Category;
     txtCondition.Text = m_record.Condition;
     txtId.Text        = m_record.ItemID.ToString();
     txtLocation.Text  = m_record.Location;
     txtModel.Text     = m_record.Model;
     rtbNotes.AppendText(m_record.Notes);
     txtPurshasePrice.Text = m_record.PurchasePrice.ToString();
     txtReceivedDate.Text  = m_record.ReceivedDate.ToString();
     txtSellingPrice.Text  = m_record.SellingPrice.ToString();
     txtWeight.Text        = m_record.Weight.ToString();
 }
Ejemplo n.º 3
0
    /*Loads data from the record to textboxes*/
    private void LoadInfo()
    {
        m_record              = new dbRecord(m_service.GetItemRecord(Convert.ToInt32(ItemId.Value)));
        txtID.Text            = m_record.ItemID.ToString();
        txtBrand.Text         = m_record.Brand;
        txtCategory.Text      = m_record.Category;
        txtCondition.Text     = m_record.Condition;
        txtLocation.Text      = m_record.Location;
        txtModel.Text         = m_record.Model;
        txtPurshasePrice.Text = m_record.PurchasePrice.ToString();
        txtReceivedDate.Text  = m_record.ReceivedDate.ToString();
        txtSellingPrice.Text  = m_record.SellingPrice.ToString();
        txtWeight.Text        = m_record.Weight.ToString();
        txtNotes.Text         = m_record.Notes;

        /*Converts the date to ticks and then store it. When date is converted to string
         * the ticks differ from the original date, although date, hour, minutes and seconds are equal*/
        LastModified.Value = m_record.LastUpdated.Ticks.ToString();
    }
Ejemplo n.º 4
0
    /*Loads the data from textboxes to the record*/
    private void SetRecord()
    {
        m_record           = new dbRecord();
        m_record.Brand     = txtBrand.Text;
        m_record.Category  = txtCategory.Text;
        m_record.Condition = txtCondition.Text;
        if (PageMode.Value == "Edit")
        {
            m_record.ItemID      = Convert.ToInt32(ItemId.Value);
            m_record.LastUpdated = new DateTime(Convert.ToInt64(LastModified.Value));
        }

        m_record.Location      = txtLocation.Text;
        m_record.Model         = txtModel.Text;
        m_record.Notes         = txtNotes.Text;
        m_record.PurchasePrice = Convert.ToDouble(txtPurshasePrice.Text);
        m_record.ReceivedDate  = Convert.ToDateTime(txtReceivedDate.Text);
        m_record.SellingPrice  = Convert.ToDouble(txtSellingPrice.Text);
        m_record.Weight        = Convert.ToInt32(txtWeight.Text);
    }
Ejemplo n.º 5
0
 //Updates a row in database. Returns true in success or false in fail.
 public bool UpdateItemRecord(dbRecord itemRecord)
 {
     return(m_data.UpdateItemRecord(itemRecord));
 }
Ejemplo n.º 6
0
 //Adds a new row in database and returns its ID
 public int AddItemRecord(dbRecord itemRecord)
 {
     return(m_data.AddItemRecord(itemRecord));
 }