示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            (Master as OrderingMaster).SetPageHeader("客户调查");
            var test = OrderProvider.GetCustomerSurvey(DistributorID);

            if (test != null)
            {
                var tableOptions = new HtmlTable();
                foreach (var questionse in test)
                {
                    PopulateQuestion(questionse, tableOptions, 1);
                }

                plQuestion.Controls.Add(tableOptions);
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);
                var data = OrderProvider.GetPCCustomerIdByReferralId(DistributorID);
                if (data != null && data.Any())
                {
                    foreach (var info in data)
                    {
                        ddlMemberID.Items.Add(new ListItem(info.CustomerId + " " + info.NameCn, info.CustomerId));
                    }
                    var strTextSelect = (string)GetLocalResourceObject("TextSelect");
                    ddlMemberID.Items.Insert(0, new ListItem(strTextSelect, ""));
                }
            }

            (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid gdo-nav-mid-copc");
        }
示例#3
0
        protected void BtnSaveClick(object sender, EventArgs e)
        {
            var             surveyQuestionswithOptions = OrderProvider.GetCustomerSurvey(DistributorID);
            SelectionDetail selection;
            var             lstselection = new List <SelectionDetail>();
            int             surveyID     = SessionInfo.surveyDetails.SurveyId;
            int             SkuQuentity  = SessionInfo.surveyDetails.SurveySKUQuantity;
            string          freeSKU      = SessionInfo.surveyDetails.SurveySKU;

            if (surveyQuestionswithOptions != null)
            {
                foreach (var q in surveyQuestionswithOptions)
                {
                    selection = new SelectionDetail();
                    var answerChkList = (from option in q.ListSurveyOptions
                                         let optionControl =
                                             plQuestion.FindControl("chkOption" + option.Id) as CheckBox
                                             where optionControl != null
                                             where optionControl.Checked
                                             select option.Id).ToList();
                    var answerTxtList = (from option in q.ListSurveyOptions
                                         let optionControl =
                                             plQuestion.FindControl("txtOption" + option.Id) as TextBox
                                             where optionControl != null
                                             select optionControl.Text).ToList();
                    var answerRdList = (from option in q.ListSurveyOptions
                                        let optionControl =
                                            plQuestion.FindControl("rdOption" + option.Id) as RadioButton
                                            where optionControl != null
                                            where optionControl.Checked
                                            select option.Id).ToList();
                    if (answerChkList != null && answerChkList.Any())
                    {
                        foreach (var i in answerChkList)
                        {
                            selection = new SelectionDetail();

                            selection.QuestionId        = q.Id;
                            selection.OptionSelectionID = i;
                            lstselection.Add(selection);

                            CaptureComment(selection, plQuestion, q, i);
                        }
                    }
                    else if (answerTxtList != null && answerTxtList.Any() && !string.IsNullOrEmpty(answerTxtList[0]))
                    {
                        selection.QuestionId = q.Id;
                        selection.Feedback   = answerTxtList[0];
                        lstselection.Add(selection);
                    }
                    else if (answerRdList != null && answerRdList.Any())
                    {
                        foreach (var i in answerRdList)
                        {
                            selection.QuestionId        = q.Id;
                            selection.OptionSelectionID = i;
                            lstselection.Add(selection);

                            CaptureComment(selection, plQuestion, q, i);
                        }
                    }
                }
                var noOfQuestions = lstselection.GroupBy(qst => qst.QuestionId)
                                    .Select(grp => grp.First())
                                    .ToList();
                if (noOfQuestions.Count() == surveyQuestionswithOptions.Count())
                {
                    var result = OrderProvider.SubmitCustomerSurvey(DistributorID, surveyID, lstselection);
                    if ((result == null) || (result.Status != ServiceResponseStatusType.Success))
                    {
                        lblErrorMessage.Text    = "无法提交。请重试";
                        lblErrorMessage.Visible = true;
                    }
                    else
                    {
                        lblErrorMessage.Text    = "";
                        lblErrorMessage.Visible = false;
                        OrderProvider.AddFreeGift(freeSKU, SkuQuentity, (ProductsBase).ProductInfoCatalog.AllSKUs, ProductsBase.CurrentWarehouse, ShoppingCart);
                        ScriptManager.RegisterStartupScript(this, GetType(), "popup",
                                                            "alert('" + surveyMessage + "');" +
                                                            "window.location='ShoppingCart.aspx';", true);
                    }
                }
                else
                {
                    lblErrorMessage.Text    = "请填写所有领域";
                    lblErrorMessage.Visible = true;
                }
            }
        }