Esempio n. 1
0
    protected void btnUpdateFile_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorizationOrManagedImage(Authorizations.UpdateProfile, Image.Id);
        var deleteResult = BLL.ImageProfileFileFolder.DeleteImageProfileFileFolders(ImageProfile.Id);
        var checkedCount = 0;

        foreach (GridViewRow row in gvFile.Rows)
        {
            var enabled = (CheckBox)row.FindControl("chkEnabled");
            if (enabled == null)
            {
                continue;
            }
            if (!enabled.Checked)
            {
                continue;
            }
            checkedCount++;
            var dataKey = gvFile.DataKeys[row.RowIndex];
            if (dataKey == null)
            {
                continue;
            }

            var profileFileFolder = new Models.ImageProfileFileFolder
            {
                FileFolderId = Convert.ToInt32(dataKey.Value),
                ProfileId    = ImageProfile.Id,
            };
            var txtPriority = row.FindControl("txtPriority") as TextBox;
            if (txtPriority != null)
            {
                if (!string.IsNullOrEmpty(txtPriority.Text))
                {
                    profileFileFolder.Priority = Convert.ToInt32(txtPriority.Text);
                }
            }
            var txtPartition = row.FindControl("txtPartition") as TextBox;
            if (txtPartition != null)
            {
                profileFileFolder.DestinationPartition = txtPartition.Text;
            }
            var txtPath = row.FindControl("txtPath") as TextBox;
            if (txtPath != null)
            {
                profileFileFolder.DestinationFolder = txtPath.Text;
            }
            var ddlFolderMode = row.FindControl("ddlFolderMode") as DropDownList;
            if (ddlFolderMode != null)
            {
                profileFileFolder.FolderCopyType = ddlFolderMode.Text;
            }
            EndUserMessage = BLL.ImageProfileFileFolder.AddImageProfileFileFolder(profileFileFolder) ? "Successfully Updated Image Profile" : "Could Not Update Image Profile";
        }
        if (checkedCount == 0)
        {
            EndUserMessage = deleteResult ? "Successfully Updated Image Profile" : "Could Not Update Image Profile";
        }
    }
Esempio n. 2
0
    protected void btnUpdateFile_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorizationOrManagedImage(Authorizations.UpdateProfile, Image.Id);
        var deleteResult = BLL.ImageProfileFileFolder.DeleteImageProfileFileFolders(ImageProfile.Id);
        var checkedCount = 0;
        foreach (GridViewRow row in gvFile.Rows)
        {
            var enabled = (CheckBox)row.FindControl("chkEnabled");
            if (enabled == null) continue;
            if (!enabled.Checked) continue;
            checkedCount++;
            var dataKey = gvFile.DataKeys[row.RowIndex];
            if (dataKey == null) continue;

            var profileFileFolder = new Models.ImageProfileFileFolder
            {
                FileFolderId = Convert.ToInt32(dataKey.Value),
                ProfileId = ImageProfile.Id,
            };
            var txtPriority = row.FindControl("txtPriority") as TextBox;
            if (txtPriority != null)
                if (!string.IsNullOrEmpty(txtPriority.Text))
                    profileFileFolder.Priority = Convert.ToInt32(txtPriority.Text);
            var txtPartition = row.FindControl("txtPartition") as TextBox;
            if (txtPartition != null)
                profileFileFolder.DestinationPartition = txtPartition.Text;
            var txtPath = row.FindControl("txtPath") as TextBox;
            if (txtPath != null)
                profileFileFolder.DestinationFolder = txtPath.Text;
            var ddlFolderMode = row.FindControl("ddlFolderMode") as DropDownList;
            if (ddlFolderMode != null)
                profileFileFolder.FolderCopyType = ddlFolderMode.Text;
            EndUserMessage = BLL.ImageProfileFileFolder.AddImageProfileFileFolder(profileFileFolder) ? "Successfully Updated Image Profile" : "Could Not Update Image Profile";
        }
        if (checkedCount == 0)
        {
            EndUserMessage = deleteResult ? "Successfully Updated Image Profile" : "Could Not Update Image Profile";
        }
    }