コード例 #1
0
ファイル: SLM_SCR_056.aspx.cs プロジェクト: KKPBank/SLM
 private bool LoadLead(string uploadLeadId)
 {
     try
     {
         UploadLeadBiz biz     = new UploadLeadBiz();
         var           allData = biz.GetUploadListById(int.Parse(uploadLeadId));
         if (allData != null)
         {
             hdfExistingFilename.Value = allData.UploadFileName;
             txtFileName.Text          = allData.UploadFileName;
             cmbChannel.SelectedIndex  = cmbChannel.Items.IndexOf(cmbChannel.Items.FindByValue(allData.ChannelId));
             cmbCampaign.SelectedIndex = cmbCampaign.Items.IndexOf(cmbCampaign.Items.FindByValue(allData.CampaignId));
             DoBindGridview(allData.LeadDataList, 0);
             SetStateControlButton(true, true, false);
             return(true);
         }
         else
         {
             ErrorMessage     = biz.ErrorMessage;
             RedirectToSearch = biz.RedirectToSearch;
             return(false);
         }
     }
     catch
     {
         throw;
     }
 }
コード例 #2
0
ファイル: SLM_SCR_057.aspx.cs プロジェクト: KKPBank/SLM
 protected void PageSearchChange(object sender, EventArgs e)
 {
     try
     {
         var pageControl = (SLM.Application.Shared.GridviewPageController)sender;
         if (!string.IsNullOrEmpty(hdfUploadLeadId.Value))
         {
             UploadLeadBiz biz     = new UploadLeadBiz();
             var           allData = biz.GetUploadListById(int.Parse(hdfUploadLeadId.Value));
             if (allData != null)
             {
                 BindGridview(pageControl, allData.LeadDataList.ToArray(), pageControl.SelectedPageIndex);
             }
             else
             {
                 AppUtil.ClientAlertAndRedirect(Page, string.Format("ไม่พบข้อมูลการ Upload Lead, UploadId={0}", hdfUploadLeadId.Value), SearchPage);
                 return;
             }
         }
         else
         {
             AppUtil.ClientAlertAndRedirect(Page, "UploadId not found", SearchPage);
             return;
         }
     }
     catch (Exception ex)
     {
         string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
         _log.Error(message);
         AppUtil.ClientAlert(Page, message);
     }
 }
コード例 #3
0
ファイル: SLM_SCR_056.aspx.cs プロジェクト: KKPBank/SLM
        /// <summary>
        /// ปุ่ม Download ทำงานในกรณี Edit เท่านั้น โดย download ข้อมูลที่อยู่ใน DB แล้ว Export ออกเป็น excel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDownload_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(hdfUploadLeadId.Value))
                {
                    UploadLeadBiz biz     = new UploadLeadBiz();
                    var           allData = biz.GetUploadListById(int.Parse(hdfUploadLeadId.Value));
                    if (allData != null && allData.LeadDataList != null)
                    {
                        //ExportExcelOpenXml(allData);
                        ExportExcel(allData);
                        return;
                    }
                    else
                    {
                        WriteLogFile(hdfUploadLeadId.Value, biz.ErrorMessage);

                        if (biz.RedirectToSearch)
                        {
                            PrepareRedirectPage();
                            AppUtil.ClientAlertAndRedirect(Page, biz.ErrorMessage, SearchPage);
                            return;
                        }
                        else
                        {
                            AppUtil.ClientAlert(Page, biz.ErrorMessage);
                            return;
                        }
                    }
                }
                else
                {
                    PrepareRedirectPage();
                    WriteLogFile("None", "Upload Id not found");
                    AppUtil.ClientAlertAndRedirect(Page, "Upload Id not found", SearchPage);
                    return;
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
コード例 #4
0
ファイル: SLM_SCR_056.aspx.cs プロジェクト: KKPBank/SLM
 protected void PageSearchChange(object sender, EventArgs e)
 {
     try
     {
         var pageControl = (SLM.Application.Shared.GridviewPageController)sender;
         if (Session[SessionUploadLead] != null)
         {
             //มี Session เกิดจากการ Browse
             System.Threading.Thread.Sleep(400);
             DoBindGridview((List <UploadLeadData>)Session[SessionUploadLead], pageControl.SelectedPageIndex);
         }
         else
         {
             if (!string.IsNullOrEmpty(hdfUploadLeadId.Value))   //Edit
             {
                 UploadLeadBiz biz     = new UploadLeadBiz();
                 var           allData = biz.GetUploadListById(int.Parse(hdfUploadLeadId.Value));
                 if (allData != null)
                 {
                     BindGridview(pageControl, allData.LeadDataList.ToArray(), pageControl.SelectedPageIndex);
                 }
                 else
                 {
                     AppUtil.ClientAlertAndRedirect(Page, string.Format("ไม่พบข้อมูลการ Upload Lead, UploadId={0}", hdfUploadLeadId.Value), SearchPage);
                     return;
                 }
             }
             else
             {
                 AppUtil.ClientAlertAndRedirect(Page, "Session has expired", SearchPage);
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
         _log.Error(message);
         AppUtil.ClientAlert(Page, message);
     }
 }