Click here to Skip to main content
15,886,873 members
Articles / Desktop Programming / Windows Forms

Internal Supply Chain Management System, Visibility

Rate me:
Please Sign up or sign in to vote.
4.78/5 (30 votes)
9 Oct 2009CPOL7 min read 105.9K   16.5K   108  
Internal supply chain management system's objective is to visualize organization's activities and events spawn during its work flow and offers panoramic view of upstream and downstream activities
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hasan;

namespace ISCMS.Control
{
  

    public class RMInTransitBalloon : CBalloonBase
    {
        private Label label1;
        private Label lblRaw_Material;
        private Label label5;
        private Label label13;
        private Hasan.TextBox txtComments;
        private Label label16;
        private Label lblStatus;
        private CustomLabel Header;
        private Hasan.Button button1;
        private System.ComponentModel.IContainer components = null;

        public static RMInTransitBalloon newMessageBox;

        
        Point poi;
        
        //CMS.Appointment.List m_List;
        
        private Label Error;
        private Hasan.Button btnSave;
        private Hasan.Button btnCancel;
        private Label lblDuration;

        Bars.Bar Slot;
        private DateTimePicker Received_Start_Time;
        private DateTimePicker Received_Date;
        int ID = 0;

        
        private Label lblUnit;
        private Label label3;
        private Label lblDate;
        private Label label6;

        int RMTransaction_Status_ID = 5;
        int RMTransaction_Type_ID = 2;
        int FGTransaction_Status_ID = 1;
        int FGTransaction_Type_ID = 1;
        int Job_Transaction_Status_ID = 5;

     //   int Job_Transaction_Status_ID = 0;



        public RMInTransitBalloon()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call
        }



