예제 #1
0
        public JsonResult Contacto(FormCollection form)
        {
            form = DeSerialize(form);

            ViewBag.error = "";
            int rowid_contacto = 0;

            try { rowid_contacto = int.Parse(form["rowid"]); }
            catch { }

            try
            {
                Contacto contacto = db.Contacto.Where(f => f.RowID == rowid_contacto).FirstOrDefault();

                if (contacto == null)//insertar
                {
                    contacto = new Contacto();
                    contacto.UsuarioCreacion = ((Usuario)Session["curUser"]).NombreUsuario;
                    contacto.FechaCreacion   = UtilTool.GetDateTime();
                }
                else//modificar
                {
                    contacto.UsuarioModificacion = ((Usuario)Session["curUser"]).NombreUsuario;
                    contacto.FechaModificacion   = UtilTool.GetDateTime();
                }

                contacto.Nombre         = form["nombres"];
                contacto.Apellido       = form["apellidos"];
                contacto.Identificacion = form["identificacion"];
                try
                {
                    contacto.CiudadID = int.Parse(form["Ciudad"]);
                }
                catch (Exception)
                {
                }
                try { contacto.SucursalID = int.Parse(form["rowid_sucursal"]); }
                catch { contacto.SucursalID = null; }
                contacto.Telefono1   = form["telefono"];
                contacto.Area        = form["area"];
                contacto.Descripcion = form["descripcion"];
                contacto.Skype       = form["skype"];
                contacto.ruta_imagen = form["ruta_imagen"];
                contacto.Cargo       = form["cargo"];
                contacto.Celular     = form["celular"];
                contacto.Email       = form["email"];

                if (rowid_contacto == 0)
                {
                    db.Contacto.Add(contacto);
                }

                db.SaveChanges();
                rowid_contacto = contacto.RowID;
            }
            catch (Exception e)
            {
                Response.StatusCode        = 500;
                Response.StatusDescription = e.Message.ToString();
                return(Json("Se presento un problema al momento de almacenar la información del contacto"));
            }

            return(Json(rowid_contacto));
        }
예제 #2
0
 private void EventHandler()
 {
     UtilTool.SafeExecute(this.mAction);
 }
예제 #3
0
 /// <summary>
 /// 等待View关闭动画播放完后开始删除一个View
 /// </summary>
 private void DestroyView(View rView)
 {
     rView.Dispose();
     UtilTool.SafeDestroy(rView.GameObject);
     rView = null;
 }
예제 #4
0
 public GameObjectNode(GameObject rNodeGo)
 {
     this.NodeGo = rNodeGo;
     this.Path   = UtilTool.GetTransformPath(rNodeGo.transform);
 }
