Пример #1
0
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            ScheduleTaskCollection collection = ScheduleTaskManager.GetAll(CurrentUser.CompanyID);
            DataTable dt       = collection.ToDataTable <ScheduleTask>();
            string    fileName = "ScheduleTask_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i]))
                {
                    dt.Columns.Remove(RemoveColumn[i]);
                }
            }
            FileInputHelper.ExportExcel(dt, fileName, "ScheduleTask List", false);
            return(fileName);
        }
Пример #2
0
        public virtual DataTable ImportData(DataTable objList)
        {
            IEnumerable <ScheduleTask> myList    = objList.ToList <ScheduleTask>();
            ScheduleTaskCollection     ErrorList = new ScheduleTaskCollection();

            foreach (ScheduleTask objitem in myList)
            {
                try
                {
                    Save(objitem);
                }
                catch (Exception objEx)
                {
                    objitem.ErrorMesssage = "<div class='error'>" + objEx.Message + "</div>";
                    ErrorList.Add(objitem);
                }
            }
            return(ErrorList.ToDataTable <ScheduleTask>());
        }