Exemplo n.º 1
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            BufferConfig     vBufferConfig = getBufferConfig(treeView_FeatureLayers.SelectedNode.Name);
            ComboBoxListItem vSelectedItem = (ComboBoxListItem)comboBox_Layers.SelectedItem;

            foreach (ListViewItem vTempItem in vBufferConfig.SelectedLayers)
            {
                if (vTempItem.Name == vSelectedItem.Value)
                {
                    MessageBox.Show("已存在相同的图层请重新选择", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            ListViewItem vNewItem = new ListViewItem()
            {
                Name = vSelectedItem.Value,
                Text = vSelectedItem.Name,
            };

            vBufferConfig.SelectedLayers.Add(vNewItem);
            listView_Layers.Clear();
            listView_Layers.Items.AddRange(vBufferConfig.SelectedLayers.ToArray());
            listView_Layers.Refresh();
        }
Exemplo n.º 2
0
        ComboBoxListItem[] getTownshipDict()
        {
            List <ComboBoxListItem> vTownshipList = new List <ComboBoxListItem>();

            vTownshipList.Add(new ComboBoxListItem("请选择", "请选择"));
            Dictionary <string, string> vTownshipDict = new Dictionary <string, string>();

            if (TownshipFeatureLayer != null)
            {
                IQueryFilter vQueryFilter = new QueryFilterClass();
                var          vFeatures    = TownshipFeatureLayer.FeatureClass.Search(vQueryFilter, true);
                IFeature     vFeature     = vFeatures.NextFeature();
                while (vFeature != null)
                {
                    ComboBoxListItem vNewItme = new ComboBoxListItem();
                    int vXZDMIndex            = vFeature.Fields.FindField("XZDM");
                    int VNameIndex            = vFeature.Fields.FindField("街道");
                    vNewItme.Name  = vFeature.get_Value(VNameIndex).ToString();
                    vNewItme.Value = vFeature.get_Value(vXZDMIndex).ToString();
                    vTownshipList.Add(vNewItme);
                    vFeature = vFeatures.NextFeature();
                }
            }
            return(vTownshipList.ToArray());
        }
Exemplo n.º 3
0
        private void buyNoAlert()
        {
            // EventUtil.ClearAllEvents(this.timerSubRequest, "Tick");

            try
            {
                ComboBoxListItem item = this.ddlTicket.SelectedItem as ComboBoxListItem;

                Live l = allLives.Find(live => live.TicketNumber == item.Id);
                this.currentLive = l;

                SeatType seat;
                if (radVip.Checked)
                {
                    seat = SeatType.VIP;
                }
                else if (radStand.Checked)
                {
                    seat = SeatType.站;
                }
                else
                {
                    seat = SeatType.普;
                }

                string postUrl  = "https://shop.48.cn/TOrder/add";
                string postData = string.Format("id={0}&num={1}&seattype={2}&brand_id={3}&r={4}&choose_times_end=-1",
                                                l.TicketNumber, this.txtNumber.Value, Convert.ToInt32(seat),
                                                l.Group.GroupId, r.NextDouble()
                                                );

                // 购票请求
                Task.Factory.StartNew(() =>
                {
                    this.btnBuyOne.Enabled = false;
                    return(util.POST(postUrl, cc, postData));
                }).ContinueWith(t =>
                {
                    if (t.Result.IndexOf("success") > -1 ||
                        (t.Result.IndexOf("下单申请成功") > -1 && DateTime.Now.Hour == 19)
                        )
                    {   // 星沃卡购买成功
                        this.buyOK = true;
                        MessageBox.Show("购买成功!");
                        timerSubRequest.Stop();
                    }
                    else if (t.Result.IndexOf("下单申请成功") > -1)
                    {
                        MessageBox.Show("sub req");
                        timerSubRequest.Start();
                    }
                    this.btnBuyOne.Enabled = true;
                });
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先选择需要购买的门票!!");
            }
        }
        private void FillReturnDataType(string nSelect_Data_Type_Returned, string nSchema_Name_Returned, string nObject_Name_Returned)
        {
            ReturnDataTypeComboBox.Items.Clear();

            if (lstReturnType.SelectedIndex != -1)
            {
                switch ((CMData.Schemas.ReturnType)(Enum.Parse(typeof(CMData.Schemas.ReturnType), lstReturnType.SelectedItem.ToString())))
                {
                case CMData.Schemas.ReturnType.TablaGenerica:
                    ReturnDataTypeComboBox.Items.Add("DataTable");
                    ReturnDataTypeComboBox.SelectedIndex = 0;
                    break;

                case CMData.Schemas.ReturnType.Escalar:
                    // ReSharper disable CoVariantArrayConversion
                    ReturnDataTypeComboBox.Items.AddRange(Enum.GetNames(typeof(DbType)));
                    // ReSharper restore CoVariantArrayConversion

                    if (nSelect_Data_Type_Returned != "")
                    {
                        ReturnDataTypeComboBox.SelectedItem = nSelect_Data_Type_Returned;
                    }
                    else
                    {
                        ReturnDataTypeComboBox.SelectedIndex = 0;
                    }

                    break;

                case CMData.Schemas.ReturnType.TablaTipada:
                    var objects = (CMData.Schemas.XsdDataBase.TBL_ObjectRow[])(DtsDataBase.TBL_Object.Select("Generic_Type IN ('Table','View')", "Schema_Name,Object_Name"));

                    foreach (var obj in objects)
                    {
                        var item = new ComboBoxListItem(obj.Schema_Name + "." + obj.Object_Name, obj.id_Object);

                        ReturnDataTypeComboBox.Items.Add(item);

                        if (obj.Schema_Name == nSchema_Name_Returned && obj.Object_Name == nObject_Name_Returned)
                        {
                            ReturnDataTypeComboBox.SelectedItem = item;
                        }
                    }

                    if (nObject_Name_Returned == "")
                    {
                        ReturnDataTypeComboBox.SelectedIndex = 0;
                    }

                    break;

                case CMData.Schemas.ReturnType.Nada:
                    ReturnDataTypeComboBox.Items.Add("Vacio");
                    ReturnDataTypeComboBox.SelectedIndex = 0;
                    break;
                }
            }
        }
Exemplo n.º 5
0
 void initcomboBox_Layers()
 {
     m_ComboBoxLayerItmes = new ComboBoxListItem[VMainForm.m_Layers.Count];
     for (int i = 0; i < VMainForm.m_Layers.Count; i++)
     {
         ComboBoxListItem vNewItme = new ComboBoxListItem()
         {
             Name  = string.Format("{0}({1})", VMainForm.m_Layers[i].Expository, CommonUnit.ConvertLayerType(VMainForm.m_Layers[i].Type ?? 0)),
             Value = VMainForm.m_Layers[i].Name
         };
         m_ComboBoxLayerItmes[i] = vNewItme;
     }
     comboBox_Layers.Items.AddRange(m_ComboBoxLayerItmes);
 }
Exemplo n.º 6
0
        private void comboBox_Township_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxListItem vSelectedItem = (ComboBoxListItem)comboBox_Township.SelectedItem;

            if (vSelectedItem.Value != "请选择")
            {
                string             vCode = vSelectedItem.Value;
                ComboBoxListItem[] vVillageCommitteeList = getVillageCommitteeDict(vCode);
                comboBox_VillageCommittee.Items.Clear();
                foreach (ComboBoxListItem vTempVillageCommittee in vVillageCommitteeList)
                {
                    comboBox_VillageCommittee.Items.Add(vTempVillageCommittee);
                    comboBox_VillageCommittee.SelectedIndex = 0;
                }
            }
        }
Exemplo n.º 7
0
        private void ddlGroup_DrawItem(object sender, DrawItemEventArgs e)
        {
            // MessageBox.Show( e.Index.ToString() );
            ComboBoxListItem item = this.ddlGroup.Items[e.Index] as ComboBoxListItem;

            Color c = item.Color;

            Font      font = new Font("微软雅黑", 9);
            Rectangle r    = new Rectangle(e.Bounds.Left, e.Bounds.Top,
                                           e.Bounds.Width, e.Bounds.Height);

            e.DrawBackground();
            e.Graphics.FillRectangle(new SolidBrush(c), r);
            e.Graphics.DrawString(item.Name, font, Brushes.Black, new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
            e.DrawFocusRectangle();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 切换选择票务后,读取并展示该票务的详情
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ddlTicket_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxListItem item = this.ddlTicket.SelectedItem as ComboBoxListItem;
            Live             l    = allLives.Find(live => live.TicketNumber == item.Id);

            // MessageBox.Show(l.ToString());
            string liveMessage = string.Format("开始时间:{0} \n\n场次类型:{1}\n\n详情:{2}",
                                               l.LiveDetail.StartTime, l.LiveDetail.LiveType, l.LiveDetail.Detail);

            // 可选没有库存的票
            this.radVip.BackColor    = l.LiveDetail.RemainingTickets[0] ? Color.Green : Color.Red;
            this.radStand.BackColor  = l.LiveDetail.RemainingTickets[1] ? Color.Green : Color.Red;
            this.radNormal.BackColor = l.LiveDetail.RemainingTickets[2] ? Color.Green : Color.Red;


            this.lblDetail.Text = liveMessage;
        }
Exemplo n.º 9
0
        /// <summary>
        ///  读取 GroupList , 生成 “组合” 下拉菜单的选项
        /// </summary>
        private void GetGroups()
        {
            Dictionary <int, string> dictGroups = EnumHepler.EnumToDictionary <GroupType>();

            this.ddlGroup.DisplayMember = "Name";
            this.ddlGroup.ValueMember   = "Id";

            foreach (var item in dictGroups)
            {
                ComboBoxListItem listItem = new ComboBoxListItem(
                    item.Key, item.Value, GroupUtil.GetGroupColorByGroupId(item.Key)
                    );
                this.ddlGroup.Items.Add(listItem);
            }

            this.ddlGroup.SelectedIndex = 0;
        }
Exemplo n.º 10
0
        string getPrintTitle()
        {
            string           vTitle                    = "丰城市文档数据查询";
            ComboBoxListItem vTownshipListItem         = (ComboBoxListItem)comboBox_Township.SelectedItem;
            ComboBoxListItem vVillageCommitteeListItem = (ComboBoxListItem)comboBox_VillageCommittee.SelectedItem;
            ComboBoxListItem vVillageListItem          = (ComboBoxListItem)comboBox_Village.SelectedItem;

            if (vTownshipListItem != null && vTownshipListItem.Value != "请选择")
            {
                vTitle = string.Format("丰城市{0}文档数据查询", vTownshipListItem.Name);
            }
            if (vVillageCommitteeListItem != null && vVillageCommitteeListItem.Value != "请选择")
            {
                vTitle = string.Format("丰城市{0}文档数据查询", vVillageCommitteeListItem.Name);
            }
            if (vVillageListItem != null && vVillageListItem.Value != "请选择")
            {
                vTitle = string.Format("丰城市{0}{1}村文档数据查询", vVillageCommitteeListItem.Name, vVillageListItem.Name);
            }
            return(vTitle);
        }
Exemplo n.º 11
0
        private void SetDdlTicket(IEnumerable <Live> lives)
        {
            this.ddlTicket.Items.Clear();

            //this.ddlTicket.Items.Add(new ComboBoxListItem(-1 , "请选择票务"));

            foreach (Live live in lives)
            {
                ComboBoxListItem item = new ComboBoxListItem(
                    live.TicketNumber,
                    string.Format("{0}月{1}日 {2} Team {3} 公演",
                                  live.StartTime.Month.ToString().Length == 1 ? "0" + live.StartTime.Month.ToString() :
                                  live.StartTime.Month.ToString(),
                                  live.StartTime.Day.ToString().Length == 1? "0" + live.StartTime.Day.ToString() : live.StartTime.Day.ToString(),
                                  live.Group.GroupName, live.Team.TeamName)
                    );

                item.Color = live.Team.TeamColor == null ? TeamColor.Unknown : live.Team.TeamColor;

                // MessageBox.Show( live.Team.TeamColor.ToString() );
                this.ddlTicket.Items.Add(item);
            }
        }
Exemplo n.º 12
0
        private void buy()
        {
            // EventUtil.ClearAllEvents(this.timerSubRequest, "Tick");

            try
            {
                ComboBoxListItem item = this.ddlTicket.SelectedItem as ComboBoxListItem;

                Live l = allLives.Find(live => live.TicketNumber == item.Id);

                // 普通OK
                // {"HasError":false,"ErrorCode":"","Message":"success","ReturnObject":"/TOrder/Item/181031-2-101267"}

                // {"HasError":true,"ErrorCode":"144007","Message":"此门票为限购商品,注册会员用户请于开票24小时以后尝试购买。详询客服。","ReturnObject":null}

                // {"HasError":true,"ErrorCode":"161001","Message":"请不要反复点击“立即购买”按钮,请稍等下再尝试咯,谢谢您的支持和理解~","ReturnObject":null}

                // {"HasError":true,"ErrorCode":"168802","Message":"19:00-20:00为星沃卡用户优先购买特权,请20:00参与公开销售。","ReturnObject":null}

                //  星沃卡OK
                // {"HasError":false,"ErrorCode":"","Message":"下单申请成功","ReturnObject":null}

                // 星沃卡ERROR
                // {"HasError":true,"ErrorCode":"168801","Message":"星沃卡用户购买票务享受优先购买权,每个手机号码,每周仅可优先购买一场公演,取消订单无法重复使用特权。","ReturnObject":null}


                // 转圈中
                // id=2631&num=1&seattype=4&brand_id=1&r=0.6115051392512127&choose_times_end=-1
                // {"HasError":false,"ErrorCode":"","Message":"下单申请成功","ReturnObject":null}

                // 转圈 OK
                // GET /TOrder/tickCheck?id=2631&r=0.9927577215731782
                // {"HasError":false,"ErrorCode":"success","Message":"ok","ReturnObject":"/TOrder/Item/181106-2-103055"}


                SeatType seat;
                if (radVip.Checked)
                {
                    seat = SeatType.VIP;
                }
                else if (radStand.Checked)
                {
                    seat = SeatType.站;
                }
                else
                {
                    seat = SeatType.普;
                }

                string postUrl  = "https://shop.48.cn/TOrder/add";
                string postData = string.Format("id={0}&num={1}&seattype={2}&brand_id={3}&r={4}&choose_times_end=-1",
                                                l.TicketNumber, this.txtNumber.Value, Convert.ToInt32(seat),
                                                l.Group.GroupId, r.NextDouble()
                                                );


                // 购票请求
                Task.Factory.StartNew(() =>
                {
                    this.btnBuyOne.Enabled = false;
                    return(util.POST(postUrl, cc, postData));
                }).ContinueWith(t =>
                {
                    //      8点普通用户切票成功
                    if (t.Result.IndexOf("success") > -1 ||
                        // 7 点星沃卡切票成功
                        (t.Result.IndexOf("下单申请成功") > -1 && DateTime.Now.Hour == 7)
                        )
                    {
                        this.buyOK = true;
                        MessageBox.Show("购买成功!");
                    }
                    else if (t.Result.IndexOf("161001") > -1)
                    {
                        // 10秒内再次请求
                        ShowError("点击购买按钮过于频繁!");
                    }
                    else if (t.Result.IndexOf("161005") > -1)
                    {
                        // 8点没到
                        ShowError("尚未开始购买,请稍后再试!");
                    }
                    else if (t.Result.IndexOf("168801") > -1)
                    {
                        // 星沃卡已使用
                        ShowError("星沃卡只能使用一次!");
                    }
                    else if (t.Result.IndexOf("168802") > -1)
                    {
                        // 8点没到
                        ShowError("您不是星沃卡用户,请8点再来买!");
                    }

                    else if (t.Result.IndexOf("144007") > -1)
                    {
                        // vip24小时内限购
                        ShowError("已售罄或者您不是VIP用户需要开票24小时后购买!");
                    }
                    else if (t.Result.IndexOf("144008") > -1)
                    {
                        // 取消超过一次,24小时内无法购买
                        ShowError("您已取消订单,24小时内无法重新购买");
                    }
                    else if (t.Result.IndexOf("144009") > -1)
                    {
                        // 已有同类商品
                        ShowError("您已购买此门票,请打开网页付款");
                    }
                    else if (t.Result.IndexOf("下单申请成功") > -1 && DateTime.Now.Hour >= 8)
                    {
                        // 转圈中, 发送子请求

                        timerSubRequest.Start();
                    }
                    // MessageBox.Show( t.Result );

                    this.btnBuyOne.Enabled = true;
                });
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("请先选择需要购买的门票!!");
            }
        }
Exemplo n.º 13
0
        private void button_Statistics_Click(object sender, EventArgs e)
        {
            string           vTitle                 = "";
            string           vAreaCodeStr           = "";
            string           vTownshipValue         = ((ComboBoxListItem)comboBox_Township.SelectedItem).Value;
            string           vVillageCommitteeValue = ((ComboBoxListItem)comboBox_VillageCommittee.SelectedItem).Value;
            ComboBoxListItem vFatherItem            = null;

            if (vTownshipValue == "0")
            {
                vTitle = "丰城市资料上传统计";
                foreach (ComboBoxListItem vTempItem in comboBox_Township.Items)
                {
                    if (vTempItem.Value != "0")
                    {
                        vAreaCodeStr += string.Format("{0},{1}|", vTempItem.Value, vTempItem.Name);
                    }
                }
            }
            else if (vVillageCommitteeValue == "0")
            {
                vFatherItem  = (ComboBoxListItem)comboBox_Township.SelectedItem;
                vTitle       = string.Format("{0}资料上传统计", vFatherItem.Name);
                vAreaCodeStr = string.Format("{0},{1}|", vFatherItem.Value, vFatherItem.Name);
                foreach (ComboBoxListItem vTempItem in comboBox_VillageCommittee.Items)
                {
                    if (vTempItem.Value != "0")
                    {
                        vAreaCodeStr += string.Format("{0},{1}|", vTempItem.Value, vTempItem.Name);
                    }
                }
            }
            else
            {
                vFatherItem  = (ComboBoxListItem)comboBox_VillageCommittee.SelectedItem;
                vTitle       = string.Format("{0}资料上传统计", vFatherItem.Name);
                vAreaCodeStr = string.Format("{0},{1}|", vFatherItem.Value, vFatherItem.Name);
                ComboBoxListItem[] vVillageDict = getVillageDict(vVillageCommitteeValue);
                foreach (ComboBoxListItem vTempItem in vVillageDict)
                {
                    vAreaCodeStr += string.Format("{0},{1}|", vTempItem.Value, vTempItem.Name);
                }
            }
            if (vAreaCodeStr != "")
            {
                vAreaCodeStr = vAreaCodeStr.Remove(vAreaCodeStr.Length - 1);
                RemoteInterface vRemoteInterface = new RemoteInterface(Program.LoginUserInfo.ID.Value, Program.LoginUserInfo.UserName, Program.LoginUserInfo.Token);
                var             vStatisticsResut = vRemoteInterface.FileNumberStatistics(vAreaCodeStr).Where(m => m.FileNumber > 0);
                if (vTownshipValue != "0")
                {
                    FileNumberStatisticsStruct vFatherData = vStatisticsResut.Where(m => m.AreaCode == vFatherItem.Value).FirstOrDefault();
                    if (vFatherData != null && vFatherData.FileNumber != 0)
                    {
                        int vSum = vStatisticsResut.Where(m => m.AreaCode != vFatherItem.Value).Sum(m => m.FileNumber);
                        vFatherData.FileNumber -= vSum;
                    }
                }
                //DataTable vTable = convertToDataTable(vStatisticsResut);
                if (vStatisticsResut.Count() > 0)
                {
                    chart_Statistics.DataSource              = vStatisticsResut;
                    chart_Statistics.Series[0].XValueMember  = "UnitName";
                    chart_Statistics.Series[0].YValueMembers = "FileNumber";
                    chart_Statistics.Titles[0].Text          = vTitle;
                    chart_Statistics.DataBind();
                }
                else
                {
                    chart_Statistics.DataSource     = new DataTable();
                    chart_Statistics.Titles[0].Text = vTitle;
                    chart_Statistics.DataBind();
                    MessageBox.Show("选择的行政区域没有上传资料", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                chart_Statistics.DataSource     = new DataTable();
                chart_Statistics.Titles[0].Text = vTitle;
                chart_Statistics.DataBind();
                MessageBox.Show("选择的行政区域没有数据", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }