protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["Role"] != Guid.Empty)
        {
            EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]);
            role.Model.Name = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Update();

            DataTable dt = (DataTable)ViewState["DTDetail"];
            foreach (DataRow dr in dt.Rows)
            {
                switch (dr.RowState)
                {
                    case DataRowState.Added:
                        role.Add_DORelational((string)dr["ScrValue"], (int)dr["RecipientStaff"]);
                        break;
                    case DataRowState.Deleted:
                        role.Delete_DORelational((string)dr["ScrValue", DataRowVersion.Original], (int)dr["RecipientStaff", DataRowVersion.Original]);
                        break;
                }
            }
        }
        Response.Redirect("RoleList.aspx");
    }
Пример #2
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["Role"] != Guid.Empty)
        {
            EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]);
            role.Model.Name        = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Update();

            DataTable dt = (DataTable)ViewState["DTDetail"];
            foreach (DataRow dr in dt.Rows)
            {
                switch (dr.RowState)
                {
                case DataRowState.Added:
                    role.Add_DORelational((string)dr["ScrValue"], (int)dr["RecipientStaff"]);
                    break;

                case DataRowState.Deleted:
                    role.Delete_DORelational((string)dr["ScrValue", DataRowVersion.Original], (int)dr["RecipientStaff", DataRowVersion.Original]);
                    break;
                }
            }
        }
        Response.Redirect("RoleList.aspx");
    }
 protected void bt_Save_Click(object sender, EventArgs e)
 {
     if (this.ddl_Type.SelectedValue == "0")
     {
         MessageBox.Show(this, "请选择角色类型!");
         return;
     }
     EWF_RoleBLL role;
     if ((Guid)ViewState["Role"] == Guid.Empty)
     {
         role = new EWF_RoleBLL();
         role.Model.Name = tbx_Name.Text;
         role.Model.Description = tbx_Description.Text;
         role.Model.Type = int.Parse(ddl_Type.SelectedValue);
         role.Add();
     }
     else
     {
         role = new EWF_RoleBLL((Guid)ViewState["Role"]);
         role.Model.Name = tbx_Name.Text;
         role.Model.Description = tbx_Description.Text;
         role.Update();
     }
     Response.Redirect("RoleList.aspx");
 }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if (this.ddl_Type.SelectedValue == "0")
        {
            MessageBox.Show(this, "请选择角色类型!");
            return;
        }
        EWF_RoleBLL role;

        if ((Guid)ViewState["Role"] == Guid.Empty)
        {
            role                   = new EWF_RoleBLL();
            role.Model.Name        = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Model.Type        = int.Parse(ddl_Type.SelectedValue);
            role.Add();
        }
        else
        {
            role                   = new EWF_RoleBLL((Guid)ViewState["Role"]);
            role.Model.Name        = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Update();
        }
        Response.Redirect("RoleList.aspx");
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["Role"] != Guid.Empty && ddl_Level.SelectedValue != "0")
        {
            EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]);
            role.Model.Name = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Update();

            DataTable dt = role.GetDetailList();

            if (dt.Rows.Count > 0 && ddl_Level.SelectedValue != dt.Rows[0]["OrganizeCityLevel"].ToString())
            {
                role.Delete_OrganizeCityManager((int)dt.Rows[0]["OrganizeCityLevel"]);
            }

            role.Add_OrganizeCityManager(int.Parse(ddl_Level.SelectedValue));

            Response.Redirect("RoleList.aspx");
        }
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((Guid)ViewState["Role"] != Guid.Empty && ddl_Level.SelectedValue != "0")
        {
            EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]);
            role.Model.Name        = tbx_Name.Text;
            role.Model.Description = tbx_Description.Text;
            role.Update();

            DataTable dt = role.GetDetailList();

            if (dt.Rows.Count > 0 && ddl_Level.SelectedValue != dt.Rows[0]["OrganizeCityLevel"].ToString())
            {
                role.Delete_OrganizeCityManager((int)dt.Rows[0]["OrganizeCityLevel"]);
            }

            role.Add_OrganizeCityManager(int.Parse(ddl_Level.SelectedValue));

            Response.Redirect("RoleList.aspx");
        }
    }