Checkpoint commit - ComboGeographies complete
This commit is contained in:
@@ -339,6 +339,9 @@
|
||||
<data name="Menu5_People_AddMember" xml:space="preserve">
|
||||
<value>Add Member</value>
|
||||
</data>
|
||||
<data name="Menu5_People_ListFind" xml:space="preserve">
|
||||
<value>List/Find People</value>
|
||||
</data>
|
||||
<data name="Menu5_People_ListMembers" xml:space="preserve">
|
||||
<value>List Members</value>
|
||||
</data>
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="FindListPeople_Info" xml:space="preserve">
|
||||
<value>Find people in the organization (write more here)</value>
|
||||
</data>
|
||||
<data name="FindListPeople_Title" xml:space="preserve">
|
||||
<value>Find, List People</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-GeographiesTree.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_GeographiesTree" %>
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Swarm;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
public partial class Json_GeographiesTree : DataV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "application/json";
|
||||
|
||||
int rootGeographyId = Geography.RootIdentity;
|
||||
|
||||
// What's our root GeographyId? (probably Geography.RootIdentity...)
|
||||
|
||||
string rootIdString = Request.QueryString["RootGeographyId"];
|
||||
if (!string.IsNullOrEmpty(rootIdString))
|
||||
{
|
||||
rootGeographyId = Int32.Parse(rootIdString); // will throw if invalid Int32, but who cares
|
||||
}
|
||||
|
||||
// Is this stuff in cache already?
|
||||
|
||||
string cacheKey = "Geographies-Json-" + rootGeographyId.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
string accountsJson =
|
||||
(string) Cache[cacheKey];
|
||||
|
||||
if (accountsJson != null)
|
||||
{
|
||||
Response.Output.WriteLine(accountsJson);
|
||||
Response.End();
|
||||
return;
|
||||
}
|
||||
|
||||
// Not in cache. Construct.
|
||||
|
||||
Geography rootGeography = Geography.FromIdentity(rootGeographyId);
|
||||
|
||||
// Get geography tree
|
||||
|
||||
Geographies geographies = rootGeography.GetTree();
|
||||
|
||||
// Build tree (there should be a template for this)
|
||||
|
||||
Dictionary<int, List<Geography>> treeMap = new Dictionary<int, List<Geography>>();
|
||||
|
||||
foreach (Geography geography in geographies)
|
||||
{
|
||||
if (!treeMap.ContainsKey(geography.ParentIdentity))
|
||||
{
|
||||
treeMap[geography.ParentIdentity] = new List<Geography>();
|
||||
}
|
||||
|
||||
treeMap[geography.ParentIdentity].Add(geography);
|
||||
}
|
||||
|
||||
int renderRootNodeId = rootGeography.ParentGeographyId; // This works as rootGeography will be the only present child in the collection; other children won't be there
|
||||
|
||||
accountsJson = RecurseTreeMap(treeMap, renderRootNodeId);
|
||||
|
||||
Cache.Insert(cacheKey, accountsJson, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero);
|
||||
// cache lasts for five minutes, no sliding expiration
|
||||
Response.Output.WriteLine(accountsJson);
|
||||
|
||||
Response.End();
|
||||
}
|
||||
|
||||
private string RecurseTreeMap(Dictionary<int, List<Geography>> treeMap, int node)
|
||||
{
|
||||
List<string> elements = new List<string>();
|
||||
|
||||
foreach (Geography geography in treeMap[node])
|
||||
{
|
||||
string element = string.Format("\"id\":{0},\"text\":\"{1}\"", geography.Identity,
|
||||
JsonSanitize(geography.Name));
|
||||
|
||||
if (treeMap.ContainsKey(geography.Identity))
|
||||
{
|
||||
element += ",\"state\":\"closed\",\"children\":" + RecurseTreeMap(treeMap, geography.Identity);
|
||||
}
|
||||
|
||||
elements.Add("{" + element + "}");
|
||||
}
|
||||
|
||||
return "[" + String.Join(",", elements.ToArray()) + "]";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboGeographies.ascx.cs" Inherits="Swarmops.Controls.Base.ComboGeographies" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.ClientID %>_DropGeographies').combotree({
|
||||
animate: true,
|
||||
height: 30,
|
||||
onLoadSuccess: function() {
|
||||
$('#<%=this.ClientID %>_DropGeographies').combotree('setText', "<%=this.RootGeographyName%>");
|
||||
<%
|
||||
if (!String.IsNullOrEmpty(this.OnClientLoaded))
|
||||
{
|
||||
Response.Write(this.OnClientLoaded + "(); ");
|
||||
}
|
||||
Response.Write("}");
|
||||
if (!String.IsNullOrEmpty(this.OnClientSelect))
|
||||
{
|
||||
Response.Write(", onSelect: function(account) { " + this.OnClientSelect + "(account.id); }");
|
||||
}
|
||||
|
||||
%>
|
||||
});
|
||||
|
||||
$('#<%=this.ClientID %>_SpanGeographies span.combo input.combo-text').click(function () {
|
||||
$('#<%=this.ClientID %>_SpanGeographies span.combo span span.combo-arrow').click();
|
||||
});
|
||||
|
||||
$('#<%=this.ClientID %>_SpanGeographies span.combo input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
$('#<%=this.ClientID %>_SpanGeographies span.combo span span.combo-arrow').click();
|
||||
break;
|
||||
|
||||
default: return; // exit this handler for other keys
|
||||
}
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<span id="<%=this.ClientID %>_SpanGeographies"><select class="easyui-combotree" url="/Automation/Json-GeographiesTree.aspx?RootGeographyId=<%=this.RootGeographyId %>" name="DropGeographies" id="<%=this.ClientID %>_DropGeographies" animate="true" style="width:300px"></select></span>
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Controls.Base
|
||||
{
|
||||
public partial class ComboGeographies : ControlV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
RootGeography = Geography.Root; // set to "world" unless manually set to something else
|
||||
}
|
||||
|
||||
public string OnClientLoaded { get; set; }
|
||||
public string OnClientSelect { get; set; }
|
||||
protected int RootGeographyId { get; private set; }
|
||||
protected string RootGeographyName { get; private set; }
|
||||
|
||||
public Geography RootGeography
|
||||
{
|
||||
set
|
||||
{
|
||||
this.RootGeographyId = value.Identity;
|
||||
RootGeographyName = value.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,12 @@
|
||||
<Children>
|
||||
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Placeholder_Todo</ResourceKey>
|
||||
<UserLevel>1</UserLevel>
|
||||
<ResourceKey>People_ListFind</ResourceKey>
|
||||
<UserLevel>2</UserLevel>
|
||||
<Permissions />
|
||||
<ImageUrl />
|
||||
<Type>Disabled</Type>
|
||||
<NavigateUrl>/Pages/v5/People/ListFindPeople.aspx</NavigateUrl>
|
||||
<Type>Link</Type>
|
||||
<Children />
|
||||
</MainMenuItem>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
width: "100%"
|
||||
}, { queue: false });
|
||||
|
||||
this.document.location = '/';
|
||||
window.location = '/';
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="ListFindPeople.aspx.cs" Inherits="Swarmops.Frontend.Pages.People.ListFindPeople" %>
|
||||
<%@ Register src="~/Controls/v5/UI/ExternalScripts.ascx" tagname="ExternalScripts" tagprefix="Swarmops5" %>
|
||||
<%@ Register src="~/Controls/v5/Base/ComboGeographies.ascx" tagname="ComboGeographies" tagprefix="Swarmops5" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts2" Package="easyui" Control="tree" runat="server" />
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts1" Package="easyui" Control="datagrid" runat="server" />
|
||||
<link rel="stylesheet" type="text/css" href="/Style/v5-easyui-elements.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function preload(arrayOfImages) {
|
||||
$(arrayOfImages).each(function () {
|
||||
(new Image()).src = this;
|
||||
});
|
||||
}
|
||||
|
||||
preload([
|
||||
'/Images/Abstract/ajaxloader-medium.gif',
|
||||
'/Images/Icons/iconshock-balloon-yes-16px-hot.png',
|
||||
'/Images/Icons/iconshock-balloon-no-16px-hot.png',
|
||||
'/Images/Icons/iconshock-greentick-16px.png',
|
||||
'/Images/Icons/iconshock-redcross-16px.png',
|
||||
'/Images/Icons/undo-16px.png'
|
||||
]);
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#TablePayableCosts').datagrid(
|
||||
{
|
||||
onLoadSuccess: function () {
|
||||
$(".LocalIconApproval").attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
$(".LocalIconApproved").attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
$(".LocalIconApproved").css("display", "none");
|
||||
$(".LocalIconApproval, .LocalIconApproved").css("cursor", "pointer");
|
||||
|
||||
$(".LocalIconApproval").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-hot.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproval").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/undo-16px.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproval").click(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
$("#IconDenial" + $(this).attr("baseid").replace(/\|/g,'')).fadeTo(1000, 0.01).css("cursor", "default");
|
||||
var thisIcon = this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "PayOutMoney.aspx/ConfirmPayout",
|
||||
data: "{'protoIdentity': '" + escape($(this).attr("baseid")) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
$(thisIcon).attr("databaseid", msg.d.AssignedId);
|
||||
$(thisIcon).css("display", "none");
|
||||
$(thisIcon).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
$(thisIcon).attr("rel", "active");
|
||||
$("#IconApproved" + $(thisIcon).attr("baseid").replace(/\|/g, '')).fadeIn(100);
|
||||
alertify.success(unescape(msg.d.DisplayMessage));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").click(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
var thisIcon = this;
|
||||
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "PayOutMoney.aspx/UndoPayout",
|
||||
data: "{'databaseId': '" + $("#IconApproval" + $(thisIcon).attr("baseid").replace(/\|/g, '')).attr("databaseid") + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
if (msg.d.Success) {
|
||||
$(thisIcon).css("display", "none");
|
||||
$(thisIcon).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
$(thisIcon).attr("rel", "");
|
||||
$("#IconApproval" + $(thisIcon).attr("baseid").replace(/\|/g, '')).fadeIn(100);
|
||||
$("#" + $(thisIcon).attr("rel"), "");
|
||||
alertify.log(unescape(msg.d.DisplayMessage));
|
||||
} else {
|
||||
$(thisIcon).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
alertify.error(unescape(msg.d.DisplayMessage));
|
||||
// TODO: Add alert box?
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.datagrid-row-selected,.datagrid-row-over{
|
||||
background:transparent;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<h2><asp:Label runat="server" ID="LabelPayOutMoneyHeader" Text="Find / List People XYZ" /></h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:ComboGeographies ID="ComboGeographies" runat="server" /> <br/>
|
||||
<asp:TextBox runat="server" ID="NamePattern" />
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
Geography<br/>
|
||||
Name pattern<br/>
|
||||
</div>
|
||||
<h2>Matching people</h2>
|
||||
<table id="TablePayableCosts" class="easyui-datagrid" style="width:680px;height:500px"
|
||||
data-options="rownumbers:false,singleSelect:false,nowrap:false,fit:false,loading:false,selectOnCheck:true,checkOnSelect:true,url:'Json-PayableCosts.aspx'"
|
||||
idField="itemId">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'due',width:70"><asp:Label ID="LabelGridHeaderDue" runat="server" Text="XYZ Due"/></th>
|
||||
<th data-options="field:'recipient',width:150,sortable:true"><asp:Label ID="LabelGridHeaderRecipient" runat="server" Text="XYZ Beneficiary" /></th>
|
||||
<th data-options="field:'bank',width:70"><asp:Label ID="LabelGridHeaderBank" runat="server" Text="XYZ Bank" /></th>
|
||||
<th data-options="field:'account',width:120,sortable:true"><asp:Label ID="LabelGridHeaderAccount" runat="server" Text="XYZ Account" /></th>
|
||||
<th data-options="field:'reference',width:140,sortable:true,order:'asc'"><asp:Label ID="LabelGridHeaderReference" runat="server" Text="XYZ Reference" /></th>
|
||||
<th data-options="field:'amount',width:80,align:'right'"><asp:Label ID="LabelGridHeaderAmount" runat="server" Text="XYZ Amount" /></th>
|
||||
<th data-options="field:'action',width:43,align:'center'"><asp:Label ID="LabelGridHeaderPaid" runat="server" Text="XYZPaid" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ServiceModel.Security;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Basic.Enums;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.People
|
||||
{
|
||||
public partial class ListFindPeople : PageV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.PageIcon = "iconshock-money-envelope";
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
{
|
||||
this.PageTitle = Resources.Pages.Financial.PayOutMoney_PageTitle;
|
||||
this.InfoBoxLiteral = Resources.Pages.Financial.PayOutMoney_Info;
|
||||
this.LabelPayOutMoneyHeader.Text = Resources.Pages.Financial.PayOutMoney_Header;
|
||||
this.LabelGridHeaderAccount.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_BankAccount;
|
||||
this.LabelGridHeaderAmount.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Amount;
|
||||
this.LabelGridHeaderBank.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_BankName;
|
||||
this.LabelGridHeaderDue.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_DueDate;
|
||||
this.LabelGridHeaderPaid.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_PaidOut;
|
||||
this.LabelGridHeaderRecipient.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Recipient;
|
||||
this.LabelGridHeaderReference.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_Reference;
|
||||
|
||||
}
|
||||
|
||||
public struct ConfirmPayoutResult
|
||||
{
|
||||
public int AssignedId;
|
||||
public string DisplayMessage;
|
||||
};
|
||||
|
||||
[WebMethod]
|
||||
public static ConfirmPayoutResult ConfirmPayout (string protoIdentity)
|
||||
{
|
||||
protoIdentity = HttpUtility.UrlDecode(protoIdentity);
|
||||
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (!authData.CurrentUser.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials, AccessType.Write)))
|
||||
{
|
||||
throw new SecurityAccessDeniedException("Insufficient privileges for operation");
|
||||
}
|
||||
|
||||
ConfirmPayoutResult result = new ConfirmPayoutResult();
|
||||
|
||||
Payout payout = Payout.CreateFromProtoIdentity(authData.CurrentUser, protoIdentity);
|
||||
Swarmops.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.PayoutCreated,
|
||||
authData.CurrentUser.Identity, 1, 1, 0, payout.Identity,
|
||||
protoIdentity);
|
||||
|
||||
// Create result and return it
|
||||
|
||||
result.AssignedId = payout.Identity;
|
||||
result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCreated, payout.Identity,
|
||||
payout.Recipient);
|
||||
|
||||
result.DisplayMessage = HttpUtility.UrlEncode(result.DisplayMessage).Replace("+", "%20");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public struct UndoPayoutResult
|
||||
{
|
||||
public bool Success;
|
||||
public string DisplayMessage;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static UndoPayoutResult UndoPayout (int databaseId)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
UndoPayoutResult result = new UndoPayoutResult();
|
||||
|
||||
Payout payout = Payout.FromIdentity(databaseId);
|
||||
|
||||
if (!payout.Open)
|
||||
{
|
||||
// this payout has already been settled, or picked up for settling
|
||||
|
||||
result.Success = false;
|
||||
result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCannotUndo,
|
||||
databaseId);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
payout.UndoPayout();
|
||||
|
||||
result.DisplayMessage = HttpUtility.UrlEncode(String.Format(Resources.Pages.Financial.PayOutMoney_PayoutUndone, databaseId)).Replace("+","%20");
|
||||
result.Success = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user