コード例 #1
0
        public HttpResponseBase ShowArrByUserList()
        {
            string json = string.Empty;
            int totalcount = 0;
            ArrivalNoticeQuery query = new ArrivalNoticeQuery();

            //Ris.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
            //Ris.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");

            query.item_id = Convert.ToUInt32( Request.Params["item_id"]);
            arrivalnoticemgr = new ArrivalNoticeMgr(mySqlConnectionString);
            
            if (!string.IsNullOrEmpty(Request.Params["item_id"]))
            {
                string item_id = Request.Params["item_id"];
            }
            if (!string.IsNullOrEmpty(Request.Params["startTime"]))
            {
                query.start_time = Convert.ToDateTime(Request.Params["startTime"]).ToString("yyyy-MM-dd 00:00:00");
            }
            if (!string.IsNullOrEmpty(Request.Params["endTime"]))
            {
                query.end_time = Convert.ToDateTime(Request.Params["endTime"]).ToString("yyyy-MM-dd 23:59:59");
            }
            List<ArrivalNoticeQuery> List = arrivalnoticemgr.ShowArrByUserList(query, out totalcount);
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConverter.DateTimeFormat = "yyyy-MM-dd";
            json = "{success:true,totalCount:" + totalcount + ",data:" + JsonConvert.SerializeObject(List, Formatting.Indented,timeConverter) + "}";
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return Response;
        }
コード例 #2
0
        public void ExportCSV()
        {
            ArrivalNoticeQuery query = new ArrivalNoticeQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["vendor_name_full_OR_vendor_id"]))
                {
                    query.vendor_name_full_OR_vendor_id = Request.Params["vendor_name_full_OR_vendor_id"];//供應商名稱/供應商編號
                }
                if (!string.IsNullOrEmpty(Request.Params["product_id_OR_product_name"]))//商品編號或商品名稱
                {
                    query.product_id_OR_product_name = Request.Params["product_id_OR_product_name"];
                }
                if (!string.IsNullOrEmpty(Request.Params["start_time"]))//開始時間
                {
                    query.start_time = Convert.ToDateTime(Request.Params["start_time"]).ToString("yyyy-MM-dd 00:00:00");
                }
                if (!string.IsNullOrEmpty(Request.Params["end_time"]))//結束時間
                {
                    query.end_time = Convert.ToDateTime(Request.Params["end_time"]).ToString("yyyy-MM-dd 23:59:59");
                }
                DataTable dtHZ = new DataTable();
                int totalcount = 0;
                query.IsPage = false;
                string newExcelName = string.Empty;
                dtHZ.Columns.Add("商品編號", typeof(String));
                dtHZ.Columns.Add("商品名稱", typeof(String));
                dtHZ.Columns.Add("商品細項編號", typeof(String));
                dtHZ.Columns.Add("商品規格", typeof(String));
                dtHZ.Columns.Add("供應商編號", typeof(String));
                dtHZ.Columns.Add("供應商名稱", typeof(String));
                dtHZ.Columns.Add("補貨通知人數", typeof(String));
                List<ArrivalNoticeQuery> list = new List<ArrivalNoticeQuery>();
                arrivalnoticemgr = new ArrivalNoticeMgr(mySqlConnectionString);
                list = arrivalnoticemgr.GetArrNoticeList(query, out totalcount);

                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        DataRow dr = dtHZ.NewRow();
                        dr[0] = list[i].product_id;
                        dr[1] = list[i].product_name;
                        dr[2] = list[i].item_id;
                        dr[3] = list[i].product_spec;
                        dr[4] = list[i].vendor_id;
                        dr[5] = list[i].vendor_name_full;
                        dr[6] = list[i].ri_nums;
                        dtHZ.Rows.Add(dr);
                    }
                    string fileName = "補貨通知統計匯出_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "");
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                    Response.BinaryWrite(ms.ToArray());
                }
                else
                {
                    Response.Clear();
                    this.Response.Write("無數據存在<br/>");
                }
               
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
             
            }
        }
コード例 #3
0
        public HttpResponseBase GetArrNoticeList()// createTime 2015/8/25 by yachao1120j
        {
            string json = string.Empty;
            int totalcount = 0;
            ArrivalNoticeQuery query = new ArrivalNoticeQuery();
            query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
            query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
            arrivalnoticemgr = new ArrivalNoticeMgr(mySqlConnectionString);

            if (!string.IsNullOrEmpty(Request.Params["vendor_name_full_OR_vendor_id"]))
            {
                query.vendor_name_full_OR_vendor_id = Request.Params["vendor_name_full_OR_vendor_id"];//供應商名稱/供應商編號
            }
            // 要修改商品編號  改為 商品編號/名稱

            //if (!string.IsNullOrEmpty(Request.Params["product_id"]))//商品編號
            //{
            //    query.product_id = Convert.ToUInt32(Request.Params["product_id"]);
            //}

            if (!string.IsNullOrEmpty(Request.Params["product_id_OR_product_name"]))
            {
                query.product_id_OR_product_name = Request.Params["product_id_OR_product_name"];//商品编号/名称
            }

            if (!string.IsNullOrEmpty(Request.Params["start_time"]))//開始時間
            {
                query.start_time = Convert.ToDateTime(Request.Params["start_time"]).ToString("yyyy-MM-dd 00:00:00");
            }
            if (!string.IsNullOrEmpty(Request.Params["end_time"]))//結束時間
            {
                query.end_time = Convert.ToDateTime(Request.Params["end_time"]).ToString("yyyy-MM-dd 23:59:59");
            }
            List<ArrivalNoticeQuery> list = arrivalnoticemgr.GetArrNoticeList(query, out totalcount);
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConverter.DateTimeFormat = "yyyy-MM-dd";
            json = "{success:true,totalCount:" + totalcount + ",data:" + JsonConvert.SerializeObject(list, Formatting.Indented, timeConverter) + "}";
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return Response;

        }