コード例 #1
0
        protected void SAVEGrp_Click(object sender, EventArgs e)
        {
            if (InputGroup.Text == "")
            {
                return;
            }
            int level = TreeView1.SelectedNode.Depth + 2;

            if (level > 4)
            {
                return;
            }
            DataTable dt = ViewState["AllGroup"] as DataTable;
            string    master_Group_id = GROUP_IDLabel.Text;// TreeView1.SelectedNode.Value;
            string    department      = master_Group_id.Substring(0, 3);
            DataTable dt2             = new DataTable();
            string    maxId;

            DataRow[] row = dt.Select("DEPARTMENT_ID=" + department + " AND GROUP_LEVEL =" + level);
            if (row.Count() > 0)
            {
                dt2 = row.CopyToDataTable();
                var maxRow = dt2.Select("Group_id = MAX(Group_id)");
                maxId = (Convert.ToInt32(maxRow[0]["Group_id"]) + 1).ToString();
            }
            else
            {
                maxId = department + level + "001";
            }
            string       Group_id   = maxId;
            string       Group_name = InputGroup.Text;
            string       longinName = Session["ID"].ToString();
            OracleQuery2 cc2        = new OracleQuery2();

            cc2.InsertNewGroup(Group_id, Group_name, level, master_Group_id, longinName);

            grpPanel.Visible      = false;
            AddGroupPanel.Visible = false;
            TreeView1.Nodes.Clear();
            bindTree();

            BindGroupDetail(master_Group_id, 0);
        }