/// <summary>
        /// Insert a row
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int CustomerOfCompany_Insert(CustomerOfCompany entity)
        {
            using (SqlConnection conn = new SqlConnection(AppConfiguration.ConnectionString))
            {
                SqlCommand command = new SqlCommand("CustomerOfCompany_Insert", conn);
                command.CommandType = CommandType.StoredProcedure;
                try
                {
                    command.Parameters.Add(new SqlParameter("@Company_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Company_Id"].Value = entity.Company_Id;
                    command.Parameters.Add(new SqlParameter("@Customer_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Customer_Id"].Value = entity.Customer_Id;
                    conn.Open();

                    return command.ExecuteNonQuery();
                }
                catch
                {

                    throw;
                }
                finally
                {
                    command.Dispose();
                }

            }
        }
 /// <summary>
 /// Update a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int CustomerOfCompany_Update(CustomerOfCompany entity)
 {
     return customer.CustomerOfCompany_Update(entity);
 }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (GetDataForm() == null)
        {
            pnlRed.Visible = true;
            lblError.Text = "Please check data.";
            return;
        }

        Problem entity = GetDataForm();
        if (problem.Problem_Insert(entity) == 0)
        {
            pnlRed.Visible = true;
            lblError.Text = "Do not success !!!";
            return;
        }

        ProblemOfCustomer problemOfCustomer = new ProblemOfCustomer();
        problemOfCustomer.Company_Id = new Guid(ddlCompany.SelectedValue);
        problemOfCustomer.Customer_Id = new Guid(ddlCustomer.SelectedValue);
        if (string.IsNullOrEmpty(txtDate.Text))
        {
            problemOfCustomer.ProblemOfCustomer_Date = DateTime.Now;
        }
        else
        {
            problemOfCustomer.ProblemOfCustomer_Date = DateTime.Parse(txtDate.Text);
        }
        problemOfCustomer.Problem_Id = entity.Problem_Id;
        if (!problemOfCustomerBll.ProblemOfCustomer_Insert(problemOfCustomer))
        {
            pnlRed.Visible = true;
            lblError.Text = "Do not success !!!";
            return;
        }

        if (customerOfCompanyBll.CustomerOfCompany_Check(problemOfCustomer.Company_Id.ToString(), problemOfCustomer.Customer_Id.ToString()))
        {
            pnlRed.Visible = false;
            pnlGreen.Visible = true;
            lblSuccess.Text = "Create successfully!";
            BindDataDropDownList();
        }
        CustomerOfCompany customerOfCompany = new CustomerOfCompany();
        customerOfCompany.Customer_Id = problemOfCustomer.Customer_Id;
        customerOfCompany.Company_Id = problemOfCustomer.Company_Id;
        if (customerOfCompanyBll.CustomerOfCompany_Check(customerOfCompany.Company_Id.ToString(), customerOfCompany.Customer_Id.ToString()))
        {
            pnlRed.Visible = true;
            lblError.Text = "Do not Insert CustomerOfCompany";
            return;
        }
        customerOfCompanyBll.CustomerOfCompany_Insert(customerOfCompany);
        pnlRed.Visible = false;
        pnlGreen.Visible = true;
        lblSuccess.Text = "Create successfully!";
        ResetForm();
        BindDataDropDownList();
    }
 /// <summary>
 /// Insert a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool CustomerOfCompany_Insert(CustomerOfCompany entity)
 {
     return customer.CustomerOfCompany_Insert(entity) > 0;
 }