Beispiel #1
0
        public virtual void getExportExcel <T, P>() where T : class where P : class
        {
            try
            {
                string record = this.Request["record"];

                Hashtable         ht      = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                List <ColumnInfo> records = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["params"].ToString());
                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["headers"].ToString());

                T       bll     = (T)typeof(T).GetConstructor(new Type[] { }).Invoke(new object[] { });
                BaseBll baseBll = bll as BaseBll;

                int      total = 0;
                List <P> obj   = baseBll.GetSelectedRecords <P>(records, false, 0, 0, ref total);


                if ((obj != null) && (total > 0))
                {
                    List <object> finalObj = BuildAnonymousObject(obj).Cast <object>().ToList();
                    UtilExcel.ExportToExcel(finalObj[0].GetType(), Response, this.GetType().Name.GetPageName(), headers, finalObj);
                }
            }
            catch (Exception ex)
            {
                string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Beispiel #2
0
        public void exportexceldtl()
        {
            try
            {
                string record = this.Request["record"];

                Hashtable         ht      = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                List <ColumnInfo> records = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["params"].ToString());
                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["headers"].ToString());

                prprirstBll bll = new prprirstBll();

                int           total = 0;
                List <object> obj   = bll.GetSelectedRecords <object>(records, false, 0, 0, ref total);


                if ((obj != null) && (total > 0))
                {
                    List <object> finalObj = obj.Cast <object>().ToList();
                    UtilExcel.ExportToExcel(finalObj[0].GetType(), Response, this.GetType().Name.GetPageName(), headers, finalObj);
                }
            }
            catch (Exception ex)
            {
                string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Beispiel #3
0
        public void exportExcel()
        {
            try
            {
                table_name = this.Request["tableName"];
                string record = this.Request["record"];
                string header = this.Request["header"];

                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(header);

                List <object>     dataList   = null;
                List <ColumnInfo> parameters = new List <ColumnInfo>();

                MasterDataBll bll = new MasterDataBll();

                if (record != null)
                {
                    parameters = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(record);
                }

                dataList = bll.GetSelectedRecords(table_name, parameters);

                if (dataList != null)
                {
                    UtilExcel.ExportToExcel(bll.GetDynamicType(table_name), Response, table_name, headers, dataList);
                }
            }
            catch (Exception ex)
            {
                string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Beispiel #4
0
        public void exportExcel()
        {
            try
            {
                string record = this.Request["record"];

                Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                //List<ColumnInfo> records = JavaScriptConvert.DeserializeObject<List<ColumnInfo>>(ht["params"].ToString());
                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["headers"].ToString());

                List <ColumnInfo> atdtParameters     = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["atdtparams"].ToString());
                List <ColumnInfo> personalParameters = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["personalparams"].ToString());

                string scope = ht["scope"].ToString();

                List <ColumnInfo> fullParameters = new List <ColumnInfo>();

                for (int i = 0; i < personalParameters.Count; i++)
                {
                    fullParameters.Add(personalParameters[i]);
                }

                for (int i = 0; i < atdtParameters.Count; i++)
                {
                    fullParameters.Add(atdtParameters[i]);
                }

                fullParameters.Add(new ColumnInfo()
                {
                    ColumnName = "atst", ColumnValue = (scope == "All" ? "" : "1")
                });                                                                                                      //1: abnormal

                atanarstBll bll = new atanarstBll();

                int total = 0;


                List <object> obj = bll.GetAnalyzeResult(fullParameters, false, 0, 0, ref total);


                if ((obj != null) && (total > 0))
                {
                    List <object> finalObj = BuildAnonymousObject(obj).Cast <object>().ToList();
                    UtilExcel.ExportToExcel(finalObj[0].GetType(), Response, this.GetType().Name.GetPageName(), headers, finalObj);
                }
            }
            catch (Exception ex)
            {
                string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Beispiel #5
0
        public void exportExcel()
        {
            try
            {
                string      record = this.Request["record"];
                pshctvalBll bll    = new pshctvalBll();

                tpshctcfg cfg = bll.GetSelectedObject <tpshctcfg>(new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "hccd", ColumnValue = record
                    }
                });

                tstdefcfg xdef = bll.GetSelectedObject <tstdefcfg>(new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "dfnm", ColumnValue = cfg.xdef
                    }
                });

                tstdefcfg ydef = bll.GetSelectedObject <tstdefcfg>(new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "dfnm", ColumnValue = cfg.ydef
                    }
                });

                ValueInfoBll     dd   = new ValueInfoBll();
                List <ValueInfo> lstX = typeof(ValueInfoBll).GetMethod(xdef.dasc).Invoke(dd, new object[] { }) as List <ValueInfo>;
                List <ValueInfo> lstY = typeof(ValueInfoBll).GetMethod(ydef.dasc).Invoke(dd, new object[] { }) as List <ValueInfo>;

                List <List <ColumnInfo> > lstResult = bll.GetHeadCountCfgValue(record, cfg, lstX, lstY);

                if (lstResult != null)
                {
                    UtilExcel.ExportToExcel(Response, this.GetType().Name, lstResult);
                }
            }
            catch (Exception ex)
            {
                string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Beispiel #6
0
 public void exportExcel()
 {
     try
     {
         string            header  = this.Request["header"];
         List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(header);
         object            obj     = HttpContext.Session["traceJson"];
         if (obj != null)
         {
             List <Dictionary <string, string> > list = obj as List <Dictionary <string, string> >;
             UtilExcel.ExportToExcel(Response, this.GetType().Name.GetPageName(), headers, list);
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #7
0
        public void exportExcel()
        {
            string message = string.Empty;

            try
            {
                string record = this.Request["record"];
                string header = this.Request["header"];

                if ((record == null) || (record.Length < 1))
                {
                    record = "{\"year\":\"" + UtilDatetime.FormatDate3(DateTime.Now).Substring(0, 4) + "\"}";
                }

                if (header == null || header.Equals(string.Empty))
                {
                    return;
                }
                Hashtable         ht      = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(header);
                stperiodBll       bll     = new stperiodBll();

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "year", ColumnValue = ht["year"].ToString()
                    }
                };

                List <tstperiod> yearList = bll.GetSelectedRecords <tstperiod>(parameters);
                if (yearList != null)
                {
                    UtilExcel.ExportToExcel(Response, this.GetType().Name.GetPageName(), headers, yearList);
                }
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_ExportExcelFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }