Exemplo n.º 1
0
        public int Insert(PlannerDetails planDet)
        {
            string        DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;
            SqlConnection myConn    = new SqlConnection(DBConnect);

            string sqlStmt = "INSERT INTO PlannerDetails (planId, userId, planCategory, planTitle, planType, planTime, planDuration, webLink, confirmNo, flightAirline, flightNo, flightTerminal, flightGate, planAddress, actETixNo, actPrice, actPax, actTotal, planNotes, planAttachment)" +
                             "VALUES (@paraPlanId,@paraUserId,@paraCategory, @paraTitle, @paraType, @paraTime, @paraDuration, @paraWebLink, @paraConNo, @paraFAirline, @paraFNo, @paraFTer, @paraFGate, @paraAddr, @paraETix,  @paraPrice," +
                             " @paraPax, @paraTotal, @paraNotes, @paraAttachment)";



            int        result = 0; // Execute NonQuery return an integer value
            SqlCommand sqlCmd = new SqlCommand(sqlStmt, myConn);

            ;
            sqlCmd.Parameters.AddWithValue("@paraPlanId", planDet.planId);
            sqlCmd.Parameters.AddWithValue("@paraUserId", planDet.userId);
            sqlCmd.Parameters.AddWithValue("@paraCategory", planDet.category);
            sqlCmd.Parameters.AddWithValue("@paraTitle", planDet.title);
            sqlCmd.Parameters.AddWithValue("@paraType", planDet.type);
            sqlCmd.Parameters.AddWithValue("@paraTime", planDet.planTime);
            sqlCmd.Parameters.AddWithValue("@paraDuration", planDet.duration);
            sqlCmd.Parameters.AddWithValue("@paraWebLink", planDet.webLink);
            sqlCmd.Parameters.AddWithValue("@paraConNo", planDet.conNo);
            sqlCmd.Parameters.AddWithValue("@paraFAirline", planDet.airline);
            sqlCmd.Parameters.AddWithValue("@paraFNo", planDet.flightNo);
            sqlCmd.Parameters.AddWithValue("@paraFTer", planDet.terminal);
            sqlCmd.Parameters.AddWithValue("@paraFGate", planDet.gate);
            sqlCmd.Parameters.AddWithValue("@paraAddr", planDet.addr);
            sqlCmd.Parameters.AddWithValue("@paraETix", planDet.eTixNo);
            sqlCmd.Parameters.AddWithValue("@paraPrice", planDet.price);
            sqlCmd.Parameters.AddWithValue("@paraPax", planDet.pax);
            sqlCmd.Parameters.AddWithValue("@paraTotal", planDet.ttl);
            sqlCmd.Parameters.AddWithValue("@paraNotes", planDet.notes);
            sqlCmd.Parameters.AddWithValue("@paraAttachment", planDet.attach);



            myConn.Open();
            result = sqlCmd.ExecuteNonQuery();

            myConn.Close();

            return(result);
        }
