예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //To add the javascript using code for the Next button, in a wizard step to get confirmation
            //In addition to using Onclient Click button property for injecting javascript , can inject the same in Code behind using the Button ID -[which is not directly available so need to obtain by hierarchy]
            //OnClientClick = "return confirm('Are you sure to Cancel?')"
            //using Code behind
            Button bt = (Button)Wizard1.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton");

            bt.OnClientClick = "return confirm('Are you sure to Cancel?')";
        }
예제 #2
0
 protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
 {
     if (Wizard1.ActiveStepIndex == 1)
     {
         //Wizard1.ActiveStepIndex = 1;
         Button myPreviousBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepPreviousButton");
         if (myPreviousBtn != null)
         {
             LogUtils.myLog.Info("My Previous Button is not null");
             myPreviousBtn.Visible = false;
         }
         LogUtils.myLog.Info("I am inside 1st tab. Input Value is: " + TextBox1.Text);
     }
 }
예제 #3
0
    protected void rdoList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList rbl = (RadioButtonList)sender;
        Panel           ccp = (Panel)Wizard1.FindControl("CreditCardPayment");

        if (rbl.SelectedValue == "CC")
        {
            //ccp.Visible = true;
        }
        else
        {
            //ccp.Visible = false;
        }
    }
예제 #4
0
    protected void OnFinishButtonClick(Object sender, WizardNavigationEventArgs e)
    {
        // The OnFinishButtonClick method is a good place to collect all
        // the data from the completed pages and persist it to the data store.

        // For this example, write a confirmation message to the Complete page
        // of the Wizard control.
        Label tempLabel = (Label)Wizard1.FindControl("CompleteMessageLabel");

        if (tempLabel != null)
        {
            tempLabel.Text = "Your order has been placed. An email confirmation will be sent to "
                             + (EmailAddress.Text.Length == 0 ? "your email address" : EmailAddress.Text) + ".";
        }
    }
예제 #5
0
    private void LocalizePage()
    {
        labelError.Text   = Resources.Resources.ResourceBibtextimportError;
        LabelMessage.Text = Resources.Resources.ResourceBibtextimportMessage;

        ParserErrorsLabel.Text = Resources.Resources.ResourceBibtextimportParseerror;

        MappingErrorsLabel.Text = Resources.Resources.ResourceBibtextimportMappingerror;
        Label2.Text             = Resources.Resources.ResourceBibtextimportSuccesspareseentries;

        ResourceWithCitationLabel.Text    = Resources.Resources.ResourceBibtextimportResourcewithcitations;
        ResourceWithoutCitationLabel.Text = Resources.Resources.ResourceBibtextimportResourcewithoutcitations;
        NewResourcesLabel.Text            = Resources.Resources.ResourceBibtextimportNewresource;

        RequiredFieldValidatorFileUPload.ErrorMessage = Resources.Resources.ResourceBibtextimportFileuploadmessage;
        ragularExpBibTeXFile.ErrorMessage             = Resources.Resources.ResourceBibtextimportFileuploadmessage;

        // Get reference of buttons "Step2BackButton" and "Step2ImportButton" from template "StepNavigationTemplateContainerID" and
        // set their text property.
        Control stepNavigationTemplate = Wizard1.FindControl(_stepNavTemplateContainerID) as Control;

        if (stepNavigationTemplate != null)
        {
            Button step2BackButton = stepNavigationTemplate.FindControl(_step2BackButton) as Button;
            if (step2BackButton != null)
            {
                step2BackButton.Text = Resources.Resources.BibTexImportStep2BackButtonText;
            }
            Button step2ImportButton = stepNavigationTemplate.FindControl(_step2ImportButton) as Button;
            if (step2ImportButton != null)
            {
                step2ImportButton.Text = Resources.Resources.BibTexImportStep2ButtonText;
            }
        }

        // Get reference of button "Step3FinishButton" from template "FinishNavigationTemplate" and
        // assign it's text property.
        Control finishNavigationTemplate = Wizard1.FindControl(_finishNavTemplateContainerID) as Control;

        if (finishNavigationTemplate != null)
        {
            Button step3Button = finishNavigationTemplate.FindControl(_step2FinishButton) as Button;
            if (step3Button != null)
            {
                step3Button.Text = Resources.Resources.BibTexImportStep3ButtonText;
            }
        }
    }
예제 #6
0
 protected void chkUseProfileAddress_CheckChanged(object sender, System.EventArgs e)
 {
     if (chkUseProfileAddress.Checked)
     {
         ((TextBox)Wizard1.FindControl("txtName")).Text     = Profile.Name;
         ((TextBox)Wizard1.FindControl("txtAddress")).Text  = Profile.Address;
         ((TextBox)Wizard1.FindControl("txtCity")).Text     = Profile.City;
         ((TextBox)Wizard1.FindControl("txtPostCode")).Text = Profile.PostCode;
         ((TextBox)Wizard1.FindControl("txtCountry")).Text  = Profile.Country;
         ((TextBox)Wizard1.FindControl("txtName")).DataBind();
         ((TextBox)Wizard1.FindControl("txtAddress")).DataBind();
         ((TextBox)Wizard1.FindControl("txtCity")).DataBind();
         ((TextBox)Wizard1.FindControl("txtPostCode")).DataBind();
         ((TextBox)Wizard1.FindControl("txtCountry")).DataBind();
     }
 }
