protected void Page_Load(object sender, EventArgs e)
 {
     TransitionLogic tl = new TransitionLogic();
     DataTable dt = tl.SelectForProductReport();
     Repeater1.DataSource = dt;
     Repeater1.DataBind();
 }
Ejemplo n.º 2
0
        public PassiveStateMachine <TState, TEvent> CreatePassiveStateMachine(string name)
        {
            var stateContainer = new StateContainer <TState, TEvent>(name);

            foreach (var stateIdAndLastActiveState in this.initiallyLastActiveStates)
            {
                stateContainer.SetLastActiveStateFor(stateIdAndLastActiveState.Key, stateIdAndLastActiveState.Value);
            }

            var transitionLogic = new TransitionLogic <TState, TEvent>(stateContainer);
            var stateLogic      = new StateLogic <TState, TEvent>(transitionLogic, stateContainer);

            transitionLogic.SetStateLogic(stateLogic);

            var standardFactory = new StandardFactory <TState, TEvent>();
            var stateMachine    = new StateMachine <TState, TEvent>(standardFactory, stateLogic);

            return(new PassiveStateMachine <TState, TEvent>(stateMachine, stateContainer, this.stateDefinitions, this.initialState));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     TransitionLogic ol = new TransitionLogic();
     Repeater9.DataSource = ol.SelectProductStatus1(DateTime.Today);
     Repeater9.DataBind();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text = DateTime.Today.ToString("dd/MM/yyyy");
        TransitionLogic ol = new TransitionLogic();

        DataTable dt1 = ol.SelectProductStatus("Product Created", DateTime.Today);
        DataTable dt2 = ol.SelectProductStatus("Product Designed", DateTime.Today);
        DataTable dt3 = ol.SelectProductStatus("Product Sent for client design approval", DateTime.Today);
        DataTable dt4 = ol.SelectProductStatus("Design approved bt client", DateTime.Today);
        DataTable dt5 = ol.SelectProductStatus("Trial product prepared", DateTime.Today);
        DataTable dt6 = ol.SelectProductStatus("Trial product sent for client approval", DateTime.Today);
        DataTable dt7 = ol.SelectProductStatus("Trial product approved by client", DateTime.Today);
        DataTable dt8 = ol.SelectProductStatusApproved("product approved", DateTime.Today);

        int[] arr = { dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count };



        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        Repeater1.DataSource = dt1;
        Repeater2.DataSource = dt2;
        Repeater3.DataSource = dt3;
        Repeater4.DataSource = dt4;
        Repeater5.DataSource = dt5;
        Repeater6.DataSource = dt6;
        Repeater7.DataSource = dt7;
        Repeater8.DataSource = dt8;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.QueryString["ID"]) > 0)
        {
            //edit mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
                OrderLogic ol = new OrderLogic();
                Order      o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(o1.ProductID);
                // = Convert.ToInt32(DropDownList1.SelectedValue)


                o1.ProductID   = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text.ToString());
                o1.Quantity    = Convert.ToInt32(TextBox2.Text);
                o1.Rate        = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate = d1;

                o1.PONumber = Convert.ToInt32(TextBox5.Text);
                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }
                if (o1.Status.Equals(DropDownList2.SelectedItem.Text))
                {
                    o1.Status = DropDownList2.SelectedItem.Text;
                }
                else
                {
                    TransitionLogic tl = new TransitionLogic();
                    Transition      t1 = new Transition();
                    t1.KeyID     = o1.OrderID;
                    t1.KeyType   = "Ord";
                    t1.TranDate  = DateTime.Now;
                    t1.NewStatus = DropDownList2.SelectedItem.Text;
                    t1.Remarks   = "";
                    tl.Insert(t1);

                    o1.Status = DropDownList2.SelectedItem.Text;
                }

                o1.StatusRemarks   = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po          = "Images/" + ticks + FileUpload1.FileName;
                    o1.AttachPO = po;
                }


                ol.Update(o1);

                Response.Redirect("OrderList.aspx");
            }
            else
            {
                Label2.Visible = true;
            }
        }
        else
        {
            //Insert mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
                OrderLogic ol = new OrderLogic();
                Order      o1 = new Order();

                ProductLogic pl = new ProductLogic();

                o1.ProductID   = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text);
                o1.Quantity    = Convert.ToInt32(TextBox2.Text);
                o1.Rate        = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate   = d1;
                o1.JobPath  = "";
                o1.PONumber = Convert.ToInt32(TextBox5.Text);

                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }

                o1.Status          = DropDownList2.SelectedItem.Text;
                o1.StatusRemarks   = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po = "Images/" + ticks + FileUpload1.FileName;
                }
                o1.AttachPO = po;
                ol.Insert(o1);

                Response.Redirect("OrderList.aspx");
            }
            else
            {
                Label2.Visible = true;
            }
        }
    }
