Пример #1
0
        private void DataGrid2_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                string    strReceiveID    = e.Item.Cells[0].Text;
                DataTable dtSendReceiveID = (DataTable)Session["SendReceiveID"];
                for (int s = 0; s < dtSendReceiveID.Rows.Count; s++)
                {
                    if (dtSendReceiveID.Rows[s]["cnnReceiveSerialNo"].ToString() == strReceiveID)
                    {
                        dtSendReceiveID.Rows[s].Delete();
                        break;
                    }
                }

                Session.Remove("SendReceiveID");
                Session["SendReceiveID"] = dtSendReceiveID;

                Hashtable htapp   = (Hashtable)Application["appconf"];
                string    strcons = (string)htapp["cons"];
                StoBusi = new BusiComm.StorageBusi(strcons);
                try
                {
                    DataTable dtout = StoBusi.GetBillOfReceiveTempDetail(dtSendReceiveID);
                    if (dtout == null)
                    {
                        this.SetErrorMsgPageBydir("查询出错,请重试!");
                        return;
                    }
                    else
                    {
                        dtout.TableName = "领料单";
                        Session.Remove("SendReceiveDetail");
                        Session["SendReceiveDetail"] = dtout;
                        if (dtout.Rows.Count > 0)
                        {
                            this.btnPrint.Enabled = true;
                        }
                        else
                        {
                            this.btnPrint.Enabled = false;
                        }
                    }

                    this.DataGrid2.DataSource = (DataTable)Session["SendReceiveID"];
                    this.DataGrid2.DataBind();

                    this.DataGrid3.DataSource = (DataTable)Session["SendReceiveDetail"];
                    this.DataGrid3.DataBind();
                }
                catch (Exception er)
                {
                    this.clog.WriteLine(er);
                    this.SetErrorMsgPageBydir("查询错误,请重试!");
                    return;
                }
            }
        }