Exemplo n.º 2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var    category = lblCat.Text;
            string title;
            string type;
            //time
            string pTime;
            //duration
            string duration;
            string webLink;
            string conNo;
            string airline;
            string flightNo;
            string terminal;
            string gate;

            string addr;
            string eTixNo;
            string price;
            string pax;
            string ttl;
            //notes
            string notes;
            string attach;

            if (category == "flight")
            {
                title = tbTitleFlight.Text;
                type  = rblTypeFlight.SelectedValue;
                //string timeF = Request["timepicker-selectbox-Flight"];  //!!!!
                pTime = "";
                //pTime = this.Request.Form["timepicker-selectbox-Flight"];
                //string durationFlight = durationF.InnerHtml;
                duration = "";
                webLink  = tbWebBookFlight.Text;
                conNo    = tbConNoFlight.Text;
                airline  = tbAirlineFlight.Text;
                flightNo = tbFNoFlight.Text;
                terminal = tbTerFlight.Text;
                gate     = tbGateFlight.Text;
                addr     = "";
                eTixNo   = "";
                price    = "";
                pax      = "";
                ttl      = "";
                //string notesF = editorFlight.InnerHtml;
                notes  = "";
                attach = FUFliAttachFlight.FileName;

                PlannerDetails planDetF = new PlannerDetails();
                planDetF = new PlannerDetails(category, title, type, pTime, duration, webLink, conNo, airline, flightNo, terminal, gate, addr, eTixNo, price, pax, ttl, notes, attach);
                int resultF = planDetF.addPlanDetails();
                if (resultF == 1)
                {
                    string url = string.Format("~/S_Planner_Start.aspx");
                    Response.Redirect(url);
                }



                //var df = this.Request.Form["txtName"];

                //Label1.Text = durationFlight;
                //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + durationFlight + "');", true);
            }
            else if (category == "accomodation")
            {
                title = tbTitleAcco.Text;
                type  = RBLAcco.SelectedValue;
                //time
                pTime = "";
                //duration
                duration = "";
                webLink  = tbWebBookAcco.Text;
                conNo    = tbConNoAcco.Text;
                airline  = "";
                flightNo = "";
                terminal = "";
                gate     = "";
                addr     = tbAddrAcco.Text;
                eTixNo   = "";
                price    = "";
                pax      = "";
                ttl      = "";
                //string notesAcco = editorAcco.InnerHtml;
                notes  = null;
                attach = FUAcco.FileName;

                PlannerDetails planDetAcco = new PlannerDetails(category, title, type, pTime, duration, webLink, conNo, airline, flightNo, terminal, gate, addr, eTixNo, price, pax, ttl, notes, attach);
                int            resultAcco  = planDetAcco.addPlanDetailsAcco();
                if (resultAcco == 1)
                {
                    string url = string.Format("~/S_Planner_Start.aspx");
                    Response.Redirect(url);
                }
            }
            else if (category == "activity")
            {
                title = tbTitleAct.Text;
                type  = "";
                //time
                pTime = "";
                //duration
                duration = "";
                webLink  = tbWebLinkAct.Text;
                conNo    = "";
                airline  = "";
                flightNo = "";
                terminal = "";
                gate     = "";
                addr     = tbAddrAct.Text;
                eTixNo   = tbETixAct.Text;
                price    = tbPriceAct.Text;
                pax      = tbPaxAct.Text;
                ttl      = tbTtlPriceAct.Text;
                //notes
                notes  = "";
                attach = FUAct.FileName;

                PlannerDetails planDetAct = new PlannerDetails(category, title, type, pTime, duration, webLink, conNo, airline, flightNo, terminal, gate, addr, eTixNo, price, pax, ttl, notes, attach);
                int            resultAct  = planDetAct.addPlanDetails();
                if (resultAct == 1)
                {
                    string url = string.Format("~/S_Planner_Start.aspx");
                    Response.Redirect(url);
                }
            }
            else if (category == "fooD")
            {
                title = tbTitleFnD.Text;
                type  = "";
                //time
                pTime = "";
                //duration
                duration = "";
                webLink  = tbWebLinkFnD.Text;
                conNo    = "";
                airline  = "";
                flightNo = "";
                terminal = "";
                gate     = "";
                addr     = tbAddrFnD.Text;
                eTixNo   = "";
                price    = "";
                pax      = "";
                ttl      = "";
                //notes
                notes  = "";
                attach = FUFnD.FileName;

                PlannerDetails planDetFooD = new PlannerDetails(category, title, type, pTime, duration, webLink, conNo, airline, flightNo, terminal, gate, addr, eTixNo, price, pax, ttl, notes, attach);
                int            resultFooD  = planDetFooD.addPlanDetails();
                if (resultFooD == 1)
                {
                    string url = string.Format("~/S_Planner_Start.aspx");
                    Response.Redirect(url);
                }
            }
        }