示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Session["Agentname"] as string;

            if (name == null)
            {
                Response.Redirect("~/AgentLogin.aspx");
            }
            int    agent_id = Convert.ToInt32(Session["Aid"]);
            string profQ    = "SELECT * FROM TRANSACTION WHERE \"agent_id\" =" + agent_id + " AND \"delivery_status\"='pending'";


            TransProtocol.SelectCommand     = profQ;
            TransProtocol.SelectCommandType = SqlDataSourceCommandType.Text;
            DataView dv = TransProtocol.Select(DataSourceSelectArguments.Empty) as DataView;

            GridView1.DataSource   = dv;
            GridView1.DataSourceID = null;
            GridView1.DataBind();
        }
示例#2
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int transID = Convert.ToInt32(GridView1.DataKeys[GridView1.SelectedIndex].Value);

            Label1.Text = transID.ToString();

            Session["tid"] = transID;


            string codeQ = "SELECT \"pin_code\" FROM \"TRANSACTION\" WHERE \"trans_id\"=" + transID;

            TransProtocol.SelectCommand     = codeQ;
            TransProtocol.SelectCommandType = SqlDataSourceCommandType.Text;
            DataView dx = TransProtocol.Select(DataSourceSelectArguments.Empty) as DataView;

            int code = Convert.ToInt32(dx.Table.Rows[0][0]);

            //Label1.Text = code.ToString();

            Session["transCode"] = code;

            Response.Redirect("~/AgentConfirm.aspx");
        }
示例#3
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            List <Order> Orders = null;

            Orders = Session["OrderList_Session"] as List <Order>;
            if (Orders != null)
            {
                Random rnd  = new Random();
                int    code = rnd.Next(1000, 9999);
                Session["code"] = code;
                /************************/
                string orderString = null;

                foreach (Order x in Orders)
                {
                    orderString += "Food name:" + x.Name + ", ";
                    orderString += "Price: " + x.Price + ", ";
                    orderString += "Quantity: " + x.Quantity + ", ";
                    orderString += "Hotel Name: " + x.hotelName + ", ";
                    orderString += "Address: " + x.hotelAddress + ", ";
                    orderString += "_________________________________";
                }

                DebugLabel.Text = orderString;
                /************************/



                /*
                 *  string query1="SELECT MAX(\"customer_id\") AS CID FROM CUSTOMER";
                 *  SqlDataSource1.SelectCommand = query1;
                 *  SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text;
                 *  DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView;
                 *
                 *  //Debug2.Text = query1;
                 *  int id = 0;
                 *
                 *  id = Convert.ToInt32(dv.Table.Rows[0][0]);
                 *  id += 1;
                 */

                /***************/

                string maxQ = "SELECT MAX(\"trans_id\") AS Tid FROM TRANSACTION";
                TransProtocol.SelectCommand     = maxQ;
                TransProtocol.SelectCommandType = SqlDataSourceCommandType.Text;
                DataView transDV = TransProtocol.Select(DataSourceSelectArguments.Empty) as DataView;
                int      trans   = Convert.ToInt32(transDV.Table.Rows[0][0]) + 1;


                /****************/

                int cc = Convert.ToInt32(Session["cid"]);

                /****************/

                string money = Price.Text;

                /**********************/



                //INSERT INTO "TRANSACTION" VALUES (2,1,'abc',ASSIGN_AGENT(1),125,666,'pending');

                /*
                 * SqlDataSource1.InsertCommand = insertquery;
                 * SqlDataSource1.InsertCommandType = SqlDataSourceCommandType.Text;
                 * int nrows = SqlDataSource1.Insert();
                 *
                 * */

                /*
                 *
                 * string transQ= "INSERT INTO \"TRANSACTION\" VALUES ("
                 *
                 + trans+ ", "
                 + cc + ", "
                 + "'" + orderString + "'" +", "
                 + "ASSIGN_AGENT(" + cc + ")" +", "
                 + money+", "
                 + code +", "
                 +"'pending')";
                 */


                string transQ = "DECLARE tempAddress VARCHAR2(100); BEGIN \"getCustomerAddress\"(" + cc + ", tempAddress); INSERT INTO \"TRANSACTION\" VALUES ("

                                + trans + ", "
                                + cc + ", "
                                + "tempAddress" + ", "
                                + "'" + orderString + "'" + ", "
                                + "ASSIGN_AGENT(" + cc + ")" + ", "
                                + money + ", "
                                + code + ", "
                                + "'pending'); END;";



                ;

                /*
                 * DECLARE
                 *
                 * tempAddress VARCHAR2(100);
                 *
                 *
                 * BEGIN
                 *
                 * "getCustomerAddress"(1, tempAddress);
                 *
                 * */



                DebugLabel.Text = transQ;

                TransProtocol.InsertCommand     = transQ;
                TransProtocol.InsertCommandType = SqlDataSourceCommandType.Text;
                int nrows = TransProtocol.Insert();
                if (nrows > 0)
                {
                    //DebugLabel.Text = "hoise";
                }


                /*************************/


                Response.Redirect("~/Completed.aspx");
            }

            else
            {
                Response.Redirect("~/Completed.aspx");
            }
        }