Esempio n. 1
0
        public string GET_YGINFO(string datastring)
        {
            string              token = AppClass.GetSession("token").ToString();
            HR_RY_RYINFO        model_HR_RY_RYINFO = Newtonsoft.Json.JsonConvert.DeserializeObject <HR_RY_RYINFO>(datastring);
            HR_RY_RYINFO_SELECT rst = hrmodels.RY_RYINFO.SELECT(model_HR_RY_RYINFO, token);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(rst));
        }
Esempio n. 2
0
        public string EXPOST_TJBB(string datastring, string JZDATE, int WZGL)
        {
            MES_RETURN_UI       rst   = new MES_RETURN_UI();
            string              token = AppClass.GetSession("token").ToString();
            HR_RY_RYINFO        model_HR_RY_RYINFO      = Newtonsoft.Json.JsonConvert.DeserializeObject <HR_RY_RYINFO>(datastring);
            HR_RY_RYINFO_SELECT rst_HR_RY_RYINFO_SELECT = hrmodels.RY_RYINFO.SELECT(model_HR_RY_RYINFO, token);

            if (rst_HR_RY_RYINFO_SELECT.MES_RETURN.TYPE != "S")
            {
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rst_HR_RY_RYINFO_SELECT.MES_RETURN));
            }
            HR_RY_RYINFO_LIST[] model_HR_RY_RYINFO_LIST = rst_HR_RY_RYINFO_SELECT.HR_RY_RYINFO_LIST;
            try
            {
                FileStream file     = new FileStream(Server.MapPath("~") + @"/Areas/HR/ExportFile/工龄计算报表导出.xlsx", FileMode.Open, FileAccess.Read);
                IWorkbook  workbook = new XSSFWorkbook(file);
                ISheet     sheet    = workbook.GetSheetAt(0);
                int        rowcount = 1;
                for (int i = 0; i < model_HR_RY_RYINFO_LIST.Length; i++)
                {
                    double gl = getMonthNumber_YEAR(model_HR_RY_RYINFO_LIST[i].RZDATE, JZDATE);
                    if (gl >= WZGL)
                    {
                        int  cellIndex = 0;
                        IRow row       = sheet.CreateRow(rowcount++);
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].GH));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].YGNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].ZZTYPENAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].ZZNO));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].RZDATE));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(getMonthNumber(model_HR_RY_RYINFO_LIST[i].RZDATE, JZDATE)));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].GLQSR));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(getMonthNumber(model_HR_RY_RYINFO_LIST[i].GLQSR, JZDATE)));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].BIRTHDAT));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].EDUCACTIONNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].XB));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].GSNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].DEPTNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].GSBMNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].YGTYPENAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].ZZZTNAME));
                        row.CreateCell(cellIndex++).SetCellValue(Convert.ToString(model_HR_RY_RYINFO_LIST[i].PHONENUMBER));
                    }
                }
                string     now   = DateTime.Now.ToString("yyyyMMddHHmmss.fff");
                FileStream file1 = new FileStream(string.Format(@"{0}/Areas/HR/ExportFile/{1}.xlsx", Server.MapPath("~"), now), FileMode.Create);
                workbook.Write(file1);
                file1.Close();
                rst.TYPE    = "S";
                rst.MESSAGE = now;
            }
            catch
            {
                rst.TYPE    = "E";
                rst.MESSAGE = "生成文件失败!";
            }
            return(Newtonsoft.Json.JsonConvert.SerializeObject(rst));
        }
Esempio n. 3
0
        public MES_RETURN_UI UPDATE_QUIT(HR_RY_RYINFO model, string ptoken)
        {
            MES_RETURN    mr   = client.UPDATE_QUIT(model, ptoken);
            MES_RETURN_UI mrui = new MES_RETURN_UI();

            mrui.TYPE    = mr.TYPE;
            mrui.MESSAGE = mr.MESSAGE;
            return(mrui);
        }
Esempio n. 4
0
 public HR_RY_LZINFO_SELECT SELECT_LZINFO(HR_RY_RYINFO model, string ptoken)
 {
     return(client.SELECT_LZINFO(model, ptoken));
 }