Ejemplo n.º 6
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("EMPLOYEE") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
        {
            if (e.CommandName.Equals("Product Designed"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Product Designed";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Product Designed";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("Product Sent for client design approval"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Product Sent for client design approval";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Product Sent for client design approval";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("Design approved by client"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Design approved by client";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Design approved by client";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("Trial product prepared"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product prepared";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Trial product prepared";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("Trial product sent for client approval"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product sent for client approval";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Trial product sent for client approval";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("Trial product approved by client"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product approved by client";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "Trial product approved by client";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
            else if (e.CommandName.Equals("product approved"))
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "product approved";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = p1.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = "product approved";
                t1.Remarks   = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text = DateTime.Today.ToString("dd/MM/yyyy");
        TransitionLogic ol   = new TransitionLogic();
        DataTable       dt1  = ol.SelectOrderStatus("Order Created", DateTime.Today);
        DataTable       dt2  = ol.SelectOrderStatus("Performa invoice generated", DateTime.Today);
        DataTable       dt3  = ol.SelectOrderStatus("Performa invoice approved", DateTime.Today);
        DataTable       dt4  = ol.SelectOrderStatus("Cylinder requested", DateTime.Today);
        DataTable       dt5  = ol.SelectOrderStatus("Cylinder received", DateTime.Today);
        DataTable       dt6  = ol.SelectOrderStatus("Print pending", DateTime.Today);
        DataTable       dt7  = ol.SelectOrderStatus("Converting", DateTime.Today);
        DataTable       dt8  = ol.SelectOrderStatus("Ready", DateTime.Today);
        DataTable       dt9  = ol.SelectOrderStatus("Dispached", DateTime.Today);
        DataTable       dt10 = ol.SelectOrderStatusClosed("Closed", DateTime.Today);

        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count, dt9.Rows.Count, dt10.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        if (dt9.Rows.Count < max)
        {
            for (int i = dt9.Rows.Count; i < max; i++)
            {
                dt9.Rows.Add("-");
            }
        }
        if (dt10.Rows.Count < max)
        {
            for (int i = dt10.Rows.Count; i < max; i++)
            {
                dt10.Rows.Add("-");
            }
        }
        Repeater1.DataSource  = dt1;
        Repeater2.DataSource  = dt2;
        Repeater3.DataSource  = dt3;
        Repeater4.DataSource  = dt4;
        Repeater5.DataSource  = dt5;
        Repeater6.DataSource  = dt6;
        Repeater7.DataSource  = dt7;
        Repeater8.DataSource  = dt8;
        Repeater9.DataSource  = dt9;
        Repeater10.DataSource = dt10;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
        Repeater9.DataBind();
        Repeater10.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {

        Label2.Text = DateTime.Today.ToString("dd/MM/yyyy");
        TransitionLogic ol = new TransitionLogic();
        DataTable dt1 = ol.SelectOrderStatus("Order Created",DateTime.Today);
        DataTable dt2 = ol.SelectOrderStatus("Performa invoice generated", DateTime.Today);
        DataTable dt3 = ol.SelectOrderStatus("Performa invoice approved", DateTime.Today);
        DataTable dt4 = ol.SelectOrderStatus("Cylinder requested", DateTime.Today);
        DataTable dt5 = ol.SelectOrderStatus("Cylinder received", DateTime.Today);
        DataTable dt6 = ol.SelectOrderStatus("Print pending", DateTime.Today);
        DataTable dt7 = ol.SelectOrderStatus("Converting", DateTime.Today);
        DataTable dt8 = ol.SelectOrderStatus("Ready", DateTime.Today);
        DataTable dt9 = ol.SelectOrderStatus("Dispached", DateTime.Today);
        DataTable dt10 = ol.SelectOrderStatusClosed("Closed", DateTime.Today);

        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count, dt9.Rows.Count, dt10.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        if (dt9.Rows.Count < max)
        {
            for (int i = dt9.Rows.Count; i < max; i++)
            {
                dt9.Rows.Add("-");
            }
        }
        if (dt10.Rows.Count < max)
        {
            for (int i = dt10.Rows.Count; i < max; i++)
            {
                dt10.Rows.Add("-");
            }
        }
        Repeater1.DataSource = dt1;
        Repeater2.DataSource = dt2;
        Repeater3.DataSource = dt3;
        Repeater4.DataSource = dt4;
        Repeater5.DataSource = dt5;
        Repeater6.DataSource = dt6;
        Repeater7.DataSource = dt7;
        Repeater8.DataSource = dt8;
        Repeater9.DataSource = dt9;
        Repeater10.DataSource = dt10;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
        Repeater9.DataBind();
        Repeater10.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text = DateTime.Today.ToString("dd/MM/yyyy");
        TransitionLogic ol = new TransitionLogic();

        DataTable dt1 = ol.SelectProductStatus("Product Created",DateTime.Today);
        DataTable dt2 = ol.SelectProductStatus("Product Designed",DateTime.Today);
        DataTable dt3 = ol.SelectProductStatus("Product Sent for client design approval",DateTime.Today);
        DataTable dt4 = ol.SelectProductStatus("Design approved bt client",DateTime.Today);
        DataTable dt5 = ol.SelectProductStatus("Trial product prepared",DateTime.Today);
        DataTable dt6 = ol.SelectProductStatus("Trial product sent for client approval",DateTime.Today);
        DataTable dt7 = ol.SelectProductStatus("Trial product approved by client",DateTime.Today);
        DataTable dt8 = ol.SelectProductStatusApproved("product approved",DateTime.Today);

        int[] arr = { dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count};




        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count);
        
        if (dt1.Rows.Count < max)
           {
               for (int i = dt1.Rows.Count; i < max; i++)
               {
                   dt1.Rows.Add("-");
               }
           }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        Repeater1.DataSource = dt1;
        Repeater2.DataSource = dt2;
        Repeater3.DataSource = dt3;
        Repeater4.DataSource = dt4;
        Repeater5.DataSource = dt5;
        Repeater6.DataSource = dt6;
        Repeater7.DataSource = dt7;
        Repeater8.DataSource = dt8;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();


       }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.QueryString["ID"]) > 0)
        {
            //edit mode
            ProductLogic PL = new ProductLogic();
            Product objPro = PL.SelectByProductID(Convert.ToInt32(Request.QueryString["ID"]));

            objPro.Name = TextBox1.Text;

            if (objPro.Status.Equals(DropDownList3.SelectedItem.Text))
            {
                objPro.Status = DropDownList3.SelectedItem.Text;
            }
            else
            {
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = objPro.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = DropDownList3.SelectedItem.Text;
                t1.Remarks = "";
                tl.Insert(t1);
                objPro.Status = DropDownList3.SelectedItem.Text;
            }
            objPro.Description = TextArea1.Text;
            objPro.Size = TextBox4.Text;
            objPro.Colors = TextBox5.Text;
            objPro.Type = DropDownList1.SelectedItem.Text;
            objPro.CustomerID = Convert.ToInt32(DropDownList2.SelectedItem.Value);

            DateTime d1 = new DateTime();
            if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
            {
                objPro.CreateDate = DateTime.Now;
            }
            if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
            {
                objPro.CreateDate = DateTime.Now;
            }
            else
            {
                objPro.CreateDate = d1;
            }
            String path = objPro.DesignFiles;


            string ticks = DateTime.Now.Ticks.ToString();

            if (FileUpload1.HasFile)
            {
                FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));

                path += "Images/" + ticks + FileUpload1.FileName + "#,#";
            }
            if (FileUpload2.HasFile)
            {
                FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName));
                path += "Images/" + ticks + FileUpload2.FileName + "#,#";
            }
            if (FileUpload3.HasFile)
            {
                FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName));
                path += "Images/" + ticks + FileUpload3.FileName + "#,#";
            }
            if (FileUpload4.HasFile)
            {
                FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName));
                path += "Images/" + ticks + FileUpload4.FileName + "#,#";
            }
            if (FileUpload5.HasFile)
            {
                FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName));
                path += "Images/" + ticks + FileUpload5.FileName + "#,#";
            }

            objPro.DesignFiles = path;

            objPro.ProductID = Convert.ToInt32(Request.QueryString["id"]);
            PL.Update(objPro);

            Response.Redirect("ProdList.aspx");
        }
        else
        {
            // insert mode
            Product objPro = new Product();
            objPro.Name = TextBox1.Text;

            objPro.Status =DropDownList3.SelectedItem.Text;
            objPro.Description = TextArea1.Text;
            objPro.Size = TextBox4.Text;
            objPro.Colors = TextBox5.Text;
            objPro.Type = DropDownList1.Text;
            objPro.CustomerID = Convert.ToInt32(DropDownList2.SelectedItem.Value);

            DateTime d1 = new DateTime();
            if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
            {
                objPro.CreateDate = DateTime.Now;
            }
            if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
            {
                objPro.CreateDate = DateTime.Now;
            }
            else
            {
                objPro.CreateDate = d1;
            }

            String path = "";
            string ticks = DateTime.Now.Ticks.ToString();

            if (FileUpload1.HasFile)
            {
                FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));

                path += "Images/" + ticks + FileUpload1.FileName + "#,#";
            }
            if (FileUpload2.HasFile)
            {
                FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName));
                path += "Images/" + ticks + FileUpload2.FileName + "#,#";
            }
            if (FileUpload3.HasFile)
            {
                FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName));
                path += "Images/" + ticks + FileUpload3.FileName + "#,#";
            }
            if (FileUpload4.HasFile)
            {
                FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName));
                path += "Images/" + ticks + FileUpload4.FileName + "#,#";
            }
            if (FileUpload5.HasFile)
            {
                FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName));
                path += "Images/" + ticks + FileUpload5.FileName + "#,#";
            }

            objPro.DesignFiles = path;


            ProductLogic PL = new ProductLogic();
            PL.Insert(objPro);

            Response.Redirect("ProdList.aspx");

        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.QueryString["ID"]) > 0)
        {
            //edit mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
            OrderLogic ol = new OrderLogic();
            Order o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

            ProductLogic pl = new ProductLogic();
            Product p1 = pl.SelectByProductID(o1.ProductID);
            // = Convert.ToInt32(DropDownList1.SelectedValue) 

           
                o1.ProductID = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text.ToString());
                o1.Quantity = Convert.ToInt32(TextBox2.Text);
                o1.Rate = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate = d1;

                o1.PONumber = Convert.ToInt32(TextBox5.Text);
                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }
                if (o1.Status.Equals(DropDownList2.SelectedItem.Text))
                {
                    o1.Status = DropDownList2.SelectedItem.Text;
                }
                else
                {
                    TransitionLogic tl = new TransitionLogic();
                    Transition t1 = new Transition();
                    t1.KeyID = o1.OrderID;
                    t1.KeyType = "Ord";
                    t1.TranDate = DateTime.Now;
                    t1.NewStatus = DropDownList2.SelectedItem.Text;
                    t1.Remarks = "";
                    tl.Insert(t1);

                    o1.Status = DropDownList2.SelectedItem.Text;
                }

                o1.StatusRemarks = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po = "Images/" + ticks + FileUpload1.FileName;
                    o1.AttachPO = po;
                }
               

                ol.Update(o1);

                Response.Redirect("OrderList.aspx");
            }
            else
            {
                Label2.Visible = true;
            }
            

        }
        else
        {
            //Insert mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
                OrderLogic ol = new OrderLogic();
                Order o1 = new Order();

                ProductLogic pl = new ProductLogic();

                o1.ProductID = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text);
                o1.Quantity = Convert.ToInt32(TextBox2.Text);
                o1.Rate = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate = d1;
                o1.JobPath = "";
                o1.PONumber = Convert.ToInt32(TextBox5.Text);

                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }

                o1.Status = DropDownList2.SelectedItem.Text;
                o1.StatusRemarks = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po = "Images/" + ticks + FileUpload1.FileName;
                }
                o1.AttachPO = po;
                ol.Insert(o1);

                Response.Redirect("OrderList.aspx");

            }
            else
            {
                Label2.Visible = true;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today);

        int present = Convert.ToInt32(dt.Rows[0][1]);
        int absent = Convert.ToInt32(dt.Rows[1][1]);


        lblPResentPerc.Text = ((float)present * 100) / ((float)present + absent) + "";
        lblPResentPerc.Attributes.Add("Present", present.ToString());
        lblPResentPerc.Attributes.Add("Absent", absent.ToString());

        DataTable dt1 = new InvoiceLogic().SelectForBestOrder();

        bestOrd.Text = dt1.Rows[0]["ProductName"].ToString();
        totalAmt.Text = dt1.Rows[0]["GrandTotal"].ToString();
        txtCustomer.Text = dt1.Rows[0]["CustomerName"].ToString();
        string dp = dt1.Rows[0]["ProductImage"].ToString();
        String[] arr = dp.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        proimg.Src = arr[arr.Length - 1];

        DataTable dt2 = new InvoiceLogic().SelectForRevenue();
        txtTotIncome.Text = dt2.Rows[0]["TotalIncome"].ToString();

        DataTable dt4 = new InvoiceLogic().SelectIndividualInvoiceAmount();
        string s = "";
        for (int i = 0; i < dt4.Rows.Count; i++)
        {
            s += dt4.Rows[i]["GrandTotal"] + ",";
        }
        s = "[" + s.TrimEnd(',') + "]";
        individualInvoiceAmount.Attributes.Add("data-data", s);


        DataTable dt3 = new ProductLogic().SelectBestProduct();
        OrderNumber.Text = dt3.Rows[0]["Total"].ToString() + " Orders";
        string dp1 = dt3.Rows[0]["DesignFiles"].ToString();
        String[] arr1 = dp1.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        topProimg.Src = arr1[arr1.Length - 1];

        ProName.Text = dt3.Rows[0]["Name"].ToString();
        
        DataTable dt5 = new InvoiceLogic().SelectTotalSale2();
        Repeater2.DataSource = dt5;
        Repeater2.DataBind();
        DataTable dt6 = new InventoryLogic().SelectRawStock();
        Repeater1.DataSource = dt6;
        Repeater1.DataBind();

        CustomerLogic CL = new CustomerLogic();
        Repeater3.DataSource = CL.SelectForReport1();
        Repeater3.DataBind();
        TransitionLogic ol = new TransitionLogic();
        Repeater9.DataSource = ol.SelectProductStatus1(DateTime.Today);
        Repeater9.DataBind();

        TransitionLogic ol2 = new TransitionLogic();
        Repeater4.DataSource = ol2.SelectOrderStatus1(DateTime.Today);
        Repeater4.DataBind();

    }
