Exemple #1
0
        public string SaveFile(UploadFileModel uploadFile)
        {
            try
            {
                // Store File to File System
                string strVirtualPath = ConfigurationManager.AppSettings["FileUploadLocation"].ToString();
                string strPath        = HttpContext.Current.Server.MapPath(strVirtualPath) + uploadFile.FileName;
                if (Directory.Exists(HttpContext.Current.Server.MapPath(strVirtualPath)) == false)
                {
                    Directory.CreateDirectory(HttpContext.Current.Server.MapPath(strVirtualPath));
                }
                FileStream FileStream = new FileStream(strPath, FileMode.Create);
                FileStream.Write(uploadFile.File, 0, uploadFile.File.Length);

                FileStream.Close();
                FileStream.Dispose();

                string strFilePath = strVirtualPath + uploadFile.FileName;
                return(strFilePath);
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("获取文件路径错误::" + ex.ToString());
                return(string.Empty);
            }
        }
Exemple #2
0
 public List <V_ORGANIZATIONINFO> ImportOrgInfo(UploadFileModel uploadFile, string companyID, Dictionary <string, string> empInfoDic)
 {
     using (DepartmentBLL bll = new DepartmentBLL())
     {
         string strPath         = SaveFile(uploadFile);                        //获取文件路径
         string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath); //到时测试strPath为空是是否报错
         return(bll.ImportOrgInfo(strPhysicalPath, companyID, empInfoDic));
     }
 }
Exemple #3
0
        public void SaveFile(UploadFileModel UploadFile, out string strFilePath)
        {
            // Store File to File System
            string strVirtualPath = ConfigurationManager.AppSettings["FileUploadLocation"].ToString();
            string strPath = HttpContext.Current.Server.MapPath(strVirtualPath) + UploadFile.FileName;
            if (Directory.Exists(HttpContext.Current.Server.MapPath(strVirtualPath)) == false)
            {
                Directory.CreateDirectory(HttpContext.Current.Server.MapPath(strVirtualPath));
            }
            FileStream FileStream = new FileStream(strPath, FileMode.Create);
            FileStream.Write(UploadFile.File, 0, UploadFile.File.Length);

            FileStream.Close();
            FileStream.Dispose();

            strFilePath = strVirtualPath + UploadFile.FileName;
        }
Exemple #4
0
        public void SaveFile(UploadFileModel UploadFile, out string strFilePath)
        {
            // Store File to File System
            string strNewFileName = string.Empty;
            string strVirtualPath = ConfigurationManager.AppSettings["FileUploadLocation"].ToString();
            if (!string.IsNullOrWhiteSpace(UploadFile.FileName))
            {
                strNewFileName = DateTime.Now.ToString("yyMMddhhmmss") + DateTime.Now.Millisecond.ToString() + UploadFile.FileName.Substring(UploadFile.FileName.LastIndexOf("."));
            }

            string strPath = HttpContext.Current.Server.MapPath(strVirtualPath) + strNewFileName;
            if (Directory.Exists(HttpContext.Current.Server.MapPath(strVirtualPath)) == false)
            {
                Directory.CreateDirectory(HttpContext.Current.Server.MapPath(strVirtualPath));
            }
            FileStream FileStream = new FileStream(strPath, FileMode.Create);
            FileStream.Write(UploadFile.File, 0, UploadFile.File.Length);

            FileStream.Close();
            FileStream.Dispose();

            strFilePath = strVirtualPath + strNewFileName;
        }
Exemple #5
0
 public List<T_HR_ATTENDMONTHLYBALANCE> ImportAttendMonthlyBalanceForShow(UploadFileModel UploadFile)
 {
     string strPath = string.Empty;
     SaveFile(UploadFile, out strPath);
     string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);
     using (AttendMonthlyBalanceBLL bllAttendMonthlyBalance = new AttendMonthlyBalanceBLL())
     {
         return bllAttendMonthlyBalance.ImportMonthlyBalanceForShow(strPhysicalPath);
     }
 }
