Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ContractDetail _newContract = new ContractDetail();

            if (IsEdit == true)
            {
                _newContract = _db.GetContractById(ContractId);
            }


            _newContract.CustomerId    = CustomerId;
            _newContract.BasePrice     = Convert.ToDecimal(txtBasePrice.Text);
            _newContract.BaseUsers     = Convert.ToInt32(txtBaseUsers.Text);
            _newContract.CostExtraUser = Convert.ToDecimal(txtCostOfExtraUser.Text);
            _newContract.MonthlyCharge = Convert.ToDecimal(txtMonthlyCharge.Text);
            _newContract.NoOfUsers     = Convert.ToInt32(txtNumberOfUsers.Text);
            _newContract.SignOffGoLive = dtSignOffDate.Value;
            _newContract.RRARR         = Convert.ToDecimal(txtRRARR.Text);
            _newContract.databaseID    = databaseId;
            if (IsEdit == true)
            {
                _db.SaveContractType(_newContract);
                _db.SaveChanges();
                MessageBox.Show("Contract has been Update", "Contract Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                _db.AddToContract(_newContract);
                _db.SaveChanges();
                MessageBox.Show("Contract has been Created", "Contract Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }