/// <summary>
    /// 解除库位锁定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUnLock_Click(object sender, EventArgs e)
    {
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    int id = int.Parse(chkId.ValidationGroup);
                    LWareLocatorData wareLocatorModel = new LWareLocatorData();

                    wareLocatorModel = wareLocatorBB.GetModel(id);
                    wareLocatorModel.isUsing = false;
                    wareLocatorModel.updtDt = System.DateTime.Now.ToString();
                    wareLocatorModel.updtEmpId = this.currentUser.empId;
                    wareLocatorBB.ModifyRecord(wareLocatorModel);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            wareLocatorBB.Dispose();
        }
    }
Пример #2
0
    /// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strInfo = "";

        if (!this.ValidateData(out strInfo))
        {
            strInfo = strInfo.Replace("\"", "'").Replace("\n", "");
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true);
            return;
        }

        LWareLocatorData model = new LWareLocatorData();
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();

        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = wareLocatorBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = wareLocatorBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                wareLocatorBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            wareLocatorBB.Dispose();
        }

        if (Request.Params["backurl"] != null && Request.Params["backurl"].Trim() != "")
        {
            Response.Redirect(Request.Params["backurl"], true);
        }
    }