예제 #5
0
        void DrawRotation()
        {
            bool reset = false;

            using (var space = new EditorGUILayout.HorizontalScope())
            {
                reset = GUILayout.Button("R", GUILayout.Width(20f));

                Vector3 visible = (serializedObject.targetObject as Transform).localEulerAngles;

                visible.x = UtilTool.WrapAngle(visible.x);
                visible.y = UtilTool.WrapAngle(visible.y);
                visible.z = UtilTool.WrapAngle(visible.z);

                Axes            changed = CheckDifference(mRot);
                Axes            altered = Axes.None;
                GUILayoutOption opt     = GUILayout.MinWidth(30f);

                if (FloatField("X", ref visible.x, (changed & Axes.X) != 0, false, opt))
                {
                    altered |= Axes.X;
                }
                if (FloatField("Y", ref visible.y, (changed & Axes.Y) != 0, false, opt))
                {
                    altered |= Axes.Y;
                }
                if (FloatField("Z", ref visible.z, (changed & Axes.Z) != 0, false, opt))
                {
                    altered |= Axes.Z;
                }

                if (reset)
                {
                    mRot.quaternionValue = Quaternion.identity;
                }
                else if (altered != Axes.None)
                {
                    EditorAssists.RegisterUndo("Change Rotation", serializedObject.targetObjects);
                    foreach (var obj in serializedObject.targetObjects)
                    {
                        Transform t = obj as Transform;
                        Vector3   v = t.localEulerAngles;

                        if ((altered & Axes.X) != 0)
                        {
                            v.x = visible.x;
                        }
                        if ((altered & Axes.Y) != 0)
                        {
                            v.y = visible.y;
                        }
                        if ((altered & Axes.Z) != 0)
                        {
                            v.z = visible.z;
                        }

                        t.localEulerAngles = v;
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// ViewModel和View之间的数据绑定
        /// </summary>
        private void BindingViewAndViewModels(ViewControllerContainer rViewControllerContainer)
        {
            var rAllMemberBindings = UtilTool.GetComponentsInChildrenUtilOrigin <MemberBindingAbstract>(rViewControllerContainer);

            for (int i = 0; i < rAllMemberBindings.Count; i++)
            {
                var rMemberBinding = rAllMemberBindings[i];
                if (rMemberBinding.IsListTemplate)
                {
                    continue;                                   // 过滤掉ListTemplate标记得Binding Script
                }
                rMemberBinding.ViewProp = DataBindingTypeResolve.MakeViewDataBindingProperty(rMemberBinding.gameObject, rMemberBinding.ViewPath);
                if (rMemberBinding.ViewProp == null)
                {
                    Debug.LogErrorFormat("View Path: {0} error..", rMemberBinding.ViewPath);
                    return;
                }

                rMemberBinding.ViewModelProp = HotfixDataBindingTypeResolve.MakeViewModelDataBindingProperty(rMemberBinding.ViewModelPath);
                if (rMemberBinding.ViewModelProp == null)
                {
                    Debug.LogErrorFormat("View Model Path: {0} error..", rMemberBinding.ViewModelPath);
                    return;
                }
                ViewModel rViewModel = this.GetViewModel(rMemberBinding.ViewModelProp.PropertyOwnerKey);
                if (rViewModel == null)
                {
                    Debug.LogErrorFormat("View Model: {0} error..", rMemberBinding.ViewModelPath);
                    return;
                }

                // 设置类型转换器
                if (rMemberBinding.IsDataConvert)
                {
                    rMemberBinding.ViewModelProp.ConvertMethod = HotfixDataBindingTypeResolve.MakeViewModelDataBindingConvertMethod(rMemberBinding.DataConverterMethodPath);
                    if (rMemberBinding.IsDataConvert && rMemberBinding.ViewModelProp.ConvertMethod == null)
                    {
                        Debug.LogError("Cannot find convert method: {0}.." + rMemberBinding.DataConverterMethodPath);
                        return;
                    }
                }
                else
                {
                    rMemberBinding.ViewModelProp.ConvertMethod = null;
                }

                rMemberBinding.ViewModelProp.PropertyOwner = rViewModel;
                rMemberBinding.SyncFromViewModel();

                // ViewModel绑定View
                rMemberBinding.ViewModelPropertyWatcher = new DataBindingPropertyWatcher(rViewModel, rMemberBinding.ViewModelProp.PropertyName, () =>
                {
                    rMemberBinding.SyncFromViewModel();
                });
                rViewModel.PropChangedHandler += rMemberBinding.ViewModelPropertyWatcher.PropertyChanged;

                // View绑定ViewModel
                var rMemberBindingTwoWay = rMemberBinding as MemberBindingTwoWay;
                if (rMemberBindingTwoWay != null)
                {
                    rMemberBindingTwoWay.InitEventWatcher();
                }
            }
        }
예제 #7
0
        /// <summary>
        /// 提取游戏包资源到本地目录中
        /// </summary>
        /// <returns></returns>
        IEnumerator OnExtractResource()
        {
            string dataPath = UtilTool.DataPath;         //数据目录
            string pkgPath  = UtilTool.AppContentPath(); //游戏包资源目录

            if (Directory.Exists(dataPath))              //删除所有本地资源
            {
                Directory.Delete(dataPath, true);
            }
            Directory.CreateDirectory(dataPath);

            string pkgMapFile   = pkgPath + "files.txt";
            string localMapFile = dataPath + "files.txt";

            if (File.Exists(localMapFile)) //删除旧的map文件
            {
                File.Delete(localMapFile);
            }

            EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "(此过程不消耗任何流量,请放心等待)首次进入游戏,初始化中...", 100);
            if (Application.platform == RuntimePlatform.Android)
            {
                UnityWebRequest unityWeb = UnityWebRequest.Get(pkgMapFile);
                unityWeb.downloadHandler = new DownloadHandlerFile(pkgMapFile);
                yield return(unityWeb);

                while (!unityWeb.isDone)
                {
                    EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "(此过程不消耗任何流量,请放心等待)首次进入游戏,初始化中...|", unityWeb.downloadProgress * 100);
                    yield return(null);
                }
            }
            else
            {
                File.Copy(pkgMapFile, localMapFile, true);
            }
            yield return(new WaitForEndOfFrame());

            string[] files    = File.ReadAllLines(localMapFile); //释放所有文件到数据目录
            int      count    = files.Length;                    //总文件
            int      step     = 0;                               //第N个文件
            string   lastLine = files[count - 1];

            lastAppVersion = UtilTool.GetVersion(lastLine, 0);//包中的版本号

            foreach (var file in files)
            {
                string[] fs = file.Split('|');
                if (fs.Length != 2)
                {
                    break;
                }
                pkgMapFile   = pkgPath + fs[0];
                localMapFile = dataPath + fs[0];
                EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "(此过程不消耗任何流量,请放心等待)正在准备进入游戏中...", Mathf.FloorToInt((++step * 100 / count)));

//#if !SyncLocal //进行更新场景
//                if (fs[0].Contains("scene/"))
//                {//跳过场景资源,进行动态加载
//                    loaderMgr.CacheAssetBundleLoaderData(fs[0], fs[1]);
//                    continue;
//                }
//#endif
                string dir = Path.GetDirectoryName(localMapFile);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                if (Application.platform == RuntimePlatform.Android)
                {
                    UnityWebRequest unityWeb = UnityWebRequest.Get(pkgMapFile);
                    unityWeb.downloadHandler = new DownloadHandlerFile(pkgMapFile);
                    yield return(unityWeb);
                }
                else
                {
                    if (File.Exists(localMapFile))
                    {
                        File.Delete(localMapFile);
                    }
                    File.Copy(pkgMapFile, localMapFile, true);
                }
                yield return(null);
            }
            yield return(1);

            PlayerPrefs.SetString(appVesionKey, lastAppVersion);                      // 本地记录v1
            cacheAppVersion = lastAppVersion;                                         //解压完成当前的版本号

            CoroutineMgr.Instance.StartCoroutine(assetUpdateCor, OnUpdateResource()); //释放完成,开始启动更新资源
        }
        public override void CSGenerateProcess(CSGenerate rGenerate)
        {
            StartGenerateCommon();
            foreach (var rType in SerializerBinaryTypes.Types)
            {
                var rText = new StringBuilder();

                rText
                .A("using System.IO;").N()
                .A("using Core;").N()
                .A("using Core.Serializer;").N()
                .A("using Game.Serializer;").N()
                .L(2)
                .A("/// <summary>").N()
                .A("/// 文件自动生成无需又该!如果出现编译错误,删除文件后会自动生成").N()
                .A("/// </summary>").N();
                if (!string.IsNullOrEmpty(rType.Namespace))
                {
                    rText
                    .F("namespace {0}", rType.Namespace).N()
                    .A("{").N();
                }
                rText
                .F("public partial class {0}", rType.Name).N()
                .A("{").N();

                var rSerializeMemberInfo = SearchSerializeMember(rType);

                // Serialize Function
                rText
                .T(1).A("public override void Serialize(BinaryWriter rWriter)").N()
                .T(1).A("{").N()
                .T(2).A("base.Serialize(rWriter);").N();
                foreach (var rMemberInfo in rSerializeMemberInfo)
                {
                    var rParamText = GenerateClassMemberDummyText(rMemberInfo);
                    if (rMemberInfo.IsDefined(typeof(SBDynamicAttribute), true) && !IsBaseType(GetMemberType(rMemberInfo), false))
                    {
                        rText.T(2).F("rWriter.SerializeDynamic({0});", rParamText).N();
                    }
                    else
                    {
                        rText.T(2).F("rWriter.Serialize({0});", rParamText).N();
                    }
                }

                rText
                .T(1).A("}").N();

                // Deserialize Function
                rText
                .T(1).A("public override void Deserialize(BinaryReader rReader)").N()
                .T(1).A("{").N()
                .T(2).A("base.Deserialize(rReader);").N();
                foreach (var rMemberInfo in rSerializeMemberInfo)
                {
                    if (rMemberInfo.IsDefined(typeof(SBDynamicAttribute), false) && !IsBaseType(GetMemberType(rMemberInfo), false))
                    {
                        rText.T(2).F("this.{0} = {1}rReader.DeserializeDynamic({2});", rMemberInfo.Name,
                                     GenerateClassMemberTypeText(rMemberInfo),
                                     GenerateClassMemberDummyText(rMemberInfo)).N();
                    }
                    else
                    {
                        rText.T(2).F("this.{0} = {1}rReader.Deserialize({2});", rMemberInfo.Name,
                                     GenerateClassMemberTypeText(rMemberInfo),
                                     GenerateClassMemberDummyText(rMemberInfo)).N();
                    }
                }

                rText
                .T(1).A("}").N();

                rText.A("}").N();
                if (!string.IsNullOrEmpty(rType.Namespace))
                {
                    rText.A("}").N();
                }

                var rGroupName  = string.Empty;
                var rAttributes = rType.GetCustomAttributes <SBGroupAttribute>(true);
                if (rAttributes.Length > 0)
                {
                    rGroupName = rAttributes[0].GroupName;
                }

                rGenerate.Add(rText.ToString(), UtilTool.PathCombine(GeneratePath, rGroupName, rType.FullName + ".Binary.cs"));

                foreach (var rMemberInfo in rSerializeMemberInfo)
                {
                    var bDynamic = rMemberInfo.IsDefined(typeof(SBDynamicAttribute), false);
                    if (rMemberInfo.MemberType == MemberTypes.Field)
                    {
                        AnalyzeGenerateCommon((rMemberInfo as FieldInfo).FieldType, bDynamic);
                    }
                    else if (rMemberInfo.MemberType == MemberTypes.Property)
                    {
                        AnalyzeGenerateCommon((rMemberInfo as PropertyInfo).PropertyType, bDynamic);
                    }
                }
            }
            EndGenerateCommon();

            rGenerate.AddHead(mCommonSerializer.ToString(), CommonSerializerPath);
        }
예제 #9
0
 public void SetCompleted(Action rPlayCompleted)
 {
     this.OnPlayCompleted = () => { UtilTool.SafeExecute(rPlayCompleted); };
     this.mTweener.OnComplete(this.OnPlayCompleted);
 }
예제 #10
0
        /// <summary>
        /// 更新本地文件
        /// </summary>
        /// <returns></returns>
        IEnumerator OnUpdateResource()
        {
            string dataPath = UtilTool.DataPath;  //数据目录

            if (!Directory.Exists(dataPath))
            {
                Directory.CreateDirectory(dataPath);
            }

            string[] lastMapList = UtilTool.GetVersionMap(dataPath + "files.txt");
            int      count       = lastMapList.Length; //总文件
            int      step        = 0;                  //第N个文件
            string   lastLine    = lastMapList[count - 1];
            string   lastVersion = lastLine;           //最近版本号

            gameVersion = lastVersion.Trim();

            //不进行更新 no edit

            bool hasUpdate = false;//是否存在必要更新

            #region 本地资源版本
            //收集当前版本文件信息
            for (int i = 0; i < count; i++)
            {
                if (string.IsNullOrEmpty(lastMapList[i]))
                {
                    continue;
                }
                string[] keyValue = lastMapList[i].Split('|');
                if (keyValue.Length != 2)
                {
                    break;
                }
                localVersionInfo.Add(keyValue[0].Trim(), keyValue[1].Trim());
            }
            lastAppVersion = UtilTool.GetVersion(lastLine, 0); //最近app v1
            string lv2 = UtilTool.GetVersion(lastVersion, 1);  //非UI资源
            string lv3 = UtilTool.GetVersion(lastVersion, 2);  //UI资源
            string lv4 = UtilTool.GetVersion(lastVersion, 3);  //脚本资源
            #endregion

            #region  务器资源版本
            EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "正在通讯中... ", 0);
            string          remoteVersion = lastVersion;//cdn版本号 暂定与本地一样
            string          url           = AppConst.WebUrl;
            string          random        = DateTime.Now.ToString("yyyymmddhhmmss");
            string          webMapUrl     = url + "files.txt?v=" + random;
            UnityWebRequest unityWeb      = new UnityWebRequest(webMapUrl);
            ZLogger.Info("资源位置:" + webMapUrl);
            yield return(unityWeb);

            if (unityWeb.error != null)
            {
                ZLogger.Info("可能网络问题,也可能服务器资源没提交!  此处可以考虑直接进游戏用本地资源[不进行更新 #SyncLocal]");

                #region 临时解决方案(没有连接上cdn 使用本地资源)
                EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "连接不到服务器中心,应用最近版本进入游戏,建议稍候重启游戏更新!!", 100);
                for (int i = 0; i < count; i++)
                {
                    if (string.IsNullOrEmpty(lastMapList[i]))
                    {
                        continue;
                    }
                    string[] keyValue = lastMapList[i].Split('|');
                    if (keyValue.Length != 2)
                    {
                        break;
                    }
                    string f = keyValue[0];

                    //if (keyValue[0].Contains("scene/"))
                    //{//跳过场景资源,进行动态加载
                    //    loaderMgr.CacheAssetBundleLoaderData(keyValue[0], keyValue[1]);
                    //    continue;
                    //}
                }
                yield return(new WaitForSeconds(1));

                OnResourceInited();
                yield break;
                #endregion

                //EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "(此过程不消耗任何流量,请放心等待)请求失败,您的网络可能不稳定,请稍后再重新启动游戏!");
                yield break;
            }
            else
            {
                int p    = Mathf.FloorToInt(unityWeb.downloadProgress * 100);
                int size = Mathf.CeilToInt(9877);
                EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "加载版本配置中,需要消耗流量约 " + size + "kb, 已经完成", p);
            }
            byte[]   webMapData = unityWeb.downloadHandler.data;
            string   webMap     = unityWeb.downloadHandler.text.Trim();
            string[] webMapList = webMap.Split('\n');
            count         = webMapList.Length;
            lastLine      = webMapList[count - 1];
            remoteVersion = lastLine;
            string remoteAppVersion = UtilTool.GetVersion(lastLine, 0);
            string rv2 = UtilTool.GetVersion(remoteVersion, 1); //非UI资源
            string rv3 = UtilTool.GetVersion(remoteVersion, 2); //UI资源
            string rv4 = UtilTool.GetVersion(remoteVersion, 3); //脚本资源
            #endregion
            Debug.Log("服务器版本:" + remoteVersion);
            bool updateV1 = !remoteAppVersion.Equals(lastAppVersion);
            bool updateV2 = (!lv2.Equals(rv2)) || updateV1;
            bool updateV3 = (!lv3.Equals(rv3)) || updateV1;
            bool updateV4 = (!lv4.Equals(rv4)) || updateV1;

            int resCount = 0;
            int resStep  = 0;
            int uiCount  = 0;
            int uiStep   = 0;
            int luaCount = 0;
            int luaStep  = 0;
            if (updateV2 || updateV3 || updateV4) //需要更新时,计算各部分文件总量
            {
                for (int i = 0; i < count; i++)
                {
                    if (string.IsNullOrEmpty(webMapList[i]))
                    {
                        continue;
                    }
                    string[] keyValue = webMapList[i].Split('|');
                    if (keyValue.Length != 2)
                    {
                        break;
                    }
                    if (keyValue[0].Contains("/UI/"))
                    {
                        uiCount++;
                    }
                    else if (keyValue[0].Contains("/Lua/"))
                    {
                        luaCount++;
                    }
                    else
                    {
                        resCount++;
                    }
                }
            }

            for (int i = 0; i < count; i++)
            {
                if (string.IsNullOrEmpty(webMapList[i]))
                {
                    continue;
                }
                string[] keyValue = webMapList[i].Split('|');
                if (keyValue.Length != 2)
                {
                    break;
                }
                string f = keyValue[0].Trim();

                //if (keyValue[0].Contains("scene/"))
                //{//跳过场景资源,进行动态加载
                //    loaderMgr.CacheAssetBundleLoaderData(keyValue[0], keyValue[1]);
                //    continue;
                //}
                if (lastVersion == remoteVersion)//版本一样,不用更新
                {
                    EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, "(此过程不消耗任何流量,请放心等待)初始化游戏环境中... ", Mathf.FloorToInt((++step * 100 / count)));
                    continue;
                }

                string fileUrl     = url + f + "?v=" + random; //接取服务器资源
                string localfile   = (dataPath + f).Trim();
                bool   canUpdate   = false;                    // 是否需要更新
                string path        = "";
                string message     = "";
                bool   checkUpdate = false;
                checkUpdate = ((f.Contains("/UI/") && updateV3) || (f.Contains("/Lua/") && updateV4) || updateV2);

                if (checkUpdate)
                {
                    canUpdate = !File.Exists(localfile);
                    path      = Path.GetDirectoryName(localfile);
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    if (!canUpdate) //检查是否更新
                    {
                        string localKey = "*";
                        if (localVersionInfo.ContainsKey(f))
                        {
                            localKey = localVersionInfo[f];
                        }
                        string remoteKey = keyValue[1].Trim();
                        canUpdate = !remoteKey.Equals(localKey);
                        if (canUpdate)
                        {
                            File.Delete(localfile);
                        }
                    }
                }

                if (canUpdate) //更新或新增文件
                {
                    //方式1 UnityWebRequest更新
                    hasUpdate = true; //Debug.Log("更新-->" + fileUrl);
                    unityWeb  = new UnityWebRequest(fileUrl);
                    yield return(unityWeb);

                    if (unityWeb.error != null)
                    {
                        OnUpdateFailed(path);
                        yield break;
                    }
                    int size = 0;
                    if (f.Contains("/UI/"))
                    {
                        size    = 311 * uiCount;
                        message = String.Format("正在更新{0}文件, 需要消耗流量约 {1} kb", "UI", size);
                        EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, message, Mathf.FloorToInt((++uiStep) * 100 / uiCount));
                    }
                    else if (f.Contains("/Lua/"))
                    {
                        size    = 6 * luaCount;
                        message = String.Format("正在更新{0}文件, 需要消耗流量约 {1} kb", "Lua", size);
                        EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, message, Mathf.FloorToInt((++luaStep) * 100 / luaCount));
                    }
                    else
                    {
                        size    = 151 * resCount;
                        message = String.Format("正在更新{0}文件, 需要消耗流量约 {1} kb", "环境", size);
                        EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_PROGRESS, message, Mathf.FloorToInt((++resStep) * 100 / resCount));
                    }
                    //byte[] tempDownByte = unityWeb.downloadHandler.data;
                    File.WriteAllBytes(localfile, unityWeb.downloadHandler.data);
                    yield return(null);
                }
            }
            if (hasUpdate)
            {
                File.WriteAllBytes(dataPath + "files.txt", webMapData);
                PlayerPrefs.SetString(appVesionKey, remoteAppVersion); // 本地记录v1
                cacheAppVersion = remoteAppVersion;                    //解压完成当前的版本号
                gameVersion     = remoteVersion.Trim();
                ZLogger.Info("写入版本号");
            }

            //Debug.Log("=================版本:===================>>最近:" + lastVersion + "| 远程:" + remoteVersion);
            yield return(new WaitForEndOfFrame());

            EventMgr.Instance.TriggerEvent(UpdataConst.LOADER_COMPLETED, " 游戏更新检查完毕!!", 100);
            OnResourceInited();
            yield return(0);
        }