        public RMInTransitBalloon(Bars.Bar slot//, Main.Control.schedular sche
                                    , Point po, int id)//, CMS.Appointment.List pm_List)
        {


            // This call is required by the Windows Form Designer.
            Slot = slot;
            poi = po;
            InitializeComponent();
            this.Location = poi;
            //schedular = sche;
            Control.Bars.Is_HoverEnable = false;
            Header.BackColor = slot.color;


            //m_List = pm_List;

            if (slot.color == Color.Green)
            {
                Header.Text = "Finished Job";
                lblStatus.Text = "In Process Job";
                //Transaction_Status_ID = 5;
                //Transaction_Type_ID = 2;

                RMTransaction_Status_ID = 5;
                RMTransaction_Type_ID = 2;
                FGTransaction_Status_ID = 1;
                FGTransaction_Type_ID = 1;
                Job_Transaction_Status_ID = 5;
            }
            if (slot.color == Color.Orange)
            {
                Header.Text = "In Process Job";
                lblStatus.Text = "Expected Job";
                //Transaction_Status_ID = 3;
                //Transaction_Type_ID = 2;

                RMTransaction_Status_ID = 3;
                RMTransaction_Type_ID = 2;
                FGTransaction_Status_ID = 3;
                FGTransaction_Type_ID = 1;

                Job_Transaction_Status_ID = 3;
            }

            lblRaw_Material.Text = Slot.ID.ToString();
            ID = id;



        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.lblRaw_Material = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.txtComments = new Hasan.TextBox();
            this.label16 = new System.Windows.Forms.Label();
            this.lblStatus = new System.Windows.Forms.Label();
            this.Header = new Hasan.CustomLabel();
            this.button1 = new Hasan.Button();
            this.Error = new System.Windows.Forms.Label();
            this.btnSave = new Hasan.Button();
            this.btnCancel = new Hasan.Button();
            this.lblDuration = new System.Windows.Forms.Label();
            this.Received_Start_Time = new System.Windows.Forms.DateTimePicker();
            this.Received_Date = new System.Windows.Forms.DateTimePicker();
            this.lblUnit = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.lblDate = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(47, 82);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(90, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Raw Material";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // lblRaw_Material
            // 
            this.lblRaw_Material.AutoSize = true;
            this.lblRaw_Material.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblRaw_Material.Location = new System.Drawing.Point(139, 82);
            this.lblRaw_Material.Name = "lblRaw_Material";
            this.lblRaw_Material.Size = new System.Drawing.Size(72, 13);
            this.lblRaw_Material.TabIndex = 2;
            this.lblRaw_Material.Text = "-------------";
            this.lblRaw_Material.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.Location = new System.Drawing.Point(38, 112);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(100, 13);
            this.label5.TabIndex = 5;
            this.label5.Text = "Received Date";
            // 
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label13.Location = new System.Drawing.Point(57, 225);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(75, 13);
            this.label13.TabIndex = 13;
            this.label13.Text = "Comments";
            this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txtComments
            // 
            this.txtComments.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.txtComments.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtComments.Currencyed = Hasan.Currency.None;
            this.txtComments.Digits = -1;
            this.txtComments.Location = new System.Drawing.Point(131, 225);
            this.txtComments.Masked = Hasan.Mask.None;
            this.txtComments.Multiline = true;
            this.txtComments.Name = "txtComments";
            this.txtComments.Precision = 2;
            this.txtComments.Size = new System.Drawing.Size(213, 43);
            this.txtComments.TabIndex = 15;
            this.txtComments.TextChanged += new System.EventHandler(this.Comments_TextChanged);
            // 
            // label16
            // 
            this.label16.AutoSize = true;
            this.label16.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label16.Location = new System.Drawing.Point(102, 191);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(37, 13);
            this.label16.TabIndex = 17;
            this.label16.Text = "Date";
            this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // lblStatus
            // 
            this.lblStatus.AutoSize = true;
            this.lblStatus.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblStatus.Location = new System.Drawing.Point(140, 167);
            this.lblStatus.Name = "lblStatus";
            this.lblStatus.Size = new System.Drawing.Size(62, 13);
            this.lblStatus.TabIndex = 18;
            this.lblStatus.Text = "-----------";
            this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // Header
            // 
            this.Header.BackColor = System.Drawing.Color.Green;
            this.Header.CornerRadius = 70;
            this.Header.Font = new System.Drawing.Font("Verdana", 11F, System.Drawing.FontStyle.Bold);
            this.Header.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.Header.Location = new System.Drawing.Point(37, 35);
            this.Header.Name = "Header";
            this.Header.RoundCorners = Hasan.Corners.TopRight;
            this.Header.Size = new System.Drawing.Size(341, 36);
            this.Header.TabIndex = 19;
            this.Header.Text = "Received Stock";
            this.Header.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // button1
            // 
            this.button1.BackColor = System.Drawing.Color.Red;
            this.button1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button1.ForeColor = System.Drawing.Color.White;
            this.button1.Location = new System.Drawing.Point(343, 38);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(19, 19);
            this.button1.TabIndex = 20;
            this.button1.Text = "X";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // Error
            // 
            this.Error.AutoSize = true;
            this.Error.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Error.ForeColor = System.Drawing.Color.Red;
            this.Error.Location = new System.Drawing.Point(128, 271);
            this.Error.Name = "Error";
            this.Error.Size = new System.Drawing.Size(176, 13);
            this.Error.TabIndex = 22;
            this.Error.Text = "Comments are mandatory";
            this.Error.Visible = false;
            // 
            // btnSave
            // 
            this.btnSave.Location = new System.Drawing.Point(286, 292);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new System.Drawing.Size(59, 23);
            this.btnSave.TabIndex = 24;
            this.btnSave.Text = "Save";
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            // 
            // btnCancel
            // 
            this.btnCancel.Location = new System.Drawing.Point(221, 292);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(59, 23);
            this.btnCancel.TabIndex = 25;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            // 
            // lblDuration
            // 
            this.lblDuration.AutoSize = true;
            this.lblDuration.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblDuration.Location = new System.Drawing.Point(218, 209);
            this.lblDuration.Name = "lblDuration";
            this.lblDuration.Size = new System.Drawing.Size(56, 13);
            this.lblDuration.TabIndex = 28;
            this.lblDuration.Text = "Duration";
            // 
            // Received_Start_Time
            // 
            this.Received_Start_Time.Format = System.Windows.Forms.DateTimePickerFormat.Time;
            this.Received_Start_Time.Location = new System.Drawing.Point(249, 106);
            this.Received_Start_Time.Name = "Received_Start_Time";
            this.Received_Start_Time.Size = new System.Drawing.Size(108, 21);
            this.Received_Start_Time.TabIndex = 30;
            // 
            // Received_Date
            // 
            this.Received_Date.Format = System.Windows.Forms.DateTimePickerFormat.Short;
            this.Received_Date.Location = new System.Drawing.Point(142, 106);
            this.Received_Date.Name = "Received_Date";
            this.Received_Date.Size = new System.Drawing.Size(99, 21);
            this.Received_Date.TabIndex = 29;
            // 
            // lblUnit
            // 
            this.lblUnit.AutoSize = true;
            this.lblUnit.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblUnit.Location = new System.Drawing.Point(141, 142);
            this.lblUnit.Name = "lblUnit";
            this.lblUnit.Size = new System.Drawing.Size(57, 13);
            this.lblUnit.TabIndex = 32;
            this.lblUnit.Text = "----------";
            this.lblUnit.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(106, 142);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(33, 13);
            this.label3.TabIndex = 31;
            this.label3.Text = "Unit";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // lblDate
            // 
            this.lblDate.AutoSize = true;
            this.lblDate.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblDate.Location = new System.Drawing.Point(140, 191);
            this.lblDate.Name = "lblDate";
            this.lblDate.Size = new System.Drawing.Size(62, 13);
            this.lblDate.TabIndex = 34;
            this.lblDate.Text = "-----------";
            this.lblDate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label6.Location = new System.Drawing.Point(91, 167);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(48, 13);
            this.label6.TabIndex = 33;
            this.label6.Text = "Status";
            this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // RMInTransitBalloon
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.BackColor = System.Drawing.Color.Gainsboro;
            this.ClientSize = new System.Drawing.Size(415, 362);
            this.Controls.Add(this.lblDate);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.lblUnit);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.Received_Start_Time);
            this.Controls.Add(this.Received_Date);
            this.Controls.Add(this.lblDuration);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnSave);
            this.Controls.Add(this.Error);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.Header);
            this.Controls.Add(this.lblStatus);
            this.Controls.Add(this.label16);
            this.Controls.Add(this.txtComments);
            this.Controls.Add(this.label13);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.lblRaw_Material);
            this.Controls.Add(this.label1);
            this.FadeOnClose = false;
            this.FadeOnLoad = false;
            this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FrameBottomRight = System.Drawing.Color.DarkGreen;
            this.FrameTopLeft = System.Drawing.Color.Turquoise;
            this.FullOpacityOnHover = false;
            this.Location = new System.Drawing.Point(120, 200);
            this.MinimumSize = new System.Drawing.Size(50, 60);
            this.Name = "RMInTransitBalloon";
            this.ShowFrame = false;
            this.tailOffset = 5;
            this.TransparencyKey = System.Drawing.Color.Empty;
            this.Load += new System.EventHandler(this.JobStatusBalloon_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            Point p = new Point(Location.X, Location.Y);
            p.Offset(5, 5);
            this.Location = p;
        }

        public static string ShowBox(Control.Bars.Bar slot, //Main.Control.schedular sche, 
            Point po)//, CMS.Appointment.List pm_List)
        {
            newMessageBox = new RMInTransitBalloon(slot//,sche
                                        , po, slot.ID);//, pm_List);

            //newMessageBox.Location = new Point(m_X + 50, m_Y + 90);


            DialogResult dr = newMessageBox.ShowDialog();


          //  if (strMessage == "OK")
                return "OK";
           
            //. return "CANCEL";
           
        }


        private void button1_Click(object sender, EventArgs e)
        {
            Control.Bars.Is_HoverEnable = true;
            newMessageBox.Close();

        }

        public override void CBalloonBase_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.Escape)
            {
                Control.Bars.Is_HoverEnable = true;
                this.Close();
                return;
            }

        }



        bool validation()
        {
            if (txtComments.Text.Trim().Length < 3)
            {
                Error.Visible = true;
                txtComments.Focus();
                return false;
            }
            return true;
        }

        private void Comments_TextChanged(object sender, EventArgs e)
        {
            Error.Visible = false;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Control.Bars.Is_HoverEnable = true;
            newMessageBox.Close();
        }

        private void JobStatusBalloon_Load(object sender, EventArgs e)
        {
           
            DataRow[] rows = MainForm.data.Tables[0].Select(" Transaction_ID = " + Slot.ID.ToString());
            lblDate.Text = rows[0]["Date_Time"].ToString();
            lblRaw_Material.Text = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows[0]["Goods_ID"].ToString())[0]["Name"].ToString(); //  rows[0]["Goods_ID"].ToString();

            lblStatus.Text = rows[0]["Transaction_Status_ID"].ToString();

            string unit_ID = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows[0]["Goods_ID"].ToString())[0]["Goods_Unit_ID"].ToString();
            string unit = MainForm.dsData.Tables["Goods_Unit"].Select(" Goods_Unit_ID = " + unit_ID)[0]["Goods_Unit_Name"].ToString();  // 


            lblUnit.Text = rows[0]["Unit"].ToString() + " " + unit;
            txtComments.Text = rows[0]["Comments"].ToString();

          





            //return;
            //rows = MainForm.data.Tables[0].Select(" Job_ID = " + ID.ToString());
            //lblRaw_Material.Text = rows[0]["Job_ID"].ToString();
            ////lblStart_Date.Text = rows[0]["Start_Date_Time"].ToString();
            //// lblEnd_Date.Text = rows[0]["End_Date_Time"].ToString();

            //txtComments.Text = rows[0]["Comments"].ToString();



            //string sStart_Date = rows[0]["Start_Date_Time"].ToString();// Start_Date.Value.ToShortDateString() + "  " + Start_Time.Value.ToShortTimeString();
            //string sEnd_Date = rows[0]["End_Date_Time"].ToString();// End_Date.Value.ToShortDateString() + "  " + End_Time.Value.ToShortTimeString();

            //TimeSpan ts = DateTime.Parse(sEnd_Date) - DateTime.Parse(sStart_Date);

            //lblDuration.Text = "";
            //if (ts.Days != 0)
            //{
            //    lblDuration.Text += ts.Days.ToString() + " days ";
            //}

            //if (ts.Hours != 0)
            //{
            //    lblDuration.Text += ts.Hours.ToString() + " hour ";
            //}

            //if (ts.Minutes != 0)
            //{
            //    lblDuration.Text += ts.Minutes.ToString() + " min.";
            //}

            //if (ts.Days == 0 && ts.Hours == 0 && ts.Minutes == 0)
            //    lblDuration.Text = "#######";


        }

        private void btnSave_Click(object sender, EventArgs e)
        {

            


            DataRow[] rows = MainForm.data.Tables[0].Select(" Job_ID = " + ID.ToString());


            //string sStart_Date = DateTime.Parse(start_Date).ToShortDateString();
            //string sEnd_Date = DateTime.Parse(end_Date).ToShortDateString();

            DataAccess.Access ac = new ISCMS.DataAccess.Access();


            //ac.InsertJob_Transaction(Convert.ToInt32(rows[0]["Job_ID"]), Convert.ToInt32(rows[0]["Status_ID"]),
            //    rows[0]["Start_Date_Time"].ToString(),
            //    Received_Date.Value.ToShortDateString() + "  " + Received_Start_Time.Value.ToShortTimeString(),//rows[0]["End_Date_Time"].ToString(),
            //    Convert.ToInt32(rows[0]["Status_ID"]), rows[0]["Comments"].ToString(), rows[0]["Job_Start_Date"].ToString());

            

            


           

        }





    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation

33 members

Comments and Discussions