Esempio n. 5
0
 public HR_RY_RYINFO_SELECT SELECT_LB(HR_RY_RYINFO model, int LB, string ptoken)
 {
     return(client.SELECT_LB(model, LB, ptoken));
 }
Esempio n. 6
0
 public HR_RY_RYINFO_SELECT INSERT(HR_RY_RYINFO model, string ptoken)
 {
     return(client.INSERT(model, ptoken));
 }
Esempio n. 7
0
        public string Data_DaoRu_ZXFJKC(int PXZTID)
        {
            string        token   = AppClass.GetSession("token").ToString();
            int           STAFFID = Convert.ToInt32(AppClass.GetSession("STAFFID"));
            MES_RETURN_UI msg     = new MES_RETURN_UI();

            try
            {
                var    file     = Request.Files[0];
                string year     = DateTime.Now.Year.ToString();
                string month    = DateTime.Now.Month.ToString();
                string gotname  = file.FileName;
                string savePath = FileSavePath + @"\excel\" + year + @"\" + month + @"\" + gotname;
                if (Directory.Exists(FileSavePath + @"\excel\" + year + @"\" + month) == false)
                {
                    Directory.CreateDirectory(FileSavePath + @"\excel\" + year + @"\" + month);
                }
                file.SaveAs(savePath);
                FileInfo fi = new FileInfo(savePath);
                if (fi.Exists == true)
                {
                    DataTable data1 = ExcelToDataTable(savePath, 0, true);
                    System.IO.File.Delete(savePath);
                    if (data1 != null)
                    {
                        if (data1.Columns.Contains("工号") == false || data1.Columns.Contains("姓名") == false)
                        {
                            msg.TYPE    = "E";
                            msg.MESSAGE = "请使用新模版!";
                            return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                        }
                        else
                        {
                            try
                            {
                                data1.Columns.Add("RYID", typeof(int));
                                if (data1.Rows.Count > 0)
                                {
                                    for (int i = 0; i < data1.Rows.Count; i++)
                                    {
                                        if (data1.Rows[i]["工号"].ToString().Trim() != "")
                                        {
                                            if (data1.Rows[i]["工号"].ToString().Trim().Length != 5)
                                            {
                                                msg.TYPE    = "E";
                                                msg.MESSAGE = "第" + (i + 2) + "行(工号:" + data1.Rows[i]["工号"].ToString() + ")工号格式不正确!";
                                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                                            }
                                            if (data1.Rows[i]["姓名"].ToString().Trim() == "")
                                            {
                                                msg.TYPE    = "E";
                                                msg.MESSAGE = "第" + (i + 2) + "行(工号:" + data1.Rows[i]["工号"].ToString() + ")姓名格式不正确!";
                                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                                            }
                                            HR_RY_RYINFO model = new HR_RY_RYINFO();
                                            model.GH     = data1.Rows[i]["工号"].ToString().Trim();
                                            model.YGNAME = data1.Rows[i]["姓名"].ToString().Trim();
                                            HR_RY_RYINFO_SELECT staffdata = hrmodels.RY_RYINFO.SELECT(model, token);
                                            if (staffdata.HR_RY_RYINFO_LIST.Length == 0)
                                            {
                                                msg.TYPE    = "E";
                                                msg.MESSAGE = "第" + (i + 2) + "行(工号:" + data1.Rows[i]["工号"].ToString() + ")工号不存在,请检查!";
                                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                                            }
                                            else
                                            {
                                                data1.Rows[i]["RYID"] = staffdata.HR_RY_RYINFO_LIST[0].RYID;
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                msg.TYPE    = "E";
                                msg.MESSAGE = e.ToString();
                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                            }
                        }
                    }
                    for (int i = 0; i < data1.Rows.Count; i++)
                    {
                        if (data1.Rows[i]["工号"].ToString().Trim() != "")
                        {
                            HR_PX_PXZT_BMRY model = new HR_PX_PXZT_BMRY();
                            model.RYID   = Convert.ToInt32(data1.Rows[i]["RYID"].ToString());
                            model.PXZTID = PXZTID;
                            MES_RETURN_UI result = hrmodels.PX_PXZT.PXZT_BMRY_INSERT(model, token);
                            if (result.TYPE == "E")
                            {
                                msg.TYPE    = "E";
                                msg.MESSAGE = "第" + (i + 2) + "行(工号:" + data1.Rows[i]["工号"].ToString() + ")出现问题," + result.MESSAGE;
                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                            }
                        }
                    }
                    msg.TYPE    = "S";
                    msg.MESSAGE = "新增成功!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
                else
                {
                    msg.TYPE    = "E";
                    msg.MESSAGE = "文件读取失败!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
            }
            catch (Exception e)
            {
                msg.TYPE    = "E";
                msg.MESSAGE = e.ToString();
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
        }
Esempio n. 8
0
        public string Data_DaoRu_PXRY(int PXZTID)
        {
            int      STAFFID = Convert.ToInt32(AppClass.GetSession("STAFFID"));
            string   token   = AppClass.GetSession("token").ToString();
            DaoRuMsg msg     = new DaoRuMsg();

            try
            {
                var file = Request.Files[0];

                string year  = DateTime.Now.Year.ToString();
                string month = DateTime.Now.Month.ToString();

                string gotname = file.FileName;

                string savePath = HRFile + @"\upload\excel\" + year + @"\" + month + @"\" + gotname;
                if (Directory.Exists(HRFile + @"\upload\excel\" + year + @"\" + month) == false)
                {
                    Directory.CreateDirectory(HRFile + @"\upload\excel\" + year + @"\" + month);
                }
                file.SaveAs(savePath);
                FileInfo fi = new FileInfo(savePath);


                if (fi.Exists == true)
                {
                    string[] sheet = { "培训人员导入" };


                    //开始做数据校验

                    DataTable data1 = ExcelToDataTable(savePath, 0, true);
                    #region
                    if (data1 != null)
                    {
                        if (data1.Columns.Contains("工号") == false)
                        {
                            msg.Msg = "请使用新增模版!";
                            return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                        }
                        else
                        {
                            try
                            {
                                //做数据验证
                                if (data1.Rows.Count > 0)
                                {
                                    for (int i = 0; i < data1.Rows.Count; i++)
                                    {
                                        if (data1.Rows[i]["工号"].ToString() != "")
                                        {
                                            if (data1.Rows[i]["工号"].ToString().Length != 5)
                                            {
                                                msg.Msg = "工会导入第" + (i + 2) + "行工号格式不正确!";
                                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                                            }
                                            HR_RY_RYINFO model = new HR_RY_RYINFO();
                                            model.GH = data1.Rows[i]["工号"].ToString();
                                            HR_RY_RYINFO_SELECT staffdata = hrmodels.RY_RYINFO.SELECT(model, token);
                                            if (staffdata.HR_RY_RYINFO_LIST.Length == 0)
                                            {
                                                msg.Msg = "工会导入第" + (i + 2) + "行工号不存在!";
                                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                msg.Msg = e.ToString();
                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                            }
                        }
                    }
                    #endregion



                    //能到这儿就说明数据是没问题的了...大概,然后才进行数据库写入
                    #region

                    for (int i = 0; i < data1.Rows.Count; i++)
                    {
                        #region
                        if (data1.Rows[i]["工号"].ToString() != "")
                        {
                            HR_RY_RYINFO insert_model = new HR_RY_RYINFO();
                            insert_model.GH = data1.Rows[i]["工号"].ToString();
                            HR_RY_RYINFO_SELECT staffdata = hrmodels.RY_RYINFO.SELECT(insert_model, token);
                            HR_PX_PXZT          model     = new HR_PX_PXZT();
                            model.RYID   = staffdata.HR_RY_RYINFO_LIST[0].RYID;
                            model.PXZTID = PXZTID;
                            model.CJR    = STAFFID;

                            MES_RETURN_UI result = hrmodels.PX_PXZT.INSERT_PXZTMX(model, token);


                            if (result.TYPE == "E")
                            {
                                msg.Msg = "培训人员导入的第" + (i + 2) + "行出现问题,请记录当前报错信息并联系管理员";
                                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                            }
                        }
                        #endregion
                    }


                    #endregion
                    msg.Msg = "新增成功!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
                else
                {
                    msg.Msg = "文件读取失败!";
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
                }
            }
            catch (Exception e)
            {
                msg.Msg = e.ToString();
                return(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
            }
        }