protected void btnSave_Click(object sender, EventArgs e) { string msg = string.Empty; if (!CheckInput(out msg)) { ShowMessageToClient(msg, 2, false, false); return; } if (rbtnNewDirectory.Checked) { DirectoryEntity model = GetDirectory(); int id = fileApp.UpdateDirectory(model); if (id > 0) { this.ShowSuccessMessageToClient(); } else { this.ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); } } else if (rbtnNewFile.Checked) { FilesEntity model = GetFile(); if (fileApp.UpdateFile(model)) { ShowSuccessMessageToClient(true, true); } else { ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); } } }
private bool UpdateDirectory(HttpContext context, out string msg, out int id) { DirectoryEntity model = GetDirectoryFromRequest(context); FileApplication fileApp = new FileApplication(); id = fileApp.UpdateDirectory(model); msg = string.Empty; if (fileApp.BrokenRuleMessages.Count > 0) { msg = string.Format("{0},{1}", fileApp.BrokenRuleMessages[0].Key, fileApp.BrokenRuleMessages[0].Message); return(false); } return(true); }
protected void btnSave_Click(object sender, EventArgs e) { string msg = string.Empty; if (!CheckInput(out msg)) { ShowMessageToClient(msg, 2, false, false); return; } if (rbtnNewDirectory.Checked) { DirectoryEntity model = GetDirectory(); int id = fileApp.UpdateDirectory(model); if (id > 0) { Session["CreatedDirectory"] = string.Format("{0}-{1}", ddlCurrent.SelectedValue, id.ToString()); this.ShowSuccessMessageToClient(); } else { this.ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); } } else if (rbtnNewFile.Checked) { FilesEntity model = GetFile(); FileApplication fileApp = new FileApplication(); int result = fileApp.AddFile(model); if (result <= 0) { ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); return; } else { DirectoryObjectsEntity objecttoadd = GetObject(result); int id = fileApp.PushObjectToDirectory(objecttoadd); if (id > 0) { ShowSuccessMessageToClient(true, true); } else { ShowFailMessageToClient(fileApp.BrokenRuleMessages, false); return; } } } }