Ejemplo n.º 13
0
    protected void Button2_click(object sender, EventArgs e)
    {
        DateTime d1 = new DateTime();

        // d1 = Convert.ToDateTime(TextBox1.Text);
        if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
        {
        }

        Label2.Text = d1.ToString("dd/MM/yyyy");

        TransitionLogic ol   = new TransitionLogic();
        DataTable       dt1  = ol.SelectOrderStatus("Order Created", d1);
        DataTable       dt2  = ol.SelectOrderStatus("Performa invoice generated", d1);
        DataTable       dt3  = ol.SelectOrderStatus("Performa invoice approved", d1);
        DataTable       dt4  = ol.SelectOrderStatus("Cylinder requested", d1);
        DataTable       dt5  = ol.SelectOrderStatus("Cylinder received", d1);
        DataTable       dt6  = ol.SelectOrderStatus("Print pending", d1);
        DataTable       dt7  = ol.SelectOrderStatus("Converting", d1);
        DataTable       dt8  = ol.SelectOrderStatus("Ready", d1);
        DataTable       dt9  = ol.SelectOrderStatus("Dispached", d1);
        DataTable       dt10 = ol.SelectOrderStatus("Closed", d1);

        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count, dt9.Rows.Count, dt10.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        if (dt9.Rows.Count < max)
        {
            for (int i = dt9.Rows.Count; i < max; i++)
            {
                dt9.Rows.Add("-");
            }
        }
        if (dt10.Rows.Count < max)
        {
            for (int i = dt10.Rows.Count; i < max; i++)
            {
                dt10.Rows.Add("-");
            }
        }
        Repeater1.DataSource  = dt1;
        Repeater2.DataSource  = dt2;
        Repeater3.DataSource  = dt3;
        Repeater4.DataSource  = dt4;
        Repeater5.DataSource  = dt5;
        Repeater6.DataSource  = dt6;
        Repeater7.DataSource  = dt7;
        Repeater8.DataSource  = dt8;
        Repeater9.DataSource  = dt9;
        Repeater10.DataSource = dt10;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
        Repeater9.DataBind();
        Repeater10.DataBind();
    }
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("EMPLOYEE") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
        {
            if(e.CommandName.Equals("Product Designed")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Product Designed";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Product Designed";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("Product Sent for client design approval")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Product Sent for client design approval";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Product Sent for client design approval";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("Design approved by client")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Design approved by client";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Design approved by client";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("Trial product prepared")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product prepared";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Trial product prepared";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("Trial product sent for client approval")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product sent for client approval";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Trial product sent for client approval";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("Trial product approved by client")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "Trial product approved by client";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "Trial product approved by client";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }else if(e.CommandName.Equals("product approved")){
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(e.CommandArgument));
                p1.Status = "product approved";
                pl.Update(p1);
                DataTable dt = pl.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
                TransitionLogic tl = new TransitionLogic();
                Transition t1 = new Transition();
                t1.KeyID = p1.ProductID;
                t1.KeyType = "Prod";
                t1.TranDate = DateTime.Now;
                t1.NewStatus = "product approved";
                t1.Remarks = ((TextBox)e.Item.FindControl("TextBox2")).Text;
                tl.Insert(t1);
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
    protected void Button2_click(object sender, EventArgs e)
    {


        DateTime d1 = new DateTime();
        // d1 = Convert.ToDateTime(TextBox1.Text);
        if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
        {

        }

        Label2.Text = d1.ToString("dd/MM/yyyy");

        TransitionLogic ol = new TransitionLogic();
        DataTable dt1 = ol.SelectProductStatus("Product Created",d1);
        DataTable dt2 = ol.SelectProductStatus("Product Designed",d1);
        DataTable dt3 = ol.SelectProductStatus("Product Sent for client design approval",d1);
        DataTable dt4 = ol.SelectProductStatus("Design approved bt client",d1);
        DataTable dt5 = ol.SelectProductStatus("Trial product prepared",d1);
        DataTable dt6 = ol.SelectProductStatus("Trial product sent for client approval",d1);
        DataTable dt7 = ol.SelectProductStatus("Trial product approved by client",d1);
        DataTable dt8 = ol.SelectProductStatus("product approved",d1);
      

        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        
        Repeater1.DataSource = dt1;
        Repeater2.DataSource = dt2;
        Repeater3.DataSource = dt3;
        Repeater4.DataSource = dt4;
        Repeater5.DataSource = dt5;
        Repeater6.DataSource = dt6;
        Repeater7.DataSource = dt7;
        Repeater8.DataSource = dt8;
       

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
       
    }
 /*
 protected void ImageButton1_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Performa invoice generated";
     ol.Update(o1);
 }
 protected void ImageButton2_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Performa invoice approved";
     ol.Update(o1);
 }
 protected void ImageButton3_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Cylinder requested";
     ol.Update(o1);
 }
 protected void ImageButton4_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Cylinder received";
     ol.Update(o1);
 }
 protected void ImageButton5_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Print pending";
     ol.Update(o1);
 }
 protected void ImageButton6_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Converting";
     ol.Update(o1);
 }
 protected void ImageButton7_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Ready";
     ol.Update(o1);
 }
 protected void ImageButton8_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Dispached";
     ol.Update(o1);
 }
 protected void ImageButton9_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Closed";
     ol.Update(o1);
 }*/
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
       EmployeeLogic el = new EmployeeLogic();
     Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
     if (!(e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
     {
         if(e.CommandName.Equals("Performa invoice generated")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Performa invoice generated";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Performa invoice generated";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Performa invoice approved")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Performa invoice approved";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Performa invoice approved";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Cylinder requested")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Cylinder requested";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Cylinder requested";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Cylinder received")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Cylinder received";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Cylinder received";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Print pending")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Print pending";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Print pending";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Converting")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Converting";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Converting";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Ready")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Ready";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Ready";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Dispached")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Dispached";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Dispached";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Closed")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Closed";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Closed";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }
     }
     else
     {
         Response.Redirect("Access.aspx");
     }
     
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today);

        int present = Convert.ToInt32(dt.Rows[0][1]);
        int absent  = Convert.ToInt32(dt.Rows[1][1]);


        lblPResentPerc.Text = ((float)present * 100) / ((float)present + absent) + "";
        lblPResentPerc.Attributes.Add("Present", present.ToString());
        lblPResentPerc.Attributes.Add("Absent", absent.ToString());

        DataTable dt1 = new InvoiceLogic().SelectForBestOrder();

        bestOrd.Text     = dt1.Rows[0]["ProductName"].ToString();
        totalAmt.Text    = dt1.Rows[0]["GrandTotal"].ToString();
        txtCustomer.Text = dt1.Rows[0]["CustomerName"].ToString();
        string dp = dt1.Rows[0]["ProductImage"].ToString();

        String[] arr = dp.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        proimg.Src = arr[arr.Length - 1];

        DataTable dt2 = new InvoiceLogic().SelectForRevenue();

        txtTotIncome.Text = dt2.Rows[0]["TotalIncome"].ToString();

        DataTable dt4 = new InvoiceLogic().SelectIndividualInvoiceAmount();
        string    s   = "";

        for (int i = 0; i < dt4.Rows.Count; i++)
        {
            s += dt4.Rows[i]["GrandTotal"] + ",";
        }
        s = "[" + s.TrimEnd(',') + "]";
        individualInvoiceAmount.Attributes.Add("data-data", s);


        DataTable dt3 = new ProductLogic().SelectBestProduct();

        OrderNumber.Text = dt3.Rows[0]["Total"].ToString() + " Orders";
        string dp1 = dt3.Rows[0]["DesignFiles"].ToString();

        String[] arr1 = dp1.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        topProimg.Src = arr1[arr1.Length - 1];

        ProName.Text = dt3.Rows[0]["Name"].ToString();

        DataTable dt5 = new InvoiceLogic().SelectTotalSale2();

        Repeater2.DataSource = dt5;
        Repeater2.DataBind();
        DataTable dt6 = new InventoryLogic().SelectRawStock();

        Repeater1.DataSource = dt6;
        Repeater1.DataBind();

        CustomerLogic CL = new CustomerLogic();

        Repeater3.DataSource = CL.SelectForReport1();
        Repeater3.DataBind();
        TransitionLogic ol = new TransitionLogic();

        Repeater9.DataSource = ol.SelectProductStatus1(DateTime.Today);
        Repeater9.DataBind();

        TransitionLogic ol2 = new TransitionLogic();

        Repeater4.DataSource = ol2.SelectOrderStatus1(DateTime.Today);
        Repeater4.DataBind();
    }
    protected void Button2_click(object sender, EventArgs e)
    {

       
        DateTime d1 = new DateTime();
       // d1 = Convert.ToDateTime(TextBox1.Text);
        if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
        {
           
        }

        Label2.Text = d1.ToString("dd/MM/yyyy");

        TransitionLogic ol = new TransitionLogic();
        DataTable dt1 = ol.SelectOrderStatus("Order Created",d1);
        DataTable dt2 = ol.SelectOrderStatus("Performa invoice generated", d1);
        DataTable dt3 = ol.SelectOrderStatus("Performa invoice approved", d1);
        DataTable dt4 = ol.SelectOrderStatus("Cylinder requested", d1);
        DataTable dt5 = ol.SelectOrderStatus("Cylinder received", d1);
        DataTable dt6 = ol.SelectOrderStatus("Print pending", d1);
        DataTable dt7 = ol.SelectOrderStatus("Converting", d1);
        DataTable dt8 = ol.SelectOrderStatus("Ready", d1);
        DataTable dt9 = ol.SelectOrderStatus("Dispached", d1);
        DataTable dt10 = ol.SelectOrderStatus("Closed", d1);

        int max = findMax(dt1.Rows.Count, dt2.Rows.Count, dt3.Rows.Count, dt4.Rows.Count, dt5.Rows.Count, dt6.Rows.Count, dt7.Rows.Count, dt8.Rows.Count,dt9.Rows.Count, dt10.Rows.Count);

        if (dt1.Rows.Count < max)
        {
            for (int i = dt1.Rows.Count; i < max; i++)
            {
                dt1.Rows.Add("-");
            }
        }

        if (dt2.Rows.Count < max)
        {
            for (int i = dt2.Rows.Count; i < max; i++)
            {
                dt2.Rows.Add("-");
            }
        }
        if (dt3.Rows.Count < max)
        {
            for (int i = dt3.Rows.Count; i < max; i++)
            {
                dt3.Rows.Add("-");
            }
        }
        if (dt4.Rows.Count < max)
        {
            for (int i = dt4.Rows.Count; i < max; i++)
            {
                dt4.Rows.Add("-");
            }
        }
        if (dt5.Rows.Count < max)
        {
            for (int i = dt5.Rows.Count; i < max; i++)
            {
                dt5.Rows.Add("-");
            }
        }
        if (dt6.Rows.Count < max)
        {
            for (int i = dt6.Rows.Count; i < max; i++)
            {
                dt6.Rows.Add("-");
            }
        }
        if (dt7.Rows.Count < max)
        {
            for (int i = dt7.Rows.Count; i < max; i++)
            {
                dt7.Rows.Add("-");
            }
        }
        if (dt8.Rows.Count < max)
        {
            for (int i = dt8.Rows.Count; i < max; i++)
            {
                dt8.Rows.Add("-");
            }
        }
        if (dt9.Rows.Count < max)
        {
            for (int i = dt9.Rows.Count; i < max; i++)
            {
                dt9.Rows.Add("-");
            }
        }
        if (dt10.Rows.Count < max)
        {
            for (int i = dt10.Rows.Count; i < max; i++)
            {
                dt10.Rows.Add("-");
            }
        }
        Repeater1.DataSource = dt1;
        Repeater2.DataSource = dt2;
        Repeater3.DataSource = dt3;
        Repeater4.DataSource = dt4;
        Repeater5.DataSource = dt5;
        Repeater6.DataSource = dt6;
        Repeater7.DataSource = dt7;
        Repeater8.DataSource = dt8;
        Repeater9.DataSource = dt9;
        Repeater10.DataSource = dt10;

        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
        Repeater6.DataBind();
        Repeater7.DataBind();
        Repeater8.DataBind();
        Repeater9.DataBind();
        Repeater10.DataBind();
    }
