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