using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ISCMS
{
using System.Xml;
using System.Data;
using System.Globalization;
using System.Threading;
using System.Drawing;
public class Base : Hasan.FormCustom
{
public ISCMS.Main.BaseControl FormBase;
public ISCMS.Main.BaseControl LastFormBase;
public int isFormDispaly = 1;
public static int GLocation_ID = 0;
public int STATE = 1;
public static Thread loadingThread;
public Thread shadeThread;
public static System.Drawing.Size mpSize;
public static System.Drawing.Point mpLocation;
private System.Windows.Forms.Label TEMP;
public static int GRole_ID = 1;
public static long GEmployee_ID;
public static object GEmployee_IDObject;
public static string GRole_Name = "";
public static string GClinic_Name = "", GAccount_ID = "", Guser = "", GPhone = "";
public static string GClinic_ID = "";
public static int GIs_Listing = 0;
public static DataSet dsData;
public Base()
{
if (dsData == null)
{
ISCMS.DataAccess.Access da = new ISCMS.DataAccess.Access();
dsData = da.LoadParameters();
}
}
public void setLoading()
{
//lock (this)
//{
// l = new ISCMS.Main.Loading();
// l.ShowDialog();
//}
}
public virtual void setShade()
{
//lock (this)
//{
// sh = new ISCMS.Main.Shade();
// sh.ShowDialog();
//}
}
//public delegate void ParameterizedThreadStart (object obj);
public void startLoadingDialog()
{
loadingThread = new Thread(new ThreadStart(setLoading));
loadingThread.IsBackground = true;
loadingThread.Start();
}
public void stopLoadingDialog()
{
try
{
Thread.Sleep(500);
loadingThread.Abort();
loadingThread.Join();
// l.Visible = false;
// Thread.Sleep(1000);
}
catch (Exception af)
{
System.Windows.Forms.MessageBox.Show(af.Message);
}
}
public Main.BaseControl BaseFactory(string Form, int Location, MainForm mf)
{
GLocation_ID = Location;
switch (Form)
{
// Plant
case "Plant_Panoramic":
return new Plant.Panoramic();
case "Plant_Event_List":
return new Plant.EventList();
case "Sales_Order_Conversion":
return new Plant.PurchaseOrderConversion();
case "Purchase_Order_Conversion":
return new Plant.SalesOrderConversion();
#region Procurement
case "Procurement_Stock":
return new Procurement.Stock();
case "Procurement_Events":
return new Procurement.Event();
case "Procurement_Event_List":
return new Procurement.EventList();
// Segregation cost
case "RM_Waste_By_Cost_Segregation":
case "RM_WIP_By_Cost_Segregation":
case "RM_Consumed_By_Cost_Segregation":
case "RM_In_Transit_By_Cost_Segregation":
return new Main.Chart(Form,Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Bar,Main.Chart.ChartBy.Segregated_Cost,true);
// Segregation quantity
case "RM_Waste_By_Quantity_Segregation":
case "RM_WIP_By_Quantity_Segregation":
case "RM_Consumed_By_Quantity_Segregation":
case "RM_In_Transit_By_Quantity_Segregation":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Quantity,true);
// Aggregation Cost Bar
case "RM_Waste_By_Cost_Aggregation_Bar":
case "RM_WIP_By_Cost_Aggregation_Bar":
case "RM_Consumed_By_Cost_Aggregation_Bar":
case "RM_In_Transit_By_Cost_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Cost,false);
// Aggregation Quantity Bar
case "RM_Waste_By_Quantity_Aggregation_Bar":
case "RM_WIP_By_Quantity_Aggregation_Bar":
case "RM_Consumed_By_Quantity_Aggregation_Bar":
case "RM_In_Transit_By_Quantity_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Quantity,false);
// Aggregation Cost Pie
case "RM_Waste_By_Cost_Aggregation_Pie":
case "RM_WIP_By_Cost_Aggregation_Pie":
case "RM_Consumed_By_Cost_Aggregation_Pie":
case "RM_In_Transit_By_Cost_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Segregated_Cost,false);
// Aggregation Quantity Pie
case "RM_Waste_By_Quantity_Aggregation_Pie":
case "RM_WIP_By_Quantity_Aggregation_Pie":
case "RM_Consumed_By_Quantity_Aggregation_Pie":
case "RM_In_Transit_By_Quantity_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Segregated_Quantity,false);
case "RM_Segregated_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Segregated_Cost, true);
case "RM_Cumulative_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Segregated_Cost, false);
case "RM_Rates":
return new Main.Chart(Form, Main.Chart.PlantSegment.Procurement,
Main.Chart.Charts.Kagi, Main.Chart.ChartBy.Segregated_Cost, false);
#endregion
#region Manufacturing
case "Manufacturing_Events":
return new Manufacturing.Event();
case "Manufacturing_Event_List":
return new Manufacturing.EventList();
case "Manufacturing_Material":
return new Manufacturing.Material();
case "Job_List":
return new Manufacturing.JobList();
// Segregation cost
case "WIP_Waste_By_Cost_Segregation":
case "WIP_WIP_By_Cost_Segregation":
case "WIP_Consumed_By_Cost_Segregation":
case "WIP_In_Transit_By_Cost_Segregation":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Cost, true);
// Segregation quantity
case "WIP_Waste_By_Quantity_Segregation":
case "WIP_WIP_By_Quantity_Segregation":
case "WIP_Consumed_By_Quantity_Segregation":
case "WIP_In_Transit_By_Quantity_Segregation":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Quantity, true);
// Aggregation Cost Bar
case "WIP_Waste_By_Cost_Aggregation_Bar":
case "WIP_WIP_By_Cost_Aggregation_Bar":
case "WIP_Consumed_By_Cost_Aggregation_Bar":
case "WIP_In_Transit_By_Cost_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Cumulative_Cost, false);
// Aggregation Quantity Bar
case "WIP_Waste_By_Quantity_Aggregation_Bar":
case "WIP_WIP_By_Quantity_Aggregation_Bar":
case "WIP_Consumed_By_Quantity_Aggregation_Bar":
case "WIP_In_Transit_By_Quantity_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Cumulative_Quantity, false);
// Aggregation Cost Pie
case "WIP_Waste_By_Cost_Aggregation_Pie":
case "WIP_WIP_By_Cost_Aggregation_Pie":
case "WIP_Consumed_By_Cost_Aggregation_Pie":
case "WIP_In_Transit_By_Cost_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Cumulative_Cost, false);
// Aggregation Quantity Pie
case "WIP_Waste_By_Quantity_Aggregation_Pie":
case "WIP_WIP_By_Quantity_Aggregation_Pie":
case "WIP_Consumed_By_Quantity_Aggregation_Pie":
case "WIP_In_Transit_By_Quantity_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Cumulative_Quantity, false);
case "WIP_Segregated_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Segregated_Cost, true);
case "WIP_Cumulative_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Cumulative_Cost, false);
case "WIP_Rates":
return new Main.Chart(Form, Main.Chart.PlantSegment.Work_In_Progress,
Main.Chart.Charts.Kagi, Main.Chart.ChartBy.Rate, false);
#endregion
#region Warehouse
case "Warehouse_Stock":
return new Warehouse.Stock();
case "Warehouse_Events":
return new Warehouse.Event();
case "Warehouse_Event_List":
return new Warehouse.EventList();
// Segregation cost
case "FG_Waste_By_Cost_Segregation":
case "FG_WIP_By_Cost_Segregation":
case "FG_Consumed_By_Cost_Segregation":
case "FG_In_Transit_By_Cost_Segregation":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Cost, true);
// Segregation quantity
case "FG_Waste_By_Quantity_Segregation":
case "FG_WIP_By_Quantity_Segregation":
case "FG_Consumed_By_Quantity_Segregation":
case "FG_In_Transit_By_Quantity_Segregation":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Segregated_Quantity, true);
// Aggregation Cost Bar
case "FG_Waste_By_Cost_Aggregation_Bar":
case "FG_WIP_By_Cost_Aggregation_Bar":
case "FG_Consumed_By_Cost_Aggregation_Bar":
case "FG_In_Transit_By_Cost_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Cumulative_Cost, false);
// Aggregation Quantity Bar
case "FG_Waste_By_Quantity_Aggregation_Bar":
case "FG_WIP_By_Quantity_Aggregation_Bar":
case "FG_Consumed_By_Quantity_Aggregation_Bar":
case "FG_In_Transit_By_Quantity_Aggregation_Bar":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Bar, Main.Chart.ChartBy.Cumulative_Quantity, false);
// Aggregation Cost Pie
case "FG_Waste_By_Cost_Aggregation_Pie":
case "FG_WIP_By_Cost_Aggregation_Pie":
case "FG_Consumed_By_Cost_Aggregation_Pie":
case "FG_In_Transit_By_Cost_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Rate, false);
// Aggregation Quantity Pie
case "FG_Waste_By_Quantity_Aggregation_Pie":
case "FG_WIP_By_Quantity_Aggregation_Pie":
case "FG_Consumed_By_Quantity_Aggregation_Pie":
case "FG_In_Transit_By_Quantity_Aggregation_Pie":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Pie, Main.Chart.ChartBy.Cumulative_Quantity, false);
case "FG_Segregated_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Segregated_Cost, true);
case "FG_Cumulative_Cost_Line_Chart":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Line, Main.Chart.ChartBy.Segregated_Cost, false);
case "FG_Rates":
return new Main.Chart(Form, Main.Chart.PlantSegment.Warehouse,
Main.Chart.Charts.Kagi, Main.Chart.ChartBy.Rate, false);
#endregion
// Purchase Invoice
case "Purchase_Invoice":
return new Invoice.PurchaseInvoice();
case "Purchase_Invoice_List":
return new Invoice.PurchaseInvoiceList();
// Sales Invoice
case "Sales_Invoice":
return new Invoice.SalesInvioce();
case "Sales_Invoice_List":
return new Invoice.SalesInvoiceList();
// Purchase Order
///case "Purchase_Order":
case "Purchase_Order_List":
return new Order.PurchaseOrderList();
// Sales Order
//case "Sales_Order":
case "Sales_Order_List":
return new Order.SalesOrderList();
// Master files
case "Carrier_List":
return new ISCMS.MasterFiles.Carrier.List();
case "Client_List":
return new ISCMS.MasterFiles.Client.List();
case "Goods_List":
return new ISCMS.MasterFiles.Goods.List();
case "Invoice_List":
return new ISCMS.MasterFiles.Invoice.List();
case "Order_List":
return new ISCMS.MasterFiles.Order.List();
case "Supplier_List":
return new ISCMS.MasterFiles.Supplier.List();
case "Transporter_List":
return new ISCMS.MasterFiles.Transporter.List();
case "Employee_List":
return new ISCMS.MasterFiles.Employee.List();
default:
return new Main.BaseControl();
}
return new ISCMS.Main.BaseControl();
}
public Hasan.FormCustom BaseFactory(string Form, int Location, MainForm mf, bool IsDetail)
{
GLocation_ID = Location;
switch (Form)
{
case "In-bound_Receive":
return new ISCMS.Dialog.Transaction(mf, 1, 1, true, false, 0);
case "In-bound_Transit":
return new ISCMS.Dialog.Transaction(mf,2, 1, true, false, 0);
case "In-bound_Waste":
return new ISCMS.Dialog.Transaction(mf,6, 2, true, false, 0);
case "Out-bound_Waste":
return new ISCMS.Dialog.Transaction(mf, 6,2,false, false, 0);
case "Sold":
return new ISCMS.Dialog.Transaction(mf,4, 2, false, false, 0);
case "Out-bound_Reserve":
return new ISCMS.Dialog.Transaction(mf, 2, 2, false, false, 0);
case "Sales_Return":
return new ISCMS.Dialog.Transaction(mf,4, 1, false, false, 0);
case "Carrier":
return new ISCMS.MasterFiles.Carrier.Carrier();
case "Client":
return new ISCMS.MasterFiles.Client.Client();
case "Goods":
return new ISCMS.MasterFiles.Goods.Goods();
case "Invoice":
return new ISCMS.MasterFiles.Invoice.Invoice();
case "Order":
return new ISCMS.MasterFiles.Order.Order();
case "Supplier":
return new ISCMS.MasterFiles.Supplier.Supplier();
case "Transporter":
return new ISCMS.MasterFiles.Transporter.Transporter();
case "Employee":
return new ISCMS.MasterFiles.Employee.Employee();
case "Job":
return new ISCMS.Dialog.Job();
default:
return new Hasan.FormCustom();
}
}
public void SetReadOnlyProcess(System.Windows.Forms.Control C, bool b)
{
string s = "";
System.Windows.Forms.TextBox TB;
System.Windows.Forms.ComboBox CB;
System.Windows.Forms.CheckBox CHB;
System.Windows.Forms.RadioButton RB;
System.Windows.Forms.DateTimePicker DTP;
System.Windows.Forms.CheckedListBox CLB;
System.Windows.Forms.ListBox LB;
System.Windows.Forms.NumericUpDown NUD;
System.Windows.Forms.GroupBox GB;
foreach (System.Windows.Forms.Control current in C.Controls)
{
s = current.GetType().ToString();
if (s.IndexOf("CheckBox") >= 0)
{
CHB = (System.Windows.Forms.CheckBox)current;
CHB.Enabled = b;
}
if (s.IndexOf("TextBox") >= 0)
{
TB = (System.Windows.Forms.TextBox)current;
if (b)
{
TB.ReadOnly = false;
TB.BackColor = System.Drawing.Color.White;
}
else
{
TB.ReadOnly = true;
TB.BackColor = System.Drawing.Color.Gainsboro;
}
}
if (s.IndexOf("ComboBox") >= 0)
{
CB = (System.Windows.Forms.ComboBox)current;
//if( STATE == 1 )
// CB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
if (b)
{
CB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
CB.Enabled = true;
CB.BackColor = System.Drawing.Color.White;
CB.ForeColor = System.Drawing.Color.Black;
}
else
{
CB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
CB.Enabled = false;
CB.BackColor = System.Drawing.Color.Gainsboro;
CB.ForeColor = System.Drawing.Color.Black;
}
}
if (s.IndexOf(".RadioButton") >= 0)
{
RB = (System.Windows.Forms.RadioButton)current;
RB.Enabled = b;
}
if (s.IndexOf(".Button") >= 0)
{
//B = (Button) current;
// B.Enabled = b;
}
if (s.IndexOf(".DateTimePicker") >= 0)
{
DTP = (System.Windows.Forms.DateTimePicker)current;
DTP.Enabled = b;
if (b)
DTP.BackColor = System.Drawing.Color.White;
else
DTP.BackColor = System.Drawing.Color.Gainsboro;
}
if (s.IndexOf(".CheckedListBox") >= 0)
{
CLB = (System.Windows.Forms.CheckedListBox)current;
if (b)
{
CLB.Enabled = true;
CLB.BackColor = System.Drawing.Color.White;
}
else
{
CLB.Enabled = false;
CLB.BackColor = System.Drawing.Color.Gainsboro;
}
}
if (s.IndexOf(".ListBox") >= 0)
{
LB = (System.Windows.Forms.ListBox)current;
if (b)
{
LB.Enabled = true;
LB.BackColor = System.Drawing.Color.White;
}
else
{
LB.Enabled = false;
LB.BackColor = System.Drawing.Color.Gainsboro;
}
}
if (s.IndexOf(".NumericUpDown") >= 0)
{
NUD = (System.Windows.Forms.NumericUpDown)current;
if (b)
{
// NUD.Enabled = true;
// NUD.BackColor = System.Drawing.Color.White;
}
else
{
// NUD.Enabled = false;
// NUD.BackColor = System.Drawing.Color.Gainsboro;
}
}
if (s.IndexOf(".GroupBox") >= 0)
{
GB = (System.Windows.Forms.GroupBox)current;
if (b)
{
// GB.Enabled = true;
// GB.BackColor = System.Drawing.Color.White;
}
else
{
// GB.Enabled = false;
// GB.BackColor = System.Drawing.Color.Gainsboro;
}
}
}
}
public void UnBindControl(System.Windows.Forms.Control C, bool b)
{
string s = "";
System.Windows.Forms.TextBox TB;
System.Windows.Forms.ComboBox CB;
System.Windows.Forms.CheckBox CHB;
System.Windows.Forms.RadioButton RB;
System.Windows.Forms.DateTimePicker DTP;
System.Windows.Forms.Label L;
foreach (System.Windows.Forms.Control current in C.Controls)
{
s = current.GetType().ToString();
if (s.IndexOf("CheckBox") >= 0)
{
CHB = (System.Windows.Forms.CheckBox)current;
if (CHB.DataBindings.Count > 0)
CHB.DataBindings.RemoveAt(0);
}
if (s.IndexOf("TextBox") >= 0)
{
TB = (System.Windows.Forms.TextBox)current;
if (TB.DataBindings.Count > 0)
TB.DataBindings.RemoveAt(0);
}
if (s.IndexOf("ComboBox") >= 0)
{
CB = (System.Windows.Forms.ComboBox)current;
if (CB.DataBindings.Count > 0)
CB.DataBindings.RemoveAt(0);
}
if (s.IndexOf(".RadioButton") >= 0)
{
RB = (System.Windows.Forms.RadioButton)current;
if (RB.DataBindings.Count > 0)
RB.DataBindings.RemoveAt(0);
}
if (s.IndexOf(".Button") >= 0)
{
// B = (Button) current;
// B.Enabled = b;
}
if (s.IndexOf(".DateTimePicker") >= 0)
{
DTP = (System.Windows.Forms.DateTimePicker)current;
if (DTP.DataBindings.Count > 0)
DTP.DataBindings.RemoveAt(0);
}
if (s.IndexOf(".Label") >= 0)
{
L = (System.Windows.Forms.Label)current;
if (L.DataBindings.Count > 0)
L.DataBindings.RemoveAt(0);
}
}
}
private void InitializeComponent()
{
this.TEMP = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// TEMP
//
this.TEMP.Dock = System.Windows.Forms.DockStyle.Top;
this.TEMP.Location = new System.Drawing.Point(0, 0);
this.TEMP.Name = "TEMP";
this.TEMP.Size = new System.Drawing.Size(432, 51);
this.TEMP.TabIndex = 0;
this.TEMP.Text = "label1";
//
// Base
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(432, 362);
this.Controls.Add(this.TEMP);
this.Name = "Base";
this.Opacity = 0.3;
this.ResumeLayout(false);
}
public string GetNodesValue(XmlNodeList n, string name)
{
for (int i = 0; i < n.Item(0).ChildNodes.Count; i++)
{
if (n.Item(0).ChildNodes[i].Name == name)
return n.Item(0).ChildNodes[i].InnerText;
}
return "nto fds";
}
protected void LoadForm(MainForm mF, Base baseClass)
{
//mF.FormBase = baseClass;
//mF.mainPanel.Controls.Clear();
//mF.FormBase.MdiParent = mF;
//mF.FormBase.Parent = mF.MdiParent;
//mF.mainPanel.Controls.Add(mF.FormBase);
//mF.FormBase.Show();
}
}
}