Ejemplo n.º 19
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.QueryString["ID"]) > 0)
        {
            //edit mode
            ProductLogic PL     = new ProductLogic();
            Product      objPro = PL.SelectByProductID(Convert.ToInt32(Request.QueryString["ID"]));

            objPro.Name = TextBox1.Text;

            if (objPro.Status.Equals(DropDownList3.SelectedItem.Text))
            {
                objPro.Status = DropDownList3.SelectedItem.Text;
            }
            else
            {
                TransitionLogic tl = new TransitionLogic();
                Transition      t1 = new Transition();
                t1.KeyID     = objPro.ProductID;
                t1.KeyType   = "Prod";
                t1.TranDate  = DateTime.Now;
                t1.NewStatus = DropDownList3.SelectedItem.Text;
                t1.Remarks   = "";
                tl.Insert(t1);
                objPro.Status = DropDownList3.SelectedItem.Text;
            }
            objPro.Description = TextArea1.Text;
            objPro.Size        = TextBox4.Text;
            objPro.Colors      = TextBox5.Text;
            objPro.Type        = DropDownList1.SelectedItem.Text;
            objPro.CustomerID  = Convert.ToInt32(DropDownList2.SelectedItem.Value);

            DateTime d1 = new DateTime();
            if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
            {
                objPro.CreateDate = DateTime.Now;
            }
            if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
            {
                objPro.CreateDate = DateTime.Now;
            }
            else
            {
                objPro.CreateDate = d1;
            }
            String path = objPro.DesignFiles;


            string ticks = DateTime.Now.Ticks.ToString();

            if (FileUpload1.HasFile)
            {
                FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));

                path += "Images/" + ticks + FileUpload1.FileName + "#,#";
            }
            if (FileUpload2.HasFile)
            {
                FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName));
                path += "Images/" + ticks + FileUpload2.FileName + "#,#";
            }
            if (FileUpload3.HasFile)
            {
                FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName));
                path += "Images/" + ticks + FileUpload3.FileName + "#,#";
            }
            if (FileUpload4.HasFile)
            {
                FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName));
                path += "Images/" + ticks + FileUpload4.FileName + "#,#";
            }
            if (FileUpload5.HasFile)
            {
                FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName));
                path += "Images/" + ticks + FileUpload5.FileName + "#,#";
            }

            objPro.DesignFiles = path;

            objPro.ProductID = Convert.ToInt32(Request.QueryString["id"]);
            PL.Update(objPro);

            Response.Redirect("ProdList.aspx");
        }
        else
        {
            // insert mode
            Product objPro = new Product();
            objPro.Name = TextBox1.Text;

            objPro.Status      = DropDownList3.SelectedItem.Text;
            objPro.Description = TextArea1.Text;
            objPro.Size        = TextBox4.Text;
            objPro.Colors      = TextBox5.Text;
            objPro.Type        = DropDownList1.Text;
            objPro.CustomerID  = Convert.ToInt32(DropDownList2.SelectedItem.Value);

            DateTime d1 = new DateTime();
            if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
            {
                objPro.CreateDate = DateTime.Now;
            }
            if (d1.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
            {
                objPro.CreateDate = DateTime.Now;
            }
            else
            {
                objPro.CreateDate = d1;
            }

            String path  = "";
            string ticks = DateTime.Now.Ticks.ToString();

            if (FileUpload1.HasFile)
            {
                FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));

                path += "Images/" + ticks + FileUpload1.FileName + "#,#";
            }
            if (FileUpload2.HasFile)
            {
                FileUpload2.SaveAs(Server.MapPath("Images/" + ticks + FileUpload2.FileName));
                path += "Images/" + ticks + FileUpload2.FileName + "#,#";
            }
            if (FileUpload3.HasFile)
            {
                FileUpload3.SaveAs(Server.MapPath("Images/" + ticks + FileUpload3.FileName));
                path += "Images/" + ticks + FileUpload3.FileName + "#,#";
            }
            if (FileUpload4.HasFile)
            {
                FileUpload4.SaveAs(Server.MapPath("Images/" + ticks + FileUpload4.FileName));
                path += "Images/" + ticks + FileUpload4.FileName + "#,#";
            }
            if (FileUpload5.HasFile)
            {
                FileUpload5.SaveAs(Server.MapPath("Images/" + ticks + FileUpload5.FileName));
                path += "Images/" + ticks + FileUpload5.FileName + "#,#";
            }

            objPro.DesignFiles = path;


            ProductLogic PL = new ProductLogic();
            PL.Insert(objPro);

            Response.Redirect("ProdList.aspx");
        }
    }