예제 #11
0
        private void btnBindUser_Click(object sender, EventArgs e)
        {
            #region 保存前验证

            if (string.IsNullOrEmpty(txtUserCode.Text.Trim()))
            {
                MessageBox.Show("用户编码不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(txtImgPath.Text.Trim()))
            {
                MessageBox.Show("图片路径不能为空!");
                return;
            }

            var caUserName = txtCaName.Text.Trim();
            if (string.IsNullOrEmpty(txtCaId.Text.Trim() + caUserName))
            {
                MessageBox.Show("CAId和Ca用户名不能为空,请先点击读取!");
            }

            var dtYh = GetYHXX(txtUserCode.Text.Trim());
            if (dtYh.Rows.Count == 0)
            {
                MessageBox.Show($"没有找到用户:" + txtUserCode.Text.Trim());
                return;
            }

            var dbUserName = dtYh.Rows[0]["F_YHMC"].ToString().Trim();
            if (dbUserName != caUserName)
            {
                DialogResult r = MessageBox.Show($"用户姓名验证失败!\r\nUKey姓名为:{dbUserName};朗珈用户姓名为:{caUserName}\r\n是否继续绑定?",
                                                 "", MessageBoxButtons.YesNo);
                if (r != DialogResult.Yes)
                {
                    return;
                }
            }

            #endregion

            #region 把CaId保存到用户表BY2字段

            odbcdb aa  = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            string sql = $"update t_yh set F_YH_BY2='{txtCaId.Text.Trim()}' where f_yhm='{txtUserCode.Text.Trim()}' ";
            try
            {
                aa.ExecuteSQL(sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show("绑定失败,执行sql时出现异常:" + ex);
                return;
            }
            finally
            {
                aa.Close();
            }

            #endregion

            #region 获取ca签名图片并上传到指定路径,图片名称为 ca用户姓名.bmp

            IPDFSign iPDFSign = new PDFSign();
            //选择证书
            iPDFSign.SelectCert("netca", 0);
            IUtilTool iUtilTool = new UtilTool();
            //传入选中的签名证书的base64编码
            string CertBase64 = iPDFSign.SignCertBase64Encode;
            if (CertBase64.Trim() == "")
            {
                MessageBox.Show("获取签名证书的base64编码失败");
                return;
            }
            try
            {
                //log.WriteMyLog("CertBase64:"+CertBase64);
                byte[] image = iUtilTool.GetImageFromDevicByCert(CertBase64);
                try
                {
                    MemoryStream memoryStream = new MemoryStream(image, 0, image.Length);
                    memoryStream.Write(image, 0, image.Length);
                    //转成图片
                    Image ii = Image.FromStream(memoryStream);
                    ii.Save(txtImgPath.Text + caUserName + ".bmp", ImageFormat.Bmp);
                }
                catch (Exception ee4)
                {
                    MessageBox.Show("保存签名图片失败:" + ee4.Message);
                    return;
                }
            }
            catch (Exception ex1)
            {
                MessageBox.Show("保存签名图片时出现异常:" + ex1);
                return;
            }

            #endregion

            MessageBox.Show("绑定成功!");
        }
예제 #12
0
 protected override void DestroyCustom()
 {
     UtilTool.SafeDestroy(this.Mesh);
 }
예제 #13
0
        public JsonResult Actividad(FormCollection FormData)
        {
            ViewBag.error = "";
            int rowid_actividad = 0;

            try
            {
                FormCollection form = DeSerialize(FormData);
                try
                {
                    rowid_actividad = int.Parse(form["rowid_actividad"]);
                }
                catch { }

                Usuario usuario = ((Usuario)Session["curUser"]);

                Actividad actividad = db.Actividad.Where(f => f.RowID == rowid_actividad).FirstOrDefault();

                if (actividad == null)//insertar
                {
                    actividad = new Actividad();
                    actividad.UsuarioCreacion = usuario.NombreUsuario;
                    actividad.FechaCreacion   = UtilTool.GetDateTime();
                }
                else//modificar
                {
                    actividad.UsuarioModificacion = usuario.NombreUsuario;
                    actividad.FechaModificacion   = UtilTool.GetDateTime();
                }

                actividad.EstadoID     = int.Parse(form["rowid_estado"]);
                actividad.Tema         = form["tema"];
                actividad.PrioridadID  = int.Parse(form["ind_prioridad"]);
                actividad.FechaInicial = DateTime.Parse(form["fecha_inicial"]);
                actividad.FechaFinal   = DateTime.Parse(form["fecha_final"]);
                actividad.TipoID       = int.Parse(form["tipo"]);
                //actividad.TipoRelacionID = int.Parse(form["tipo_relacion"]);
                try
                {
                    int    a    = int.Parse(form["tipo_relacion"]);
                    Opcion data = db.Opcion.Where(f => f.RowID == a).FirstOrDefault();
                    actividad.TipoRelacionID = data.RowID;
                    if (data.Nombre == "CLIENTE")
                    {
                        actividad.TerceroERPID = int.Parse(form["rowid_relacion"]);
                    }
                    else if (data.Nombre == " CONTACTO")
                    {
                        actividad.ContactoID = int.Parse(form["rowid_relacion"]);
                    }
                }
                catch { }

                actividad.Descripcion = form["descripcion"];


                if (rowid_actividad == 0)
                {
                    db.Actividad.Add(actividad);
                }


                db.SaveChanges();

                return(Json(actividad.RowID));
            }
            catch (Exception e)
            {
                Response.StatusCode        = 500;
                Response.StatusDescription = e.Message.ToString();
                return(Json("Se presento un problema al momento de almacenar los datos, intente nuevamente"));
            }
        }
예제 #14
0
 private void EventHandler()
 {
     UtilTool.SafeExecute(this.mAction, new EventArg());
 }
예제 #15
0
    /// <summary>
    /// OnCollisionEnter2D is called when this collider/rigidbody has begun
    /// touching another rigidbody/collider.
    /// </summary>
    /// <param name="other">The Collision data associated with this collision.</param>
    void OnCollisionEnter2D(Collision2D other)
    {
        string collider_name = UtilTool.getOriName(other.gameObject.name);

        if (other.gameObject.tag == "stair")
        {
            addHp(2); // 踩一個階梯 +2 hp
        }

        if (other.gameObject.tag == "Drug")
        {
            effHash[collider_name].NextTime  = System.Math.Max(effHash[collider_name].NextTime, _timer) + effHash[collider_name].DefaultTime;
            effHash[collider_name].IsTrigger = true;

            switch (collider_name)
            {
            case "Bath_salts":
                // 浴鹽 (突然暴衝 0.5f)
                moveSpeed *= 2;
                effHash["Bath_salts"].Triggered = true;
                break;

            case "Heroin":
                // 海洛因 (行動緩慢)
                moveSpeed /= 2;
                effHash["Heroin"].Triggered = true;
                break;

            case "Ketamine":
                // K他命 (血條逐漸變少)
                effHash["Ketamine"].Triggered = true;
                break;

            case "MDMA":
                // 搖頭丸 (走一下停一下)
                effHash["MDMA"].Triggered = true;
                break;

            case "NewDrugs":
                // 新興藥物 (相反方向)
                if (effHash["NewDrugs"].Triggered)
                {
                    // effHash["NewDrugs"].NextTime += effHash["NewDrugs"].DefaultTime;
                }
                else
                {
                    effHash["NewDrugs"].Triggered = true;
                    facingRight = false;
                }
                break;

            case "Amphetamines":
                // 安非他命 (出現分身,且分身不受控)
                GameObject playerClone = objPool.ReUse("Player", transform.position + new Vector3(Random.Range(-1, 1), 0, 0), transform.rotation);
                Debug.Log("playerClone:" + playerClone.name);
                playerClone.GetComponent <PlayerCtrl> ().IsClone     = true;
                playerClone.GetComponent <PlayerCtrl> ().moveSpeed  *= -1;
                playerClone.GetComponent <PlayerCtrl> ().facingRight = !playerClone.GetComponent <PlayerCtrl> ().facingRight;
                playerClone.GetComponent <PlayerCtrl> ().Life_time   = effHash["Amphetamines"].DefaultTime;
                playerClone.name = "NonPlayer";
                break;

            case "Health_bag":
                addHp(20);
                break;
            }
        }
    }
예제 #16
0
        /// <summary>
        /// 得到Persistent空间下的Url路径
        /// </summary>
        public string GetPersistentUrl(Platform rPlatform)
        {
            int rPlatformIndex = (int)rPlatform;

            return(PlatformPrefixs[rPlatformIndex] + UtilTool.PathCombine(Application.persistentDataPath, PlatformNames[rPlatformIndex] + "_Assetbundles") + "/");
        }
예제 #17
0
        public void DataBindingDisconnect(ViewControllerContainer rViewControllerContainer)
        {
            if (!rViewControllerContainer)
            {
                return;
            }

            var rAllMemberBindings = rViewControllerContainer.gameObject.GetComponentsInChildren <MemberBindingAbstract>(true);

            for (int i = 0; i < rAllMemberBindings.Length; i++)
            {
                var rMemberBinding = rAllMemberBindings[i];
                if (rMemberBinding.ViewModelProp == null)
                {
                    continue;
                }

                ViewModel rViewModel = rMemberBinding.ViewModelProp.PropertyOwner as ViewModel;
                if (rViewModel != null)
                {
                    if (rMemberBinding)
                    {
                        rViewModel.PropChangedHandler -= rMemberBinding.ViewModelPropertyWatcher.PropertyChanged;
                    }
                }
                if (rMemberBinding)
                {
                    rMemberBinding.OnDestroy();
                }
            }

            var rListViewModelDataSources = UtilTool.GetComponentsInChildrenUtilOrigin <ViewModelDataSourceList>(rViewControllerContainer);

            for (int i = 0; i < rListViewModelDataSources.Count; i++)
            {
                var       rViewModelDataSource = rListViewModelDataSources[i];
                ViewModel rViewModel           = rViewModelDataSource.ViewModelProp.PropertyOwner as ViewModel;
                if (rViewModel != null)
                {
                    rViewModel.PropChangedHandler -= rViewModelDataSource.ViewModelPropertyWatcher.PropertyChanged;
                }
            }

            var rTabViewModelDataSources = rViewControllerContainer.gameObject.GetComponentsInChildren <ViewModelDataSourceTab>(true);

            for (int i = 0; i < rTabViewModelDataSources.Length; i++)
            {
                var       rViewModelDataSource = rTabViewModelDataSources[i];
                ViewModel rViewModel           = rViewModelDataSource.ViewModelProp.PropertyOwner as ViewModel;
                if (rViewModel != null)
                {
                    rViewModel.PropChangedHandler -= rViewModelDataSource.ViewModelPropertyWatcher.PropertyChanged;
                }
            }

            var rArrayViewModelDataSources = rViewControllerContainer.gameObject.GetComponentsInChildren <ViewModelDataSourceArray>(true);

            for (int i = 0; i < rArrayViewModelDataSources.Length; i++)
            {
                var       rViewModelDataSource = rArrayViewModelDataSources[i];
                ViewModel rViewModel           = rViewModelDataSource.ViewModelProp.PropertyOwner as ViewModel;
                if (rViewModel != null)
                {
                    rViewModel.PropChangedHandler -= rViewModelDataSource.ViewModelPropertyWatcher.PropertyChanged;
                }
            }

            var rAllEventBindings = rViewControllerContainer.gameObject.GetComponentsInChildren <EventBinding>(true);

            for (int i = 0; i < rAllEventBindings.Length; i++)
            {
                rAllEventBindings[i].OnDestroy();
            }
        }
예제 #18
0
파일: ViewModel.cs 프로젝트: skywood/knight
 public void PropChanged(string rPropName)
 {
     UtilTool.SafeExecute(this.PropChangedHandler, rPropName);
 }
예제 #19
0
 public void Destroy()
 {
     this.mObjectPool.Destroy();
     UtilTool.SafeDestroy(this.mRootGo);
 }
예제 #20
0
 public void OnExitGameButton_Clicked()
 {
     UtilTool.ExitApplication();
 }
예제 #21
0
 private void OnDestroy(AudioSource rAudioSource)
 {
     UtilTool.SafeDestroy(rAudioSource);
 }
예제 #22
0
        /// <summary>
        /// 初始化View,如果是Dispatch类型的话,只对curViews顶层View进行交换
        /// </summary>
        public async Task <View> OpenView(string rViewName, GameObject rViewPrefab, View.State rViewState, Action <View> rOpenCompleted)
        {
            if (rViewPrefab == null)
            {
                return(null);
            }

            //把View的GameObject结点加到rootCanvas下
            GameObject rViewGo = null;

            switch (rViewState)
            {
            case View.State.Fixing:
                rViewGo = this.DynamicRoot.transform.AddChildNoScale(rViewPrefab, "UI");
                break;

            case View.State.Popup:
                rViewGo = this.PopupRoot.transform.AddChildNoScale(rViewPrefab, "UI");
                break;

            case View.State.Frame:
                rViewGo = this.FrameRoot.transform.AddChildNoScale(rViewPrefab, "UI");
                break;

            case View.State.PageSwitch:
            case View.State.PageOverlap:
                rViewGo = this.PageRoot.transform.AddChildNoScale(rViewPrefab, "UI");
                break;
            }

            var    rView     = View.CreateView(rViewGo);
            string rViewGUID = Guid.NewGuid().ToString();   //生成GUID

            if (rView == null)
            {
                Debug.LogErrorFormat("GameObject {0} is null.", rViewGo.name);
                UtilTool.SafeExecute(rOpenCompleted, null);
                return(null);
            }

            //新的View的存储逻辑
            switch (rViewState)
            {
            case View.State.Fixing:
                mCurFixedViews.Add(rViewGUID, rView);
                break;

            case View.State.Frame:
                mCurFrameViews.Add(rViewGUID, rView);
                break;

            case View.State.PageSwitch:
                if (mCurPageViews.Count == 0)
                {
                    mCurPageViews.Add(rViewGUID, rView);
                }
                else
                {
                    var rTopNode = this.mCurPageViews.Last();
                    mCurPageViews.Remove(rTopNode.Key);
                    mCurPageViews.Add(rViewGUID, rView);
                }
                break;

            case View.State.PageOverlap:
                mCurPageViews.Add(rViewGUID, rView);
                break;

            case View.State.Popup:
                mCurPageViews.Add(rViewGUID, rView);
                break;

            default:
                break;
            }

            try
            {
                await rView.Initialize(rViewName, rViewGUID, rViewState);   //为View的初始化设置

                await rView.Open();
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message + "\n" + e.StackTrace);
            }
            UtilTool.SafeExecute(rOpenCompleted, rView);

            return(rView);
        }
예제 #23
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        public void Export(ExcelFormat rExcelFormat)
        {
            string rConfigFile = UtilTool.PathCombine(this.ExcelConfigRootPath, "Excel", rExcelFormat.ExcelName);
            string rExportDir  = UtilTool.PathCombine(this.ExcelConfigRootPath, "Text");

            FileStream       rStream      = File.Open(rConfigFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            IExcelDataReader rExcelReader = ExcelReaderFactory.CreateOpenXmlReader(rStream);
            DataSet          rResult      = rExcelReader.AsDataSet();
            DataTable        rDataTable   = rResult.Tables[rExcelFormat.SheetName];

            if (rDataTable == null)
            {
                Debug.LogErrorFormat("Excel {0} has not sheet {1}.", rExcelFormat.ExcelName, rExcelFormat.SheetName);
                rExcelReader.Close();
                rStream.Close();
                return;
            }
            int rColumns = rDataTable.Columns.Count;
            int rRows    = rDataTable.Rows.Count;

            if (rRows == 0)
            {
                Debug.LogErrorFormat("Excel {0} has empty rows.", rExcelFormat.ExcelName);
                rExcelReader.Close();
                rStream.Close();
                return;
            }

            Type rDataType = MainAssemblyExpand.GetType(rExcelFormat.ClassName);

            if (rDataType == null)
            {
                Debug.LogErrorFormat("Excel {0} can not find Class {1}, please check it.", rExcelFormat.ExcelName, rExcelFormat.ClassName);
                rExcelReader.Close();
                rStream.Close();
                return;
            }

            var rTitleRow = rDataTable.Rows[0];
            var rFields   = new Dict <string, FieldInfo>();
            var rKeyIDs   = new Dict <string, int>();

            for (int i = 0; i < rColumns; i++)
            {
                FieldInfo rFileInfo = rDataType.GetField(rTitleRow[i].ToString());
                rFields.Add(rTitleRow[i].ToString(), rFileInfo);
                rKeyIDs.Add(rTitleRow[i].ToString(), i);
            }

            JsonNode rDataJson = new JsonClass();

            for (int i = 1; i < rRows; i++)
            {
                JsonNode rItemJson = new JsonClass();
                foreach (var rPair in rFields)
                {
                    string     rFieldValue = rDataTable.Rows[i][rKeyIDs[rPair.Key]].ToString();
                    JsonParser rJsonParser = new JsonParser(rFieldValue);
                    JsonNode   rTempNode   = null;
                    try {
                        rTempNode = rJsonParser.Parser();
                    }
                    catch (Exception) {
                        rJsonParser.isValid = false;
                    }
                    if (!rJsonParser.isValid)
                    {
                        rTempNode = new JsonData(rFieldValue);
                    }

                    rItemJson.Add(rPair.Key, rTempNode);
                }
                rDataJson.Add(rDataTable.Rows[i][rKeyIDs[rExcelFormat.PrimaryKey]].ToString(), rItemJson);
            }
            File.WriteAllText(UtilTool.PathCombine(rExportDir, rExcelFormat.SheetName + ".json"), rDataJson.ToString());
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            rExcelReader.Close();
            rStream.Close();
        }
예제 #24
0
        public string ca(string yhxx)
        {
            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");

            ////-------获取sz中设置的参数---------------------
            string debug   = f.ReadString("CA", "debug", "").Replace("\0", "").Trim();
            string msg     = f.ReadString("CA", "message", "1").Replace("\0", "").Trim();
            string isywb64 = f.ReadString("CA", "ywb64", "1").Replace("\0", "").Trim();

            string getblh = "";
            string type   = "";
            string type2  = "";
            string yhm    = "";

            string yhmc = "";
            string yhbh = "";
            string yhmm = "";
            string bglx = "";
            string bgxh = "";

            #region CA登陆
            if (ZGQClass.GetSZ("CA", "ca", "").Replace("\0", "").Trim() == "1")
            {
                if (yhxx == "")
                {
                    return(Login());
                }
            }
            #endregion
            string[] getyhxx = yhxx.Split('^');
            if (getyhxx.Length == 5)
            {
                type = getyhxx[0];
                yhm  = getyhxx[1];
                yhmc = getyhxx[3];
                yhbh = getyhxx[2];
                yhmm = getyhxx[4];
            }
            else
            {
                type2  = getyhxx[0];
                getblh = getyhxx[1];
                bgxh   = getyhxx[2];
                bglx   = getyhxx[3].ToLower();
                type   = getyhxx[4];
                yhm    = getyhxx[5];
                yhmc   = getyhxx[6];
                yhbh   = getyhxx[7];
                yhmm   = getyhxx[8];
            }


            #region 审核前验证KEY


            if (type == "SH")
            {
                return(YZKEY(msg, yhmc, yhbh));
            }
            #endregion

            string blbh = getblh + bglx + bgxh;
            #region 审核后执行,数字签名

            if (type == "QZ")
            {
                NETCAPKI oNetcaPki = new NETCAPKI();

                if (debug == "1")
                {
                    MessageBox.Show("审核签字");
                }

                string yw = "";

                bool WithTSA = false;//带时间戳签名
                if ((f.ReadString("ca", "WithTSA", "0").Trim().Replace("\0", "").Trim()) == "1")
                {
                    WithTSA = true;//签名值包含原文
                }
                bool havcount = false;
                bool isVerify = false; //网关验证
                if ((f.ReadString("ca", "isVerify", "0").Trim().Replace("\0", "").Trim()) == "1")
                {
                    isVerify = true;
                }
                string    usapurl    = f.ReadString("ca", "usapurl", "").Trim().Replace("\0", "").Trim();     //网关地址
                string    svrcertb64 = f.ReadString("ca", "svrcertb64", "1").Trim().Replace("\0", "").Trim(); //网关证书
                string    b64SignVal = "";
                int       oCert      = 0;
                DataTable dt_jcxx    = new DataTable();
                DataTable dt_bc      = new DataTable();
                DataTable dt_bd      = new DataTable();
                try
                {
                    #region 原文

                    dt_jcxx = aa.GetDataTable("select * from T_JCXX where  F_BLH='" + getblh + "'", "cgbg");

                    if (dt_jcxx == null)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("连接数据库异常");
                        }
                        return("0");
                    }
                    if (dt_jcxx.Rows.Count <= 0)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("T_JCXX查询数据异常");
                        }
                        return("0");
                    }
                    if (bglx == "cg")
                    {
                        if (dt_jcxx.Rows[0]["F_BGZT"].ToString() != "已审核")
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("报告未审核");
                            }
                            return("0");
                        }
                        yw = "病理号:" + dt_jcxx.Rows[0]["f_blh"].ToString() + "&常规报告&&性别:" + dt_jcxx.Rows[0]["F_XB"].ToString() + "&年龄:" + dt_jcxx.Rows[0]["F_nl"].ToString()
                             + "&住院号:" + dt_jcxx.Rows[0]["F_zyh"].ToString() + "&门诊号:" + dt_jcxx.Rows[0]["F_mzh"].ToString() + "&身份证号:" + dt_jcxx.Rows[0]["F_SFZH"].ToString() + "&科室:" + dt_jcxx.Rows[0]["F_sjks"].ToString()
                             + "&病理诊断:" + dt_jcxx.Rows[0]["F_blzd"].ToString() + "&报告医生:" + dt_jcxx.Rows[0]["F_bgys"].ToString() + "&复诊医生:" + dt_jcxx.Rows[0]["F_FZYS"].ToString()
                             + "&审核医生:" + dt_jcxx.Rows[0]["F_SHYS"].ToString() + "&报告日期:" + dt_jcxx.Rows[0]["F_bgrq"].ToString() + "&审核日期:" + dt_jcxx.Rows[0]["F_spare5"].ToString();
                    }
                    //// 补充审核
                    if (bglx == "bc")
                    {
                        dt_bc = aa.GetDataTable("select * from T_BCBG where  F_BLH='" + getblh + "' and F_BC_BGZT='已审核'and F_BC_BGXH='" + bgxh + "'", "bcbg");
                        if (dt_bc == null)
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("连接数据库异常");
                            }
                            return("0");
                        }
                        if (dt_bc.Rows.Count <= 0)
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("T_BCBG查询数据异常");
                            }
                            return("0");
                        }
                        yw = "病理号:" + dt_jcxx.Rows[0]["f_blh"].ToString() + "&补充报告:" + bgxh + "&性别:" + dt_jcxx.Rows[0]["F_XB"].ToString() + "&年龄:" + dt_jcxx.Rows[0]["F_nl"].ToString()
                             + "&住院号:" + dt_jcxx.Rows[0]["F_zyh"].ToString() + "&门诊号:" + dt_jcxx.Rows[0]["F_mzh"].ToString() + "&身份证号:" + dt_jcxx.Rows[0]["F_SFZH"].ToString() + "&科室:" + dt_jcxx.Rows[0]["F_sjks"].ToString()
                             + "&病理诊断:" + dt_bc.Rows[0]["F_BCZD"].ToString() + "&报告医生:" + dt_bc.Rows[0]["F_bc_bgys"].ToString() + "&复诊医生:" + dt_bc.Rows[0]["F_bc_FZYS"].ToString()
                             + "&审核医生:" + dt_bc.Rows[0]["F_bc_SHYS"].ToString() + "&报告日期:" + dt_bc.Rows[0]["F_bc_bgrq"].ToString() + "&审核日期:" + dt_bc.Rows[0]["F_bc_spare5"].ToString();
                    }
                    ///// 小冰冻审核
                    if (bglx == "bd")
                    {
                        dt_bd = aa.GetDataTable("select * from T_BDBG  where  F_BLH='" + getblh + "' and  F_BD_BGZT='已审核' and F_BD_BGXH='" + bgxh + "'", "bcbg");
                        if (dt_bd == null)
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("连接数据库异常");
                            }
                            return("0");
                        }
                        if (dt_bd.Rows.Count <= 0)
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("T_BDBG查询数据异常");
                            }
                            return("0");
                        }
                        yw = "病理号:" + dt_jcxx.Rows[0]["f_blh"].ToString() + "&冰冻报告:" + bgxh + "&性别:" + dt_jcxx.Rows[0]["F_XB"].ToString() + "&年龄:" + dt_jcxx.Rows[0]["F_nl"].ToString()
                             + "&住院号:" + dt_jcxx.Rows[0]["F_zyh"].ToString() + "&门诊号:" + dt_jcxx.Rows[0]["F_mzh"].ToString() + "&身份证号:" + dt_jcxx.Rows[0]["F_SFZH"].ToString() + "&科室:" + dt_jcxx.Rows[0]["F_sjks"].ToString()
                             + "&病理诊断:" + dt_bd.Rows[0]["F_BdZD"].ToString() + "&报告医生:" + dt_bd.Rows[0]["F_bd_bgys"].ToString() + "&复诊医生:" + dt_bd.Rows[0]["F_bd_FZYS"].ToString()
                             + "&审核医生:" + dt_bd.Rows[0]["F_bd_SHYS"].ToString() + "&报告日期:" + dt_bd.Rows[0]["F_bd_bgrq"].ToString();
                    }

                    if (yw.Trim() == "")
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("数字签名内容为空");
                        }
                        return("0");
                    }

                    #endregion


                    if (isywb64 == "1")
                    {
                        yw = changebase64(yw);
                    }

                    #region 签名
                    try
                    {
                        ////签名
                        if (WithTSA)
                        {
                            b64SignVal = oNetcaPki.SignPKCS7WithTSA(yw, havcount, usapurl); //时间戳签名
                        }
                        else
                        {
                            b64SignVal = oNetcaPki.SignPKCS7(yw, havcount);  //不带时间戳签名
                        }
                    }
                    catch (Exception ee1)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("签名失败:" + ee1.Message);
                        }
                        return("0");
                    }
                    if (b64SignVal == "")
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("签名失败");
                        }
                        return("0");
                    }
                    #endregion

                    #region 验签

                    try
                    {
                        oCert = oNetcaPki.VerifyPKCS7(b64SignVal, yw);
                    }
                    catch (Exception ee2)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("验签失败:" + ee2.Message);
                        }
                        return("0");
                    }
                    if (oCert == 0)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("验签失败");
                        }
                        return("0");
                    }
                    #endregion

                    #region   验证证书
                    if (isVerify)
                    {
                        try
                        {
                            bool bFlag = oNetcaPki.VerifyCert(usapurl, svrcertb64, 1, oCert);        //再验证证书
                            if (!bFlag)
                            {
                                MessageBox.Show("签名证书验证失败");
                                return("0");
                            }
                        }
                        catch (Exception ee3)
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("签名证书验证失败:" + ee3.Message);
                            }
                            return("0");
                        }
                    }
                    #endregion

                    // 签字
                }
                catch (Exception ex)
                {
                    MessageBox.Show("签名异常:" + ex.Message);
                    return("0");
                }
                #region 签名完成,写数据库

                string errmsg = "";
                int    x      = aa.ExecuteSQL("insert into T_SZQM(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_CZY,F_YW,F_SignCert,F_SignData,F_QZRQ) values('" + blbh + "','"
                                              + getblh + "','" + bglx + "','" + bgxh + "','" + yhmc + "','" + yw + "','"
                                              + oCert.ToString() + "','" + b64SignVal.ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')");

                if (debug == "1")
                {
                    if (x >= 1)
                    {
                        MessageBox.Show("写入T_CAXX完成");
                    }
                    else
                    {
                        MessageBox.Show("写入T_CAXX失败:" + errmsg);
                    }
                }

                #endregion



                if (f.ReadString("ca", "hqkeytp", "0").Trim().Replace("\0", "").Trim() == "1")
                {
                    #region 获取签字图片

                    string szqmlj = ZGQClass.GetSZ("view", "szqmlj", @"\\127.0.0.1\pathqc\rpt-szqm\YSBMP\");


                    try
                    {
                        IPDFSign iPDFSign = new PDFSign();
                        //选择证书
                        iPDFSign.SelectCert("netca", 0);
                        IUtilTool iUtilTool = new UtilTool();
                        //传入选中的签名证书的base64编码
                        string CertBase64 = iPDFSign.SignCertBase64Encode;
                        if (CertBase64.Trim() == "")
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("获取签名证书的base64编码失败");
                            }
                            return("0");
                        }
                        try
                        {
                            byte[] image = iUtilTool.GetImageFromDevicByCert(CertBase64);
                            try
                            {
                                MemoryStream memoryStream = new MemoryStream(image, 0, image.Length);
                                memoryStream.Write(image, 0, image.Length);
                                //转成图片
                                Image ii = Image.FromStream(memoryStream);
                                ii.Save(szqmlj + yhmc + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                            }
                            catch (Exception ee4)
                            {
                                if (msg == "1")
                                {
                                    MessageBox.Show("保存签名图片失败:" + ee4.Message);
                                }
                                return("0");
                            }



                            string pdfszqz = ZGQClass.GetSZ("CA", "pdfszqz", "1");
                            if (pdfszqz == "1")
                            {
                                #region  生成pdf
                                string blh = getblh;
                                try
                                {
                                    if (bglx == "")
                                    {
                                        bglx = "cg";
                                    }
                                    if (bgxh == "")
                                    {
                                        bgxh = "1";
                                    }

                                    string bgzt     = "";
                                    string filename = dt_jcxx.Rows[0]["F_SPARE5"].ToString();
                                    if (bglx.ToLower() == "bd")
                                    {
                                        bgzt     = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                                        filename = dt_bd.Rows[0]["F_BD_bgrq"].ToString();
                                    }
                                    if (bglx.ToLower() == "bc")
                                    {
                                        bgzt     = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                                        filename = dt_bc.Rows[0]["F_Bc_SPARE5"].ToString();
                                    }
                                    if (bglx.ToLower() == "cg")
                                    {
                                        bgzt     = dt_jcxx.Rows[0]["F_BGZT"].ToString();
                                        filename = dt_jcxx.Rows[0]["F_SPARE5"].ToString();
                                    }

                                    if (bgzt == "已审核")
                                    {
                                        try
                                        {
                                            filename = blh.Trim() + "_" + bglx.ToLower() + "_" + bgxh + "_" + DateTime.Parse(filename.Trim()).ToString("yyyyMMddHHmmss") + ".pdf";
                                        }
                                        catch
                                        {
                                            filename = blh.Trim() + "_" + bglx.ToLower() + "_" + bgxh + ".pdf";
                                        }
                                        string ml      = DateTime.Parse(dt_jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                                        string pdfpath = "";
                                        string rptpath = ZGQClass.GetSZ("ca", "rptpath", "rpt").Replace("\0", "").Trim();

                                        string     scpdffs = f.ReadString("ca", "scpdffs", "1").Replace("\0", "").Trim();
                                        ZGQ_PDFJPG zgq = new ZGQ_PDFJPG();
                                        string     message = ""; string filePath = "";

                                        //生成PDF
                                        string ErrMsg = "";
                                        bool   pdf1   = zgq.CreatePDFJPG(blh, bglx, bgxh, ref filename, rptpath, ZGQ_PDFJPG.type.PDF, ref ErrMsg);
                                        if (!pdf1)
                                        {
                                            MessageBox.Show("生成PDF失败,请重新审核\r\n" + ErrMsg);
                                            DeleteTempFile(blh);
                                            return("0");
                                        }

                                        if (!File.Exists(filename))
                                        {
                                            MessageBox.Show("生成PDF失败,请重新审核");
                                            DeleteTempFile(blh);
                                            return("0");
                                        }

                                        filePath = filename;
                                        if (zgq.UpPDF(blh, filename, ml, 0, ref errmsg, ref pdfpath))
                                        {
                                            if (debug == "1")
                                            {
                                                log.WriteMyLog("上传PDF成功");
                                            }
                                            filename = filePath.Substring(filePath.LastIndexOf('\\') + 1);
                                            ZGQClass.BGHJ(blh, "上传PDF", "审核", "上传PDF成功:" + ml + "\\" + filename, "ZGQJK", "上传PDF");
                                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "'");
                                            aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME,F_FilePath,F_PDFLX) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + ml + "\\" + blh + "','" + filename + "','" + pdfpath + "','')");
                                        }
                                        else
                                        {
                                            MessageBox.Show("上传签字PDF失败,请重新审核\r\n" + errmsg);
                                            ZGQClass.BGHJ(blh, "上传PDF", "审核", "上传PDF失败:" + errmsg, "ZGQJK", "上传PDF");
                                        }
                                        //上传pdf

                                        iPDFSign.SetImage(image);
                                        iPDFSign.RenderMode  = 3;
                                        iPDFSign.SrcFileName = filePath;
                                        string szqm_filename = filePath.Replace(".pdf", "_szqm.pdf");
                                        iPDFSign.DestFileName = szqm_filename;
                                        int xPos   = int.Parse(ZGQClass.GetSZ("ca", "xPos", "350").Replace("\0", "").Trim());
                                        int yPos   = int.Parse(ZGQClass.GetSZ("ca", "yPos", "100").Replace("\0", "").Trim());
                                        int width  = int.Parse(ZGQClass.GetSZ("ca", "width", "80").Replace("\0", "").Trim());
                                        int height = int.Parse(ZGQClass.GetSZ("ca", "height", "40").Replace("\0", "").Trim());
                                        iPDFSign.SignPosition(1, xPos, yPos, width, height);

                                        if (File.Exists(szqm_filename))
                                        {
                                            //上传签字的pdf

                                            if (zgq.UpPDF(blh, szqm_filename, ml, 0, ref errmsg, ref pdfpath))
                                            {
                                                if (debug == "1")
                                                {
                                                    log.WriteMyLog("上传签字PDF成功");
                                                }
                                                szqm_filename = szqm_filename.Substring(szqm_filename.LastIndexOf('\\') + 1);
                                                ZGQClass.BGHJ(blh, "上传PDF", "审核", "上传签字PDF成功:" + ml + "\\" + szqm_filename, "ZGQJK", "上传PDF");
                                                aa.ExecuteSQL("delete T_BG_PDF_CA  where F_BLBH='" + blbh + "'");
                                                aa.ExecuteSQL("insert  into T_BG_PDF_CA(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME,F_FilePath,F_PDFLX) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + ml + "\\" + blh + "','" + szqm_filename + "','" + pdfpath + "','szqm')");
                                            }
                                            else
                                            {
                                                MessageBox.Show("上传签字PDF失败,请重新审核\r\n" + errmsg);
                                                ZGQClass.BGHJ(blh, "上传签字PDF", "审核", "上传PDF失败:" + errmsg, "ZGQJK", "上传PDF");
                                            }
                                        }
                                        else
                                        {
                                            MessageBox.Show("PDF签字失败,请重新审核");
                                        }
                                        DeleteTempFile(blh);
                                        return("1");
                                    }
                                    else
                                    {
                                        MessageBox.Show("报告未审核"); return("0");
                                    }
                                }
                                catch (Exception ee10)
                                {
                                    MessageBox.Show("生成PDF异常,请重新审核\r\n" + ee10.Message);
                                    DeleteTempFile(blh);
                                    return("0");
                                }
                                #endregion
                            }
                        }
                        catch (Exception ee5)
                        {
                            MessageBox.Show("获取签名图像异常,请重新审核\r\n" + ee5.Message);
                            return("0");
                        }
                    }
                    catch (Exception ee6)
                    {
                        MessageBox.Show("获取签名证书失败,请重新审核\r\n" + ee6.Message);
                        return("0");
                    }

                    #endregion
                }
                if (debug == "1")
                {
                    MessageBox.Show("签字完成");
                }

                return("1");
            }
            #endregion

            #region 取消审核
            if (type == "QXSH")
            {
                if (f.ReadString("ca", "qxshyz", "0").Trim().Replace("\0", "").Trim() == "1")
                {
                    return(YZKEY(msg, yhmc, yhbh));
                }
                return("1");
            }
            #endregion

            #region
            if (type == "QXQZ")  //&& (bglx == "BC" || bglx == "BD")
            {
                aa.ExecuteSQL("delete from  T_CAXX  where  F_BLBH='" + blbh + "' ");
                aa.ExecuteSQL("delete from  T_BG_PDF  where  F_BLBH='" + blbh + "' ");
                aa.ExecuteSQL("delete from  T_BG_PDF_CA  where  F_BLBH='" + blbh + "' ");
                return("1");
            }
            #endregion

            return("1");
        }
