Ejemplo n.º 1
0
        public static Image getIcon(string fileName)
        {
            try
            {
                HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), "GET_BYTES");
                applyLogin.InvokeType = InvType.GET;

                HsParam param1 = new HsParam("Name", "fileName", DataType.String, InvType.GET);
                HsParam param2 = new HsParam("Type", "0", DataType.String, InvType.GET);

                applyLogin.addParam(param1);
                applyLogin.addParam(param2);


                HsResultData resultDat = applyLogin.excuteCommand();

                if (resultDat.ErrorId == 200)
                {
                    JArray rtnArrays = (JArray)resultDat.ResultString;

                    for (int index = 0; index < rtnArrays.Count; index++)
                    {
                        //ServiceItem oneRole = ServiceItem.parseFromString(rtnRolesArray[index].ToString());

                        //rtnMenus.Add(oneRole);
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(null);
        }
Ejemplo n.º 2
0
        private bool excuteDelete(ServiceItem deleProtocol, ServiceItem srvItem)
        {
            HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), deleProtocol.CmdString);

            applyLogin.InvokeType = deleProtocol.getHttpType(OpertorType.Delete);

            for (int index = 0; index < deleProtocol.ServiceItemAttrs.Count; index++)
            {
                ServiceItemAttribute attr = deleProtocol.ServiceItemAttrs[index];

                if (attr.KName == "PreApi")
                {
                    continue;
                }
                HsParam param1 = attr.buildParam(applyLogin.InvokeType);


                param1.ParamValue = ToolsUtils.GetObjectPropertyValue <ServiceItem>(srvItem, attr.KName);

                applyLogin.addParam(param1);
            }

            HsResultData resultDat = applyLogin.excuteCommand();

            //GlobalConfig.SystemProtocols.Clear();
            if (resultDat.ErrorId == 200)
            {
                return(true);
            }
            //MessageBox.Show(resultDat.ErrorInfo);
            return(false);
        }
Ejemplo n.º 3
0
        private void pbImage_Click(object sender, EventArgs e)
        {
            HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), SrvItem.CmdString);

            applyLogin.InvokeType = SrvItem.getHttpType(_operType);

            //HsParam param1 = new HsParam("Account", userName.Text.ToString(), DataType.String, InvType.POST);
            //HsParam param2 = new HsParam("Password", ToolsUtils.Md5(userPassword.Text), DataType.String, InvType.POST);
            //applyLogin.addParam(param1);
            //applyLogin.addParam(param2);
            //for (int index = 0 ; index < SrvItem)
            for (int index = 0; index < SrvItem.ServiceItemAttrs.Count; index++)
            {
                ServiceItemAttribute attr = SrvItem.ServiceItemAttrs[index];

                HsParam param1 = attr.buildParam(applyLogin.InvokeType);


                param1.ParamValue = ManageCtrl.getInputValue(attr.KName);

                applyLogin.addParam(param1);
            }

            HsResultData resultDat = applyLogin.excuteCommand();

            //GlobalConfig.SystemProtocols.Clear();
            if (resultDat.ErrorId == 200)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                return;
            }
            MessageBox.Show(resultDat.ErrorInfo);
            return;
        }
Ejemplo n.º 4
0
        private void StartLoadNodeImage(TreeNode node, ServiceItem item)
        {
            Thread t = new Thread(() =>
            {
                try
                {
                    HsApply remoteInvoke    = new HsApply(GlobalConfig.getUrlHead(), "GET_BYTES");
                    remoteInvoke.ReturnType = 1;
                    remoteInvoke.InvokeType = InvType.GET;

                    HsParam param1 = new HsParam("Name", item.ImageName, DataType.String, InvType.GET);
                    HsParam param2 = new HsParam("Type", "0", DataType.String, InvType.GET);

                    remoteInvoke.addParam(param1);
                    remoteInvoke.addParam(param2);


                    HsResultData resultData = remoteInvoke.excuteCommand();

                    SrvTreeView.Invoke(new EventHandler(delegate
                    {
                        if (resultData.ResultString == null)
                        {
                        }
                        else
                        {
                            try
                            {
                                byte[] byteDatas = Convert.FromBase64String(resultData.ResultString.ToString());
                                Image img        = ImageHelper.BytesToImage(byteDatas);
                                if (img != null)
                                {
                                    lock (_lockObj)
                                    {
                                        ImgList.Images.Add(img);
                                        node.ImageIndex         = ImgList.Images.Count - 1;
                                        node.SelectedImageIndex = node.ImageIndex;
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                }
            });

            t.Start();
        }
Ejemplo n.º 5
0
        public static List <ServiceItem> loadSystemFuncTree()
        {
            List <ServiceItem> rtnMenus = new List <ServiceItem>();

            try
            {
                HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), "FETCH_MENUS");
                applyLogin.InvokeType = InvType.GET;

                HsParam param1 = new HsParam("Account", "root", DataType.String, InvType.GET);

                applyLogin.addParam(param1);
                //applyLogin.addParam(param2);


                HsResultData resultDat = applyLogin.excuteCommand();

                if (resultDat.ErrorId == 200)
                {
                    JArray rtnRolesArray = (JArray)resultDat.ResultString;

                    for (int index = 0; index < rtnRolesArray.Count; index++)
                    {
                        ServiceItem oneRole = ServiceItem.parseFromString(rtnRolesArray[index].ToString());

                        rtnMenus.Add(oneRole);
                    }
                }

                rtnMenus.Sort();
                GlobalConfig.SystemMenus = rtnMenus;
                return(rtnMenus);
            }
            catch (Exception ex)
            {
            }

            GlobalConfig.SystemMenus = rtnMenus;
            return(rtnMenus);
        }
Ejemplo n.º 6
0
        private Boolean send_LoginCommand()
        {
            HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), "LOGIN_SYSTEM");

            applyLogin.InvokeType = InvType.POST;
            HsParam param1 = new HsParam("Account", userName.Text.ToString(), DataType.String, InvType.POST);

            HsParam param2 = new HsParam("Password", ToolsUtils.Md5(userPassword.Text), DataType.String, InvType.POST);

            applyLogin.addParam(param1);
            applyLogin.addParam(param2);

            HsResultData resultDat = applyLogin.excuteCommand();

            //GlobalConfig.SystemProtocols.Clear();
            if (resultDat.ErrorId == 200)
            {
                //JArray rtnRolesArray = (JArray)resultDat.ResultString;

                //for (int index = 0; index < rtnRolesArray.Count; index++)
                //{
                //    JObject jo = JObject.Parse(rtnRolesArray[index].ToString());
                //    Dictionary<string, object> rtnResults = jo.ToObject<Dictionary<string, object>>();

                //    HsProtocol pro = new HsProtocol();
                //    pro.Command = rtnResults["Command"].ToString();
                //    pro.Apilab = rtnResults["ApiLab"].ToString();

                //    GlobalConfig.SystemProtocols.Add(pro);
                //}

                return(true);
            }
            MessageBox.Show(resultDat.ErrorInfo);
            return(false);
        }