Esempio n. 1
0
        protected void createDo_Click(object sender, EventArgs e)
        {
            BllDeliveryOrders d = new BllDeliveryOrders();
            int poNum           = Convert.ToInt32(lblPONum.Text);
            int qty             = Convert.ToInt32(lblQty.Text);
            //int prodID = Convert.ToInt32(GridView1.SelectedRow.Cells[0].Text);
            //string prodDesc = GridView1.SelectedRow.Cells[1].Text;
            //int qty = Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text);
            //string status = "Processing";
            DateTime time   = DateTime.Now;            // Use current time
            string   format = "yyyy-MM-dd hh:mm tt";
            string   date   = time.ToString(format);
            int      result = 0;

            result = d.DeliveryInsert(50.00M, "Processing", poNum, date, "Standard", lblDesc.Text, qty, "boxwear", Convert.ToDecimal(lblTotal.Text));

            if (result == 1)
            {
                BllPurchaseOrders po = new BllPurchaseOrders();
                po.updatePOStatus(poNum);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                    "alert('Insert successful'); window.location='" +
                                                    Request.ApplicationPath + "pendingpurchaseorders.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                                    "alert('Insert unsuccessful'); window.location='" +
                                                    Request.ApplicationPath + "pendingpurchaseorders.aspx';", true);
            }



            ////invoce
            //int result = 0;
            //int poNum = Convert.ToInt32(lblPONum.Text);
            //Bllinvoice a = new Bllinvoice();
            //string status = "Processing";
            //DateTime myDateTime = DateTime.Now;
            //string date = myDateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
            //result = a.insertInvoice(date, Convert.ToDecimal(lblTotal.Text), status, poNum);

            //if (result == 1)
            //{

            //    BllPurchaseOrders po = new BllPurchaseOrders();
            //    po.updatePOStatus(poNum);
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
            //            "alert('Insert successful'); window.location='" +
            //            Request.ApplicationPath + "pendingpurchaseorders.aspx';", true);
            //}else
            //{
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
            //            "alert('Insert unsuccessful'); window.location='" +
            //            Request.ApplicationPath + "pendingpurchaseorders.aspx';", true);
            //}
        }
        private void Bind()
        {
            BllDeliveryOrders myCat = new BllDeliveryOrders();
            DataSet           ds;

            ds = myCat.GetAll();
            gvDelivery.DataSource = ds;
            gvDelivery.DataBind();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id1 = Session["id"].ToString();

            if (id1 != null)
            {
                int id = Convert.ToInt32(Session["id"].ToString());
                BllDeliveryOrders myCat = new BllDeliveryOrders();
                DataSet           ds;
                ds = myCat.GetDeliveryDetailsByID(id);
                gvDelivery.DataSource = ds;
                gvDelivery.DataBind();

                int rec = ds.Tables["Table"].Rows.Count;

                DataRow row            = ds.Tables["Table"].Rows[0];
                string  trackingid     = row["trackingID"].ToString();
                string  weight         = row["weight"].ToString();
                string  deliverystatus = row["deliveryStatus"].ToString();
                string  type           = row["deliveryType"].ToString();
                string  value          = row["TotalValue"].ToString();
                string  poid           = row["PoID"].ToString();
                string  invoiceid      = row["InvoiceID"].ToString();



                //string trackingid = ds.Tables[0].Rows[0]["trackingID"].ToString();
                //string weight = ds.Tables[0].Rows[0]["weight"].ToString();
                //string deliverystatus = ds.Tables[0].Rows[0]["deliveryStatus"].ToString();

                trackingidlbl.Text   = trackingid;
                weightlbl.Text       = weight + " KG";
                statuslbl.Text       = deliverystatus;
                deliveryTypelbl.Text = type;
                valuelbl.Text        = value;
                poidlbl.Text         = poid;
                inidlbl.Text         = invoiceid;

                string status = statuslbl.Text;
                string inid   = inidlbl.Text;


                if (invoiceid == null || invoiceid == "")
                {
                    createInvoice.Visible = true;
                }
                else
                {
                    createInvoice.Attributes.Add("disabled", "disabled");
                    //createInvoice.Visible = false;
                }
                if (status != "Delivered")
                {
                    createInvoice.Attributes.Add("disabled", "disabled");

                    //createInvoice.Visible = false;
                }
                if (invoiceid == null || invoiceid == "")
                {
                    viewinvoice.Visible = false;
                }
            }
        }