예제 #25
0
        [OutputCache(Location = OutputCacheLocation.None, NoStore = false)]   //清除缓存
        public ActionResult QRCodePay(decimal cash)
        {
            string body      = "账户充值";
            string Recordid  = UtilTool.GenerateOutTradeNo();
            string notifyurl = "http://*****:*****@"<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>Title</title>
    <style>
      *{
        margin: 0;
        padding: 0;
      }
      .layout-qrcode{
        width:100%;
      }
      .layout-qrcode .container{
        width:251px;
        margin:0 auto;
        border:1px solid #ddd;
        border-radius: 10px;
      }
      .layout-qrcode .content{
          padding:35px;
      }
      .layout-qrcode .qr-img{
        width:181px;
        height:181px;
      }
      .layout-qrcode .qr-txt{
          width:181px;
          margin: 15px auto 0;
      }
      .layout-qrcode .qr-txt img{
          width: 100%;
      }
    </style>
</head>
<body>
<div class='layout-qrcode'>
  <div class='container'>
    <div class='content'>
      <div class='qr-img'>
        <img src='" + pic + @"' height='181' width='181'/>
      </div>
      <div class='qr-txt'>
          <img src='/Content/wx/说明文字.png' alt=''>
      </div>
    </div>
  </div>
</div>
</body>
</html>";


            return(Content(html));
        }