Exemple #6
0
        public void ImportAttendMonthlyBalanceFromCSV(UploadFileModel UploadFile, string strCreateUserID, string strUnitType, string strUnitObjectId, decimal dBalanceYear, decimal dBalanceMonth, ref string strMsg)
        {
            string strPath = string.Empty;
            SaveFile(UploadFile, out strPath);
            string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

            using (AttendMonthlyBalanceBLL bllAttendMonthlyBalance = new AttendMonthlyBalanceBLL())
            {
                bllAttendMonthlyBalance.ImportMonthlyBalance(strCreateUserID, strPhysicalPath, strUnitType, strUnitObjectId, dBalanceYear, dBalanceMonth, ref strMsg);
            }
        }
Exemple #7
0
        public void ImportClockInRdListFromFileAndLoginData(UploadFileModel UploadFile, string strFileType, string strUnitType, string strUnitObjectId, DateTime dtStart, DateTime dtEnd, ref string strMsg)
        {
            string strPath = string.Empty;
            SaveFile(UploadFile, out strPath);
            string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

            using (ClockInRecordBLL bllClockInRecord = new ClockInRecordBLL())
            {
                bllClockInRecord.ImportClockInRdListByImportFileAndLoginData(strPhysicalPath, strFileType, strUnitType, strUnitObjectId, dtStart, dtEnd, ref strMsg);
            }
        }
Exemple #8
0
        public void ImportClockInRdListFromFile(UploadFileModel UploadFile, string strFileType, string strUnitType, string strUnitObjectId, DateTime dtStart, DateTime dtEnd, ref string strMsg)
        {
            string strPath = string.Empty;
            SaveFile(UploadFile, out strPath);
            string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

            using (ClockInRecordBLL bllClockInRecord = new ClockInRecordBLL())
            {
                if (strFileType.ToLower() == "csv")
                {
                    bllClockInRecord.ImportClockInRdListByImportCSV(strPhysicalPath, strUnitType, strUnitObjectId, dtStart, dtEnd, ref strMsg);
                }
                else if (strFileType.ToLower() == "xls")
                {
                    bllClockInRecord.ImportClockInRdListByImportExcel(strPhysicalPath, strUnitType, strUnitObjectId, dtStart, dtEnd, ref strMsg);
                }
            }
        }
Exemple #9
0
        public List<T_HR_PENSIONDETAIL> ImportClockInRdListFromExcelForShow(UploadFileModel UploadFile, Dictionary<string, string> paras, ref string strMsg)
        {
            List<T_HR_PENSIONDETAIL> ListResult = new List<T_HR_PENSIONDETAIL>();
            try
            {
                Tracer.Debug("import start" + paras.Count.ToString());
                string strPath = string.Empty;
                SaveFile(UploadFile, out strPath);
                string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

                using (PensionDetailBLL bll = new PensionDetailBLL())
                {
                    ListResult = bll.ImportPensionByImportExcelForShow(strPhysicalPath, paras, ref strMsg);
                }
                Tracer.Debug("import sucess");
            }
            catch (Exception ex)
            {
                Tracer.Debug("ImportClockInRdListFromExcelWS:" + ex.Message);
            }
            return ListResult;
        }
Exemple #10
0
        public void ImportClockInRdListFromExcel(UploadFileModel UploadFile, Dictionary<string, string> paras, ref string strMsg)
        {
            try
            {
                Tracer.Debug("import start" + paras.Count.ToString());
                string strPath = string.Empty;
                SaveFile(UploadFile, out strPath);
                string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

                using (PensionDetailBLL bll = new PensionDetailBLL())
                {
                    bll.ImportPensionByImportExcel(strPhysicalPath, paras, ref strMsg);
                }
                Tracer.Debug("import sucess");
            }
            catch (Exception ex)
            {
                Tracer.Debug("ImportClockInRdListFromExcelWS:" + ex.Message);
            }
        }
