Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    CampaignId = "";
                    ((Label)Page.Master.FindControl("lblTopic")).Text = "เพิ่มข้อมูล Lead (Add)";

                    ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_010");
                    if (priData == null || priData.IsView != 1)
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                    }


                    //รับค่า Seaaion มากจากหน้า viewlead, ปุ่ม คัดลอกข้อมูลผู้มุ่งหวัง
                    if (Session["ticket_id"] != null)
                    {
                        hdfCopyTicket.Value = Session["ticket_id"] as string;
                        Session.Remove("ticket_id");

                        // load default data
                        //var ticketid = Session["ticket_id"] as string;
                        //LeadData lead = SlmScr010Biz.GetLeadData(ticketid);
                        // Session["ticket_id"] = null;
                        LeadData lead = SlmScr010Biz.GetLeadData(hdfCopyTicket.Value);
                        lead.Delegate        = "";
                        lead.Delegate_Branch = "";
                        lead.Delegate_Flag   = 0;

                        if (lead != null)
                        {
                            //CampaignId = lead.CampaignId;
                            ctlCommon.SetLeadData(lead, true, true);

                            //LoadDetailControl();
                            //ctlLead.LoadData(lead);
                        }
                    }
                    ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.New);
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 2
0
        protected void btnNext_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ctlCommon.ValidateData())
                {
                    AppUtil.ClientAlert(this, "ข้อมูลไม่ครบถ้วน");
                    return;
                }
                if (ctlCommon.CampaignID != "")
                {
                    CampaignId = ctlCommon.CampaignID;
                    LoadDetailControl();
                    ctlLead.SetControlMode(Lead_Detail_Master.CtlMode.New);
                    tbNext.Visible = false;
                    tbSave.Visible = true;
                    ctlCommon.SetEnableCampaign(false);

                    // copy lead
                    //if (Session["ticket_id"] != null)
                    if (hdfCopyTicket.Value.Trim() != "")
                    {
                        //var ticketId = Session["ticket_id"] as string;
                        var    lead = SlmScr010Biz.GetLeadData(hdfCopyTicket.Value);
                        string type = new ConfigProductScreenBiz().GetFieldType(lead.CampaignId, lead.ProductId, SLMConstant.ConfigProductScreen.ActionType.View);

                        // remove unsed data

                        // load data from old lead
                        ctlLead.LoadData(lead, true, type);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    ((Label)Page.Master.FindControl("lblTopic")).Text = "แก้ไขข้อมูล Lead (Edit)";
                    Page.Form.DefaultButton = btnSave.UniqueID;

                    ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.Edit);

                    if (Request["ticketid"] != null && Request["ticketid"].ToString().Trim() != string.Empty)
                    {
                        CheckTicketIdPrivilege(Request["ticketid"].ToString().Trim());
                    }
                    else
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx");
                        return;
                    }

                    if (!string.IsNullOrEmpty(Request["ticketid"]))
                    {
                        var      ticketid = Request["ticketid"];
                        LeadData lead     = SlmScr010Biz.GetLeadData(ticketid);
                        if (lead == null)
                        {
                            AppUtil.ClientAlertAndRedirect(Page, "ไม่พบ Ticket Id " + ticketid + " ในระบบ", "SLM_SCR_003.aspx");
                            return;
                        }


                        if (!CheckTicketCloseOrTicketCOC(lead))
                        {
                            return;
                        }

                        CampaignId = lead.CampaignId;
                        ctlCommon.SetLeadData(lead);
                        LoadDetailControl();
                        ctlLead.LoadData(lead);

                        //InitialControl();
                        //SetScript();
                    }
                    else
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx");
                        return;
                    }

                    ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_011");
                    if (priData == null || priData.IsView != 1)
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                        return;
                    }

                    //Check สิทธิ์ภัทรในการเข้าใช้งาน
                    StaffData staff = StaffBiz.GetStaff(HttpContext.Current.User.Identity.Name);
                    ConfigBranchPrivilegeData data = ConfigBranchPrivilegeBiz.GetConfigBranchPrivilege(staff.BranchCode);
                    if (data != null)
                    {
                        if (data.IsEdit != null && data.IsEdit.Value == false)
                        {
                            AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                            return;
                        }
                    }
                    //------------------------------------------------------------------------------------------------------
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }