コード例 #1
0
        public List <View_DiffAnalyseReportDetails> GetDetails(DiffAnalyseReportItem item, UserGroup userGroup)
        {
            var query = Context.View_DiffAnalyseReportDetails.Where(d => d.ItemID == item.ItemID);

            if (userGroup != null)
            {
                query = query.Where(d => d.UserGroupID == userGroup.GroupID);
            }
            return(query.OrderBy(d => d.GroupName).ThenBy(d => d.Description).ToList());
        }
コード例 #2
0
 public List <View_DiffAnalyseReportDetails> GetDiffAnalyseRptDetails(DiffAnalyseReportItem item, UserGroup userGroup)
 {
     return(Channel.GetDiffAnalyseRptDetails(item, userGroup));
 }
コード例 #3
0
    protected void Toolbar1_ButtonClicked(object sender, SCS.Web.UI.WebControls.ButtonEventArgs e)
    {
        switch (e.CommandName)
        {
        case "query":
            pagerNew.CurrentPage = 1;
            //pagerAnalysis.CurrentPage = 1;
            NotiToAnalyse        = null;
            hdnDeleteItems.Value = string.Empty;
            Query();
            break;

        case "add":

            RefreshNotiToAnalyse();

            if (NotiToAnalyse.DetailsView.Count > 0)
            {
                long   reportID;
                string reportCode;

                Service.CreateAnalyseReport(NotiToAnalyse, CurrentUser.UserInfo, out reportCode, out reportID);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "CreateAnaSuccess", "alert('生成差异分析报告成功!')", true);
            }
            break;

        case "AddAll":
            long   reportIDAll;
            string reportCodeAll;
            View_StocktakeDetails filter = BuildNewAnalyseCondition();

            Service.CreateAnalyseRptByCondition(filter, CurrentUser.UserInfo, out reportCodeAll, out reportIDAll);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "CreateAnaSuccess", "alert('生成差异分析报告成功!')", true);
            Query();
            break;

        case "export":
            string notiCode = null;
            Query();
            if (!string.IsNullOrEmpty(txtMgrNoticeNo.Text.Trim()))
            {
                notiCode = txtMgrNoticeNo.Text.Trim();
            }
            byte[] report = Service.ExportAnalyseReport(FilteredDetails);
            if (report != null)
            {
                Response.Clear();
                Response.Buffer      = true;
                Response.ContentType = "application/vnd.ms-excel";
                //string fileName = HttpUtility.UrlEncode(DateTime.Now.ToString("yyyyMMdd") + "差异分析结果(" + DateTime.Now.DayOfWeek + ").xls");
                string fileName = notiCode + HttpUtility.UrlEncode("差异分析结果.xls");
                Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";filetype=excel");
                Response.OutputStream.Write(report, 0, report.Length);
                Response.Flush();
            }
            break;

        case "delete":

            try
            {
                if (!string.IsNullOrEmpty(hdnDeleteItems.Value))
                {
                    hdnDeleteItems.Value = hdnDeleteItems.Value.Substring(1, hdnDeleteItems.Value.Length - 2);
                    hdnDeleteItems.Value = hdnDeleteItems.Value.Replace(",,", ",");
                    List <string> idList = hdnDeleteItems.Value.Split(',').ToList();
                    List <DiffAnalyseReportItem> list = new List <DiffAnalyseReportItem>();
                    foreach (var id in idList)
                    {
                        if (!string.IsNullOrEmpty(id))
                        {
                            DiffAnalyseReportItem item = new DiffAnalyseReportItem {
                                ItemID = Convert.ToInt64(id)
                            };
                            list.Add(item);
                        }
                    }

                    Service.DeleteAnalyseItems(list);
                    hdnDeleteItems.Value = string.Empty;
                }
            }
            catch (Exception ex)
            {
                hdnDeleteItems.Value = string.Empty;
                throw;
            }
            Query();
            break;

        case "analyse":

            //pagerNew.CurrentPage = 1;
            ////pagerAnalysis.CurrentPage = 1;
            //NotiToAnalyse = null;
            //hdnDeleteItems.Value = string.Empty;
            //Query();
            //if (gvAnalysis.Rows.Count > 0)
            //{
            Response.Redirect("AnalyseReportItem.aspx?NoticeNo=" + txtRptNoticeNo.Text.Trim());
            //}
            break;

        default:
            break;
        }
    }