예제 #7
0
 protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
 {
     if (e.CurrentStepIndex == 0)
     {
         Login l = (Login)Wizard1.FindControl("Login1");
         if (Membership.ValidateUser(l.UserName, l.Password))
         {
             e.Cancel = false;
         }
         else
         {
             l.InstructionText = "Your login attempt was not successful. Please try again.";
             l.InstructionTextStyle.ForeColor = System.Drawing.Color.Red;
             e.Cancel = true;
         }
     }
 }
예제 #8
0
 protected void Wizard1_FinishedButtonClick(object sender, WizardNavigationEventArgs e)
 {
     try {
         int s = addOrder();
         addOrderLines(s);
         Button nextButton = ((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishPreviousButton"));
         nextButton.Visible     = false;
         nextButton             = ((Button)Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishButton"));
         nextButton.Visible     = false;
         finishedSpan.InnerHtml = "You're order has been placed successfully. Thankyou for our business.<br/><br/>You can return to our <a href=\"../ pages / Photographs.aspx\">products</a> page or view our <a href = \"../pages/Specials.aspx\" > specials.</ a ></ p >";
         Profile.Cart.Items.Clear();
         Profile.Name     = ((TextBox)Wizard1.FindControl("txtName")).Text;
         Profile.Address  = ((TextBox)Wizard1.FindControl("txtAddress")).Text;
         Profile.City     = ((TextBox)Wizard1.FindControl("txtCity")).Text;
         Profile.PostCode = ((TextBox)Wizard1.FindControl("txtPostCode")).Text;
         Profile.Country  = ((TextBox)Wizard1.FindControl("txtCountry")).Text;
         Profile.Save();
     } catch (Exception p) {
         CreateOrderErrorLabel.Text    = p.ToString();
         CreateOrderErrorLabel.Visible = true;
     }
 }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Wizard1.PreRender += new EventHandler(Wizard1_PreRender);
            if (Context.User.IsInRole("Admin") || Context.User.IsInRole("Dealer") || Context.User.IsInRole("Member"))
            {
                Profile = ProfileBase.Create(Membership.GetUser().UserName);
            }
            else
            {
                Profile = ProfileBase.Create("Guest");
            }

            if (!Page.IsPostBack)
            {
                if (User.Identity.IsAuthenticated)
                {
                    if (Profile.Cart.isEmpty())
                    {
                        Wizard1.Visible    = false;
                        NoCartSpan.Visible = true;
                    }
                    else
                    {
                        Wizard1.ActiveStepIndex = 1;
                        Button nextButton = ((Button)Wizard1.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton"));
                        nextButton.Visible = true;
                    }
                }
                else
                {
                    Wizard1.ActiveStepIndex = 0;
                    Button nextButton = ((Button)Wizard1.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton"));
                    nextButton.Visible = false;
                }
            }
        }
        protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            setNextPrevBtnLbls(Wizard1.ActiveStepIndex);
            Button myNextBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButton");
            if (Wizard1.ActiveStepIndex == 1)
            {
                //Wizard1.ActiveStepIndex = 1;

                int selectedItemCount = 0;
                List<QuestionRangedValue> rangedValueList = new List<QuestionRangedValue>();

                selectedItemList = new Dictionary<String, String>();
                List<int> selectedItemIds = new List<int>();
                foreach (DataListItem item in DataList12.Items)
                {
                    String attributeTypeIDValue = ((HiddenField)item.FindControl("attributeTypeHidden")).Value;
                    String attributeIDValue = ((HiddenField)item.FindControl("attributeIDHidden")).Value;
                    if (attributeTypeIDValue.Equals("1001"))
                    {
                        RadioButtonList rdBtn = ((RadioButtonList)item.FindControl("radlstPubs"));
                        ListItem selItem = rdBtn.SelectedItem;
                        if (selItem != null)
                        {
                            Int32 ignoreThisValue = Int32.Parse("214748364") + Int32.Parse(attributeIDValue);
                            if (selItem.Value != ignoreThisValue.ToString())
                            {
                                selectedItemIds.Add(Int32.Parse(selItem.Value));
                                selectedItemCount++;
                            }
                            selectedItemList[selItem.Value] = selItem.Text;
                        }
                    }
                    else
                    {
                        QuestionRangedValue que = new QuestionRangedValue();
                        String fromValue = ((TextBox)item.FindControl("fromText")).Text;
                        String toValue = ((TextBox)item.FindControl("toText")).Text;
                        que.fromValue = fromValue;
                        que.toValue = toValue;
                        que.attributeID = attributeIDValue;
                        if(que.fromValue != "" && que.toValue != "") rangedValueList.Add(que);
                    }
                }
                ViewState["searchCriteria"] = selectedItemList;
                ViewState["searchCriteriaRangeValue"] = rangedValueList;

                selectedQuestionPanel.Visible = false;

                //LogUtils.myLog.Info("Selected Item of Radio Button is: " + selectedItems + " and length is : " + selectedItemCount);
                List<int> questionsIdsList = new List<int>();
                List<QueQuestion> quesScoreList = new List<QueQuestion>();

                if (selectedItemCount > 0)
                {
                    QueAssessmentSearchCriteria criteria = new QueAssessmentSearchCriteria();
                    criteria.courseId = Int32.Parse(Session["CourseID"].ToString());
                    criteria.cloId = Int32.Parse(DropDownList3.SelectedItem.Value);
                    criteria.soId = Int32.Parse(DropDownList4.SelectedItem.Value);
                    criteria.courseTopicId = Int32.Parse(DropDownList5.SelectedItem.Value);
                    criteria.selectedAttributeCount = selectedItemCount + rangedValueList.Count;

                    quesScoreList = queDaoObj.getQuesScoreListInferenceEngine(rangedValueList, selectedItemIds, "15", criteria);

                    String quesIds = "";
                    foreach (QueQuestion que in quesScoreList)
                    {
                        questionsIdsList.Add(que.questionId);
                        quesIds += que.questionId + ",";
                    }

                    LogUtils.myLog.Info(quesIds);
                }

                //questionList = queDaoObj.questionList(questionsIdsList);
                //questionList = updateScore(questionList, quesScoreList);

                questionList = quesScoreList;
                ViewState["questionList"] = questionList;

                questionListTag.DataSource = questionList;
                questionListTag.DataBind();

                bool editMode = Request.QueryString["editMode"] == null ? false : bool.Parse(Request.QueryString["editMode"]);
                if (!editMode) Wizard1.ActiveStepIndex = 2;

            }
            else if (Wizard1.ActiveStepIndex == 2)
            {
                int count = 0;

                foreach (GridViewRow gvr in questionListTag.Rows)
                {
                    if ((gvr.FindControl("CheckBox1") as CheckBox).Checked)
                    {
                        if (alreadyExists(questionList[count].questionId) == false)
                        {
                            selectedQuestionList.Add(questionList[count]);
                            List<QuestionRangedValue> rangedValueList = new List<QuestionRangedValue>();
                            String selectedAttrOptIdsStr = getSelectedSearchCriteria(rangedValueList);

                            List<QueQuestionScore> questionScoreListForCurrentQuestion =
                                queDaoObj.getQuestionScoreDetailsByID(questionList[count].questionId, rangedValueList, selectedAttrOptIdsStr);
                            questionScoreList.AddRange(questionScoreListForCurrentQuestion);
                        }
                        //LogUtils.myLog.Info("The cell selected value ID : " + questionList[count].questionId);
                    }
                    count++;
                }

                ViewState["selectedQuestionList"] = selectedQuestionList;
                ViewState["questionScoreList"] = questionScoreList;

                questionsListSelectedTag.DataSource = selectedQuestionList;
                questionsListSelectedTag.DataBind();
            }

            Button myPreviousBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepPreviousButton");
            if (myPreviousBtn != null)
            {
                //LogUtils.myLog.Info("My Previous Button is not null");
                myPreviousBtn.Visible = true;
            }
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get variables for previous form Using Page , Context handler
            // Cookies Sessions
            System.Collections.Specialized.NameValueCollection previousFormcollection = Request.Form;

            Label9.Text  = previousFormcollection["TextBoxName"];
            Label10.Text = previousFormcollection["TextBoxPlace"];

            Page previousPage = this.PreviousPage;

            if (previousPage != null && previousPage.IsCrossPagePostBack)
            {
                Label11.Text = ((TextBox)previousPage.FindControl("TextBoxName")).Text;
                Label12.Text = ((TextBox)previousPage.FindControl("TextBoxPlace")).Text;
            }
            else
            {
                lblStatus.Text = "Landed on this page using a technique other than cross page post back";
            }


            // this is ti stop post back after refresh
            if (Page.IsPostBack)
            {
                if (Session["postid"] is null)
                {
                    Session["postid"]   = System.Guid.NewGuid().ToString();
                    ViewState["postid"] = Session["postid"];
                }

                if (ViewState["postid"].ToString() != Session["postid"].ToString())
                {
                    IsPageRefresh = true;
                }
            }
            Session["postid"]   = System.Guid.NewGuid().ToString();
            ViewState["postid"] = Session["postid"];


            if (!IsPostBack)
            {
                refreshdata();
                Literal1.Text = "<b><font color='Red'>Literal Control Text</font></b>";
                multiViewEmployee.ActiveViewIndex = 0;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("select * from [dbo].[Employees] where Id = 4", con);
                    con.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        txtFirstName.Text  = rdr["FirstName"].ToString();
                        txtLastName.Text   = rdr["LastName"].ToString();
                        txtGender.Text     = rdr["Gender"].ToString();
                        txtSalary.Text     = rdr["Salary"].ToString();
                        HiddenField1.Value = rdr["ID"].ToString();
                    }
                }

                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("select * from [dbo].[Employees] where Id = 5", con);
                    con.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        TextBox1.Text           = rdr["FirstName"].ToString();
                        TextBox2.Text           = rdr["LastName"].ToString();
                        ddlGender.SelectedValue = rdr["Gender"].ToString();
                        HiddenField2.Value      = rdr["ID"].ToString();
                    }
                }



                Button btnNext = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton");
                btnNext.Attributes.Add("onclick", "return confirm('Are you sure you want to move to the next step');");


                AdminPanel.Visible    = false;
                NonAdminPanel.Visible = false;


                Page lastpage = (Page)Context.Handler;
                if (lastpage is WebForm1)
                {
                    //Use FindControl() if public properties does not exist on the
                    //previous page(WebForm1). FindControl() may cause
                    //NullRefernceExceptions due to mis-spelled conrol Id's

                    //Label15.Text = ((TextBox)lastpage.FindControl("TextBoxName")).Text;
                    //Label16.Text = ((TextBox)lastpage.FindControl("TextBoxPlace")).Text;

                    //Using public properties can eliminate NullRefernceExceptions
                    Label15.Text = ((WebForm1)lastpage).Name;
                    Label16.Text = ((WebForm1)lastpage).Place;
                }


                Label13.Text = Request.QueryString["Name"];
                Label14.Text = Request.QueryString["Place"];
                // Label13.Text = Request.QueryString[0];
                // Label14.Text = Request.QueryString[1];

                var cookie = Request.Cookies["UserInfo"];
                if (cookie != null)
                {
                    Label17.Text = cookie["Name"];
                    Label18.Text = cookie["Place"];
                }
                if (Session["Name"] != null && Session["Place"] != null)
                {
                    Label19.Text = Session["Name"].ToString();
                    Label20.Text = Session["Place"].ToString();
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        userid = Session["userid"].ToString();
        Button btn = Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishButton") as Button;

        btn.Parent.Controls.Remove(btn);

        if (!IsPostBack)
        {
            Session["memnum"] = "0";
            state             = Request["state"].ToString();
            if (Request["pname"] != null)
            {
                projectname = Request["pname"].ToString();
            }

            if (state.Equals("checkSubmit"))
            {
                this.ButtonSave.Visible   = false;
                this.ButtonSubmit.Visible = false;
                this.LabelNote.Visible    = false;
                this.ButtonPrint.Visible  = true;
            }
            else
            {
                this.ButtonSave.Visible   = true;
                this.ButtonSubmit.Visible = true;
                this.LabelNote.Visible    = true;
                this.ButtonPrint.Visible  = false;
            }

            //如果是申请非自主申请的题目
            if (state.Equals("notSelfApply"))
            {
                string        sql  = "Data Source=(local);Initial Catalog=ProjectSystem;Integrated Security=false ;User ID=sa;Password=1234";
                SqlConnection conn = new SqlConnection(sql);
                conn.Open();
                //查找项目
                string     find = "select * from Projects inner join Teachers on Projects.TeacherId = Teachers.TchrId where ProjectName ='" + projectname + "'";
                SqlCommand comm = new SqlCommand();
                comm.CommandText = find;
                comm.Connection  = conn;
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        TBProjectName.Text = projectname;
                        TBTchrName.Text    = dr["TchrName"].ToString();
                        TBTchrID.Text      = dr["TchrId"].ToString();
                        if (dr["ProjectType"].ToString().Equals("大学生创新项目"))
                        {
                            DropDownList1.SelectedIndex = 0;
                        }
                        else if (dr["ProjectType"].ToString().Equals("实验室基金项目"))
                        {
                            DropDownList1.SelectedIndex = 1;
                        }
                        else if (dr["ProjectType"].ToString().Equals("培育项目"))
                        {
                            DropDownList1.SelectedIndex = 2;
                        }
                        TBProjectName.Enabled = false;
                        TBTchrName.Enabled    = false;
                        TBTchrID.Enabled      = false;
                        DropDownList1.Enabled = false;
                    }
                }
                dr.Close();
                conn.Close();
            }

            //如果是查看修改未提交的项目
            if (state.Equals("checkNotSubmit"))
            {
                string        sql  = "Data Source=(local);Initial Catalog=ProjectSystem;Integrated Security=false ;User ID=sa;Password=1234";
                SqlConnection conn = new SqlConnection(sql);
                conn.Open();
                //查找项目
                string find = "select * from Stu_Application_Info inner join Teachers on Stu_Application_Info.TeacherId = Teachers.TchrId where" +
                              " ProjectName ='" + projectname + "' and StuId ='" + userid + "'";
                SqlCommand comm = new SqlCommand();
                comm.CommandText = find;
                comm.Connection  = conn;
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        TBProjectName.Text = projectname;
                        if (dr["TchrName"] != null)
                        {
                            TBTchrName.Text = dr["TchrName"].ToString();
                        }
                        if (dr["TchrId"] != null)
                        {
                            TBTchrID.Text = dr["TchrId"].ToString();
                        }
                        if (dr["ProjectType"].ToString().Equals("大学生创新项目"))
                        {
                            DropDownList1.SelectedIndex = 0;
                        }
                        else if (dr["ProjectType"].ToString().Equals("实验室基金项目"))
                        {
                            DropDownList1.SelectedIndex = 1;
                        }
                        else if (dr["ProjectType"].ToString().Equals("培育项目"))
                        {
                            DropDownList1.SelectedIndex = 2;
                        }
                        if (dr["Member1"] != null)
                        {
                            if (!dr["Member1"].ToString().Equals(""))
                            {
                                Panel1.Visible    = true;
                                TBMember1.Text    = dr["Member1"].ToString();
                                Session["memnum"] = 1;
                            }
                        }
                        if (dr["Member2"] != null)
                        {
                            if (!dr["Member2"].ToString().Equals(""))
                            {
                                Panel2.Visible    = true;
                                TBMember2.Text    = dr["Member2"].ToString();
                                Session["memnum"] = 2;
                            }
                        }
                        if (dr["Member3"] != null)
                        {
                            if (!dr["Member3"].ToString().Equals(""))
                            {
                                Panel3.Visible    = true;
                                TBMember3.Text    = dr["Member3"].ToString();
                                Session["memnum"] = 3;
                            }
                        }
                        if (dr["Member4"] != null)
                        {
                            if (!dr["Member4"].ToString().Equals(""))
                            {
                                Panel4.Visible    = true;
                                TBMember4.Text    = dr["Member4"].ToString();
                                Session["memnum"] = 4;
                            }
                        }
                        if (dr["Description"] != null)
                        {
                            TBDescription.Text = dr["Description"].ToString();
                        }
                    }
                }
                dr.Close();
                conn.Close();
            }

            //如果是查看已提交的项目
            if (state.Equals("checkSubmit"))
            {
                string        sql  = "Data Source=(local);Initial Catalog=ProjectSystem;Integrated Security=false ;User ID=sa;Password=1234";
                SqlConnection conn = new SqlConnection(sql);
                conn.Open();
                //查找项目
                string find = "select * from Stu_Application_Info inner join Teachers on Stu_Application_Info.TeacherId = Teachers.TchrId where" +
                              " ProjectName ='" + projectname + "' and StuId ='" + userid + "'";
                SqlCommand comm = new SqlCommand();
                comm.CommandText = find;
                comm.Connection  = conn;
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        TBProjectName.Text    = projectname;
                        TBProjectName.Enabled = false;
                        if (dr["TchrName"] != null)
                        {
                            TBTchrName.Text = dr["TchrName"].ToString();
                        }
                        TBTchrName.Enabled = false;
                        if (dr["TchrId"] != null)
                        {
                            TBTchrID.Text = dr["TchrId"].ToString();
                        }
                        TBTchrID.Enabled = false;
                        if (dr["ProjectType"].ToString().Equals("大学生创新项目"))
                        {
                            DropDownList1.SelectedIndex = 0;
                        }
                        else if (dr["ProjectType"].ToString().Equals("实验室基金项目"))
                        {
                            DropDownList1.SelectedIndex = 1;
                        }
                        else if (dr["ProjectType"].ToString().Equals("培育项目"))
                        {
                            DropDownList1.SelectedIndex = 2;
                        }
                        DropDownList1.Enabled = false;
                        if (dr["Member1"] != null)
                        {
                            if (!dr["Member1"].ToString().Equals(""))
                            {
                                Panel1.Visible    = true;
                                TBMember1.Text    = dr["Member1"].ToString();
                                Session["memnum"] = 1;
                                TBMember1.Enabled = false;
                            }
                        }
                        if (dr["Member2"] != null)
                        {
                            if (!dr["Member2"].ToString().Equals(""))
                            {
                                Panel2.Visible    = true;
                                TBMember2.Text    = dr["Member2"].ToString();
                                Session["memnum"] = 2;
                                TBMember1.Enabled = false;
                            }
                        }
                        if (dr["Member3"] != null)
                        {
                            if (!dr["Member3"].ToString().Equals(""))
                            {
                                Panel3.Visible    = true;
                                TBMember3.Text    = dr["Member3"].ToString();
                                Session["memnum"] = 3;
                                TBMember1.Enabled = false;
                            }
                        }
                        if (dr["Member4"] != null)
                        {
                            if (!dr["Member4"].ToString().Equals(""))
                            {
                                Panel4.Visible    = true;
                                TBMember4.Text    = dr["Member4"].ToString();
                                Session["memnum"] = 4;
                                TBMember1.Enabled = false;
                            }
                        }
                        if (dr["Description"] != null)
                        {
                            TBDescription.Text = dr["Description"].ToString();
                        }
                        TBDescription.Enabled = false;
                    }
                }
                dr.Close();
                conn.Close();
            }
        }

        //即时更新组员填写数量
        memnum = int.Parse(Session["memnum"].ToString());
        if (memnum == 0)
        {
            ButtonDel.Enabled = false;
            ButtonAdd.Enabled = true;
        }
        else if (memnum == 4)
        {
            ButtonAdd.Enabled = false;
            ButtonDel.Enabled = true;
        }
        else
        {
            ButtonAdd.Enabled = true;
            ButtonDel.Enabled = true;
        }
        Response.Write(memnum);
    }
