1: using System;
2: using System.Text;
3:
4: namespace Ia.Ngn.Cl.Model.Ui.Maintenance.Log.Transaction
5: {
6: ////////////////////////////////////////////////////////////////////
7: ////////
8:
9: /// <summary publish="true">
10: /// Ams support class for Next Generation Network (NGN) ui model.
11: /// </summary>
12: ///
13: /// <remarks>
14: /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
15: ///
16: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
17: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
18: ///
19: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21: ///
22: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
23: ///
24: /// Copyright notice: This notice may not be removed or altered from any source distribution.
25: /// </remarks>
26: public partial class Ams
27: {
28: /// <summary/>
29: public Ams() { }
30:
31: /////////////////////////////////////////////////////////////////////////////////
32:
33: /// <summary>
34: ///
35: /// </summary>
36: public static void Manage(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string opcode, string operand, string attachementContent, out string responseSubject, out string responseContent)
37: {
38: StringBuilder stringBuilder;
39: DateTime now;
40: Ia.Cl.Model.Result result;
41:
42: result = new Ia.Cl.Model.Result();
43:
44: opcode = opcode.ToLower();
45:
46: now = DateTime.UtcNow.AddHours(3);
47:
48: // subject can't have \r\n
49: responseSubject = "Optical Fiber Network (OFN) AMS Transaction Log Manager (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
50: responseContent = "Optical Fiber Network (OFN) AMS Transaction Log Manager: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n";
51:
52: if (opcode.Contains("help"))
53: {
54: responseContent += Ia.Ngn.Cl.Model.Data.Help.Text("mail/maintenance/log/transaction/ams");
55: responseContent += "\r\n";
56: }
57: else
58: {
59: if (opcode.StartsWith("mail/maintenance/log/transaction/ams/insert"))
60: {
61: if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanInsertAmsTransactionCsvFile(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
62: {
63: responseContent += @"Opcode: """ + opcode + @"""." + "\r\n";
64: responseContent += "\r\n";
65:
66: stringBuilder = new StringBuilder(10000);
67:
68: if (attachementContent.Length > 0)
69: {
70: Ia.Ngn.Cl.Model.Data.Nokia.AmsTransaction.Process(attachementContent, out result);
71:
72: stringBuilder.AppendLine(result.Message);
73: }
74: else
75: {
76: stringBuilder.AppendLine("Error: Attachement is empty. ");
77: }
78:
79: responseContent += stringBuilder.ToString();
80: responseContent += "\r\n";
81: //content += "\r\nResult: " + result.Message;
82:
83: responseContent += "\r\n";
84: responseContent += "\r\n";
85: responseContent += @"Help? Send email with subject ""mail/maintenance/log/transaction/ams/help"". ";
86: responseContent += "\r\n";
87: responseContent += "\r\n";
88: }
89: else
90: {
91: responseContent += "\r\n";
92: responseContent += "You are not authorized to modify this value. ";
93: responseContent += "\r\n";
94: }
95: }
96: else if (opcode.StartsWith("mail/maintenance/log/transaction/ams/read"))
97: {
98: responseContent += "\r\n";
99: responseContent += "This opcode is not defined yet. ";
100: responseContent += "\r\n";
101: }
102: else
103: {
104: responseContent += "\r\n";
105: responseContent += "This opcode is not known. ";
106: responseContent += "\r\n";
107: }
108: }
109: }
110:
111: ////////////////////////////////////////////////////////////////////////////
112: ////////////////////////////////////////////////////////////////////////////
113: }
114: }