Exemple #11
0
 public List<V_EmployeeEntryInfo> ImportEmployeeEntry(UploadFileModel uploadFile, string companyID, Dictionary<string, string> empInfoDic)
 {
     using (EmployeeEntryBLL bll = new EmployeeEntryBLL())
     {
         string strPath = string.Empty;
         SaveFile(uploadFile, out strPath);//获取文件路径
         string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);//到时测试strPath为空是是否报错
         return bll.ImportEmployeeEntry(strPhysicalPath, companyID, empInfoDic);
     }
 }
Exemple #12
0
 public string ImportEmployeeMonthlySalary(UploadFileModel UploadFile, GenerateUserInfo GenerateUser,string year, string month, ref string owerCompayId,ref string UImsg)
 {
     string strPath = string.Empty;
     SaveFile(UploadFile, out strPath);
     string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);
     using (EmployeeSalaryImportBLL bll = new EmployeeSalaryImportBLL())
     {
         return bll.ImportEmployeeMonthlySalary(GenerateUser,strPhysicalPath, year, month, owerCompayId, ref UImsg);
     }
 }
Exemple #13
0
 public List<T_HR_EMPLOYEESALARYRECORD> ImportExcel(UploadFileModel UploadFile, out int failcount, out int successcount, string year, string month, string paySign)
 {
     string strPath = string.Empty;    //, int pageIndex, int pageSize, ref int pageCount, ref string strMsg
     SaveFile(UploadFile, out strPath);
     string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);
     using (PaymentBLL bll = new PaymentBLL())
     {
         return bll.ReadExcel(strPhysicalPath, out failcount, out successcount, year, month, paySign);
     }
 }
Exemple #14
0
        public List<T_HR_EMPLOYEEADDSUM> ImportEmployeeAddSumFromExcelForShow(UploadFileModel UploadFile, Dictionary<string, string> paras, ref string strMsg, bool IsPreview)
        {
            List<T_HR_EMPLOYEEADDSUM> ListResult = new List<T_HR_EMPLOYEEADDSUM>();
            try
            {
                Tracer.Debug("import start" + paras.Count.ToString());
                string strPath = string.Empty;
                SaveFile(UploadFile, out strPath);
                string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);

                using (EmployeeAddSumBLL bll = new EmployeeAddSumBLL())
                {
                    ListResult = bll.ImportEmployeeAddSumFromExcelForShow(strPhysicalPath, paras, ref strMsg,IsPreview);
                }
                Tracer.Debug("import sucess");
            }
            catch (Exception ex)
            {
                Tracer.Debug("ImportClockInRdListFromExcelWS:" + ex.Message);
            }
            return ListResult;
        }
Exemple #15
0
        public string SaveFile(UploadFileModel uploadFile)
        {
            try
            {
                // Store File to File System
                string strVirtualPath = ConfigurationManager.AppSettings["FileUploadLocation"].ToString();
                string strPath = HttpContext.Current.Server.MapPath(strVirtualPath) + uploadFile.FileName;
                if (Directory.Exists(HttpContext.Current.Server.MapPath(strVirtualPath)) == false)
                {
                    Directory.CreateDirectory(HttpContext.Current.Server.MapPath(strVirtualPath));
                }
                FileStream FileStream = new FileStream(strPath, FileMode.Create);
                FileStream.Write(uploadFile.File, 0, uploadFile.File.Length);

                FileStream.Close();
                FileStream.Dispose();

                string strFilePath = strVirtualPath + uploadFile.FileName;
                return strFilePath;
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("获取文件路径错误::" + ex.ToString());
                return string.Empty;
            }
        }
Exemple #16
0
 public List<V_ORGANIZATIONINFO> ImportOrgInfo(UploadFileModel uploadFile, string companyID, Dictionary<string, string> empInfoDic)
 {
     using (DepartmentBLL bll = new DepartmentBLL())
     {
         string strPath = SaveFile(uploadFile);//获取文件路径
         string strPhysicalPath = HttpContext.Current.Server.MapPath(strPath);//到时测试strPath为空是是否报错
         return bll.ImportOrgInfo(strPhysicalPath, companyID, empInfoDic);
     }
 }