예제 #26
0
        /// <summary>
        /// 开始从服务器更新资源
        /// </summary>
        private async Task UpdateResource_Sync()
        {
            GameLoading.Instance.StartLoading("游戏初始化阶段,开始下载更新的资源...");

            // 加载服务器的版本信息文件
            var rServerVersionRequest = await ABVersion.Download(ABPlatform.Instance.GetServerUrl_CurPlatform(ABVersion.ABVersion_File_Bin));

            mServerVersion = rServerVersionRequest.Version;

            if (mServerVersion == null)
            {
                return;
            }

            // 比较两个空间的版本信息
            List <ABVersionEntry> rNeedUpdateEntries = new List <ABVersionEntry>();

            foreach (var rPair in mServerVersion.Entries)
            {
                var rServerAVEntry = rPair.Value;

                if (mPersistentVersion != null)
                {
                    var rPersistentAVEntry = mPersistentVersion.GetEntry(rServerAVEntry.Name);
                    if (rPersistentAVEntry == null || rServerAVEntry.Version > rPersistentAVEntry.Version)
                    {
                        rNeedUpdateEntries.Add(rServerAVEntry);
                    }
                }
                else
                {
                    rNeedUpdateEntries.Add(rServerAVEntry);
                }
            }

            if (mPersistentVersion == null)
            {
                mPersistentVersion         = new ABVersion();
                mPersistentVersion.Entries = new Dict <string, ABVersionEntry>();
            }

            for (int i = 0; i < rNeedUpdateEntries.Count; i++)
            {
                GameLoading.Instance.SetTips(string.Format("游戏初始化阶段,开始下载更新的资源[{0}/{1}]...", i + 1, rNeedUpdateEntries.Count));

                // 下载文件
                var rServerABRequest = await WebRequestAssist.DownloadFile(ABPlatform.Instance.GetServerUrl_CurPlatform(rNeedUpdateEntries[i].Name), GameLoading.Instance.SetLoadingProgress);

                // 写入文件
                string rPersisentFilePath = ABPlatform.Instance.GetPersistentFile_CurPlatform(rNeedUpdateEntries[i].Name);
                UtilTool.WriteAllBytes(rPersisentFilePath, rServerABRequest.Bytes);
                Debug.Log("--- Save ab: " + rPersisentFilePath);

                // 保存修改后的Persistent空间的文件
                var rPersistentAVEntry = mPersistentVersion.GetEntry(rNeedUpdateEntries[i].Name);
                if (rPersistentAVEntry == null)
                {
                    rPersistentAVEntry = new ABVersionEntry();
                    mPersistentVersion.Entries.Add(rNeedUpdateEntries[i].Name, rPersistentAVEntry);
                }
                rPersistentAVEntry.Name         = rNeedUpdateEntries[i].Name;
                rPersistentAVEntry.Size         = rNeedUpdateEntries[i].Size;
                rPersistentAVEntry.Version      = rNeedUpdateEntries[i].Version;
                rPersistentAVEntry.MD5          = rNeedUpdateEntries[i].MD5;
                rPersistentAVEntry.Dependencies = new List <string>(rNeedUpdateEntries[i].Dependencies).ToArray();

                string rPersistentVersionPath    = ABPlatform.Instance.GetPersistentFile_CurPlatform(ABVersion.ABVersion_File_Bin);
                string rPersistentVersionDirPath = Path.GetDirectoryName(rPersistentVersionPath);
                if (!Directory.Exists(rPersistentVersionDirPath))
                {
                    Directory.CreateDirectory(rPersistentVersionDirPath);
                }

                mPersistentVersion.Save(rPersistentVersionPath);
                Debug.Log("--- Save version: " + rPersistentVersionPath);
            }

            // 保存服务器上的MD5文件
            string rPersistentMD5Path = ABPlatform.Instance.GetPersistentFile_CurPlatform(ABVersion.ABVersion_File_MD5);

            UtilTool.WriteAllText(rPersistentMD5Path, mServerMD5);
            Debug.Log("--- Save md5: " + rPersistentMD5Path);

            GameLoading.Instance.Hide();
        }
