protected void gvContract_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                Business.Customer.Contract objContract = new Business.Customer.Contract();
                Entity.Customer.Contract   contract    = new Entity.Customer.Contract();

                if (e.CommandName == "Ed")
                {
                    int brandId = int.Parse(e.CommandArgument.ToString());
                    contract             = objContract.GetById(brandId);
                    ContractId           = contract.ContractId;
                    txtContractName.Text = contract.ContractName;
                    txtDescription.Text  = contract.Description;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
 private void LoadContractType()
 {
     Business.Customer.Contract objContract = new Business.Customer.Contract();
     ddlContractType.DataSource     = objContract.GetAll();
     ddlContractType.DataTextField  = "ContractName";
     ddlContractType.DataValueField = "ContractTypeId";
     ddlContractType.DataBind();
     ddlContractType.InsertSelect();
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Business.Customer.Contract objContract = new Business.Customer.Contract();
                Entity.Customer.Contract   contract    = new Entity.Customer.Contract();

                contract.ContractId   = ContractId;
                contract.ContractName = txtContractName.Text;
                contract.Description  = txtDescription.Text;

                int i = objContract.Save(contract);

                if (i > 0)
                {
                    ClearControls();
                    LoadContract();
                    Message.IsSuccess = true;
                    Message.Text      = "Contract Information saved successfully...";
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Can not save!!!";
                }
                Message.Show = true;
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
 private void LoadContract()
 {
     Business.Customer.Contract objContract = new Business.Customer.Contract();
     gvContract.DataSource = objContract.GetAll();
     gvContract.DataBind();
 }