EchoTex_Payroll/HRM.BO/Query Analyzer/EGlobal.cs

1614 lines
53 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using Ease.Core.Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml;
namespace HRM.BO
{
#region Menu Tree
public class KeyStack:CollectionBase
{
public KeyStack()
{
InnerList.Clear();
}
public void Add(object oItem)
{
InnerList.Add(oItem);
}
public void Remove(object oItem)
{
InnerList.Remove(oItem);
}
public object this[int i]
{
get{return (object)InnerList[i];}
set{InnerList[i]=value;}
}
}
public class EaseMenuItem
{
#region Constructor for menu item
public EaseMenuItem()
{
_sKey="";
_sCaption="";
_sParentKey="";
_bVisible=false;
}
#endregion
#region Key for menu item
private string _sKey;
public string Key
{
get{return _sKey;}
set{_sKey=value;}
}
#endregion
#region ParenKey for menu item
private string _sParentKey;
public string ParentKey
{
get{return _sParentKey;}
set{_sParentKey=value;}
}
#endregion
#region Visible for menu item
private bool _bVisible;
public bool Visible
{
get{return _bVisible;}
set{_bVisible=value;}
}
#endregion
#region Caption for menu item
private string _sCaption;
public string Caption
{
get{return _sCaption;}
set{_sCaption=value;}
}
#endregion
}
public class EaseMenuTree:CollectionBase
{
private KeyStack _oKeyStack;
public EaseMenuTree()
{
_oKeyStack=new KeyStack();
}
public void Add(EaseMenuTree oMenuTree)
{
foreach(EaseMenuItem oMenuItem in oMenuTree)
{
InnerList.Add(oMenuItem);
}
}
private string GetCurrentParent()
{
if(_oKeyStack.Count>0)
{return (string)_oKeyStack[_oKeyStack.Count-1];}
else
{return null;}
}
private void PushParent(string sKey)
{
_oKeyStack.Add(sKey);
}
private void PopParent()
{
_oKeyStack.RemoveAt(_oKeyStack.Count-1);
}
public EaseMenuItem this[int i]
{
get{return (EaseMenuItem)InnerList[i];}
set{InnerList[i]=value;}
}
private int GetIndex(string sKey)
{
int i;
for(i=0;i<this.Count;i++)
{
if(this[i].Key==sKey)
{
return i;
}
}
return 0;
}
private bool Exists(string sKey)
{
return !(GetIndex(sKey)==0);
}
public void BeginGroup(string sKey, string sCaption, bool bVisible)
{
string sParentKey;
if (!Exists(sKey))
{
EaseMenuItem oItem=new EaseMenuItem();
sParentKey = GetCurrentParent();
oItem.Key = sKey;
oItem.ParentKey = sParentKey;
oItem.Caption = sCaption;
oItem.Visible = bVisible;
if (sParentKey!=null )
{
if(!this[(int)GetIndex(sParentKey)].Visible)
{
oItem.Visible = false;
}
}
InnerList.Add(oItem);
}
PushParent(sKey);
}
public void MenuItem(string sKey, string sCaption, bool bVisible)
{
string sParentKey;
if (!Exists(sKey))
{
EaseMenuItem oItem= new EaseMenuItem();
sParentKey = GetCurrentParent();
oItem.Key = sKey;
oItem.ParentKey = sParentKey;
oItem.Caption = sCaption;
oItem.Visible = bVisible;
if(sParentKey!=null )
{
if(!this[(int)GetIndex(sParentKey)].Visible)
{
oItem.Visible = false;
}
}
InnerList.Add(oItem);
}
}
public void EndGroup()
{
PopParent();
}
public void Add(EaseMenuItem oMenuItem)
{
InnerList.Add(oMenuItem);
}
public EaseMenuTree SubMenuTree(string sParentKey)
{
EaseMenuTree oSubTree=new EaseMenuTree();
foreach(EaseMenuItem oItem in this)
{
if(oItem.ParentKey==sParentKey)
{
oSubTree.Add(oItem);
}
}
return oSubTree;
}
}
#endregion
#region EGlobal Class
public class EGlobal
{
public const int GPHANDSETSERIAL_LENGTH = 16;
public const int BATCHNO_LENGTH = 10;
#region Declartion/Constructor
private static EaseMenuTree _oMenuTree;
private static EaseMenuTree _oPermissionTree;
private static EaseMenuTree _oAllMenuTree;
public EGlobal()
{
}
#endregion
#region Menu Related Function
public static EaseMenuTree PermissionTree()
{
return _oPermissionTree;
}
public static EaseMenuTree MenuTree()
{
//return _oMenuTree;
return _oAllMenuTree;
}
public static EaseMenuTree AllMenuTree()
{
return _oAllMenuTree ;
}
public static bool IsPermitted(string PermissionKey)
{
return true;//User.CurrentUser.IsPermitted(PermissionKey);
}
#region Menu for All Applications
public static void BuildMenuAll()
{
_oAllMenuTree =new EaseMenuTree();
BuildMenuBSU();
BuildMenuLogistics();
BuildMenuZonalLogs();
}
#endregion
#region Menu for BSU
public static void BuildMenuBSU()
{
_oMenuTree=new EaseMenuTree();
//_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("TOPMENU","Administrative Privilege", false);
oTemp.MenuItem("TOPMENU1", "This System", false);
oTemp.MenuItem("TOPMENUUSERS", "Manage Users", false);
oTemp.MenuItem("TOPMENUCOMPAREGPDC", "Compare GPDC Data", false);
oTemp.MenuItem("TOPMENUCREDENTIAL", "Credential", false);
oTemp.EndGroup();
oTemp.BeginGroup("STS.BSU", "STS Management", true);
oTemp.BeginGroup("BSU1","Product Management",true);
oTemp.MenuItem("BSU1.1","Product Specifications",true);
oTemp.MenuItem("BSU1.2","Products",true);
oTemp.MenuItem("BSU1.4","Reload Products",true);
oTemp.MenuItem("BSU1.3","Product Remove",false);
oTemp.EndGroup();
oTemp.BeginGroup("BSU2","Regional Logistics Centers",true);
oTemp.MenuItem("BSU2.1","Zonal Logs",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU3","Market Hierarchy",true);
oTemp.MenuItem("BSU3.1","Regions",true);
oTemp.MenuItem("BSU3.2","Areas",true);
oTemp.MenuItem("BSU3.3","Territories",true);
oTemp.MenuItem("BSU3.4","Routes",true);
oTemp.MenuItem("BSU3.5","Re-shuffle hierarchy",true);
oTemp.MenuItem("BSU3.6","Territory Transfer Between Distributors",true);
oTemp.MenuItem("BSU3.7","Load Territory Info",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU5","Administrative Divisions",true);
oTemp.MenuItem("BSU5.1","Districts",true);
oTemp.MenuItem("BSU5.2","Thanas",true);
oTemp.MenuItem("BSU5.3","Load POS District & Thana",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU4","Bank and Branch Info",true);
oTemp.MenuItem("BSU4.1","Banks",true);
oTemp.MenuItem("BSU4.2","Branches",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU6","Suspension Types",true);
oTemp.MenuItem("BSU6.1","Suspension Types",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU7","Distributor Management",true);
oTemp.MenuItem("BSU7.1","Channel",true);
oTemp.MenuItem("BSU7.2","Distributor Registration",true);
oTemp.MenuItem("BSU7.3","Distributor Suspension",true);
oTemp.MenuItem("BSU7.4","Distributor Reactivation",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU8","Wholesaler Management",true);
oTemp.MenuItem("BSU8.1","Wholesaler Registration",true);
oTemp.MenuItem("BSU8.2","Wholesaler Suspension",true);
oTemp.MenuItem("BSU8.3","Wholesaler Reactivation",true);
oTemp.MenuItem("BSU8.4","Transfer Wholesaler(s) between Distributor",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU9","POS Management",true);
oTemp.MenuItem("BSU9.1","POS Categories One",true);
oTemp.MenuItem("BSU9.2","POS Categories Two",true);
oTemp.MenuItem("BSU9.3","POS Value Class",true);
oTemp.MenuItem("BSU9.4","POS Registration",true);
oTemp.MenuItem("BSU9.8","POS Remove",false);
oTemp.MenuItem("BSU9.5","POS Suspension",true);
oTemp.MenuItem("BSU9.6","POS Reactivation",true);
oTemp.MenuItem("BSU9.7","Transfer POS(s) between Distributorr",true);
oTemp.MenuItem("BSU9.9","POS Category Merge",true);
oTemp.MenuItem("BSU9.10","POS Category One Remove",false);
oTemp.MenuItem("BSU9.11","POS Category Two Remove",false);
oTemp.MenuItem("BSU9.12","Update POS Flexi No",true);
oTemp.MenuItem("BSU9.13","Update POS Value Class",true);
oTemp.MenuItem("BSU9.14","Update POS Data",true);
oTemp.MenuItem("BSU9.15","POS Control Exception",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU10","Data Export/Import",true);
oTemp.MenuItem("BSU10.1","Transfer Master Data to DSTS",true);
oTemp.MenuItem("BSU10.2","Recieve Sales & Return Data from DSTS",true);
oTemp.MenuItem("BSU10.3","Recieve Activation Data",true);
oTemp.MenuItem("BSU10.4","View Master Data File Contents",true);
oTemp.MenuItem("BSU10.5","Clear POSNetDelviery Data",true);
oTemp.MenuItem("BSU10.6","Last Update Date of Distributor",true);
oTemp.MenuItem("BSU10.7","CMD Data",true);
oTemp.MenuItem("BSU10.8","Upload Paper Data",true);
oTemp.MenuItem("BSU10.9","Data Sync with DSTS",true);
oTemp.MenuItem("BSU10.10","Base Report",true);
oTemp.MenuItem("BSU10.11","Special Sales Data Loading",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU11","Barcode Printing",true);
oTemp.MenuItem("BSU11.1","Prepare Barcodes for Distributor and POS",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU12","Import Basic Data",true);
oTemp.MenuItem("BSU12.1","Import Basic Data", true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU13","Reports",true);
oTemp.MenuItem("BSU13.1","Product List", true);
oTemp.MenuItem("BSU13.2","POS Related Report",true);
oTemp.MenuItem("BSU13.24","POS Value Class Change Report",true);
oTemp.MenuItem("BSU13.23","POS Wise Activated Kit Report",true);
oTemp.MenuItem("BSU13.3","POS Suspension Report",true);
oTemp.MenuItem("BSU13.4","POS Category - Total Product Delivery",true);
oTemp.MenuItem("BSU13.5","Net Delivery Report - GPDC POS by POS",true);
oTemp.MenuItem("BSU13.6","Net Delivery Report - Single POS",true);
oTemp.MenuItem("BSU13.7","Activation Cross-matching Report",true);
oTemp.MenuItem("BSU13.8","National Report",true);
oTemp.MenuItem("BSU13.9","National Delivery Report : Region Wise",true);
oTemp.MenuItem("BSU13.10","Logistics Delivery & Return to GPDCs",true);
oTemp.MenuItem("BSU13.11","Cross-Matching Output - Report",true);
oTemp.MenuItem("BSU13.12","Basic Data - Report",true);
oTemp.MenuItem("BSU13.13","Paper Related Report",true);
oTemp.MenuItem("BSU13.14","GPDC-wise Product-wise Net Delivery Report",true);
oTemp.MenuItem("BSU13.15","Paper Related Summary Report",true);
oTemp.MenuItem("BSU13.16","Nationwide Paper Related Summary Report",true);
oTemp.MenuItem("BSU13.17","GPDC-GPSD wise Product-wise Net Delivery Report",true);
oTemp.MenuItem("BSU13.18","SIMKit Activation Data",true);
oTemp.MenuItem("BSU13.19","Kit Details Data",true);
oTemp.MenuItem("BSU13.20","Campaign Products Delivery",true);
oTemp.MenuItem("BSU13.21","Distributor Wise SE Delivery Report",true);
oTemp.MenuItem("BSU13.22","DSTS Data comparing Reports",true);
oTemp.MenuItem("BSU13.25","POS History Reports",true);//14/1/2009
oTemp.MenuItem("BSU13.26","POS Control Exception Report",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU17","SE Reports",true);
oTemp.MenuItem("BSU17.1","SE Planning Report",true);
oTemp.MenuItem("BSU17.2","SE / Route Wise Reports",true);
oTemp.MenuItem("KPI","KPI Report",true);
oTemp.MenuItem("SEKPI"," SE Performance Report", true);
oTemp.MenuItem("CCRR"," Channel Contribution Ratio Report", true);
oTemp.MenuItem("TWPSR"," Thana Wise POS Summary Report", true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU14","Sub Inventory Management",true);
oTemp.MenuItem("BSU14.1","Sub Inventories",true);
oTemp.MenuItem("BSU14.2","Sub Inventory Registration",true);
oTemp.MenuItem("BSU14.3","Sub Inventory Transfer",true);
oTemp.MenuItem("BSU14.4","KPI Bonus Slab Setup",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU15","Campaign and Handset Management",true);
oTemp.MenuItem("BSU15.1","Campaigns",true);
oTemp.MenuItem("BSU15.2","Handset Products",true);
oTemp.MenuItem("BSU15.3","Campaign Products",true);
oTemp.MenuItem("BSU15.4","Vendors",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU16","Requests",true);
oTemp.MenuItem("BSU16.1","POS Request",true);
oTemp.MenuItem("BSU16.2","POS Tranfer Request Confirmation",true);
oTemp.MenuItem("BSU16.3","Create POS Tranfer File for Destination Distributor",true);
oTemp.MenuItem("BSU16.4","Create File For Rejected Request",true);
oTemp.MenuItem("BSU16.5","POS Inactive Request Confirmation",true);
oTemp.MenuItem("BSU16.6","Special Pending Paper Data Upload",true);
oTemp.MenuItem("BSU16.7","Special Pending Paper Data Creation",true);
oTemp.MenuItem("BSU16.8","Patch for Paper",true);
oTemp.MenuItem("BSU16.9","Special Pending Paper Data Creation from CSTS",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU18","STS Data Management",true);
oTemp.MenuItem("BSU18.1","Data Sync Error Log",true);
oTemp.MenuItem("BSU18.2","Data Reconciliation",true);
oTemp.MenuItem("BSU18.3","Data Reconciliation Report",true);
oTemp.MenuItem("BSU18.4","STG-CSTS Kit Reconciliation Report",true);
oTemp.MenuItem("BSU18.5","STG-CSTS Kit Sync",true);
oTemp.MenuItem("BSU18.6","CSTS Tran-Kit Reconciliation Report",true);
oTemp.MenuItem("BSU18.7","CSTS Tran-Kit Sync",true);
oTemp.MenuItem("BSU18.8","POS Net Sync",true);
// oTemp.MenuItem("BSU18.3","Sub Inventory Transfer",true);
// oTemp.MenuItem("BSU18.4","KPI Bonus Slab Setup",true);
oTemp.EndGroup();
oTemp.BeginGroup("BSU19","STS Control Management",true);
oTemp.MenuItem("BSU19.1","Control Setup",true);
oTemp.MenuItem("BSU19.2"," Category-ValueClass-Product Setup ",true );
oTemp.EndGroup();
oTemp.EndGroup();
_oMenuTree=oTemp;
if(_oAllMenuTree!=null)
{
_oAllMenuTree.Add(oTemp);
}
}
#endregion
#region Menu for Logistics
public static void BuildMenuLogistics()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("STS.Logistics", "Logistics", true);
oTemp.BeginGroup("Logistics1","Supplier Info",true);
oTemp.MenuItem("Logistics1.1","Suppliers",true);
oTemp.EndGroup();
oTemp.BeginGroup("Logistics2","Raw SIM Management",true);
oTemp.MenuItem("Logistics2.1","Receipt of Raw SIM",true);
oTemp.MenuItem("Logistics2.2","Undo Receipt of Raw SIM",true);
oTemp.MenuItem("Logistics2.3","Mark Defective Raw SIM",true);
oTemp.EndGroup();
oTemp.BeginGroup("Logistics3","SIM Kit Management",true);
oTemp.MenuItem("Logistics3.1","Used Mobile Numbers",true);
oTemp.MenuItem("Logistics3.2","Raw SIM to Production",true);
oTemp.MenuItem("Logistics3.3","Transfer SIM Kit to Central Log",true);
oTemp.MenuItem("Logistics3.4","Dismantle SIM Kit ",true);
oTemp.EndGroup();
oTemp.BeginGroup("Logistics4","Barcode Management of SIM Kit",true);
oTemp.MenuItem("Logistics4.1","Prepare File for Barcode Printing",true);
oTemp.EndGroup();
oTemp.BeginGroup("Logistics5","Logistics Reports",true);
oTemp.MenuItem("Logistics5.1","Raw SIM Status",true);
oTemp.MenuItem("Logistics5.2","SIM Kit Sent to Central Log",true);
oTemp.MenuItem("Logistics5.3","Dismantle History",true);
oTemp.MenuItem("Logistics5.4","Individual SIM History",true);
oTemp.MenuItem("Logistics5.5","SIM Mapping",true);
oTemp.EndGroup();
oTemp.EndGroup();
_oMenuTree=oTemp;
if(_oAllMenuTree!=null)
{
_oAllMenuTree.Add(oTemp);
}
}
#endregion
#region Menu for Zonal Logs
public static void BuildMenuZonalLogs()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("STS.ZonalLogistics", "Zonal Log Acitivities", true);
oTemp.BeginGroup("ZonalLogs1","Delivery & Return",true);
oTemp.MenuItem("ZonalLogs1.1","SIM Kit Delivery to Distributor",true);
oTemp.MenuItem("ZonalLogs1.2","Delivery Confirmation",true);
oTemp.MenuItem("ZonalLogs1.3","Receipt of Return SIM Kit from Distributor",true);
oTemp.MenuItem("ZonalLogs1.4","View Return SIM Kit from Distributor",true);
oTemp.MenuItem("ZonalLogs1.5","View ZLC Transaction Summary",true);
oTemp.EndGroup();
// oTemp.BeginGroup("ZonalLogs2","Delivery Data Creation ",true);
// oTemp.MenuItem("ZonalLogs2.1","Upload Delivery Data to Files",true);
// oTemp.EndGroup();
oTemp.EndGroup();
_oMenuTree=oTemp;
if(_oAllMenuTree!=null)
{
_oAllMenuTree.Add(oTemp);
}
}
#endregion
#region Menu for DSTS
public static void BuildMenuDSTS()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("TOPMENU","Administrative Privilege", false);
oTemp.MenuItem("TOPMENU1", "This System", false);
oTemp.MenuItem("TOPMENU2", "Day Start-Up", false);
oTemp.MenuItem("TOPMENU3", "Day End", false);
oTemp.MenuItem("TOPMENUUSERS", "Manage Users", false);
oTemp.MenuItem("TOPMENU5", "Received Data From Head Office", false);
oTemp.MenuItem("TOPMENU6", "Transfer Data To Head Office", false);
oTemp.MenuItem("TOPMENU7", "Backup DataBase", false);
oTemp.MenuItem("TOPMENU8", "Restore DataBase", false);
oTemp.MenuItem("TOPMENUPurgeData", "Purge STS Data", false);
oTemp.MenuItem("TOPMENUERPPrice", "ERP Price", false);
oTemp.MenuItem("TOPMENUDistInfo", "GPDC Information Change", false);
//oTemp.MenuItem("TOPMENUPOSTransferInfo", "Create POS Transfer File", false);
oTemp.EndGroup();
oTemp.BeginGroup("STS.DSTS", "DSTS", true);
oTemp.MenuItem("Product", "Product Information", true);
oTemp.MenuItem("Product", "Product Price History", true);
//oTemp.MenuItem("CategoryMerge","POS Category Merge",true);
oTemp.BeginGroup("DSTS1","Product, Paper Receipt & Return",true);
//oTemp.MenuItem("DSTS1.1","Receipt SIM Kit from Zonal Logs",true);
oTemp.MenuItem("DSTS1.2","Receive from Log(Kit and Scratch Card)",true);
oTemp.MenuItem("DSTS1.3","Receive FlexiLoad from Log",true);
oTemp.MenuItem("DSTS1.4","Receive Handsets",true);
oTemp.MenuItem("DSTS1.5","Campaign Products",true);
oTemp.MenuItem("DSTS1.9", "Read Campaign Defination", true);
oTemp.MenuItem("DSTS1.6","Load Campaigne/Bundle Products",true);
oTemp.MenuItem("DSTS1.7","Handset Return to Vendor",true);
oTemp.MenuItem("DSTS1.8","Change Handset Product",true);
oTemp.MenuItem("DSTS3.3","Paper Received from POS",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS2","Products Delivery",true);
oTemp.MenuItem("DSTS2.1","Delivery to POS",true);
oTemp.MenuItem("DSTS2.2","Delivery to Wholesaler",true);
oTemp.MenuItem("DSTS2.3","Reconfirm POS Sales of Wholesaler",true);
oTemp.MenuItem("DSTS2.4", "Category Commission Rate", true);
oTemp.MenuItem("DSTS2.5","Reconfirm Delivery to POS",true);
oTemp.MenuItem("DSTS2.6","Receive GPCF Service Data",true);
oTemp.MenuItem("DSTS2.7","Out Bound File For GPCF",true);
oTemp.MenuItem("DSTS2.11","Issue To GPSD",true);
oTemp.MenuItem("DSTS2.12","GPSD Sales Confimation",true);
///***** Van protection
//oTemp.MenuItem("DSTS2.8","Issue To Delivery Van",true);
//oTemp.MenuItem("DSTS2.9","Data To Delivery Van",true);
//oTemp.MenuItem("DSTS2.10","Received Data From Delivery Van",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS10","Campaign and Handset Management",true);
oTemp.MenuItem("DSTS10.1.1","Vendors",true);
oTemp.MenuItem("DSTS10.1.2","Campaigns",true);
oTemp.MenuItem("DSTS10.1.3","Handset Products",true);
oTemp.MenuItem("DSTS10.1.4","Campaign Products",true);
// oTemp.MenuItem("DSTS10.1.5","Campaign Products Bundle",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS3","Sales Return",true);
oTemp.MenuItem("DSTS3.1","Sales Return from POS",true);
oTemp.MenuItem("DSTS3.2","Sales Return from Wholesaler",true);
oTemp.MenuItem("DSTS3.4","Paper Return from POS",true);
//oTemp.MenuItem("DSTS3.5","Paper Submitted to CMD",true);
oTemp.MenuItem("DSTS4.1","Return to Logistics",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS4","Other Deduction",true);
oTemp.MenuItem("DSTS4.2","Mark Lost SIM Kit",true);
oTemp.MenuItem("DSTS4.3","Inactive SIM Kits",true);
oTemp.MenuItem("DSTS4.5","Inactive Service Kits",true);
oTemp.MenuItem("DSTS4.6","Mark Lost Service Kits",true);
oTemp.MenuItem("DSTS4.4","Special Return of Van or GPSD Stock",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS5","Other Activities",true);
oTemp.MenuItem("DSTS5.1","View All Activities",true);
oTemp.MenuItem("DSTS5.2","Undo Reconfirm POS Sales of Wholesaler",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS6","DSTS Reports",true);
oTemp.MenuItem("DSTS6.1.0","DSTS Reports",true);
oTemp.MenuItem("DSTS6.1.1","DSTS Paper Reports",true);
oTemp.MenuItem("DSTS6.1.2","DSTS Handset Stock Reports",true);
oTemp.MenuItem("DSTS6.1.3","DSTS Bundle Product Stock Reports",true);
oTemp.MenuItem("DSTS6.1.4","DSTS SC Stock Reports",true);
oTemp.MenuItem("DSTS6.1.5","DSTS SC Sales Reports",true);
oTemp.MenuItem("DSTS6.1.6","GPDC Summary Reports",true);
oTemp.MenuItem("DSTS6.1.7","Campaign Products Delivery Report",true);
oTemp.MenuItem("DSTS6.1.8","Pending Paper Report",true);
oTemp.MenuItem("DSTS6.1.12","Client Sale Date/ Scan Date/ Paper Receive Date wise Detail Report",true);
oTemp.MenuItem("DSTS6.1.9","CSTS Compare Reports",true);
oTemp.MenuItem("DSTS6.1.10","Net Delivery Summary Report-Territory Wise",true);
oTemp.MenuItem("DSTS6.1.11","Net Delivery Summary Report-Thana Wise",true);
//oTemp.MenuItem("DSTS6.1.11","DSTS ServiceSimKit Reports",true);
// oTemp.MenuItem("DSTS6.1.6","GPSD Payment Reports",true);
/*
oTemp.BeginGroup("DSTS6.1","Delivery Reports",true);
oTemp.MenuItem("DSTS6.1.0","All Report",false);
oTemp.MenuItem("DSTS6.1.1","POS Category Vs Product Type Stock Delivery",true);
//oTemp.MenuItem("DSTS6.1.2","Detailed Date - Product Stock Delivery",true);
oTemp.MenuItem("DSTS6.1.3","POS Category - Total Product Delivery",true);
//oTemp.MenuItem("DSTS6.1.4","POS Category Vs Route Total Stock Delivery",true);
oTemp.MenuItem("DSTS6.1.5","GPDC Stock in Hand",true);
//oTemp.MenuItem("DSTS6.1.6","Delivered Barcodes to POS",true);
oTemp.MenuItem("DSTS6.1.7","Detailed POS Registration Report",true);
oTemp.MenuItem("DSTS6.1.8","Net Deliver Report of POS",true);
oTemp.MenuItem("DSTS6.1.9","Net Delivery Report - GPDC POS by POS",true);
oTemp.MenuItem("DSTS6.1.10","Stock Delivery Report - GPDC",true);
oTemp.MenuItem("DSTS6.1.11","Number Query Report",true);
oTemp.MenuItem("DSTS6.1.12","Number Series Report",true);
oTemp.MenuItem("DSTS6.1.13","Raw Data Report",true);
oTemp.MenuItem("DSTS6.1.14","Lost & Found Report",true);
oTemp.EndGroup();
*/
oTemp.EndGroup();
oTemp.BeginGroup("DSTS7","DSTS ServiceSimKit Reports",true);
oTemp.MenuItem("DSTS7.1.0","DSTS ServiceSimKit Reports",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS13", "DSTS Handset Reports", true);
oTemp.MenuItem("DSTS13.1.0", "DSTS HS/DC Reports", true);
oTemp.MenuItem("DSTS13.1.1", "SE Stock Report", true);
oTemp.MenuItem("DSTS13.1.2", "SE Net Delivery Report", true);
oTemp.MenuItem("DSTS13.1.3", "SE Wise Summary Report", true);
oTemp.MenuItem("DSTS13.1.4", "SE Wise Product Wise Detail Report", true);
oTemp.MenuItem("DSTS13.1.5", "Stock In Hand Top Sheet Report", true);
oTemp.MenuItem("DSTS13.1.6", "Issue Top Sheet Report", true);
oTemp.EndGroup();
////**VanProtection
// oTemp.BeginGroup("DSTS7","Delivery Van Reports",true);
// oTemp.MenuItem("DSTS7.1.1","Delivery Van Stock Reports",true);
// oTemp.MenuItem("DSTS7.1.2","Delivery Van Payment Reports",true);
// oTemp.EndGroup();
////***
oTemp.BeginGroup("DSTS8","GPSD Reports",true);
oTemp.MenuItem("DSTS8.1.1","GPSD Stock Reports",true);
oTemp.MenuItem("DSTS8.1.2","GPSD Payment Reports",true);
oTemp.MenuItem("DSTS8.1.3","Net Delivery Report - GPSD",true);
oTemp.MenuItem("DSTS8.1.4","GPSD Reports",true);
oTemp.MenuItem("DSTS11.1.17","POS's Product Sales Permission ",true);
oTemp.MenuItem("DSTS11.1.18","POS's Paper Receive Percentage",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS9","SE Management",true);
oTemp.MenuItem("DSTS9.1.1","SEs",true);
oTemp.MenuItem("DSTS9.1.2","SE Supervisors",true);
oTemp.MenuItem("DSTS9.1.3","Assign SEs to Supervisor",true);
// oTemp.MenuItem("DSTS9.1.4","Assign POSs to SE",true);
oTemp.MenuItem("DSTS9.1.5","Issue Stock to SE",true);
oTemp.MenuItem("DSTS9.1.6","Return Stock From SE",true);
oTemp.MenuItem("DSTS9.1.7","Sales Confirmation by SE",true);
//oTemp.MenuItem("DSTS9.1.9","Data Transfer To Stageing",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS11","SE Reports",true);
oTemp.MenuItem("DSTS11.1.1","SE Stock Reports",true);
oTemp.MenuItem("DSTS11.1.2","SE Payment Reports",true);
oTemp.MenuItem("DSTS11.1.3","Net Delivery Report - SE",true);
//oTemp.MenuItem("DSTS11.1.4","SE Reports",true);
oTemp.MenuItem("DSTS11.1.5","SE Route Planning Report ",true);
oTemp.MenuItem("DSTS11.1.9","SE Route POSs Report ",true);
oTemp.MenuItem("DSTS11.1.6","SE Wise Summary Report ",true);
oTemp.MenuItem("DSTS11.1.7","SE Wise Productwise Detail Report ",true);
oTemp.MenuItem("DSTS11.1.8","Route Wsise SE Wise Reports ",true);
oTemp.MenuItem("DSTS11.1.10","POS SE and Route Search Report ",true);
oTemp.MenuItem("DSTS11.1.11","SE Performance Report ",true);
oTemp.MenuItem("DSTS11.1.12","Channel Contribution Ratio Report ",true);
oTemp.MenuItem("DSTS11.1.13","Thana wise Telco POS Summary Report ",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS12","Administrator",true);
oTemp.MenuItem("DSTS12.1.1","Routes",true);
oTemp.MenuItem("DSTS12.1.2","Assign POS To Route",true);
oTemp.MenuItem("DSTS12.1.3","Transfer POSs Between Routes",true);
oTemp.MenuItem("DSTS12.1.4","Assign Routes To SE",true);
oTemp.MenuItem("DSTS12.1.5","POS Inactive Request",true);
oTemp.MenuItem("DSTS12.1.6","POS Transfer Request",true);
oTemp.MenuItem("DSTS12.1.7","Create POS Request File",true);
oTemp.MenuItem("DSTS12.1.8","Receive Transfered POS",true);
oTemp.MenuItem("DSTS12.1.9","Receive Rejected Request",true);
oTemp.MenuItem("DSTS12.1.10","Transfer Special Paper Related Data",true);
oTemp.MenuItem("DSTS12.1.11","Receive Special Paper Related Data",true);
//oTemp.MenuItem("DSTS12.1.10","Receive Transfered POS",true);
// oTemp.MenuItem("DSTS10.1.5","Campaign Products Bundle",true);
oTemp.EndGroup();
oTemp.EndGroup();
_oMenuTree=oTemp;
_oAllMenuTree=oTemp;
}
#endregion
#region Menu for Distributor
public static void BuildMenuDistributor()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("TOPMENU","Administrative Privilege", false);
oTemp.MenuItem("TOPMENU1", "This System", false);
oTemp.MenuItem("TOPMENU2", "Day Start-Up", false);
oTemp.MenuItem("TOPMENU3", "Day End", false);
oTemp.MenuItem("TOPMENUUSERS", "Manage Users", false);
oTemp.MenuItem("TOPMENU5", "Received Data From Head Office", false);
oTemp.MenuItem("TOPMENU6", "Transfer Data To Head Office", false);
oTemp.MenuItem("TOPMENUSTAGING", "Send File To Stageing", false);
oTemp.MenuItem("TOPMENU7", "Backup DataBase", false);
oTemp.MenuItem("TOPMENU8", "Restore DataBase", false);
oTemp.MenuItem("TOPMENUPurgeData", "Purge STS Data", false);
oTemp.MenuItem("TOPMENUERPPrice", "ERP Price", false);
oTemp.MenuItem("TOPMENUDistInfo", "Distributor Information Change", false);
oTemp.EndGroup();
oTemp.BeginGroup("STS.DSTS", "DSTS", true);
oTemp.MenuItem("Product", "Product Information", true);
oTemp.MenuItem("Product", "Product Price History", true);
oTemp.BeginGroup("DSTS1","Product, Paper Receipt & Return",true);
oTemp.MenuItem("DSTS1.1","Receipt SIM Kit from Zonal Logs",true);
oTemp.MenuItem("DSTS1.2","Receive from Log(Kit and Scratch Card)",true);
oTemp.MenuItem("DSTS1.3","Receive FlexiLoad from Log",true);
oTemp.MenuItem("DSTS1.4","Receive Handsets",true);
oTemp.MenuItem("DSTS1.5","Campaign Products",true);
oTemp.MenuItem("DSTS1.6","Load Campaigne/Bundle Products",true);
oTemp.MenuItem("DSTS1.7","Handset Return to Vendor",true);
oTemp.MenuItem("DSTS1.8","Change Handset Product",true);
oTemp.MenuItem("DSTS2.4", "Category Commission Rate", true);
oTemp.MenuItem("DSTS2.1","Delivery to POS",true);
oTemp.MenuItem("DSTS3.3","Paper Received from POS",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS9","SE,Route & KPI Management",true);
oTemp.MenuItem("DSTS9.1.1","SEs",true);
oTemp.MenuItem("DSTS9.1.2","SE Supervisors",true);
oTemp.MenuItem("DSTS9.1.3","Assign SEs to Supervisor",true);
oTemp.MenuItem("DSTS12.1.1","Routes",true);
oTemp.MenuItem("DSTS12.1.2","Assign POS To Route",true);
oTemp.MenuItem("DSTS12.1.3","Transfer POSs Between Routes",true);
oTemp.MenuItem("DSTS12.1.4","Assign Routes To SE",true);
///oTemp.MenuItem("DSTS9.1.4","Assign POSs to SE",true);
oTemp.MenuItem("DSTS9.1.5","Issue Stock to SE",true);
oTemp.MenuItem("DSTS9.1.6","Return Stock From SE",true);
oTemp.MenuItem("DSTS9.1.7","Sales Confirmation by SE",true);
oTemp.MenuItem("DSTS9.1.8","KPI Setup",true);
oTemp.MenuItem("DSTS9.1.10","SE ERS Achievements",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS10","Handset & Datacard Management",true);
oTemp.MenuItem("DSTS10.1.1","Vendors",true);
oTemp.MenuItem("DSTS10.1.2","Campaigns",true);
oTemp.MenuItem("DSTS10.1.3","Handset Products",true);
oTemp.MenuItem("DSTS10.1.4","Campaign Products",true);
oTemp.MenuItem("DSTS1.9", "Read Campaign Defination or Device Price", true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS3","Sales Return",true);
oTemp.MenuItem("DSTS3.1","Sales Return from POS",true);
oTemp.MenuItem("DSTS3.4","Paper Return from POS",true);
oTemp.MenuItem("DSTS4.1","Return to Logistics",true);
//oTemp.MenuItem("DSTS3.5","Paper Submitted to CMD",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS4","Other Deduction",true);
oTemp.MenuItem("DSTS4.2","Mark Lost SIM Kit",true);
oTemp.MenuItem("DSTS4.3","Inactive SIM Kits",true);
oTemp.MenuItem("DSTS4.5","Inactive Service Kits",true);
oTemp.MenuItem("DSTS4.6","Mark Lost Service Kits",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS5","Other Activities",true);
oTemp.MenuItem("DSTS5.1","View All Activities",true);
oTemp.MenuItem("DSTS12.1.12","Out Bound File For GPCF",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS11","SE Reports",true);
oTemp.MenuItem("DSTS11.1.1","SE Stock Reports",true);
oTemp.MenuItem("DSTS11.1.2","SE Payment Reports",true);
oTemp.MenuItem("DSTS11.1.3","Net Delivery Report - SE",true);
//oTemp.MenuItem("DSTS11.1.4","SE Reports",true);
oTemp.MenuItem("DSTS11.1.5","SE Route Planning Report ",true);
oTemp.MenuItem("DSTS11.1.9","SE Route POSs Report ",true);
oTemp.MenuItem("DSTS11.1.6","SE Wise Summary Report ",true);
oTemp.MenuItem("DSTS11.1.7","SE Wise Productwise Detail Report ",true);
oTemp.MenuItem("DSTS11.1.8","Route Wise SE Wise Reports ",true);
oTemp.MenuItem("DSTS11.1.10","POS SE and Route Search Report ",true);
oTemp.MenuItem("DSTS11.1.11","SE Performance Report ",true);
oTemp.MenuItem("DSTS11.1.12","Channel Contribution Ratio Report ",true);
oTemp.MenuItem("DSTS11.1.13","Thana Wise Telco POS Summary Report ",true);
oTemp.MenuItem("DSTS11.1.15","DSTS Call Card",true);
oTemp.MenuItem("DSTS11.1.14","KPI Bonus Calculation Report ",true);
oTemp.MenuItem("DSTS11.1.16","Top Sheet Report ",true);
oTemp.MenuItem("DSTS11.1.17","POS's Product Sales Permission ",true);
oTemp.MenuItem("DSTS11.1.18","POS's Paper Receive Percentage",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS6","DSTS Reports",true);
oTemp.MenuItem("DSTS6.1.0","DSTS Reports",true);
oTemp.MenuItem("DSTS6.1.1","DSTS Paper Reports",true);
oTemp.MenuItem("DSTS6.1.12","Client Sale Date/ Scan Date/ Paper Receive Date wise Detail Report",true);
oTemp.MenuItem("DSTS6.1.2","DSTS Handset Stock Reports",true);
oTemp.MenuItem("DSTS6.1.3","DSTS Bundle Product Stock Reports",true);
oTemp.MenuItem("DSTS6.1.4","DSTS SC Stock Reports",true);
oTemp.MenuItem("DSTS6.1.5","DSTS SC Sales Reports",true);
oTemp.MenuItem("DSTS6.1.6","GPDC Summary Reports",true);
oTemp.MenuItem("DSTS6.1.7","Campaign Products Delivery Report",true);
oTemp.MenuItem("DSTS6.1.8","Pending Paper Report",true);
oTemp.MenuItem("DSTS6.1.9","CSTS Compare Reports",true);
oTemp.MenuItem("DSTS6.1.10","Net Delivery Summary Report-Territory Wise",true);
oTemp.MenuItem("DSTS6.1.11","Net Delivery Summary Report-Thana Wise",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS7","DSTS ServiceSimKit Reports",true);
oTemp.MenuItem("DSTS7.1.0","DSTS ServiceSimKit Reports",true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS13", "DSTS Handset & Datacard Reports", true);
oTemp.MenuItem("DSTS13.1.0", "DSTS HS/DC Reports", true);
oTemp.MenuItem("DSTS13.1.1", "SE Stock Report", true);
oTemp.MenuItem("DSTS13.1.2", "SE Net Delivery Report", true);
oTemp.MenuItem("DSTS13.1.3", "SE Wise Summary Report", true);
oTemp.MenuItem("DSTS13.1.4", "SE Wise Product Wise Detail Report", true);
oTemp.MenuItem("DSTS13.1.5", "Stock In Hand Top Sheet Report", true);
oTemp.MenuItem("DSTS13.1.6", "Issue Top Sheet Report", true);
oTemp.EndGroup();
oTemp.BeginGroup("DSTS12","Administrator",true);
oTemp.MenuItem("DSTS12.1.5","POS Inactive Request",true);
oTemp.MenuItem("DSTS12.1.6","POS Transfer Request",true);
oTemp.MenuItem("DSTS12.1.7","Create POS Request File",true);
oTemp.MenuItem("DSTS12.1.8","Receive Transfered POS",true);
oTemp.MenuItem("DSTS12.1.9","Receive Rejected Request",true);
oTemp.MenuItem("DSTS12.1.10","Transfer Special Paper Related Data",true);
oTemp.MenuItem("DSTS12.1.11","Receive Special Paper Related Data",true);
oTemp.MenuItem("DSTS12.1.12","Out Bound File For GPCF",true);
oTemp.EndGroup();
oTemp.EndGroup();
_oMenuTree=oTemp;
_oAllMenuTree=oTemp;
}
#endregion
#region Menu for Delivery Van
public static void BuildMenuDeliveryVan()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("TOPMENU","Administrative Privilege", false);
oTemp.MenuItem("TOPMENUUSERS", "Manage Users", false);
oTemp.MenuItem("TOPMENU1", "Received Data From DSTS", false);
oTemp.MenuItem("TOPMENU2", "Transfer Data To DSTS", false);
//
oTemp.EndGroup();
oTemp.BeginGroup("STS.DeliveryVan", "Delivery Van", true);
oTemp.BeginGroup("DV1","Receipt",true);
oTemp.MenuItem("DV1.2","Receive from DSTS(Kit and Scratch Card)",true);
oTemp.MenuItem("DV1.3","Increase FlexiLoad Amount",true);
oTemp.EndGroup();
oTemp.BeginGroup("DV2","Products Delivery",true);
oTemp.MenuItem("DV2.1","Delivery to POS",true);
oTemp.EndGroup();
oTemp.BeginGroup("DV3","Sales Return",true);
oTemp.MenuItem("DV3.1","Sales Return from POS",true);
oTemp.EndGroup();
oTemp.BeginGroup("DV4","Other Deduction",true);
oTemp.MenuItem("DV4.1","Return to GPDC",true);
//oTemp.MenuItem("DV4.2","Mark Lost SIM Kit",true);
oTemp.EndGroup();
oTemp.BeginGroup("DV5","Other Activities",true);
oTemp.MenuItem("DV5.1","View All Activities",true);
oTemp.EndGroup();
// oTemp.BeginGroup("DV6","Van Reports",true);
// oTemp.MenuItem("DV6.1.0","Van Reports",true);
// oTemp.MenuItem("DV6.1.1","Van Paper Reports",true);
// oTemp.MenuItem("DV6.1.2","Van SC Stock Reports",true);
// oTemp.MenuItem("DV6.1.3","Van SC Sales Reports",true);
// oTemp.MenuItem("DV6.1.4","Van Summary Reports",true);
// oTemp.EndGroup();
_oMenuTree=oTemp;
_oAllMenuTree=oTemp;
}
#endregion
#region Menu for Finance
public static void BuildMenuFinance()
{
_oMenuTree=new EaseMenuTree();
_oPermissionTree=new EaseMenuTree();
EaseMenuTree oTemp=new EaseMenuTree();
oTemp.BeginGroup("TOPMENUFINANCE","Administrative Privilege", false);
oTemp.MenuItem("FTOPMENU2", "Day Start-Up", false);
oTemp.MenuItem("FTOPMENU3", "Day End", false);
oTemp.MenuItem("FTOPMENUUSERS", "Manage Users", false);
oTemp.EndGroup();
oTemp.BeginGroup("Finance1","Daily Transaction", true);
oTemp.MenuItem("Finance1.1", "Money Receive from Customer", true);
oTemp.MenuItem("Finance1.2", "Money Return to Customer", true);
oTemp.MenuItem("Finance1.3", "Pending Transactions", true);
oTemp.MenuItem("Finance1.4", "Receive for GPCF Services", true);
oTemp.MenuItem("Finance1.5", "Money Receive from SE", true);
oTemp.MenuItem("Finance1.6", "Money Receive from GPSD", true);
oTemp.EndGroup();
oTemp.BeginGroup("Finance2","Deposit to Bank", true);
oTemp.MenuItem("Finance2.1", "Deposit Instrument", true);
oTemp.MenuItem("Finance2.2", "Deposit Cash", true);
oTemp.MenuItem("Finance2.3", "Deposit Credit Card", true);
oTemp.MenuItem("Finance2.4", "Closing Denomination", true);
oTemp.EndGroup();
oTemp.BeginGroup("Finance3","Reports", true);
oTemp.MenuItem("Finance3.1", "Money Receipt", true);
oTemp.MenuItem("Finance3.9", "GPSD Payment Status",true);
oTemp.MenuItem("Finance3.10", "SE Payment Status",true);
oTemp.MenuItem("Finance3.2", "Deposit Slip", true);
oTemp.MenuItem("Finance3.3", "Datewise Deposit", true);
oTemp.MenuItem("Finance3.4", "Final Transaction Report", true);
oTemp.MenuItem("Finance3.5", "Final Delivery Report", true);
oTemp.MenuItem("Finance3.6", "GPDC Export Details", true);
oTemp.MenuItem("Finance3.7", "GPDC Export Summary", true);
oTemp.MenuItem("Finance3.8", "Re-load Sales Report", true);
oTemp.EndGroup();
oTemp.BeginGroup("Finance4", "Administrative", true);
oTemp.MenuItem("Finance4.1", "Update GPDC Info", true);
oTemp.MenuItem("Finance4.6", "Bank Account", true);
oTemp.MenuItem("Finance4.2", "Opening Balance Entry", true);
oTemp.MenuItem("Finance4.3", "Edit Instrument", true);
oTemp.MenuItem("Finance4.4", "Edited Instrument History", true);
oTemp.MenuItem("Finance4.5", "Regenerate GPDC Export Summary", true);
oTemp.EndGroup();
_oMenuTree=oTemp;
_oAllMenuTree=oTemp;
}
#endregion
#endregion
#region System Startup/Shutdown Related function
// public static void SystemShutDown(DateTime NextOperationDate)
// {
// BOThisSystem oThisSystem=new BOThisSystem();
// oThisSystem.UpdateShutDownDate(NextOperationDate);
// }
//
// public static void StartNewDay(DateTime OperationDate)
// {
// BOThisSystem oThisSystem=new BOThisSystem();
// oThisSystem.UpdateStartUpDate(OperationDate);
// }
#endregion
#region Date Related Fucntion
public static DateTime PayrollFirstDateOfMonth(DateTime dOnDate)
{
DateTime dFDOfMonth=new DateTime(dOnDate.Year, dOnDate.Month, 1);
return dFDOfMonth;
}
public static DateTime PayrollLastDateOfMonth(DateTime dOnDate)
{
DateTime dLDOfMonth=new DateTime(dOnDate.Year, dOnDate.Month, 1);
dLDOfMonth=dLDOfMonth.AddMonths(1);
dLDOfMonth=dLDOfMonth.AddDays(-1);
return dLDOfMonth;
}
#endregion
#region Taka Format
public static string Left(string _Str, int _Len)
{
//Written by Shaila
string sStr;
if (_Len < _Str.Length )
{
sStr =_Str.Substring (0,_Len);
}
else
sStr = _Str;
return sStr;
} //EndofLeft
public static string Right(string _Str, int _Len)
{
//Written by Shaila
string sStr;
if (_Len < _Str.Length )
{
sStr =_Str.Substring(_Str.Length - _Len, _Len) ;
}
else
sStr =_Str;
return sStr;
} //EndofRight
public static string TakaFormat(double _Number)
{
//Written by Shaila
string _sign = "";
string _NumStr;
string _TakaFormat;
if (_Number < 0)
{
_sign = "-" ;
_Number =(- _Number);
}
_NumStr = _Number.ToString("0.00");
_TakaFormat = Right(_NumStr, 6);
if ((_NumStr.Length) <= 6)
{
_NumStr = "";
}
else
_NumStr = Left(_NumStr, _NumStr.Length - 6);
if (_NumStr == "")
{
_TakaFormat=_sign +_TakaFormat;
return _TakaFormat;
}
int _CommaCount = 1;
int _DigitCount = 0;
do
{
if (_CommaCount % 3 == 0)
{
_DigitCount = 3;
}
else
_DigitCount = 2;
_TakaFormat = Right(_NumStr, _DigitCount) + "," + _TakaFormat;
if ( _NumStr.Length <= _DigitCount)
{
_NumStr = "";
}
else
_NumStr = Left(_NumStr, _NumStr.Length - _DigitCount);
_CommaCount = _CommaCount + 1;
} //end do
while(_NumStr != "");
_TakaFormat= _sign + _TakaFormat;
return _TakaFormat;
} //End of TakaFormat
public static string MillionFormat(Decimal _Number)
{
//Written by Shaila
string _sign = "";
string _NumStr;
string _MilFormat;
if (_Number < 0)
{
_sign = "-" ;
_Number =(- _Number);
}
_NumStr = _Number.ToString("0.00");
_MilFormat = Right(_NumStr, 6);
if ((_NumStr.Length) <= 6)
{
_NumStr = "";
}
else
_NumStr = Left(_NumStr, _NumStr.Length - 6);
if (_NumStr == "")
{
_MilFormat=_MilFormat;
return _MilFormat;
}
int _CommaCount = 1;
int _DigitCount = 3;
do
{
_MilFormat = Right(_NumStr, _DigitCount) + "," + _MilFormat;
if ( _NumStr.Length <= _DigitCount)
{
_NumStr = "";
}
else
_NumStr = Left(_NumStr, _NumStr.Length - _DigitCount);
_CommaCount = _CommaCount + 1;
} //end do
while(_NumStr != "");
_MilFormat= _sign + _MilFormat;
return _MilFormat;
} //End of MilFormat
public static string HundredWords(int _Number)
{
//Written by Shaila
string _HundredWords;
string[] _Digits = new string[10] {"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};
string[] _Teens =new string[10] {"Ten","Eleven","Twelve","Thirteen","Forteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};
string[] _Tens =new string[10] {"","Ten","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"};
string _NumStr;
string sPos1;
string sPos2;
string sPos3;
_NumStr=Right(_Number.ToString("000"),3);
if (Left(_NumStr,1) != "0")
sPos1 = _Digits.GetValue(Convert.ToInt32( Left(_NumStr, 1))) + " Hundred" ;
else
sPos1 ="";
_NumStr=Right(_NumStr,2);
if (Left(_NumStr,1)== "1")
{
sPos2 = Convert.ToString( _Teens.GetValue(Convert.ToInt32( Right(_NumStr, 1))));
sPos3 ="";
}
else
{
sPos2 = Convert.ToString(_Tens.GetValue( Convert.ToInt32(Left(_NumStr, 1))));
sPos3 = Convert.ToString(_Digits.GetValue(Convert.ToInt32(Right(_NumStr, 1))));
}
_HundredWords=sPos1 ;
if (_HundredWords != "")
{
if (sPos2 != "" )
{
_HundredWords=_HundredWords + " " ;
}
}
_HundredWords=_HundredWords + sPos2 ;
if (_HundredWords != "")
{
if (sPos3 != "" )
{
_HundredWords=_HundredWords + " " ;
}
}
_HundredWords=_HundredWords + sPos3 ;
return _HundredWords;
} //EndofHundredWords
public static string TakaWords(double _Number)
{
//Written by Shaila
string _Sign="";
string _TakaWords;
string _NumStr;
string _sTaka;
string _sPaisa;
string[] sPows=new string[3] {"Crore","Thousand","Lakh"};
if (_Number < 0 )
{
_Sign="Minus";
_Number=Math.Abs(_Number);
}
_NumStr=_Number.ToString ("0.00");
_sPaisa =HundredWords(Convert.ToInt32 ( Right(_NumStr, 2)));
if (_sPaisa != "" )
{
//_sPaisa=" Paisa " + _sPaisa ;
}
_NumStr=Left(_NumStr,_NumStr.Length -3);
_sTaka=HundredWords(Convert.ToInt32 (Right(_NumStr,3)));
if (_NumStr.Length <= 3)
_NumStr="" ;
else
_NumStr=Left(_NumStr,_NumStr.Length -3) ;
int _nCommaCount ;
int _nDigitCount ;
string _sPow ;
_nCommaCount=1;
if (_NumStr != "" )
{
do
{
if (_nCommaCount % 3 == 0)
_nDigitCount=3;
else
_nDigitCount=2 ;
_sPow=HundredWords(Convert.ToInt32(Right (_NumStr,_nDigitCount))) ;
if (_sPow != "")
{
if (Convert.ToString( _Number).Length > 10 )
{
_sPow =_sPow + " " + sPows.GetValue (_nCommaCount % 3) + " Crore ";
}
else
_sPow =_sPow + " " + sPows.GetValue (_nCommaCount % 3) ;
}
if (_sTaka != "")
{
if (_sPow != "" )
_sPow=_sPow + " " ;
}
_sTaka= _sPow + _sTaka ;
if (_NumStr.Length <= _nDigitCount)
_NumStr="";
else
_NumStr=Left(_NumStr,_NumStr.Length -_nDigitCount) ;
_nCommaCount=_nCommaCount + 1 ;
} //EndDo
while(_NumStr != "");
}
if (_sTaka != "" )
{
_sTaka=" Taka " + _sTaka ;
}
_TakaWords=_sTaka ;
if (_TakaWords != "" )
{
if (_sPaisa != "" )
_TakaWords=_TakaWords + " And " ;
}
_TakaWords=_TakaWords + _sPaisa ;
if (_TakaWords == "" )
_TakaWords="Taka Zero" ;
_TakaWords = _Sign + _TakaWords + " Only" ;
return _TakaWords ;
} //EndofTakaWords
#endregion
#region Encrypt with XMLFile and Dycrypt
public static void DecryptFile(string FilePath, DataSet oDataSet)
{
try
{
string line=null;
string fullstring="";
StreamReader strReader=new StreamReader(FilePath);
while(((line=strReader.ReadLine()) != null))
{
fullstring=fullstring+line;
}
strReader.Close();
AES oAES=new AES();
byte [] bytIn=oAES.StringToByte(fullstring);
byte [] bytPassword=oAES.StringToByte("celadmin");
//Decrypt the data
byte [] bytOut=oAES.DecryptData (bytIn, bytPassword);
StreamWriter oWriter=new StreamWriter(FilePath);
oWriter.Write(oAES.ByteToString( bytOut));
oWriter.Flush();
oWriter.Close();
//TextReader txtReader=new StringReader(oAES.ByteToString(bytOut));
oDataSet.ReadXml(FilePath);
//txtReader.Close();
}
catch(Exception eh)
{
throw new Exception(eh.Message);
}
}
public static void CreateCSVFile(string FilePath, System.Data.DataSet DataSet, System.Data.DataTable oTable, string GPDCName)
{
try
{
string sText="";
string sDelimiter=",";
int nCount=0;
long nQty=0;
DateTime dTranDate=DateTime.Today;
string StartKitNo="";
string EndKitNo="";
StreamWriter oWriter=new StreamWriter(FilePath);
foreach(DataRow oRow in oTable.Rows)
{
string sKitNo="";
long nCode=0;
nCount++;
dTranDate=Convert.ToDateTime(oRow["TranDate"].ToString());
nQty=Convert.ToInt64( oRow["TotalQty"].ToString());
if(oRow["TranType"].ToString()=="3")
{
nQty=(-1)*nQty;
}
sKitNo=oRow["StartKitNo"].ToString();
StartKitNo=sKitNo.Substring(0,8) + oRow["KitPrefix"].ToString() + sKitNo.Substring(8,12); //+ oRow["KitSuffix"].ToString();
sKitNo=oRow["EndKitNo"].ToString();
EndKitNo=sKitNo.Substring(0,8) + oRow["KitPrefix"].ToString() + sKitNo.Substring(8,12);// + oRow["KitSuffix"].ToString();
//ERP requires only number, no padding
nCode=Convert.ToInt64(oRow["Code"]);
sText= oRow["TranNo"].ToString() + sDelimiter + dTranDate.ToString("dd/MM/yyyy") + sDelimiter;
sText= sText + nCode.ToString() + sDelimiter + GPDCName + sDelimiter + nCount.ToString()+ sDelimiter + oRow[3].ToString()+ sDelimiter ;
sText= sText + oRow["Price"].ToString() + sDelimiter + nQty.ToString() + sDelimiter + sDelimiter ;
sText= sText + StartKitNo + sDelimiter + EndKitNo ;
oWriter.WriteLine(sText);
}
oWriter.Close();
}
catch(Exception err)
{
throw new Exception(err.Message);
}
}
public static void CreateSCCSVFile(string FilePath, DataSet oDataSet, string GPDCName)
{
try
{
string sText="";
string sDelimiter=",";
int nCount=0;
long nQty=0;
DateTime dTranDate=DateTime.Today;
string StartKitNo="";
string EndKitNo="";
string sBatchCode="";
StreamWriter oWriter=new StreamWriter(FilePath);
foreach(DataRow oRow in oDataSet.Tables[0].Rows)
{
long nCode=0;
nCount++;
dTranDate=Convert.ToDateTime(oRow["TranDate"].ToString());
nQty=Convert.ToInt64( oRow["TotalQty"].ToString());
if(oRow["TranType"].ToString()=="3")
{
nQty=(-1)*nQty;
}
sBatchCode=oRow["BatchNo"].ToString() ;
StartKitNo=oRow["StartNo"].ToString() ;
EndKitNo=oRow["EndNo"].ToString();
//ERP requires only number, no padding
nCode=Convert.ToInt64(oRow["Code"]);
sText= "SC-" + oRow["TranNo"].ToString() + sDelimiter + dTranDate.ToString("dd/MM/yyyy") + sDelimiter;
sText= sText + nCode.ToString() + sDelimiter + GPDCName + sDelimiter + nCount.ToString()+ sDelimiter + oRow[3].ToString()+ sDelimiter ;
sText= sText + oRow["UnitPrice"].ToString() + sDelimiter + nQty.ToString() + sDelimiter + sBatchCode + sDelimiter ;
sText= sText + StartKitNo + sDelimiter + EndKitNo ;
oWriter.WriteLine(sText);
}
oWriter.Close();
}
catch(Exception err)
{
throw new Exception(err.Message);
}
}
public static void CreateXMLFile(string FilePath, System.Data.DataSet Dataset, bool encrypt)
{
try
{
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(FilePath, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
Dataset.WriteXml(myXmlWriter);
myXmlWriter.Close();
// if(encrypt)
// {
// string line=null;
// string fullstring="";
// StreamReader strReader=new StreamReader(FilePath);
// while(((line=strReader.ReadLine()) != null))
// {
// fullstring=fullstring+line;
// }
// strReader.Close();
//
// AES oAES=new AES();
// byte [] bytIn=oAES.StringToByte(fullstring);
// byte [] bytPassword=oAES.StringToByte("celadmin");
//
// //Encrypt the data
//
// byte [] bytOut=oAES.EncryptData(bytIn, bytPassword);
// //oAES.EncryptData(bytIn, bytPassword);
// //StreamWriter oWriter=new StreamWriter(FilePath);
// StreamWriter oWriter=new StreamWriter("C:\\STS\\x.md");
// oWriter.Write(oAES.ByteToString( bytOut));
// oWriter.Flush();
// oWriter.Close();
// }
myFileStream.Close();
}
catch(Exception err)
{
throw new Exception(err.Message);
}
}
#endregion
#region XML File Format
public static void ChangeDateFormat(DataSet oSet,string sFilePath,string sFormat,params string[] values)
{
string sFieldName="";
DateTime dDate;
bool bInsert=false;
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
//nsmgr.AddNamespace("bk", "urn:sample");
XmlParserContext context = new XmlParserContext(null, nsmgr,null, XmlSpace.None);
XmlTextReader oXMLReader = new XmlTextReader(oSet.GetXml(), XmlNodeType.Element, context);
XmlTextWriter oXMLWriter=new XmlTextWriter(sFilePath,Encoding.Unicode);
oXMLWriter.WriteStartDocument();
try
{
while(oXMLReader.Read())
{
switch(oXMLReader.NodeType)
{
case XmlNodeType.Element:
oXMLWriter.WriteStartElement(oXMLReader.Name);
if(oXMLReader.IsEmptyElement) oXMLWriter.WriteEndElement();
sFieldName=oXMLReader.Name;
break;
case XmlNodeType.Text:
bInsert=false;
foreach(string sField in values)
{
if(sFieldName.ToUpper()==sField.ToUpper())
{
if(oXMLReader.Value.ToString() != "0")
dDate=DateTime.Parse(oXMLReader.Value.ToString());
else
dDate=DateTime.MinValue;
oXMLWriter.WriteString(dDate.ToString(sFormat));
bInsert=true;
break;
}
}
if(!bInsert)
{
oXMLWriter.WriteString(oXMLReader.Value);
}
break;
case XmlNodeType.EndElement:
oXMLWriter.WriteEndElement();
break;
}
}
oXMLWriter.Close();
}
catch(XmlException e)
{
throw new Exception(e.Message);
}
}
#endregion
}
#endregion
#region Clone class
public sealed class CloneObject
{
private CloneObject()
{
}
public static void Clone(object srcObject, object destObject)
{
PropertyInfo[] props = (srcObject.GetType()).GetProperties();
foreach(PropertyInfo prop in props)
{
if(prop.CanRead)
{
object val = prop.GetValue(srcObject, null);
if(prop.CanWrite)
{
prop.SetValue(destObject, val, null);
}
}
}
}
}
#endregion
}