Beispiel #1
0
        /// <summary>
        ///  读取社保卡的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private SMT.Saas.Tools.PersonnelWS.UploadFileModel ImportClockInRd()
        {
            string strMsg = string.Empty;
            Stream stream = null;

            try
            {
                if (openFileDialog == null)
                {
                    return(null);
                }

                if (openFileDialog.File == null)
                {
                    return(null);
                }

                RefreshUI(RefreshedTypes.ProgressBar);

                stream = (System.IO.Stream)openFileDialog.File.OpenRead();

                byte[] Buffer = new byte[stream.Length];
                stream.Read(Buffer, 0, (int)stream.Length);

                stream.Dispose();
                stream.Close();

                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = openFileDialog.File.Name;
                UploadFile.File     = Buffer;

                strMsg = string.Empty;
                return(UploadFile);
                //clientAtt.ImportClockInRdListFromExcelAsync(UploadFile, dtStart, dtEnd, strMsg);
            }
            catch (Exception)
            {
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString()));

                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERRORINFO"),
                                               Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                return(null);
            }
            finally
            {
                stream.Dispose();
                stream.Close();
            }
        }
        /// <summary>
        ///  读取员工入职信息的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private void ImportEmployeeEntry()
        {
            string strMsg = string.Empty;

            try
            {
                if (acbCompanyName.SelectedItem == null)
                {
                    tbFileName.Text = string.Empty;//不显示文件
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTCOMPANY"),
                                                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                }
                if (OpenFileDialog == null || OpenFileDialog.File == null)
                {
                    tbFileName.Text = string.Empty;//不显示文件
                    return;
                }
                Stream Stream = (System.IO.Stream)OpenFileDialog.File.OpenRead();

                byte[] Buffer = new byte[Stream.Length];
                Stream.Read(Buffer, 0, (int)Stream.Length);

                Stream.Dispose();
                Stream.Close();
                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = OpenFileDialog.File.Name;
                UploadFile.File     = Buffer;
                string companyID = (acbCompanyName.SelectedItem as SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY).COMPANYID;
                Dictionary <string, string> empInfo = new Dictionary <string, string>();
                empInfo.Add("ownerID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                empInfo.Add("ownerPostID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID);
                empInfo.Add("ownerDepartmentID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID);
                empInfo.Add("ownerCompanyID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                RefreshUI(RefreshedTypes.ShowProgressBar);
                client.ImportEmployeeEntryAsync(UploadFile, companyID, empInfo);
            }
            catch (Exception ex)
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), ex.ToString(), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
        }
Beispiel #3
0
        /// <summary>
        ///  读取社保卡的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private SMT.Saas.Tools.PersonnelWS.UploadFileModel ImportClockInRd()
        {
            string strMsg = string.Empty;
            Stream stream = null;
            try
            {
                if (openFileDialog == null)
                    return null;

                if (openFileDialog.File == null)
                    return null;

                RefreshUI(RefreshedTypes.ProgressBar);

                stream = (System.IO.Stream)openFileDialog.File.OpenRead();

                byte[] Buffer = new byte[stream.Length];
                stream.Read(Buffer, 0, (int)stream.Length);

                stream.Dispose();
                stream.Close();

                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = openFileDialog.File.Name;
                UploadFile.File = Buffer;

                strMsg = string.Empty;
                return UploadFile;
                //clientAtt.ImportClockInRdListFromExcelAsync(UploadFile, dtStart, dtEnd, strMsg);
            }
            catch (Exception )
            {
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString()));

                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERRORINFO"),
                               Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                return null;
            }
            finally
            {
                stream.Dispose();
                stream.Close();
            }
        }
