protected void lkAdd_Click(object sender, EventArgs e)
    {
        string strEmptyWeightID = this.gdvList.DataKeys[Convert.ToInt32(this.hdKey.Value)].Value.ToString();
        TT_CarInfo tt_empty = new TT_CarInfo();

        TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo bllempty = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo();
        tt_empty = bllempty.GetModel(strEmptyWeightID);
        string strReturnValue = "";
        if (tt_empty != null)
        {
            strReturnValue= strEmptyWeightID + "|" + tt_empty.CarNo + "|" + tt_empty.CarType + "|" + tt_empty.EmptyWeight + "|" + tt_empty.MostWeight + "|" + tt_empty.CarHight + "|" + tt_empty.CarLength + "|" + tt_empty.CarWidth;
        }
        ScriptManager.RegisterStartupScript(this.UpdatePanel1,Page.GetType(), "", "this.top.currForm.returnvalue='" + strReturnValue + "';this.top.currForm.close();", true);
    }
    public static string GetEmptyWeightInfo(string strCarCode)
    {
        TT_CarInfo tt_empty = new TT_CarInfo();

        TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo bllempty = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo();
        tt_empty = bllempty.GetModel(strCarCode);
        if (tt_empty != null)
        {
            return strCarCode + "|" + tt_empty.CarNo + "|" + tt_empty.CarType + "|" + tt_empty.EmptyWeight + "|" + tt_empty.MostWeight;
        }
        else
        {
            return "";
        }
    }
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        TT_CarInfo model = new TT_CarInfo();
        if (Request.QueryString["key"] != null)
        {
            if (this.txtReason.Text.Trim() == "")
            {
                MessageBox.Show(this.UpdatePanel1, this, "修改原因不能为空!");
                return;
            }
            model = bll.GetModel(Request.QueryString["key"].ToString());
        }
        else
        {
            model.BangType = "人工过磅";
            model.Operator = CookieManager.GetCookieValue("UserName");
            model.EmptyBangTime = DateTime.Now;
            model.RoomCode = "0";
            model.RandomCode = CommonMethod.getRandom(4);
            model.CarCode = "0000" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.RemoteCardCode = "";
        }
        model.CarHight = 0;// Convert.ToDecimal(this.txtCarHight.Text.Trim());
        model.CarLength = 0;//Convert.ToDecimal(this.txtCarLength.Text.Trim());
        model.CarNo = this.ddlProvince.SelectedValue + this.ddlChar.SelectedValue+ "-" + CommonMethod.ToDBC(this.txtCarNo.Text.Trim());
        model.CarOwnerIDCard = this.txtCarOwnerIDCard.Text.Trim();
        model.CarOwnerName = this.txtCarOwnerName.Text.Trim();
        model.CarOwnerPhone = this.txtCarOwnerPhone.Text.Trim();
        model.CarType = this.ddlCarType.SelectedValue;
        model.CarWidth = 0;// Convert.ToDecimal(this.txtCarWidth.Text.Trim());
        model.MostWeight = 0;// Convert.ToDecimal(this.txtMostWeight.Text.Trim());
        model.EmptyWeight = Convert.ToDecimal(this.txtEmptyWeight.Text.Trim());
        model.DriveLicense = this.txtDriveLicense.Text.Trim();

        model.DriverIDCard = this.txtDriverIDCard.Text.Trim();
        model.DriverPhone = this.txtDriverPhone.Text.Trim();
        model.DriverName = this.txtDriverName.Text.Trim();
        model.FirstImage = "";
        model.RemoteCardCode = this.txtRemoteCardCode.Text.Trim();
        if (Request.QueryString["key"] != null)
        {
            if (bll.UpdateCarInfoAndNavicert(model, this.txtReason.Text.Trim()))
            {
                #region 数据同步

                //string str = "Exec PT_CarInfoUpdate '" + model.CarCode + "','" + model.DriveLicense.Replace("'", "''") + "','" + model.RoomCode + "','" + model.CarNo.Replace("'", "''") + "','" + model.CarType + "',"
                //+ "'"+model.EmptyWeight+"','"+model.MostWeight+"','"+model.Operator+"','"+model.BangType+"','"+model.RandomCode+"',"
                //+ "'" + model.EmptyBangTime + "','" + model.CarOwnerName.Replace("'", "''") + "','" + model.CarOwnerIDCard.Replace("'", "''") + "','" + model.CarOwnerPhone.Replace("'", "''") + "','" + model.Remark.Replace("'", "''") + "','" + model.DriverName.Replace("'", "''") + "','" + model.DriverIDCard.Replace("'", "''") + "','" + model.DriverPhone.Replace("'", "''") + "'" + "'" + model.RemoteCardCode + "'";
                //string strMq = mq.AllStation + mq.Prefix + "TT_CarInfo" + mq.Prefix + mq.EditFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + str.ToString();
                //mq.AddMsmq(strMq);

                #endregion

                ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "this.top.currForm.close();", true);
            }
            else
                MessageBox.Show(this.UpdatePanel1, this, "修改失败!");
        }
        else
        {
            if (DbHelperSQL.Exists("Select Count(0) from TT_CarInfo where CarNo='" + model.CarNo + "'"))
            {
                MessageBox.Show(this.UpdatePanel1, this, "该车牌号已经登记过,不能再继续登记");
                return;
            }
            string strKey = bll.AddCarInfo(model);
            if (strKey != "")
            {
                #region 数据同步
                //string str = "Exec PT_CarInfo '" + model.CarCode + "','" + model.EmptyBangTime + "','" + model.RoomCode + "','" + model.EmptyWeight + "','" + model.MostWeight + "','" + model.CarNo.Replace("'", "''") + "','" + model.CarType + "','"
                //    + model.CarOwnerName.Replace("'", "''") + "','" + model.CarOwnerIDCard.Replace("'", "''") + "','" + model.CarOwnerPhone.Replace("'", "''") + "','" + model.RandomCode + "','" + model.Operator + "','" + model.BangType
                //    + "','',null,'" + model.DriveLicense.Replace("'", "''") + "','" + model.DriverName.Replace("'", "''") + "','" + model.DriverIDCard.Replace("'", "''") + "','" + model.DriverPhone.Replace("'", "''") + "'";
                //string strMq = mq.AllStation + mq.Prefix + "TT_CarInfo" + mq.Prefix + mq.AddFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + str.ToString();
                //mq.AddMsmq(strMq);
                #endregion

                string strTitle = strCustomer + "";
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "PrintFrom('" + strKey + "','" + strTitle + "');", true);

                this.txtEmptyBangTime.Text = DateTime.Now.ToString();
                this.txtCarNo.Text = "";
                this.txtCarOwnerIDCard.Text = "";
                this.txtCarOwnerName.Text = "";
                this.txtCarOwnerPhone.Text = "";
                this.txtDriveLicense.Text = "";
                this.txtDriverIDCard.Text = "";
                this.txtDriverName.Text = "";
                this.txtDriverPhone.Text = "";
                this.txtEmptyWeight.Text = "";
                //this.txtMostWeight.Text = "";
            }
            else
                MessageBox.Show(this.UpdatePanel1, this, "修改失败!");
        }
    }