예제 #13
0
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        //insert the order and order lines into database
        SqlConnection  conn  = null;
        SqlTransaction trans = null;
        SqlCommand     cmd   = default(SqlCommand);
        ShoppingCart   cart  = StoredCart.Read();

        // if there is not shopping cart, then something has gone wrong
        if (cart == null || cart.Items.Count == 0)
        {
            e.Cancel = true;
            return;
        }

        // try / catch protects us against exeptions
        try
        {
            int OrderID = 0;
            // Create and open a new connection to the database
            conn = new SqlConnection(ConfigurationManager.ConnectionStrings
                                     ["ConnectionString"].ConnectionString);
            conn.Open();
            //start a new transaction
            trans = conn.BeginTransaction();
            //create a new command - the stored procedure
            cmd             = new SqlCommand();
            cmd.Connection  = conn;
            cmd.Transaction = trans;
            //set the order details: the name and type of the command
            cmd.CommandText = "AddOrder";
            cmd.CommandType = CommandType.StoredProcedure;
            //Set up the parameters to pass to the database

            cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Address", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Email", SqlDbType.VarChar, 255);
            cmd.Parameters.Add("@OrderTime", SqlDbType.DateTime);
            cmd.Parameters.Add("@DeliveryCharge", SqlDbType.Money);
            cmd.Parameters.Add("@TotalValue", SqlDbType.Money);
            cmd.Parameters.Add("@CustomerRequest", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@OrderID", SqlDbType.Int);

            //set the values for the parameters

            cmd.Parameters["@Name"].Value            = ((TextBox)Wizard1.FindControl("txtName")).Text;
            cmd.Parameters["@Address"].Value         = ((TextBox)Wizard1.FindControl("txtAddress")).Text;
            cmd.Parameters["@Email"].Value           = ((TextBox)Wizard1.FindControl("txtEmail")).Text;
            cmd.Parameters["@OrderTime"].Value       = DateTime.Now;
            cmd.Parameters["@DeliveryCharge"].Value  = cart.DeliveryCharge;
            cmd.Parameters["@TotalValue"].Value      = cart.Total;
            cmd.Parameters["@CustomerRequest"].Value = "";
            cmd.Parameters["@OrderID"].Direction     = ParameterDirection.Output;
            //Execute the query and parameters for the Order lines.
            cmd.ExecuteNonQuery();

            OrderID = Convert.ToInt32(cmd.Parameters["@OrderID"].Value);

            cmd.CommandText = "AddOrderItems";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@fkOrderID", SqlDbType.Int);
            cmd.Parameters.Add("@fkMenuItemID", SqlDbType.Int);
            cmd.Parameters.Add("@fkItemSize", SqlDbType.VarChar, 10);
            cmd.Parameters.Add("@ItemName", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Quantity", SqlDbType.Int);
            cmd.Parameters.Add("@SubTotal", SqlDbType.Money);
            cmd.Parameters["@fkOrderID"].Value = OrderID;
            // Loop through the items in the shopping cart adding each one
            foreach (CartItem item in cart.Items)
            {
                cmd.Parameters["@fkMenuItemID"].Value = item.MenuItemID;
                cmd.Parameters["@fkItemSize"].Value   = item.ItemSize;
                cmd.Parameters["@ItemName"].Value     = item.ItemName;
                cmd.Parameters["@Quantity"].Value     = item.Quantity;
                cmd.Parameters["@SubTotal"].Value     = item.SubTotal;

                cmd.ExecuteNonQuery();
            }
            //if no errors save to database and confirm onrder onscreen
            trans.Commit();
            lblSuccess.Visible = true;
        }
        catch (Exception)
        {
            if (trans != null)
            {
                trans.Rollback();
            }

            lblError.Visible = true;
            return;
        }
        finally
        {
            if (conn != null)
            {
                conn.Close();
            }
        }
        cart.Items.Clear();
    }
