using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web.UI.WebControls;
namespace LYFZ.Software.MainBusiness.CustomerSatisfactionRecord.Satisfaction
{
    public partial class FrmSatisfactionInvestigation : LYFZ.Software.UI.CustomerSatisfactionRecord.Satisfaction.FrmSatisfactionInvestigation
    {
        public string StrID;
        public string Ord_Number;
        public string Ord_Number_Deputy;
        public string CustomerName;
        public string Type;
        public string fw1;
        public string fw2;
        public bool bl;
        LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
        LYFZ.BLL.BLL_ErpUser userbll = new BLL.BLL_ErpUser();
        LYFZ.BLL.BLL_AllViewSet vsbll = new BLL.BLL_AllViewSet();
        LYFZ.BLL.BLL_ErpSatisfactionSurvey sfsbll = new BLL.BLL_ErpSatisfactionSurvey();
        LYFZ.BLL.BLL_ErpSatisfactionRatingSet sfrsbll = new BLL.BLL_ErpSatisfactionRatingSet();
        LYFZ.BLL.BLL_ErpSatisfactionSurveySet sfssbll = new BLL.BLL_ErpSatisfactionSurveySet();
        LYFZ.BLL.BLL_ErpSatisfactionReturningMattersSet srmsbll = new BLL.BLL_ErpSatisfactionReturningMattersSet();
        public FrmSatisfactionInvestigation()
        { this.FormClosed += FrmSatisfactionInvestigation_FormClosed; }

