Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var ticketid = "";
                ctlLead.CommonData = ctlCommon.GetCommonData();

                var check1 = ctlCommon.ValidateData(false);
                var check2 = ctlLead.ValidateData();

                if (!check1 || !check2)
                {
                    AppUtil.ClientAlert(this.Page, "ข้อมูลไม่ครบถ้วน");
                }
                else
                {
                    if (ctlLead.SaveData(ticketid, Page.User.Identity.Name))
                    {
                        btnSave.Enabled = false;

                        var    bk  = Request["backtype"];
                        string url = "SLM_SCR_003.aspx";
                        if (bk == "2" || bk == "3")
                        {
                            url = "SLM_SCR_029.aspx?backtype=" + bk;
                        }

                        AppUtil.ClientAlertAndRedirect(Page, "บันทึกข้อมูลผู้มุ่งหวังสำเร็จ", url);
                    }
                    else
                    {
                        AppUtil.ClientAlert(this.Page, ctlLead.CommonData.R_Message);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 2
0
        // ----- button action

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (CampaignId == null)
                {
                    AppUtil.ClientAlertAndRedirect(this, "Session Expired", Request.Url.PathAndQuery);
                }

                var ticketid = "";
                ctlLead.CommonData = ctlCommon.GetCommonData();
                var check1 = ctlCommon.ValidateData();
                var check2 = ctlLead.ValidateData();

                if (!check1 || !check2)
                {
                    AppUtil.ClientAlert(this.Page, "ข้อมูลไม่ครบถ้วน");
                }
                else
                {
                    DropDownList cmbCardType    = ctlLead.GetComboCardType();
                    TextBox      txtCitizenId   = ctlLead.GetTextBoxCitizenId();
                    TextBox      txtTelNo1      = ctlCommon.GetTextBoxTelNo1();
                    Label        lblAlertTelNo1 = ctlCommon.GetAlertTelNo1();

                    if (cmbCardType.SelectedItem.Value != "" && txtCitizenId.Text.Trim() != "" && txtTelNo1.Text.Trim() != "")
                    {
                        if (!AppUtil.ValidateTelNo1(cmbCardType, txtTelNo1, lblAlertTelNo1))
                        {
                            AppUtil.ClientAlert(this.Page, "ข้อมูลไม่ครบถ้วน");
                            return;
                        }
                    }

                    if (ctlLead.SaveData(ticketid, Page.User.Identity.Name))
                    {
                        //Session.Remove("ticket_id");
                        hdfCopyTicket.Value = "";
                        var cm = ctlLead.CommonData;

                        lblResultTicketId.Text      = cm.R_TicketID;
                        lblResultMessage.Text       = cm.R_Message;
                        lblResultOwnerLead.Text     = cm.R_Owner;
                        lblResultCampaign.Text      = cm.R_CampaignName;
                        lblResultChannel.Text       = cm.R_ChannelName;
                        cbResultHasAdamsUrl.Checked = cm.R_HasAdams;

                        mpePopupSaveResult.Show();
                        upPopupSaveResult.Update();

                        btnSave.Enabled = false;
                    }
                    else
                    {
                        AppUtil.ClientAlert(this.Page, ctlLead.CommonData.R_Message);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }