示例#1
0
文件: Respond.cs 项目: aj-hc/ZSSY
        public void HF(RuRo.BLL.WebService.SpecimenRt specimenRt)
        {
            #region 正式代码
            Thread.Sleep(100);//休眠1秒钟
            //检查当前数据是否需要回发——数据库中不存在当前样本id的数据或者数据库中的数据和当前样本id的样本数据不一样
            //a、数据库中存在数据——更新
            //b、数据库中不存在数据——添加
            bool exist = false;
            //检查数据是否存在 true存在
            bool checkSpecimenRtResult = CheckSpecimenRt(specimenRt, ref exist);

            if (!checkSpecimenRtResult)
            {
                string result = "";
                //数据库中不存在当前样本Id的数据
                try
                {
                    RuRo.BLL.WebService.ForCenterLabService CenterLab = new RuRo.BLL.WebService.ForCenterLabService();
                    result = CenterLab.StoreSpecimenInfo(specimenRt);
                }
                catch (Exception ex)
                {
                    result = ex.Message;
                }
                //保存日志:a、直接保存SpecimenRtLog;b、成功之后保存详细的SpecimenRt
                bool SaveSpecimenRtLogResult = AddToSpecimenRtLog(specimenRt, result);
                if (result == "0^成功")//此处需要判断回发数据之后保存是否成功——判断回发之后返回的状态。
                {
                    //保存当前记录到数据库
                    bool SaveSpecimenRtResult = AddToSpecimenRt(specimenRt);
                }
                //检查当前的数据是否和数据库中的数据一直
            }
            else//数据库中存在当前样本id的数据
            {
                if (exist)//数据不一样
                {
                    string result = "";
                    try
                    {
                        RuRo.BLL.WebService.ForCenterLabService CenterLab = new RuRo.BLL.WebService.ForCenterLabService();
                        result = CenterLab.StoreSpecimenInfo(specimenRt);//回发数据
                    }
                    catch (Exception ex)
                    {
                        result = ex.Message;
                    }
                    //保存日志:a、直接保存SpecimenRtLog;b、成功之后保存详细的SpecimenRt
                    bool SaveSpecimenRtLogResult = AddToSpecimenRtLog(specimenRt, result);
                    if (result == "0^成功")//此处需要判断回发数据之后保存是否成功——判断回发之后返回的状态。
                    {
                        //更新当前记录到数据库
                        bool SaveSpecimenRtResult = UpdateSpecimenRt(specimenRt);
                    }
                }
            }
            #endregion
        }