예제 #14
0
    protected void Wizard1_FinishButtonClick(object sender, System.Web.UI.WebControls.WizardNavigationEventArgs e)
    {
        // Insert the order and order lines into the database
        SqlConnection  conn  = null;
        SqlTransaction trans = null;
        SqlCommand     cmd;

        try
        {
            conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WroxUnited"].ConnectionString);
            conn.Open();

            trans = conn.BeginTransaction();

            cmd             = new SqlCommand();
            cmd.Connection  = conn;
            cmd.Transaction = trans;

            // set the order details
            cmd.CommandText = "INSERT INTO Orders(MemberName, OrderDate, Name, Address, County, PostCode, Country, SubTotal, Discount, Total) " + "VALUES (@MemberName, @OrderDate, @Name, @Address, @County, @PostCode, @Country, @SubTotal, @Discount, @Total)";
            cmd.Parameters.Add("@MemberName", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@OrderDate", SqlDbType.DateTime);
            cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Address", SqlDbType.VarChar, 255);
            cmd.Parameters.Add("@County", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@PostCode", SqlDbType.VarChar, 15);
            cmd.Parameters.Add("@Country", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@SubTotal", SqlDbType.Money);
            cmd.Parameters.Add("@Discount", SqlDbType.Money);
            cmd.Parameters.Add("@Total", SqlDbType.Money);

            cmd.Parameters["@MemberName"].Value = User.Identity.Name;
            cmd.Parameters["@OrderDate"].Value  = DateTime.Now;
            cmd.Parameters["@Name"].Value       = ((TextBox)Wizard1.FindControl("txtName")).Text;
            cmd.Parameters["@Address"].Value    = ((TextBox)Wizard1.FindControl("txtAddress")).Text;
            cmd.Parameters["@County"].Value     = ((TextBox)Wizard1.FindControl("txtCounty")).Text;
            cmd.Parameters["@PostCode"].Value   = ((TextBox)Wizard1.FindControl("txtPostCode")).Text;
            cmd.Parameters["@Country"].Value    = ((TextBox)Wizard1.FindControl("txtCountry")).Text;
            cmd.Parameters["@Total"].Value      = Profile.Cart.Total;

            int OrderID = Convert.ToInt32(cmd.ExecuteScalar());

            // change the query and parameters for the order lines
            cmd.CommandText = "INSERT INTO OrderLines(OrderID, ProductID, Quantity, Price) " +
                              "VALUES (@OrderID, @ProductID, @Quantity, @Price)";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@OrderID", SqlDbType.Int);
            cmd.Parameters.Add("@ProductID", SqlDbType.Int);
            cmd.Parameters.Add("@Quantity", SqlDbType.Int);
            cmd.Parameters.Add("@Price", SqlDbType.Money);

            cmd.Parameters["@OrderID"].Value = OrderID;
            foreach (CartItem item in Profile.Cart.Items)
            {
                cmd.Parameters["@ProductID"].Value = item.ProductID;
                cmd.Parameters["@Quantity"].Value  = item.Quantity;
                cmd.Parameters["@Price"].Value     = item.Price;

                cmd.ExecuteNonQuery();
            }

            // commit the transaction
            trans.Commit();
        }
        catch (SqlException SqlEx)
        {
            // some form of error - rollback the transaction
            // and rethrow the exception
            if (trans != null)
            {
                trans.Rollback();
            }



            // Log the exception
            // Tools.log("An error occurred while creating the order", SqlEx)
            throw new Exception("An error occurred while creating the order", SqlEx);
        }
        finally
        {
            if (conn != null)
            {
                conn.Close();
            }
        }

        // we will only reach here if the order has been created sucessfully
        // so clear the cart
        Profile.Cart.Items.Clear();
    }
예제 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Button btn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton");

            btn.OnClientClick = "return confirm('Are you sure?')";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false && Session["CourseID"] != null)
            {
                fillCLODropDown(Session["CourseID"].ToString());
                fillCourseTopicDropDownByCloId(DropDownList3.SelectedItem.Value);
                fillSODropDown(DropDownList3.SelectedItem.Value);

                ViewState["questionList"] = null;
                ViewState["selectedQuestionList"] = null;
                ViewState["questionScoreList"] = null;

                Button myNextBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButton");
                Button myPreviousBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepPreviousButton");
                if (myPreviousBtn != null)
                {
                    //LogUtils.myLog.Info("My Previous Button is not null");
                    myPreviousBtn.Visible = false;
                }

                bool editMode = Request.QueryString["editMode"] == null ? false : bool.Parse(Request.QueryString["editMode"]);
                if (editMode)
                {
                    label1.Text = "Update Assessment";
                    Wizard1.StartNextButtonText = "Add/Delete Questions";
                    setEditData();
                }
                else
                {
                    label1.Text = "Add Assessment";
                    Wizard1.ActiveStepIndex = 1;
                }
            }
            else
            {
                if (ViewState["questionList"] != null)
                {
                    questionList = (List<QueQuestion>)ViewState["questionList"];
                }

                if (ViewState["selectedQuestionList"] != null)
                {
                    selectedQuestionList = (List<QueQuestion>)ViewState["selectedQuestionList"];
                }
                if (ViewState["questionScoreList"] != null)
                {
                    questionScoreList = (List<QueQuestionScore>)ViewState["questionScoreList"];
                }

            }

            bool editMode1 = Request.QueryString["editMode"] == null ? false : bool.Parse(Request.QueryString["editMode"]);
            if (editMode1) this.Title = "Update Assessment";
            else this.Title = "Add Assessment";

            if (Session["CourseID"] != null)
            {
                String courseIdLocal = Session["CourseID"].ToString();
                List<KMSABET.MyPocos.QueAttribute> attributeList = queDaoObj.getAttrbuteList(courseIdLocal);
                DataList12.DataSource = attributeList;
                DataList12.DataBind();
            }
        }
예제 #17
0
    protected void Wizard2_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        SqlConnection  conn  = null;
        SqlTransaction trans = null;
        SqlCommand     cmd   = default(SqlCommand);
        ShoppingCart   cart  = StoredCart.Read();

        if (cart == null || cart.Items.Count == 0)
        {
            e.Cancel = true;
            return;
        }

        try
        {
            int SaleID = 0;

            conn = new SqlConnection(ConfigurationManager.ConnectionStrings
                                     ["CSConnectionString"].ConnectionString);
            conn.Open();

            trans = conn.BeginTransaction();

            cmd             = new SqlCommand();
            cmd.Connection  = conn;
            cmd.Transaction = trans;

            cmd.CommandText = "spInsertSale";
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@OrderDate", SqlDbType.DateTime);
            cmd.Parameters.Add("@CustName", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Address", SqlDbType.VarChar, 250);
            cmd.Parameters.Add("@PostCode", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@DeliveryCharge", SqlDbType.Money);
            cmd.Parameters.Add("@TotalValue", SqlDbType.Money);
            cmd.Parameters.Add("@OrderID", SqlDbType.Int);

            cmd.Parameters["@OrderDate"].Value      = DateTime.Now;
            cmd.Parameters["@CustName"].Value       = ((TextBox)Wizard1.FindControl("txtName")).Text;
            cmd.Parameters["@Address"].Value        = ((TextBox)Wizard1.FindControl("txtAddress")).Text;
            cmd.Parameters["@PostCode"].Value       = ((TextBox)Wizard1.FindControl("txtEmail")).Text;
            cmd.Parameters["@DeliveryCharge"].Value = cart.DeliveryCharge;
            cmd.Parameters["@TotalValue"].Value     = cart.Total;
            cmd.Parameters["@OrderID"].Direction    = ParameterDirection.Output;

            cmd.ExecuteNonQuery();
            OrderID = Convert.ToInt32(cmd.Parameters["@OrderID"].Value);

            cmd.CommandText = "spInsertOrderItems";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@fkOrderID", SqlDbType.Int);
            cmd.Parameters.Add("@fkMenuItemID", SqlDbType.Int);
            cmd.Parameters.Add("@ItemSize", SqlDbType.VarChar, 10);
            cmd.Parameters.Add("@ItemName", SqlDbType.VarChar, 50);
            cmd.Parameters.Add("@Quantity", SqlDbType.Int);
            cmd.Parameters.Add("@SubTotal", SqlDbType.Money);
            cmd.Parameters["@fkOrderID"].Value = OrderID;


            foreach (CartItem item in cart.Items)
            {
                cmd.Parameters["@fkMenuItemID"].Value = item.OrderID;
                cmd.Parameters["@ItemSize"].Value     = item.Console;
                cmd.Parameters["@ItemSize"].Value     = item.Title;
                cmd.Parameters["@Quantity"].Value     = item.Quantity;
                cmd.Parameters["@SubTotal"].Value     = item.SubTotal;

                cmd.ExecuteNonQuery();
            }

            trans.Commit();
            lblSuccess.Visible = true;
        }
        catch
        {
            if (trans != null)
            {
                trans.Rollback();
            }
            lblError.Visible = true;
            return;
        }
        finally
        {
            if (conn != null)
            {
                conn.Close();
            }
        }
        cart.Items.Clear();
    }
예제 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Control startNavigationTemplate = Wizard1.FindControl(_templateContainerID) as Control;

        if (startNavigationTemplate != null)
        {
            Button stepNextButton = startNavigationTemplate.FindControl(_stepNextButtonId) as Button;
            if (stepNextButton != null)
            {
                stepNextButton.Text = Resources.Resources.BibTexImportStep1NextButtonText;
            }
        }

        // This is required to avoid "PageRequestManagerParserErrorException" exception with update panel
        // because there is rendering problem with update panel.
        Control stepNavigationTemplate = Wizard1.FindControl(_stepNavTemplateContainerID) as Control;

        if (stepNavigationTemplate != null)
        {
            Button step2ImportButton = stepNavigationTemplate.FindControl(_step2ImportButton) as Button;
            if (step2ImportButton != null)
            {
                step2ImportButton.Text = Resources.Resources.BibTexImportStep2ButtonText;
            }
        }

        Guid guid = Guid.Empty;

        this.HideError();

        if (!this.IsPostBack)
        {
            LocalizePage();
        }

        bool isValidGuid = true;

        if (Request.QueryString[_queryStringKey] != null)
        {
            try
            {
                guid = new Guid(Request.QueryString[_queryStringKey]);
            }
            catch (FormatException)
            {
                this.DisplayError(Resources.Resources.InvalidResource);
                isValidGuid = false;
            }
            catch (OverflowException)
            {
                this.DisplayError(Resources.Resources.InvalidResource);
                isValidGuid = false;
            }
        }
        else if (guid == Guid.Empty)
        {
            this.DisplayError(Resources.Resources.BibtexImportMissinfId);
            isValidGuid = false;
        }

        if (isValidGuid)
        {
            using (ResourceDataAccess resourceDAL = new ResourceDataAccess())
            {
                _scholarlyWorkObj = (ScholarlyWork)resourceDAL.GetResource(guid);
                AuthenticatedToken token = Session[Constants.AuthenticationTokenKey] as AuthenticatedToken;

                //if user is not having update permission on the subject resource then throw exception.
                if (!resourceDAL.AuthorizeUser(token, UserResourcePermissions.Update, _scholarlyWorkObj.Id))
                {
                    throw new UnauthorizedAccessException(string.Format(CultureInfo.InstalledUICulture,
                                                                        Resources.Resources.MsgUnAuthorizeAccess, UserResourcePermissions.Update));
                }

                if (_scholarlyWorkObj != null)
                {
                    _scholarlyWorkObj.Cites.Load();
                }
                else
                {
                    // Handle scenario which is "a resource deleted by one user and another user operating on the resource".
                    this.DisplayError(Resources.Resources.ResourceNotFound);
                    this._isResExist = false;
                }
            }
            if (!IsPostBack && this.Wizard1.ActiveStepIndex == 0)
            {
                if (_scholarlyWorkObj == null)
                {
                    this.DisplayError(Resources.Resources.ResourceNotFound);
                }
                else
                {
                    ResourceTitleLabel.InnerText         = Resources.Resources.ResourceLabelTitleText;
                    LabelImportResourceTitle.Text        = FitString(_scholarlyWorkObj.Title, 40);
                    LabelImportResourceTitle.NavigateUrl = _resourceDetailUrl + _scholarlyWorkObj.Id;
                }
            }
        }
    }