Beispiel #1
0
    //初始化checkBox选择框
    private void initCheckList(string userId, int pageNbr)
    {
        string values = "";
        string userID = "";

        if (Session[Config.Curren_User] != null)
        {
            ACCTRUE.WMSBLL.Model.User cUser = (ACCTRUE.WMSBLL.Model.User)Session[Config.Curren_User];
            userID = cUser.UserID;
        }
        if (string.IsNullOrEmpty(this.hidShowList.Value))
        {
            ListViewModel mode = ListViewModel.GetListViewModelModel(userID, pageNbr);
            if (mode == null)
            {
                return;
            }
            this.drpHeadFont.SelectedValue = mode.HeadFont.ToString();
            this.drpListFont.SelectedValue = mode.ListFont.ToString();
            values = mode.ShowList;
            this.hidShowList.Value = mode.ShowList;
        }
        values           = this.hidShowList.Value;
        checkAll.Checked = false;
        int count = 0;

        foreach (Control col in m_pnlInfo.Controls)
        {
            ((CheckBox)col).Checked = false;
            try
            {
                if (values.Trim() != "")
                {
                    string[] valuarray = values.Split(',');
                    foreach (string val in valuarray)
                    {
                        if (val == col.ID)
                        {
                            ((CheckBox)m_pnlInfo.FindControl(val)).Checked = true;
                            count++;
                            break;
                        }
                    }
                }
            }
            catch
            {
                continue;
            }
        }
        if (count == m_pnlInfo.Controls.Count)
        {
            checkAll.Checked = true;//如果全部选中则全选
        }
    }
Beispiel #2
0
    /*
     * 保存自己的模板
     */
    public void saveModel()
    {
        string userId = "";

        if (Session[Config.Curren_User] == null)
        {
            return;
        }
        ACCTRUE.WMSBLL.Model.User user = (ACCTRUE.WMSBLL.Model.User)Session[Config.Curren_User];
        userId = user.UserID;

        string showList = ",";

        foreach (Control col in m_pnlInfo.Controls)
        {
            if (((CheckBox)col).Checked)
            {
                showList += ((CheckBox)col).ID + ",";
            }
        }
        this.hidShowList.Value = showList;
        ListViewModel listMode = ListViewModel.GetListViewModelModel(userId, m_pageNbr);

        if (listMode != null)
        {
            listMode.ShowList = showList;
            listMode.HeadFont = Convert.ToInt32(drpHeadFont.SelectedValue);
            listMode.ListFont = Convert.ToInt32(drpListFont.SelectedValue);
            listMode.Update();
            return;
        }
        listMode          = new ListViewModel();
        listMode.PageNbr  = m_pageNbr;
        listMode.ShowList = showList;
        listMode.HeadFont = Convert.ToInt32(drpHeadFont.SelectedValue);
        listMode.ListFont = Convert.ToInt32(drpListFont.SelectedValue);
        listMode.UserID   = userId;
        listMode.Add();
    }