Exemplo n.º 1
0
    //鎖定
    protected void btnConfirm4_Click(object sender, EventArgs e)
    {
        string SessionIDName = "ALO121_dt3" + PageTimeStamp.Value;
        DataTable dt = (DataTable)Session[SessionIDName];
        dt.PrimaryKey = new DataColumn[] { dt.Columns["N_ROWNUM"] };
        ArrayList ParameterList = new ArrayList();//20091113

        try
        {
            DataRow Dr = dt.Rows.Find(int.Parse(hidNum_Chan.Value));
            DateTime DT = DateTime.Now; //異動時間
            ParameterList.Clear();
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(Dr["CHAN_NO"].ToString()); //配本通路
            ParameterList.Add(Session["UID"].ToString()); //登入者
            ParameterList.Add(DT);
            ParameterList.Add(Dr["UPDATEUID"].ToString());
            ParameterList.Add(Dr["UPDATEDATE"].ToString());
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            bco.LockDisChan(ParameterList, null);
            Dr["IS_LOCK"] = "1";
            Dr["UPDATEUID"] = Session["UID"].ToString();
            Dr["UPDATEDATE"] = DT; //修改DataTable的異動時間,以與DB同步
            dt.AcceptChanges();
            Session[SessionIDName] = dt;
            SLP_CHAN_NO1.Text = Dr["CHAN_NO"].ToString();
            btnQuery3_Click(SLP_CHAN_NO1.Text);
            string SessionIDName1 = "ALO121_dt5" + PageTimeStamp.Value;
            GridView2.DataSource = CopyTable((DataTable)Session[SessionIDName1]);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; dt.RejectChanges(); }
    }