Beispiel #1
0
    /// <summary>
    /// 删除物流
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        List <Hi.Model.DIS_Logistics> l = new Hi.BLL.DIS_Logistics().GetList("", "isnull(dr,0)=0 and orderId=" + ViewState["OrderId"].ToString(), "");

        if (l.Count > 0)
        {
            Hi.Model.DIS_OrderOut model2 = new Hi.BLL.DIS_OrderOut().GetModel(Convert.ToInt32(KeyID));
            SqlTransaction        Tran   = DBUtility.SqlHelper.CreateStoreTranSaction();
            try
            {
                foreach (Hi.Model.DIS_Logistics item in l)
                {
                    Hi.Model.DIS_Logistics model = new Hi.BLL.DIS_Logistics().GetModel(item.Id);
                    model.dr         = 1;
                    model.ts         = DateTime.Now;
                    model.modifyuser = this.UserID;

                    //model2.ExpressNo = "";
                    model2.ts         = DateTime.Now;
                    model2.modifyuser = this.UserID;
                    //model2.Express = "";
                    bool bol = new Hi.BLL.DIS_Logistics().Update(model, Tran);
                    new Hi.BLL.DIS_OrderOut().Update(model2, Tran);
                }
                Tran.Commit();
                this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script> location.replace(location.href);</script>");
                return;
            }
            catch (Exception ex)
            {
                if (Tran != null)
                {
                    if (Tran.Connection != null)
                    {
                        Tran.Rollback();
                    }
                }
                JScript.ShowParentRefresh(this.Page, "删除物流失败");
                JScript.AlertMsgParentRefresh(this.Page, "删除物流失败", JScript.IconOption.哭脸);
            }
        }
    }