public List <CrushedMaterial> getAllCrushedMaterial()
        {
            List <CrushedMaterial> cList = new List <CrushedMaterial>();
            SelectCommandBuilder   s     = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
            string        sql            = "SELECT id, 品番, 材料, 材料编号, 模具担当, addtime, PO处理 FROM trymolde WHERE (PO处理 = '粉碎') AND(isApprove is null) ORDER BY addtime";
            SqlDataReader dr             = s.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    CrushedMaterial c = new CrushedMaterial()
                    {
                        id         = dr.GetInt32(0),
                        Name       = dr.GetString(1),
                        Material   = dr.GetString(2),
                        MaterialNo = dr.GetString(3),
                        JigLeader  = dr.GetString(4),
                        addtime    = dr.GetString(5)
                    };
                    cList.Add(c);
                }
            }
            return(cList);
        }
        protected void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                List <CrushedMaterial> cmList  = new List <CrushedMaterial>();
                List <string>          sqlList = new List <string>();
                if (dgvList.Rows.Count != 0 && checkVerifyInput())
                {
                    for (int i = 0; i < dgvList.Rows.Count; i++)
                    {
                        if ((dgvList.Rows[i].Cells[0].FindControl("cboCheckItem") as CheckBox).Checked == true)
                        {
                            CrushedMaterial c = new CrushedMaterial()
                            {
                                id         = int.Parse((dgvList.Rows[i].Cells[0].FindControl("Hfid") as HiddenField).Value),
                                Name       = (dgvList.Rows[i].Cells[1].FindControl("Label1") as Label).Text,
                                MaterialNo = (dgvList.Rows[i].Cells[2].FindControl("Label2") as Label).Text,
                                Material   = (dgvList.Rows[i].Cells[3].FindControl("Label3") as Label).Text,
                                JigLeader  = (dgvList.Rows[i].Cells[4].FindControl("Label4") as Label).Text,
                                addtime    = (dgvList.Rows[i].Cells[5].FindControl("Label5") as Label).Text
                            };
                            cmList.Add(c);
                        }
                    }
                    if (cmList.Count == 0)
                    {
                        Response.Write("<script>alert('没有选择任何行!')</script>");
                        return;
                    }
                    string        body = "部番:";
                    List <string> bd   = new List <string>();
                    string        list = "";
                    for (int i = 0; i < cmList.Count; i++)
                    {
                        if (i != cmList.Count - 1)
                        {
                            body += cmList[i].Name + ",";
                            list += cmList[i].JigLeader + ";";
                        }
                        else
                        {
                            body += cmList[i].Name;
                            list += cmList[i].JigLeader;
                        }

                        UpdateCommandBuilder up = new UpdateCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
                        up.UpdateColumn("isApprove", ddlVerify.SelectedItem.Text);
                        up.UpdateColumn("ApprovedDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        up.UpdateColumn("Reason", txtReason.Text.Trim());
                        if (string.IsNullOrEmpty(txtReason.Text.Trim()))
                        {
                            up.UpdateColumn("area1style", "Wait");
                            up.UpdateColumn("area2style", "Wait");
                            up.UpdateColumn("area3style", "Wait");
                            up.UpdateColumn("area4style", "Wait");
                        }
                        up.ConditionsColumn("id", cmList[i].id);
                        sqlList.Add(up.getUpdateCommand());
                    }
                    if (ddlVerify.SelectedItem.Text == "NG")
                    {
                        body    += "审核未通过,原因为:" + txtReason.Text;
                        mailList = getUserMailAddress(list);
                    }
                    else
                    {
                        bd.Add(body + "审核已通过!" + "   <a href='" + url + "?status=Wait&&area=1'>点击此链接开始进行粉碎...</a>");
                        bd.Add(body + "审核已通过!" + "   <a href='" + url + "?status=Wait&&area=2'>点击此链接开始进行粉碎...</a>");
                        bd.Add(body + "审核已通过!" + "   <a href='" + url + "?status=Wait&&area=3'>点击此链接开始进行粉碎...</a>");
                        bd.Add(body + "审核已通过!" + "   <a href='" + url + "?status=Wait&&area=4'>点击此链接开始进行粉碎...</a>");
                    }
                    InsertCommandBuilder ins = new InsertCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
                    int count = ins.ExcutTransaction(sqlList);
                    if (count != 0)
                    {
                        Response.Write("<script>alert('审核成功!')</script>");
                        if (mailList != "")
                        {
                            if (ddlVerify.SelectedItem.Text == "NG")
                            {
                                SendMail.ExecuteSendMail(smtpIp, Port, fromUser, fromPwd, mailList, "", "试作品粉碎审核通告(系统邮件,请勿回复!)", body, "", "");
                            }
                            else
                            {
                                for (int i = 0; i <= 3; i++)
                                {
                                    SendMail.ExecuteSendMail(smtpIp, Port, fromUser, fromPwd, ConfigurationManager.AppSettings["area" + (i + 1)].ToString(), "", "试作品粉碎审核通告(系统邮件,请勿回复!)", bd[i], "", "");
                                }
                            }
                        }

                        dgvList.DataSource = getAllCrushedMaterial();
                        dgvList.DataBind();
                        //Response.Write("<script>alert('" + s + "!')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('审核失败!')</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "!')</script>");;
            }
        }