        void FrmSatisfactionInvestigation_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (bl)
            { this.DialogResult = DialogResult.OK; }
        }
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void FrmSatisfactionInvestigation_Shown(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.Ord_Number))
            { this.label4.Text = "当前客户:(" + this.Ord_Number + "," + this.CustomerName + ")"; }
            DataTable dt = new DataTable();
            if (this.Type == "0")
            {
                dt = sfssbll.GetList("Sfss_Type=0").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cmbObject.DataSource = dt;
                    this.cmbObject.ValueMember = "ID";
                    this.cmbObject.DisplayMember = "Sfss_Name";
                }
            }
            else if (this.Type == "1")
            {
                dt = sfssbll.GetList("Sfss_Type=1").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cmbObject.DataSource = dt;
                    this.cmbObject.ValueMember = "ID";
                    this.cmbObject.DisplayMember = "Sfss_Name";
                }
            }
            else if (this.Type == "2")
            {
                dt = sfssbll.GetList("Sfss_Type=2", "id asc").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cmbObject.DataSource = dt;
                    this.cmbObject.ValueMember = "ID";
                    this.cmbObject.DisplayMember = "Sfss_Name";
                }
            }
            else if (this.Type == "3")
            {
                dt = sfssbll.GetList("Sfss_Type=3", "id asc").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cmbObject.DataSource = dt;
                    this.cmbObject.ValueMember = "ID";
                    this.cmbObject.DisplayMember = "Sfss_Name";
                }
            }
            else if (this.Type == "4")
            {
                dt = sfssbll.GetList("Sfss_Type=4", "id asc").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cmbObject.DataSource = dt;
                    this.cmbObject.ValueMember = "ID";
                    this.cmbObject.DisplayMember = "Sfss_Name";
                }
            }
            else if (this.Type == "5")
            {
                this.cmbObject.Items.Add("近期取件");
                this.cmbObject.SelectedIndex = 0;
            }
            else if (this.Type == "6")
            {
                this.cmbObject.Items.Add("近期服务");
                this.cmbObject.SelectedIndex = 0;
            }
            else if (this.Type == "7")
            {
                this.cmbObject.Items.Add("其它调查");
                this.cmbObject.SelectedIndex = 0;
            }
        }
        /// <summary>
        /// 回访对象事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void cmbObject_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.dgv2.Rows.Clear();
            if (!string.IsNullOrEmpty(this.cmbObject.Text))
            { this.BindReturningItems(); }
        }
        /// <summary>
        /// 回访事项
        /// </summary>
        public void BindReturningItems()
        {
            this.dgv2.ClearSelection();
            this.dgv1.Rows.Clear();
            DataTable dt = new DataTable();
            #region 订单
            if (this.cmbObject.Text.ToString() == "接单门市")
            {
                dt = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number = '" + this.Ord_Number + "'", ShowColumnName: "Ord_OrderPersonNumber").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    string[] Ord_OrdersPersonID = dt.Rows[0]["Ord_OrderPersonNumber"].ToString().TrimStart(',').Split(',');
                    if (Ord_OrdersPersonID.Length > 0)
                    {
                        if (!string.IsNullOrEmpty(Ord_OrdersPersonID[0]))
                        {
                            for (int i = 0; i < Ord_OrdersPersonID.Length; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                cell = new DataGridViewTextBoxCell();
                                DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_Type=0 and Sfs_EmployeeID='" + Ord_OrdersPersonID[i] + "'").Tables[0];
                                if (dtColour.Rows.Count > 0)
                                { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                                else
                                { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                                cell.Value = Ord_OrdersPersonID[i];
                                dgvr.Cells.Add(cell);

                                cell = new DataGridViewTextBoxCell();
                                cell.Value = userbll.GetUserName(Ord_OrdersPersonID[i]);
                                dgvr.Cells.Add(cell);

                                this.dgv1.Rows.Add(dgvr);
                            }
                            this.dgv1.ClearSelection();
                        }
                    }
                }
            }
            #endregion

            #region 选衣
            if (this.cmbObject.Text.ToString() == "礼服师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 礼服师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=1 and Sfs_EmployeeID='" + dt.Rows[0]["礼服师ID"].ToString() + "'").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["礼服师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["礼服师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion

            #region 拍照
            #region 拍照摄影师
            if (this.cmbObject.Text.ToString() == "摄影师")
            {
                dt = vsbll.Vw_OrdersWagePhotography(" and Ordpg_ViceNumber='" + this.Ord_Number_Deputy + "' and 摄影师id!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + dt.Rows[0]["摄影师ID"].ToString() + "' and Sfs_SurveySetID=3").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["摄影师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["摄影师名称"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion

            #region 拍照摄影助理
            if (this.cmbObject.Text.ToString() == "摄影助理")
            {
                dt = vsbll.Vw_OrdersWagePhotography(" and Ordpg_ViceNumber='" + this.Ord_Number_Deputy + "' and 摄影助理ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + dt.Rows[0]["摄影助理ID"].ToString() + "' and Sfs_SurveySetID=4").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["摄影助理ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["摄影助理名称"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
                else
                { this.dgv1.Rows.Clear(); }
            }
            #endregion

            #region 拍照化妆师
            if (this.cmbObject.Text.ToString() == "化妆师")
            {
                dt = vsbll.Vw_OrdersWagePhotography(" and Ordpg_ViceNumber='" + this.Ord_Number_Deputy + "' and 化妆师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + dt.Rows[0]["化妆师ID"].ToString() + "' and Sfs_SurveySetID=5").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["化妆师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["化妆师名称"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
                else
                { this.dgv1.Rows.Clear(); }
            }
            #endregion

            #region 拍照化妆助理
            if (this.cmbObject.Text.ToString() == "化妆助理")
            {
                dt = vsbll.Vw_OrdersWagePhotography(" and Ordpg_ViceNumber='" + this.Ord_Number_Deputy + "' and 化妆助理ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + dt.Rows[0]["化妆助理ID"].ToString() + "' and Sfs_SurveySetID=6").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["化妆助理ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["化妆助理名称"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
                else
                { this.dgv1.Rows.Clear(); }
            }
            #endregion

            #region 拍照引导师
            if (this.cmbObject.Text.ToString() == "引导师")
            {
                dt = vsbll.Vw_OrdersWagePhotography(" and Ordpg_ViceNumber='" + this.Ord_Number_Deputy + "' and 引导师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + dt.Rows[0]["引导师ID"].ToString() + "' and Sfs_SurveySetID=7").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["引导师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["引导师名称"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
                else
                { this.dgv1.Rows.Clear(); }
            }
            #endregion
            #endregion

            #region 选片
            #region 选片师
            if (this.cmbObject.Text.ToString() == "选片师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 选片师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + dt.Rows[0]["选片师ID"].ToString() + "' and Sfs_SurveySetID=8").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["选片师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["选片师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion

            #region 初修师
            if (this.cmbObject.Text.ToString() == "初修师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 初修师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + dt.Rows[0]["初修师ID"].ToString() + "' and Sfs_SurveySetID=9").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["初修师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["初修师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion

            #region 精修师
            if (this.cmbObject.Text.ToString() == "精修师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 精修师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + dt.Rows[0]["精修师ID"].ToString() + "' and Sfs_SurveySetID=10").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["精修师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["精修师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion
            #endregion

            #region 看样
            #region 看设计师
            if (this.cmbObject.Text.ToString() == "看设计师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 看设计师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + dt.Rows[0]["看设计师ID"].ToString() + "' and Sfs_SurveySetID=11").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["看设计师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["看设计师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion

            #region 设计师
            if (this.cmbObject.Text.ToString() == "设计师")
            {
                dt = vsbll.Vw_OrdersWageDigital(" and Ordv_ViceNumber='" + this.Ord_Number_Deputy + "' and 设计师ID!=''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    DataGridViewCell cell = null;

                    cell = new DataGridViewTextBoxCell();
                    DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + dt.Rows[0]["设计师ID"].ToString() + "' and Sfs_SurveySetID=12").Tables[0];
                    if (dtColour.Rows.Count > 0)
                    { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                    else
                    { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                    cell.Value = dt.Rows[0]["设计师ID"].ToString();
                    dgvr.Cells.Add(cell);

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = dt.Rows[0]["设计师"].ToString();
                    dgvr.Cells.Add(cell);

                    this.dgv1.Rows.Add(dgvr);
                    this.dgv1.ClearSelection();
                }
            }
            #endregion
            #endregion

            #region 取件
            if (this.cmbObject.Text == "近期取件")
            {
                dt = sfssbll.GetList("Sfss_Type=5").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataGridViewRow dgvr = new DataGridViewRow();
                        DataGridViewCell cell = null;

                        cell = new DataGridViewTextBoxCell();
                        DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=5  and Sfs_SurveySetID=" + dt.Rows[i]["ID"].ToString() + "").Tables[0];
                        if (dtColour.Rows.Count > 0)
                        { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                        else
                        { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                        cell.Value = dt.Rows[i]["ID"].ToString();
                        dgvr.Cells.Add(cell);

                        cell = new DataGridViewTextBoxCell();
                        cell.Value = dt.Rows[i]["Sfss_Name"].ToString();
                        dgvr.Cells.Add(cell);

                        this.dgv1.Rows.Add(dgvr);
                        this.dgv1.ClearSelection();
                    }
                }
            }
            #endregion

            #region 服务
            if (this.cmbObject.Text == "近期服务")
            {
                dt = sfssbll.GetList("Sfss_Type=6", "Id asc").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataGridViewRow dgvr = new DataGridViewRow();
                        DataGridViewCell cell = null;

                        cell = new DataGridViewTextBoxCell();
                        DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "'  and Sfs_Type=6  and Sfs_SurveySetID=" + dt.Rows[i]["ID"].ToString() + "").Tables[0];
                        if (dtColour.Rows.Count > 0)
                        { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                        else
                        { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                        cell.Value = dt.Rows[i]["ID"].ToString();
                        dgvr.Cells.Add(cell);

                        cell = new DataGridViewTextBoxCell();
                        cell.Value = dt.Rows[i]["Sfss_Name"].ToString();
                        dgvr.Cells.Add(cell);

                        this.dgv1.Rows.Add(dgvr);
                        this.dgv1.ClearSelection();
                    }
                }
            }
            #endregion

            #region 其它调查
            if (this.cmbObject.Text == "其它调查")
            {
                dt = sfssbll.GetList("Sfss_Type=7").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataGridViewRow dgvr = new DataGridViewRow();
                        DataGridViewCell cell = null;

                        cell = new DataGridViewTextBoxCell();
                        DataTable dtColour = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "'  and Sfs_Type=7  and Sfs_SurveySetID=" + dt.Rows[i]["ID"].ToString() + "").Tables[0];
                        if (dtColour.Rows.Count > 0)
                        { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
                        else
                        { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
                        cell.Value = dt.Rows[i]["ID"].ToString();
                        dgvr.Cells.Add(cell);

                        cell = new DataGridViewTextBoxCell();
                        cell.Value = dt.Rows[i]["Sfss_Name"].ToString();
                        dgvr.Cells.Add(cell);

                        this.dgv1.Rows.Add(dgvr);
                        this.dgv1.ClearSelection();
                    }
                }
            }
            #endregion
        }
        /// <summary>
        /// dgv单机事件 获取回访事项/满意度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void dgv1_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgv1.SelectedRows.Count > 0)
                {
                    DataTable dt1 = sfrsbll.GetAllList("id asc").Tables[0];
                    if (dt1.Rows.Count > 0)
                    {
                        this.cmSfrs_Scores.DataSource = dt1;
                        this.cmSfrs_Scores.ValueMember = "Id";
                        this.cmSfrs_Scores.DisplayMember = "Sfrs_Name";
                        this.cmSfrs_Scores.SelectedIndex = -1;
                    }

                    this.dgv2.Rows.Clear();
                    DataTable dt = new DataTable();

                    #region 订单
                    if (this.cmbObject.Text == "接单门市")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=1 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_Type=0 and Sfs_ReturningMattersSetID = '" + dt.Rows[i]["ID"].ToString() + "' and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "'").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[0]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[0]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[0]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[0]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);


                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[0]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 礼服师
                    if (this.cmbObject.Text == "礼服师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=2 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=1 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "'").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                          this.  dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 拍照
                    #region 摄影师
                    if (this.cmbObject.Text == "摄影师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=3 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=3").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 摄影助理
                    if (this.cmbObject.Text == "摄影助理")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=4 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=4").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 化妆师
                    if (this.cmbObject.Text == "化妆师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=5 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=5").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 化妆助理
                    if (this.cmbObject.Text == "化妆助理")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=6 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=6").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 引导师
                    if (this.cmbObject.Text == "引导师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=7 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=7").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion
                    #endregion

                    #region 选片
                    #region 选片师
                    if (this.cmbObject.Text == "选片师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=8 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=8").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 初修师
                    if (this.cmbObject.Text == "初修师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=9 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=9").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 精修师
                    if (this.cmbObject.Text == "精修师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=10 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=10").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion
                    #endregion

                    #region 看样
                    #region 看设计师
                    if (this.cmbObject.Text == "看设计师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=11 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=11").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion

                    #region 设计师
                    if (this.cmbObject.Text == "设计师")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=12 and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=12").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion
                    #endregion

                    #region 取件
                    if (this.cmbObject.Text == "近期取件")
                    {
                        #region 产品满意度
                        if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "13")
                        {
                            dt = srmsbll.GetList("Sfrms_SurveySetID=13 and Sfrms_EnableStatus=0").Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    DataGridViewRow dgvr = new DataGridViewRow();
                                    DataGridViewCell cell = null;

                                    DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=5  and Sfs_SurveySetID=13").Tables[0];
                                    if (dtOk.Rows.Count > 0)
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    else
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["ID"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }

                                    this.dgv2.Rows.Add(dgvr);
                                }
                                this.dgv2.ClearSelection();
                            }
                        }
                        #endregion

                        #region 进度满意度
                        if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "14")
                        {
                            dt = srmsbll.GetList("Sfrms_SurveySetID=14 and Sfrms_EnableStatus=0").Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    DataGridViewRow dgvr = new DataGridViewRow();
                                    DataGridViewCell cell = null;

                                    DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=5  and Sfs_SurveySetID=14").Tables[0];
                                    if (dtOk.Rows.Count > 0)
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    else
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["ID"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    this.dgv2.Rows.Add(dgvr);
                                }
                                this.dgv2.ClearSelection();
                            }
                        }
                        #endregion
                    }
                    #endregion

                    #region 服务
                    if (this.cmbObject.Text == "近期服务")
                    {
                        #region 服务人员1
                        if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "15")
                        {
                            dt = srmsbll.GetList("Sfrms_SurveySetID=15 and Sfrms_EnableStatus=0").Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    DataGridViewRow dgvr = new DataGridViewRow();
                                    DataGridViewCell cell = null;

                                    DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and  Sfs_EmployeeID='" + this.fw1 + "'  and  Sfs_Type=6  and Sfs_SurveySetID=15").Tables[0];
                                    if (dtOk.Rows.Count > 0)
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    else
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["ID"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    this.dgv2.Rows.Add(dgvr);
                                }
                                this.dgv2.ClearSelection();
                            }
                        }
                        #endregion

                        #region 服务人员2
                        if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "16")
                        {
                            dt = srmsbll.GetList("Sfrms_SurveySetID=16 and Sfrms_EnableStatus=0").Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    DataGridViewRow dgvr = new DataGridViewRow();
                                    DataGridViewCell cell = null;

                                    DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_EmployeeID='" + this.fw2 + "' and Sfs_Type=6  and Sfs_SurveySetID=16").Tables[0];
                                    if (dtOk.Rows.Count > 0)
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }
                                    else
                                    {
                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = "";
                                        dgvr.Cells.Add(cell);

                                        cell = new DataGridViewTextBoxCell();
                                        cell.Value = dt.Rows[i]["ID"].ToString();
                                        dgvr.Cells.Add(cell);
                                    }

                                    this.dgv2.Rows.Add(dgvr);
                                }
                                this.dgv2.ClearSelection();
                            }
                        }
                        #endregion
                    }
                    #endregion

                    #region 其它调查
                    if (this.cmbObject.Text == "其它调查")
                    {
                        dt = srmsbll.GetList("Sfrms_SurveySetID=" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + " and Sfrms_EnableStatus=0").Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                DataGridViewRow dgvr = new DataGridViewRow();
                                DataGridViewCell cell = null;

                                DataTable dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "'  and Sfs_Type=7  and Sfs_SurveySetID=" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "").Tables[0];
                                if (dtOk.Rows.Count > 0)
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_RatingSetName"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_Remark"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfs_ReturningMattersSetID"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dtOk.Rows[i]["Sfrs_Scores"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                else
                                {
                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["Sfrms_Contents"].ToString();
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = "";
                                    dgvr.Cells.Add(cell);

                                    cell = new DataGridViewTextBoxCell();
                                    cell.Value = dt.Rows[i]["ID"].ToString();
                                    dgvr.Cells.Add(cell);
                                }
                                this.dgv2.Rows.Add(dgvr);
                            }
                            this.dgv2.ClearSelection();
                        }
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            { MessageBoxCustom.Show(ex.Message); }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                // 判断不能为空
                if (string.IsNullOrEmpty(this.cmbObject.Text))
                { MessageBoxCustom.Show("请选择回访对象!"); return; }
                if (this.dgv1.SelectedRows.Count == 0)
                { MessageBoxCustom.Show("请选择调查对象!"); return; }
                if (this.dgv2.Rows.Count <= 0)
                { MessageBoxCustom.Show("请设置回访对象或者满意度!"); return; }
                if (this.dgv2.Rows.Count > 0)
                {
                    for (int i = 0; i < this.dgv2.Rows.Count; i++)
                    {
                        if (string.IsNullOrEmpty(this.dgv2.Rows[i].Cells["Sfrs_Scores"].Value.ToString()))
                        { MessageBoxCustom.Show("满意度不能为空,请选择满意度!"); return; }
                    }
                }

                #region 判断是否已经调查过
                DataTable dtOk = new DataTable();
                // 订单
                if (this.Type == "0")
                {
                    dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_Type=0 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "'").Tables[0];
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 礼服师
                if (this.Type == "1")
                {
                    dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=1 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "'").Tables[0];
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 拍照
                if (this.Type == "2")
                {
                    if (this.cmbObject.Text == "摄影师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=3").Tables[0]; }
                    if (this.cmbObject.Text == "摄影助理")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=4").Tables[0]; }
                    if (this.cmbObject.Text == "化妆师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=5").Tables[0]; }
                    if (this.cmbObject.Text == "化妆助理")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=6").Tables[0]; }
                    if (this.cmbObject.Text == "引导师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=2 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=7").Tables[0]; }
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 选片
                if (this.Type == "3")
                {
                    if (this.cmbObject.Text == "选片师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=8").Tables[0]; }
                    if (this.cmbObject.Text == "初修师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=9").Tables[0]; }
                    if (this.cmbObject.Text == "精修师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=3 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=10").Tables[0]; }
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 看样
                if (this.Type == "4")
                {
                    if (this.cmbObject.Text == "看设计师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=11").Tables[0]; }
                    if (this.cmbObject.Text == "设计师")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=4 and Sfs_EmployeeID='" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "' and Sfs_SurveySetID=12").Tables[0]; }
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 取件
                if (this.Type == "5")
                {
                    if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "13")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=5  and Sfs_SurveySetID=13").Tables[0]; }
                    if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "14")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and Sfs_OrderNumberDeputy='" + this.Ord_Number_Deputy + "' and Sfs_Type=5  and Sfs_SurveySetID=14").Tables[0]; }
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 服务
                if (this.Type == "6")
                {
                    if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "15")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and  Sfs_EmployeeID='" + fw1 + "'  and  Sfs_Type=6  and Sfs_SurveySetID=15").Tables[0]; }
                    if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "16")
                    { dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "' and  Sfs_EmployeeID='" + fw2 + "'  and  Sfs_Type=6  and Sfs_SurveySetID=16").Tables[0]; }
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                // 其它调查
                if (this.Type == "7")
                {
                    dtOk = sfsbll.Vw_ErpSatisfactionSurvey(" Sfs_OrderNumber='" + this.Ord_Number + "'  and Sfs_Type=7  and Sfs_SurveySetID=" + this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() + "").Tables[0];
                    if (dtOk.Rows.Count > 0)
                    { MessageBoxCustom.Show("此对象已经调查过了!"); return; }
                }
                #endregion

                #region 保存
                if (this.dgv2.Rows.Count > 0)
                {
                    DateTime StrTime = SDateTime.Now;
                    string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
                    List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
                    LYFZ.Model.Model_ErpSatisfactionSurvey model = null;
                    for (int i = 0; i < this.dgv2.Rows.Count; i++)
                    {
                        model = new Model.Model_ErpSatisfactionSurvey();
                        model.Sfs_OrderNumber = this.Ord_Number;
                        // 订单
                        if (this.Type == "0")
                        {
                            model.Sfs_OrderNumberDeputy = "";
                            model.Sfs_EmployeeID = this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString();
                            model.Sfs_Type = 0;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.cmbObject.SelectedValue);
                        }
                        // 礼服师
                        if (this.Type == "1")
                        {
                            model.Sfs_OrderNumberDeputy = this.Ord_Number_Deputy;
                            model.Sfs_EmployeeID = this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString();
                            model.Sfs_Type = 1;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.cmbObject.SelectedValue);
                        }
                        // 拍照
                        if (this.Type == "2")
                        {
                            model.Sfs_OrderNumberDeputy = this.Ord_Number_Deputy;
                            model.Sfs_EmployeeID = this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString();
                            model.Sfs_Type = 2;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.cmbObject.SelectedValue);
                        }
                        // 选片
                        if (this.Type == "3")
                        {
                            model.Sfs_OrderNumberDeputy = this.Ord_Number_Deputy;
                            model.Sfs_EmployeeID = this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString();
                            model.Sfs_Type = 3;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.cmbObject.SelectedValue);
                        }
                        // 看样
                        if (this.Type == "4")
                        {
                            model.Sfs_OrderNumberDeputy = this.Ord_Number_Deputy;
                            model.Sfs_EmployeeID = this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString();
                            model.Sfs_Type = 4;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.cmbObject.SelectedValue);
                        }
                        // 取件
                        if (this.Type == "5")
                        {
                            model.Sfs_OrderNumberDeputy = this.Ord_Number_Deputy;
                            model.Sfs_EmployeeID = "";
                            model.Sfs_Type = 5;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString());
                        }
                        // 服务
                        if (this.Type == "6")
                        {
                            model.Sfs_OrderNumberDeputy = "";
                            if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "15")
                            { model.Sfs_EmployeeID = this.fw1; }
                            if (this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString() == "16")
                            { model.Sfs_EmployeeID = this.fw2; }
                            model.Sfs_Type = 6;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString());
                        }
                        // 其它调查
                        if (this.Type == "7")
                        {
                            model.Sfs_OrderNumberDeputy = "";
                            model.Sfs_EmployeeID = "";
                            model.Sfs_Type = 7;
                            model.Sfs_SurveySetID = Convert.ToInt32(this.dgv1.CurrentRow.Cells["Numbering"].Value.ToString());
                        }
                        model.Sfs_ReturningMattersSetID = Convert.ToInt32(this.dgv2.Rows[i].Cells["Sfs_ReturningMattersSetID"].Value);
                        model.Sfs_RatingSetID = sfrsbll.GetID(this.dgv2.Rows[i].Cells["Sfrs_Scores"].Value.ToString());
                        model.Sfs_Remark = this.dgv2.Rows[i].Cells["Remark"].Value.ToString();
                        model.Sfs_CreateTime = StrTime;
                        model.Sfs_CreateName = StrUserID;
                        clist.Add(sfsbll.GetAddCommandInfo(model));
                    }
                    if (clist.Count > 0)
                    {
                        if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
                        { MessageBoxCustom.Show("保存失败!"); return; }
                        MessageBoxCustom.Show("保存成功!");
                        this.bl = true;
                        this.BindReturningItems();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            { MessageBoxCustom.Show(ex.Message); }
        }
        /// <summary>
        /// 选择满意度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void cmSfrs_Scores_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();
                for (int i = 0; i < dgv2.SelectedRows.Count; i++)
                {
                    dgv2.SelectedRows[i].Cells["Sfrs_Scores"].Value = cmSfrs_Scores.Text;
                    dt = sfrsbll.GetList("Sfrs_Name='" + dgv2.SelectedRows[i].Cells["Sfrs_Scores"].Value + "'").Tables[0];
                    if (dt.Rows.Count > 0)
                    { dgv2.SelectedRows[i].Cells["满意分值"].Value = dt.Rows[0]["Sfrs_Scores"].ToString(); }
                }
            }
            catch (Exception ex)
            { MessageBoxCustom.Show(ex.Message); }
        }
        /// <summary>
        /// dgv控件里面塞下拉框
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void dgv2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (this.dgv2.Rows.Count > 0)
            {
                if (this.dgv2.CurrentCell.ColumnIndex == this.dgv2.Columns["Sfrs_Scores"].Index)
                {
                    DataGridViewCell cell = this.dgv2.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    Rectangle rect = this.dgv2.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, true);
                    this.cmSfrs_Scores.Location = new Point(rect.Location.X + this.dgv2.Location.X, rect.Location.Y + this.dgv2.Location.Y + 1);
                    this.cmSfrs_Scores.Size = rect.Size;
                    if (cell.Value != null)
                    { this.cmSfrs_Scores.Text = (string)cell.Value; }
                    this.cmSfrs_Scores.Visible = true;
                    this.cmSfrs_Scores.Focus();
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void cmSfrs_Scores_Leave(object sender, EventArgs e)
        {
            this.dgv2.CurrentRow.Cells["Sfrs_Scores"].Value = this.cmSfrs_Scores.Text.Trim();
            this.cmSfrs_Scores.Visible = false;
        }
        /// <summary>
        /// 关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnClose_Click(object sender, EventArgs e)
        { this.Close(); }
    }
}