Ejemplo n.º 1
0
 protected void SaveClick(object sender, EventArgs e)
 {
     UserFlow uFlow = new UserFlow();
     if (txtGroupID.Text == "")
     {
         if (uFlow.InsertGroup(Authz.CurrentUserInfo.UserID, txtGroupName.Text))
         {
             Response.Redirect("GroupDetail.aspx?id=" + uFlow.GetLastRoleID());
         }
         else
             Appz.ClientAlert(this, uFlow.ErrorMessage);
     }
     else
     {
         if (!uFlow.UpdateGroup(Authz.CurrentUserInfo.UserID, txtGroupID.Text, txtGroupName.Text))
             Appz.ClientAlert(this, uFlow.ErrorMessage);
         else
         {
             // Save Role
             if (!uFlow.SaveRoleMenu(Authz.CurrentUserInfo.UserID, txtGroupID.Text, z2Menu.SelectedData))
                 Appz.ClientAlert(this, uFlow.ErrorMessage);
             else
                 Appz.ClientAlert(this, "ºÑ¹·Ö¡¢éÍÁÙÅàÃÕºÃéÍÂ");
         }
     }
 }
Ejemplo n.º 2
0
    protected void SaveClick(object sender, EventArgs e)
    {
        UserFlow uFlow = new UserFlow();
        if (txtRoleID.Text == "")
        {
            if (uFlow.CreateRoleForUser(Authz.CurrentUserInfo.UserID, Request["id"], cmbLevel.SelectedItem.Value))
            {
                Response.Redirect("UserDetail.aspx?id=" + Request["id"]);
            }
            else
                Appz.ClientAlert(this, uFlow.ErrorMessage);
        }
        else
        {
            // Update Role Level
            if (!uFlow.UpdateRoleLevel(Authz.CurrentUserInfo.UserID, txtRoleID.Text, cmbLevel.SelectedItem.Value, chkHHT.Checked, chkPOS.Checked))
                Appz.ClientAlert(this, uFlow.ErrorMessage);
            else
            {

                // Save Group
                if (!uFlow.SaveUserGroup(Authz.CurrentUserInfo.UserID, txtRoleID.Text, (cmbLevel.SelectedItem.Value == "A" ? new ArrayList() : z2Group.SelectedData)))
                    Appz.ClientAlert(this, uFlow.ErrorMessage);
                else
                {

                    // Save Role
                    if (!uFlow.SaveRoleMenu(Authz.CurrentUserInfo.UserID, txtRoleID.Text, (cmbLevel.SelectedItem.Value == "A" ? new ArrayList() : z2Menu.SelectedData)))
                        Appz.ClientAlert(this, uFlow.ErrorMessage);
                    else
                        Appz.ClientAlert(this, "ºÑ¹·Ö¡¢éÍÁÙÅàÃÕºÃéÍÂ");
                }
            }
        }
    }
Ejemplo n.º 3
0
    private void SetData()
    {
        if (Request["id"] != "new" && Request["id"] != "")
        {
            pnlRole.Visible = true;

            UserFlow uFlow = new UserFlow();
            txtGroupID.Text = Request["id"];

            DataTable zDt = uFlow.GetRoleData(txtGroupID.Text);

            if (zDt.Rows.Count > 0)
            {
                if (zDt.Rows[0]["ZLEVEL"].ToString() != "G")
                {
                    pnlRole.Visible = false;
                    lblRoleError.Visible = true;
                    lblRoleError.Text = "Group ID äÁè¶Ù¡µéͧ";
                    txtGroupName.Enabled = false;
                }
                else
                {
                    txtGroupName.Text = zDt.Rows[0]["DESCRIPTION"].ToString();
                }
            }
            else
            {
                pnlRole.Visible = false;
                lblRoleError.Visible = true;
                lblRoleError.Text = "Group ID äÁè¶Ù¡µéͧ";
                txtGroupName.Enabled = false;
            }


            // SET Menu Data
            z2Menu.SetSource(uFlow.GetMenuRoleNotAssign(txtGroupID.Text));
            z2Menu.SetDest(uFlow.GetMenuRoleAssign(txtGroupID.Text));


        }
        else
        {
            lblRoleError.Visible = true;
            pnlRole.Visible = false;
        }
    }
Ejemplo n.º 4
0
    private void SetStartUpData()
    {
        UserFlow uFlow = new UserFlow();
        DataTable zDt = uFlow.GetUserData(Request["id"]);
        if (zDt.Rows.Count > 0)
        {
            lblUID.Text = zDt.Rows[0]["USERID"].ToString();
            lblUName.Text = zDt.Rows[0]["TNAME"].ToString() + " " + zDt.Rows[0]["LASTNAME"].ToString();
        }
        txtRoleID.Text = uFlow.GetRoleID(Request["id"]);
        if (txtRoleID.Text == "")
        {
            pnlExtSystem.Visible = false;
            pnlRole.Visible = false;
            lblRoleError.Visible = true;
        }
        else
        {

            zDt = uFlow.GetRoleData(txtRoleID.Text);
            if (zDt.Rows.Count > 0)
            {
                pnlRole.Visible = true;
                lblRoleError.Visible = false ;
                pnlExtSystem.Visible = true;
                cmbLevel.SelectedIndex = cmbLevel.Items.IndexOf(cmbLevel.Items.FindByValue(zDt.Rows[0]["ZLEVEL"].ToString()));
                chkHHT.Checked = (zDt.Rows[0]["HHT"].ToString() == "Y");
                chkPOS.Checked = (zDt.Rows[0]["POS"].ToString() == "Y");

                if (cmbLevel.SelectedItem.Value == "A")
                    pnlRole.Visible = false;
                else
                {
                    SetEditGroupMode();
                }

                // SET Group Data
                z2Group.SetSource(uFlow.GetGroupRoleNotIn(txtRoleID.Text));
                z2Group.SetDest(uFlow.GetGroupRoleIn(txtRoleID.Text));

                // SET Menu Data
                z2Menu.SetSource(uFlow.GetMenuRoleNotAssign(txtRoleID.Text));
                z2Menu.SetDest(uFlow.GetMenuRoleAssign(txtRoleID.Text));
            }
        }
    }