Beispiel #4
0
        /// <summary>
        ///  读取社保卡的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private void ImportClockInRd()
        {

            string strMsg = string.Empty;
            try
            {
                if (cbxCity.SelectedItem == null)
                {
                    //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "CITY"));
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("STRINGNOTNULL", "CITY"),
                Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return;
                }
                if (string.IsNullOrEmpty(tbFileName.Text))
                {
                    //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("IMPORTSELECT"));
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("IMPORTSELECT"),
                Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return;
                }
                if (OpenFileDialog == null)
                    return;

                if (OpenFileDialog.File == null)
                    return;

                RefreshUI(RefreshedTypes.ShowProgressBar);

                Stream Stream = (System.IO.Stream)OpenFileDialog.File.OpenRead();

                byte[] Buffer = new byte[Stream.Length];
                Stream.Read(Buffer, 0, (int)Stream.Length);

                Stream.Dispose();
                Stream.Close();

                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = OpenFileDialog.File.Name;
                UploadFile.File = Buffer;

                strMsg = string.Empty;
                Dictionary<string, string> paras = new Dictionary<string, string>();
                paras.Add("CITY", (cbxCity.SelectedItem as T_SYS_DICTIONARY).DICTIONARYVALUE.ToString());
                paras.Add("OWNERID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                paras.Add("CREATEUSERID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                paras.Add("OWNERCOMPANYID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                paras.Add("OWNERDEPARTMENTID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                paras.Add("OWNERPOSTID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID);
                paras.Add("YEAR", (Nuyear.Value).ToString());
                paras.Add("MONTH", (NuStartmounth.Value).ToString());
                client.ImportClockInRdListFromExcelForShowAsync(UploadFile, paras, strMsg);
                //client.ImportClockInRdListFromExcelAsync(UploadFile, paras, strMsg);
                //client.ImportClockInRdListFromExcelAsync(UploadFile, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID, strMsg);
                //clientAtt.ImportClockInRdListFromExcelAsync(UploadFile, dtStart, dtEnd, strMsg);
            }
            catch (Exception ex)
            {
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString()));
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERRORINFO"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
        }
        /// <summary>
        ///  读取员工入职信息的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private void ImportEmployeeEntry()
        {
            string strMsg = string.Empty;
            try
            {
                if (acbCompanyName.SelectedItem==null)
                {
                    tbFileName.Text = string.Empty;//不显示文件
                  ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"),Utility.GetResourceStr("SELECTCOMPANY"),
                      Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                }
                if (OpenFileDialog == null || OpenFileDialog.File == null)
                {
                    tbFileName.Text = string.Empty;//不显示文件
                    return;
                }
                Stream Stream = (System.IO.Stream)OpenFileDialog.File.OpenRead();

                byte[] Buffer = new byte[Stream.Length];
                Stream.Read(Buffer, 0, (int)Stream.Length);

                Stream.Dispose();
                Stream.Close();
                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = OpenFileDialog.File.Name;
                UploadFile.File = Buffer;
                string companyID = (acbCompanyName.SelectedItem as SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY).COMPANYID;
                Dictionary<string, string> empInfo = new Dictionary<string, string>();
                empInfo.Add("ownerID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                empInfo.Add("ownerPostID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID);
                empInfo.Add("ownerDepartmentID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID);
                empInfo.Add("ownerCompanyID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                RefreshUI(RefreshedTypes.ShowProgressBar);
                client.ImportEmployeeEntryAsync(UploadFile, companyID, empInfo);
            }
            catch (Exception ex)
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), ex.ToString(), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
        }
Beispiel #6
0
        /// <summary>
        ///  读取社保卡的Excel文件,并导入数据库,返回导入后的结果
        /// </summary>
        private void ImportClockInRd()
        {
            string strMsg = string.Empty;

            try
            {
                if (cbxCity.SelectedItem == null)
                {
                    //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "CITY"));
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("STRINGNOTNULL", "CITY"),
                                                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return;
                }
                if (string.IsNullOrEmpty(tbFileName.Text))
                {
                    //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("IMPORTSELECT"));
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("IMPORTSELECT"),
                                                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    return;
                }
                if (OpenFileDialog == null)
                {
                    return;
                }

                if (OpenFileDialog.File == null)
                {
                    return;
                }

                RefreshUI(RefreshedTypes.ShowProgressBar);

                Stream Stream = (System.IO.Stream)OpenFileDialog.File.OpenRead();

                byte[] Buffer = new byte[Stream.Length];
                Stream.Read(Buffer, 0, (int)Stream.Length);

                Stream.Dispose();
                Stream.Close();

                SMT.Saas.Tools.PersonnelWS.UploadFileModel UploadFile = new SMT.Saas.Tools.PersonnelWS.UploadFileModel();
                UploadFile.FileName = OpenFileDialog.File.Name;
                UploadFile.File     = Buffer;

                strMsg = string.Empty;
                Dictionary <string, string> paras = new Dictionary <string, string>();
                paras.Add("CITY", (cbxCity.SelectedItem as T_SYS_DICTIONARY).DICTIONARYVALUE.ToString());
                paras.Add("OWNERID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                paras.Add("CREATEUSERID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                paras.Add("OWNERCOMPANYID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                paras.Add("OWNERDEPARTMENTID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID);
                paras.Add("OWNERPOSTID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID);
                paras.Add("YEAR", (Nuyear.Value).ToString());
                paras.Add("MONTH", (NuStartmounth.Value).ToString());
                client.ImportClockInRdListFromExcelForShowAsync(UploadFile, paras, strMsg);
                //client.ImportClockInRdListFromExcelAsync(UploadFile, paras, strMsg);
                //client.ImportClockInRdListFromExcelAsync(UploadFile, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID, strMsg);
                //clientAtt.ImportClockInRdListFromExcelAsync(UploadFile, dtStart, dtEnd, strMsg);
            }
            catch (Exception ex)
            {
                //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(ex.Message.ToString()));
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERRORINFO"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
                RefreshUI(RefreshedTypes.HideProgressBar);
            }
        }