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>
        /// Add new a row
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int ProblemOfCustomer_Insert(ProblemOfCustomer entity)
        {
            using (SqlConnection conn = new SqlConnection(AppConfiguration.ConnectionString))
            {
                SqlCommand command = new SqlCommand("ProblemOfCustomer_Insert", conn);
                command.CommandType = CommandType.StoredProcedure;
                try
                {
                    command.Parameters.Add(new SqlParameter("@Customer_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Customer_Id"].Value = entity.Customer_Id;
                    command.Parameters.Add(new SqlParameter("@Company_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Company_Id"].Value = entity.Company_Id;
                    command.Parameters.Add(new SqlParameter("@Problem_Id", SqlDbType.UniqueIdentifier));
                    command.Parameters["@Problem_Id"].Value = entity.Problem_Id;
                    command.Parameters.Add(new SqlParameter("@ProblemOfCustomer_Date", SqlDbType.SmallDateTime));
                    command.Parameters["@ProblemOfCustomer_Date"].Value = entity.ProblemOfCustomer_Date;
                    conn.Open();

                    return command.ExecuteNonQuery();
                }
                catch
                {

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

            }
        }
 /// <summary>
 /// Update a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool ProblemOfCustomer_Update(ProblemOfCustomer entity)
 {
     return problemOfCustomer.ProblemOfCustomer_Update(entity) > 0;
 }
 /// <summary>
 /// Add new a row
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool ProblemOfCustomer_Insert(ProblemOfCustomer entity)
 {
     return problemOfCustomer.ProblemOfCustomer_Insert(entity) > 0;
 }