예제 #27
0
        public ActionResult Cliente_Nuevo(TerceroPotencial model)
        {
            try
            {
                TerceroPotencial tercero_potencial = db.TerceroPotencial.Where(f => f.RowID == model.RowID).FirstOrDefault();

                if (tercero_potencial == null)
                {
                    tercero_potencial                 = new TerceroPotencial();
                    tercero_potencial.Activo          = true;
                    tercero_potencial.FechaCreacion   = UtilTool.GetDateTime();
                    tercero_potencial.UsuarioCreacion = ((Usuario)Session["curUser"]).NombreUsuario;
                }
                else
                {
                    tercero_potencial.FechaModificacion   = UtilTool.GetDateTime();
                    tercero_potencial.UsuarioModificacion = ((Usuario)Session["curUser"]).NombreUsuario;
                }


                tercero_potencial.Descripcion = model.Descripcion;
                tercero_potencial.EstadoID    = model.EstadoID;
                tercero_potencial.OrigenID    = model.OrigenID;
                if (model.OrigenID == 124)
                {
                    tercero_potencial.Otro = model.Otro;
                }
                else
                {
                    tercero_potencial.Otro = null;
                }

                try { tercero_potencial.Identificacion = model.Identificacion; }
                catch { }
                try { tercero_potencial.TipoIdentificacion = model.TipoIdentificacion; }
                catch { }
                tercero_potencial.RazonSocial        = model.RazonSocial.ToUpper();
                tercero_potencial.TipoIdentificacion = model.TipoIdentificacion;
                tercero_potencial.Cliente            = model.Cliente;
                tercero_potencial.Proveedor          = model.Proveedor;
                tercero_potencial.Vendedor           = model.Vendedor;
                tercero_potencial.ContactoID         = model.ContactoID;

                if (tercero_potencial.RowID <= 0)
                {
                    db.TerceroPotencial.Add(tercero_potencial);
                }

                db.SaveChanges();
                switch (Request.Params["accion"])
                {
                case "1":
                    return(RedirectToAction("Cliente_Nuevo", "CRM", new { rowid = tercero_potencial.RowID, @rih = Request.Params["rih"] }));

                default:
                    return(RedirectToAction("ListadoPotenciales", "CRM", new { @rih = Request.Params["rih"] }));
                }
            }

            catch (Exception ex)
            {
                return(RedirectToAction("Cliente_Nuevo", "CRM", new { rowid = model.RowID, @rih = Request.Params["rih"] }));
                //return RedirectToAction("Cliente_Nuevo", "CRM", new { Msj = ex.Message });
            }
        }