コード例 #1
0
ファイル: UpReportController.cs プロジェクト: joychen522/HCQ2
        /// <summary>
        /// 上报测试数据库
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public ActionResult UpLoad(FormCollection form)
        {
            string upType = form["upType"];

            string serviceName = "";
            string methodName  = "";

            List <string> reComList     = new List <string>();
            List <string> reProjectList = new List <string>();
            List <string> xmlList       = operateContext.bllSession.A01.UpLoadData(form, ref reComList, ref reProjectList, "test");

            switch (upType)
            {
            case "01":
                serviceName = "HSMWService";
                methodName  = "UploadCompProInfo";
                break;

            case "02":
                serviceName = "HSMWService";
                methodName  = "UploadProPerInfo";
                break;

            case "03":
                serviceName = "HSMWService";
                methodName  = "UploadProPhotoInfo";
                break;

            case "04":
                serviceName = "HSMWService";
                methodName  = "UploadProAttendInfo";
                break;

            case "05":
                serviceName = "HSMWService";
                methodName  = "UploadProSalaryInfo";
                break;

            case "06":
                serviceName = "HSMWService";
                methodName  = "UploadProBackPayInfo";
                break;

            case "07":
                serviceName = "HSMWService";
                methodName  = "UploadProBackPayForPerInfo";
                break;

            case "08":
                serviceName = "HSMWService";
                methodName  = "UploadProFileInfo";
                break;

            case "09":
                serviceName = "HSMWService";
                methodName  = "UploadPayrollAccountInfo";
                break;

            default:
                break;
            }

            List <PortErrorMess> errorList = new List <PortErrorMess>();
            uddiPortTypeClient   client    = new uddiPortTypeClient();

            if (xmlList.Count() > 0)
            {
                for (int i = 0; i < xmlList.Count(); i++)
                {
                    string        strXml = xmlList[i];
                    PortErrorMess error  = new PortErrorMess();
                    error.comName     = reComList[i];
                    error.projectName = reProjectList[i];
                    string mess = client.invokeService(serviceName, methodName, strXml);
                    if (mess.Contains("服务调用成功!"))
                    {
                        if (upType == "01")
                        {
                            operateContext.bllSession.B01.ChangeUnitUpLoad(reProjectList[i], upType);
                        }
                        error.mess = "成功!";
                    }
                    else if (mess.Contains("解析XML出错"))
                    {
                        error.mess = "解析失败!请检查上报档案信息特殊符号。";
                        ErrorMess(mess, error.comName);
                        ErrorMess(xmlList[i], error.comName + "File");
                    }
                    else
                    {
                        error.mess = "失败!";
                        ErrorMess(mess, error.comName);
                        ErrorMess(xmlList[i], error.comName + "File");
                        error.errorMsg = GetErrorDataMsg(mess);
                    }

                    errorList.Add(error);
                }
            }
            return(Json(errorList, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: UpReportController.cs プロジェクト: joychen522/HCQ2
        /// <summary>
        /// 人员信息、照片、合同上报
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public ActionResult UpLoadPersonSoure(FormCollection form)
        {
            string upType     = form["upType"];
            string unitID     = form["unitID"];
            string type       = form["type"];
            string dateSelect = form["dateSelect"];

            if (string.IsNullOrEmpty(unitID))
            {
                unitID = operateContext.bllSession.B01.GetB01PerData(operateContext.Usr.user_id)[0].UnitID;
            }

            string serviceName = "";
            string methodName  = "";

            List <string> reComList     = new List <string>();
            List <string> reProjectList = new List <string>();

            List <A01>    userList = new List <A01>();
            List <string> xmlList  = operateContext.bllSession.A01.UpLoadDataFormPerson(form, ref reComList, ref reProjectList, type, ref userList, unitID);

            switch (upType)
            {
            case "02":
                serviceName = "HSMWService";
                methodName  = "UploadProPerInfo";
                break;

            case "03":
                serviceName = "HSMWService";
                methodName  = "UploadProPhotoInfo";
                break;

            case "04":
                serviceName = "HSMWService";
                methodName  = "UploadProAttendInfo";
                break;

            case "08":
                serviceName = "HSMWService";
                methodName  = "UploadProFileInfo";
                break;

            default:
                break;
            }
            List <PortErrorMess> errorList = new List <PortErrorMess>();

            //测试地址
            uddiPortTypeClient client = new uddiPortTypeClient();

            //正式地址
            WebDataUpLoad.uddi client2 = GetClient();;

            if (xmlList.Count() > 0)
            {
                string mess = "";
                for (int i = 0; i < xmlList.Count(); i++)
                {
                    string        strXml = xmlList[i];
                    PortErrorMess error  = new PortErrorMess();
                    error.comName     = reComList[i];
                    error.projectName = reProjectList[i];
                    if (type == "test")
                    {
                        mess = client.invokeService(serviceName, methodName, strXml);
                    }
                    else
                    {
                        mess = client2.invokeService(serviceName, methodName, strXml);
                    }
                    if (mess.Contains("服务调用成功!"))
                    {
                        operateContext.bllSession.A01.ChangePersonUpLoad(userList, upType);
                        error.mess = "成功!";
                    }
                    else if (mess.Contains("解析XML出错"))
                    {
                        error.mess = "解析失败!请检查上报档案信息特殊符号。";
                        ErrorMess(mess, error.comName);
                        ErrorMess(xmlList[i], error.comName + "File");
                    }
                    else
                    {
                        error.mess = "失败!";
                        ErrorMess(mess, error.comName);
                        ErrorMess(xmlList[i], error.comName + "File");
                        error.errorMsg = GetErrorDataMsg(mess);
                    }

                    errorList.Add(error);
                }
            }
            return(Json(errorList, JsonRequestBehavior.AllowGet));
        }