コード例 #1
0
        protected void ASPxCallback1_Callback(object source, CallbackEventArgs e)
        {
            try
            {
                var CurrentPage = GetCurrentPageName();
                var activeTab   = carTabPage.ActiveTabIndex;
                ins.InsertUpdateHoltState(int.Parse(Session["userId"].ToString()), activeTab, CurrentPage);

                var c = new ControlFinder <ASPxRadioButtonList>();
                c.FindChildControlsRecursive(carTabPage);
                var ctrls = c.FoundControls.ToList();
                foreach (var item in ctrls)
                {
                    if (item.SelectedItem != null)
                    {
                        ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, item.ID.ToString(), int.Parse(item.SelectedIndex.ToString()));
                    }
                }

                Response.Redirect("AssessmentSelectingPage.aspx");
            }
            catch (System.Exception ex)
            {
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userId"] == null)
            {
                Response.Redirect("~\\Login.aspx", false);
                return;
            }

            txtName.Text    = Session["UserName"].ToString();
            txtCompany.Text = Session["company"].ToString();
            txtEmail.Text   = Session["email"].ToString();


            if (!IsPostBack)
            {
                btnNext.ClientVisible = false;

                var pageName = GetCurrentPageName();
                var user     = int.Parse(Session["userId"].ToString());
                if (user != 0)
                {
                    var ans = db.AnswerStates.Where(v => v.UserId == user && v.Page == pageName);
                    if (ans != null)
                    {
                        foreach (var answ in ans)
                        {
                            var c = new ControlFinder <ASPxRadioButtonList>();
                            c.FindChildControlsRecursive(carTabPage);
                            var ctrls = c.FoundControls;
                            var se    = ctrls.Where(v => v.ID == answ.ControlId);
                            if (se != null)
                            {
                                se.FirstOrDefault().SelectedIndex = int.Parse(answ.Answer.ToString());
                            }
                        }
                    }
                    var state = db.tblHoltStates.Where(v => v.PageName == pageName && v.UserId == user).FirstOrDefault();
                    if (state != null)
                    {
                        carTabPage.ActiveTabIndex = int.Parse(state.Holt_State.ToString());
                    }
                }


                if (carTabPage.ActiveTabIndex == 1)
                {
                    ASPxButton2.Text = "Main Menu";
                    ASPxButton1.Text = "Start";
                }
            }
        }
        protected void btnNext_Click(object sender, EventArgs e)
        {
            //var dic = Session["Data"] as Dictionary<int, int>;
            //lblError.Text = "";
            btnNext.ClientEnabled = false;

            var c = new ControlFinder <ASPxRadioButtonList>();

            c.FindChildControlsRecursive(carTabPage);
            var ctrls = c.FoundControls;

            var data  = new Dictionary <int, int>();
            int index = 1;

            foreach (var item in ctrls)
            {
                data.Add(index, Convert.ToInt32(item.SelectedItem.Value));
                index++;
            }

            var guid = Guid.NewGuid().ToString();
            //1.Prepare the name for renaming
            //string newName = string.Format("{0}_{1}_{2}", Session["UserName"].ToString(), txtCompany.Text, DateTime.Now.Ticks.ToString());
            string newName      = string.Format("{0}_{1}_{2}", Session["UserName"].ToString(), txtCompany.Text, guid);
            string modifiedName = string.Format("{0}_{1}_{2}_Edited", txtName.Text.Replace(" ", "_"), txtCompany.Text, DateTime.Now.ToString("yyyyMMddHHmm"));

            //2.Create the Folder if it doesn't already exist
            if (!Directory.Exists(Server.MapPath("~") + @"\Files\Docx\"))
            {
                Directory.CreateDirectory(Server.MapPath("~") + @"\Files\Docx\");
            }

            //3.Copy the file with the new name
            string newFileName = Server.MapPath("~") + @"\Files\Docx\" + newName + ".xlsx";
            string pdf         = Server.MapPath("~") + @"\Files\Docx\" + newName + ".pdf";

            File.Copy(Server.MapPath("~") + @"\Templates\V2\Technical-Adaptive-Assessment.xlsx", newFileName);


            //string newFileNamePdf = Server.MapPath("~") + @"\Files\Docx\" + newName + ".pdf";

            //File.Copy(Server.MapPath("~") + @"\Templates\Technical-Adaptive-Assessment.pdf", newFileNamePdf);
            //ProcessToReport(pdf, data);
            ProcessExcel(newFileName, data);
        }
コード例 #4
0
        protected void btnNext_Click(object sender, EventArgs e)
        {
            //var dic = Session["UNIQUE"] as List<KeyValuePair<int, int>>;
            btnNext.ClientEnabled = false;

            var c = new ControlFinder <ASPxRadioButtonList>();

            c.FindChildControlsRecursive(carTabPage);
            var ctrls = c.FoundControls.ToList();

            var data = new List <KeyValuePair <int, int> >();


            for (int i = 0; i < ctrls.Count(); i++)
            {
                data.Add(new KeyValuePair <int, int>(Convert.ToInt32(ctrls[i].SelectedItem.Value), Convert.ToInt32(ctrls[i + 1].SelectedItem.Value)));

                i += 1;
            }


            var guid = Guid.NewGuid().ToString();

            //1.Prepare the name for renaming
            string newName = string.Format("{0}_{1}_{2}", Session["UserName"].ToString(), txtCompany.Text, guid);
            //string newName = string.Format("{0}_{1}_{2}", Session["UserName"].ToString(), txtCompany.Text, DateTime.Now.Ticks.ToString());
            string modifiedName = string.Format("{0}_{1}_{2}_Edited", txtName.Text.Replace(" ", "_"), txtCompany.Text, DateTime.Now.ToString("yyyyMMddHHmm"));

            //2.Create the Folder if it doesn't already exist
            if (!Directory.Exists(Server.MapPath("~") + @"\Files\Docx\"))
            {
                Directory.CreateDirectory(Server.MapPath("~") + @"\Files\Docx\");
            }

            //3.Copy the file with the new name
            string newFileName = Server.MapPath("~") + @"\Files\Docx\" + newName + ".xlsx";
            string pdf         = Server.MapPath("~") + @"\Files\Docx\" + newName + ".pdf";


            File.Copy(Server.MapPath("~") + @"\Templates\V2\Unique-Ability-Test-Form.xlsx", newFileName);

            //ProcessToReport(pdf,data);
            ProcessExcel(newFileName, data);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userId"] == null)
            {
                Response.Redirect("~\\Login.aspx", false);
                return;
            }

            txtName.Text    = Session["UserName"].ToString();
            txtCompany.Text = Session["company"].ToString();
            txtEmail.Text   = Session["email"].ToString();

            //if (IsCallback)
            //{
            //    // Intentionally pauses server-side processing,
            //    // to demonstrate the Loading Panel functionality.
            //    Thread.Sleep(250);
            //}



            if (!IsPostBack)
            {
                btnNext.ClientVisible = false;


                var pageName = "Interaction-Style-assessment.aspx";

                var user = int.Parse(Session["userId"].ToString());
                //  var user = int.Parse("123");
                if (user != 0)
                {
                    var ans = db.AnswerStates.Where(v => v.UserId == user && v.Page == pageName);
                    if (ans != null)
                    {
                        foreach (var answ in ans)
                        {
                            var c = new ControlFinder <ASPxRadioButtonList>();
                            c.FindChildControlsRecursive(carTabPage);
                            var ctrls = c.FoundControls;
                            var se    = ctrls.Where(v => v.ID == answ.ControlId);
                            if (se != null)
                            {
                                se.FirstOrDefault().SelectedIndex = int.Parse(answ.Answer.ToString());
                            }
                        }
                    }
                    var state = db.tblHoltStates.Where(v => v.PageName == pageName && v.UserId == user).FirstOrDefault();
                    if (state != null)
                    {
                        carTabPage.ActiveTabIndex = int.Parse(state.Holt_State.ToString());
                    }
                }

                if (carTabPage.ActiveTabIndex == 1)
                {
                    ASPxButton2.Text = "Main Menu";
                    ASPxButton1.Text = "Start";
                }
            }
        }
        protected void ASPxButton1_Click(object sender, EventArgs e)
        {
            try
            {
                var CurrentPage = GetCurrentPageName();
                var activeTab   = carTabPage.ActiveTabIndex;
                ins.InsertUpdateHoltState(int.Parse(Session["userId"].ToString()), activeTab, CurrentPage);

                var c = new ControlFinder <ASPxRadioButtonList>();
                c.FindChildControlsRecursive(carTabPage);
                var ctrls = c.FoundControls.ToList();
                foreach (var item in ctrls)
                {
                    if (item.SelectedItem != null)
                    {
                        ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, item.ID.ToString(), int.Parse(item.SelectedIndex.ToString()));
                    }
                }

                //if (activeTab == 14)
                //{
                //    btnNext.Visible = true;
                //    ASPxButton1.Visible = false;
                //}
                //else
                //{
                //    btnNext.Visible = false;
                //    ASPxButton1.Visible = true;
                //}
                //if (activeTab==3)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q1", int.Parse(Q1.SelectedIndex.ToString()));
                //}
                //else if(activeTab == 4)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q2", int.Parse(Q2.SelectedIndex.ToString()));

                //}
                //else if (activeTab == 5)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q3", int.Parse(Q3.SelectedIndex.ToString()));

                //}
                //if (activeTab == 6)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q4", int.Parse(Q4.SelectedIndex.ToString()));
                //}
                //else if (activeTab == 7)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q5", int.Parse(Q5.SelectedIndex.ToString()));

                //}
                //else if (activeTab == 8)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q6", int.Parse(Q6.SelectedIndex.ToString()));

                //}
                //if (activeTab == 9)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q7", int.Parse(Q7.SelectedIndex.ToString()));
                //}
                //else if (activeTab == 10)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q8", int.Parse(Q8.SelectedIndex.ToString()));

                //}
                //else if (activeTab == 11)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q9", int.Parse(Q9.SelectedIndex.ToString()));

                //}
                //if (activeTab == 12)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q10", int.Parse(Q10.SelectedIndex.ToString()));
                //}
                //else if (activeTab == 13)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q11", int.Parse(Q11.SelectedIndex.ToString()));

                //}
                //else if (activeTab == 14)
                //{
                //    ins.InsertQuestion(int.Parse(Session["userId"].ToString()), CurrentPage, "Q12", int.Parse(Q12.SelectedIndex.ToString()));

                //}
            }
            catch (System.Exception ex)
            {
            }
        }