Ejemplo n.º 1
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.º 2
0
        private void loadMenuData()
        {
            _dataList.Items.Clear();
            for (int index = 0; index < GlobalConfig.SystemMenus.Count; index++)
            {
                ServiceItem  menu = GlobalConfig.SystemMenus[index];
                ListViewItem item = new ListViewItem();
                item.Tag = menu;
                for (int inx = 0; inx < _item.ServiceItemAttrs.Count; inx++)
                {
                    ServiceItemAttribute attr = _item.ServiceItemAttrs[inx];

                    if (inx == 0)
                    {
                        item.Text = ToolsUtils.GetObjectPropertyValue <ServiceItem>(menu, attr.KName);
                        continue;
                    }

                    item.SubItems.Add(ToolsUtils.GetObjectPropertyValue <ServiceItem>(menu, attr.KName));
                }


                //item.SubItems.Add(menu.Url);
                //item.SubItems.Add(menu.PUrlId);
                //item.SubItems.Add(menu.UrlId);
                //item.SubItems.Add(menu.ImageName);
                //item.SubItems.Add(menu.Inx.ToString());
                //item.SubItems.Add((menu.IsVirtual == 0? "否":"是"));
                //item.SubItems.Add(menu.CmdString);

                _dataList.Items.Add(item);
            }
        }
Ejemplo n.º 3
0
        private void initCtrl()
        {
            int labWidth   = 100;
            int ctrlHeight = 20;
            int xSep       = 40;
            int rowSep     = 25;

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

                Label lab = new Label();
                lab.Text     = attr.KAlias;
                lab.Font     = new System.Drawing.Font("宋体", 12);
                lab.Location = new Point(xSep, index * (rowSep + 20));
                lab.Size     = new Size(labWidth, ctrlHeight);
                this.Controls.Add(lab);


                if (attr.SelObjects == null || attr.SelObjects == "")
                {
                    TextBox box = new TextBox();
                    box.Name     = attr.KName;
                    box.Font     = new Font("宋体", 10);
                    box.Location = new Point(xSep + labWidth + xSep, index * (rowSep + 20));
                    box.Size     = new Size(150, ctrlHeight);

                    if (OperType == OpertorType.Modi)
                    {
                        box.Text = ToolsUtils.GetObjectPropertyValue <ServiceItem>(SrvItem, attr.KName);
                    }
                    this.Controls.Add(box);

                    box.Tag = attr;
                }
                else
                {
                    string selString = attr.SelObjects.ToString();

                    if (selString.Contains("{") && selString.Contains("}"))
                    {
                        selString = selString.Replace("{", "");
                        selString = selString.Replace("}", "");
                        RadioButton rbtn1 = new RadioButton();
                        rbtn1.Text     = selString.Split(':')[0].ToString();
                        rbtn1.Font     = new Font("宋体", 10);
                        rbtn1.Location = new Point(lab.Location.X + lab.Width + xSep, index * (rowSep + 20));
                        rbtn1.Size     = new Size(50, ctrlHeight);
                        rbtn1.Tag      = attr;
                        this.Controls.Add(rbtn1);



                        RadioButton rbtn2 = new RadioButton();
                        rbtn2.Text     = selString.Split(':')[1].ToString();
                        rbtn2.Font     = new Font("宋体", 10);
                        rbtn2.Location = new Point(rbtn1.Location.X + rbtn1.Width + 5, index * (rowSep + 20));
                        rbtn2.Size     = new Size(50, ctrlHeight);
                        this.Controls.Add(rbtn2);
                    }
                    else if (selString.Contains("$"))
                    {
                        ComboBox cbBox = new ComboBox();
                        cbBox.Name     = attr.KName;
                        cbBox.Font     = new Font("宋体", 10);
                        cbBox.Location = new Point(xSep + labWidth + xSep, index * (rowSep + 20));
                        cbBox.Size     = new Size(150, ctrlHeight);
                        cbBox.Tag      = attr;
                        string AttrName = selString.Replace("$", "");
                        cbBox.DataSource = ToolsUtils.GetStaticAttribute(AttrName);
                        this.Controls.Add(cbBox);

                        if (OperType == OpertorType.Modi)
                        {
                            string code = ToolsUtils.GetObjectPropertyValue <ServiceItem>(SrvItem, attr.KName);

                            for (int inx = 0; inx < ((List <object>)cbBox.DataSource).Count; inx++)
                            {
                                object itemObj = ((List <object>)cbBox.DataSource)[inx];

                                string itemCode = ToolsUtils.getObjectId(itemObj);

                                if (code == itemCode)
                                {
                                    cbBox.SelectedIndex = inx;
                                }
                            }
                        }
                    }
                }
            }
        }