コード例 #1
0
ファイル: MainTool.cs プロジェクト: wangjianlong/DNA
        public List <GYDW> Get(string SQLCommandText)
        {
            TempDict = GetDict();
            List <GYDW> List = new List <GYDW>();
            string      QYBH = string.Empty;
            double      JZMJ = 0.0;

            using (OleDbConnection Connection = new OleDbConnection(ConnectionString))
            {
                Connection.Open();
                using (OleDbCommand Command = Connection.CreateCommand())
                {
                    Command.CommandText = SQLCommandText;
                    var reader = Command.ExecuteReader();
                    while (reader.Read())
                    {
                        QYBH = reader[1].ToString();
                        if (double.TryParse(reader[2].ToString(), out JZMJ))
                        {
                            var percent = .0;
                            if (TempDict.ContainsKey(QYBH))
                            {
                                var tempdata = TempDict[QYBH];
                                if (tempdata.Sum > 0)
                                {
                                    percent = JZMJ / TempDict[QYBH].Sum;
                                }
                                else
                                {
                                    percent = ((double)1) / ((double)tempdata.Count);
                                }

                                if (tempdata.Count >= 2)
                                {
                                    Console.WriteLine(QYBH);
                                }
                            }
                            if (double.IsNaN(percent))
                            {
                                percent = .0;
                            }
                            List.Add(new GYDW()
                            {
                                DKBH    = reader[0].ToString(),
                                QYBH    = QYBH,
                                JZMJ    = JZMJ,
                                Percent = percent
                            });
                        }
                    }
                }
                Connection.Close();
            }
            return(List);
        }
コード例 #2
0
        private void AddNode(RhitLocation location)
        {
            if (location.Id < 0)
            {
                return;
            }
            if (TempDict.ContainsKey(location.Id))
            {
                return;
            }
            LocationNode node = new LocationNode()
            {
                Name = location.Label,
                Id   = location.Id,
            };

            if (location.ParentId <= 0)
            {
                LocationTree.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            if (TempDict.ContainsKey(location.ParentId))
            {
                TempDict[location.ParentId].ChildLocations.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            if (Locations.ContainsKey(location.ParentId))
            {
                AddNode(Locations[location.ParentId]);
                TempDict[location.ParentId].ChildLocations.Add(node);
                TempDict[location.Id] = node;
                return;
            }

            LocationTree.Add(node);
            TempDict[location.Id] = node;
        }
コード例 #3
0
ファイル: MainTool.cs プロジェクト: wangjianlong/DNA
        public void Doing()
        {
            this.List = Get("Select DKBH,QYBH,JZMJ from GYYD_YDDW");
            //DD(this.List);
            var DKBHS = GetBase("Select DKBH from GYYD Group By DKBH");

            foreach (var dkbh in DKBHS)
            {
                var tempList = this.List.Where(e => e.DKBH == dkbh).ToList();
                var merge    = new Merge()
                {
                    DKBH   = dkbh,
                    CZQYSL = tempList.Count,
                    Base   = new MergeBase()
                };
                foreach (var gydw in tempList)
                {
                    if (merge.Hy == null)
                    {
                        merge.Hy = GetHY(string.Format("Select HYLB, HYDM from YDDW where QYBH='{0}'", gydw.QYBH));
                    }
                    ReadData(new string[] {
                        string.Format("Select SFGXQY,CYRS,LJGDZCTZ,YDL2012,YDL2013,YDL2014,GSRKSS2012,GSRKSS2013,GSRKSS2014,DSRKSS2012,DSRKSS2013,DSRKSS2014,ZYYSR2012,ZYYSR2013,ZYYSR2014,TDZMJ,SFGSQY,GDZCYJ from YDDW where QYBH='{0}'", gydw.QYBH)
                    });
                    var mergebase = Translate(queue, 18);

                    if (!merge.SFGSQY && mergebase.SFGSQY)
                    {
                        merge.SFGSQY = true;
                    }
                    if (mergebase.SFGXQY)
                    {
                        merge.SFGXQY++;
                    }
                    MergeBase margin = null;
                    if (TempDict.ContainsKey(gydw.QYBH))
                    {
                        var body = TempDict[gydw.QYBH];

                        if (body.merge == null)
                        {
                            TempDict[gydw.QYBH].merge = mergebase;
                        }
                        if (body.Count == 1)
                        {
                            margin = body.merge - body.Reduce;
                        }
                        else
                        {
                            TempDict[gydw.QYBH].Count--;
                            margin = mergebase * gydw.Percent;
                            TempDict[gydw.QYBH].Reduce = body.Reduce + margin;
                        }

                        if (MarginDict.ContainsKey(gydw.QYBH))
                        {
                            MarginDict[gydw.QYBH].Add(margin);
                        }
                        //else
                        //{
                        //    if (body.Count > 1)
                        //    {
                        //        MarginDict.Add(gydw.QYBH, new List<MergeBase>() { margin });
                        //    }
                        //}
                    }
                    if (margin != null)
                    {
                        merge.Base = merge.Base + margin;
                    }
                    //merge.Base = merge.Base + mergebase * gydw.Percent;
                    if (double.IsNaN(merge.Base.DSRKSS2012))
                    {
                        Console.WriteLine("");
                    }
                }
                Dict.Add(dkbh, merge);
            }
            foreach (var key in Dict.Keys)
            {
                var tem     = Dict[key];
                var boolstr = tem.SFGSQY ? "是" : "否";
                SQLText = string.Format("UPDATE GYYD SET LJGDZCTZ={0},ZYYSR2012={1},ZYYSR2013={2},ZYYSR2014={3},DSRKSS2012={4},DSRKSS2013={5},DSRKSS2014={6},GSRKSS2012={7},GSRKSS2013={8},GSRKSS2014={9},YDL2012={10},YDL2013={11},YDL2014={12},CYRS={13},TDZMJ={14},SFGXQY={15},SYDKS=1,SFGSQY='{16}',HYLB='{17}',HYDM='{18}',GDZCYJ={19} where DKBH='{20}'", tem.Base.LJGDZCTZ, tem.Base.ZYYSR2012, tem.Base.ZYYSR2013, tem.Base.ZYYSR2014, tem.Base.DSRKSS2012, tem.Base.DSRKSS2013, tem.Base.DSRKSS2014, tem.Base.GSRKSS2012, tem.Base.GSRKSS2013, tem.Base.GSRKSS2014, tem.Base.YDL2012, tem.Base.YDL2013, tem.Base.YDL2014, tem.Base.CYRS, tem.Base.TDZMJ, tem.SFGXQY, boolstr, tem.Hy.HYLB, tem.Hy.HYDM, tem.Base.GDZCYJ, tem.DKBH);
                //SQLText = string.Format("UPDATE GYYD SET LJGDZCTZ={0},ZYYSR2012={1},ZYYSR2013={2},ZYYSR2014={3},DSRKSS2012={4},DSRKSS2013={5},DSRKSS2014={6},GSRKSS2012={7},GSRKSS2013={8} where DKBH='{9}'", tem.Base.LJGDZCTZ, tem.Base.ZYYSR2012, tem.Base.ZYYSR2013, tem.Base.ZYYSR2014, tem.Base.DSRKSS2012, tem.Base.DSRKSS2013, tem.Base.DSRKSS2014, tem.Base.GSRKSS2012, tem.Base.GSRKSS2013, tem.DKBH);

                ExecuteQuery(SQLText);
                //SQLText = string.Format("UPDATE GYYD SET GSRKSS2014={0},YDL2012={1},YDL2013={2},YDL2014={3},CYRS={4},TDZMJ={5},SFGXQY={6},SYDKS=1,SFGSQY='{7}',HYLB='{8}',HYDM='{9}',GDZCYJ={10} where DKBH='{11}'", tem.Base.GSRKSS2014, tem.Base.YDL2012, tem.Base.YDL2013, tem.Base.YDL2014, tem.Base.CYRS, tem.Base.TDZMJ, tem.SFGXQY, boolstr, tem.Hy.HYLB, tem.Hy.HYDM, tem.Base.GDZCYJ, tem.DKBH);
                //ExecuteQuery(SQLText);
                try
                {
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
            //Console.WriteLine("成功");
            Working();
            //BB();
            Console.WriteLine("Success");
        }
コード例 #4
0
ファイル: MergeTool.cs プロジェクト: wangjianlong/DNA
        public void Working()
        {
            InitM();
            using (OleDbConnection Connection = new OleDbConnection(ConnectionString))
            {
                Connection.Open();
                using (OleDbCommand Command = Connection.CreateCommand())
                {
                    #region 更新批准用地面积 土地登记面积  抵押面积

                    Command.CommandText = "UPDATE GYYD_YDDW SET PZYDMJ=NULL,TDDJMJ=NULL,DYMJ=NULL where 地块所有人 IS NULL";
                    try
                    {
                        Command.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                    foreach (string DKBH in AreaDict.Keys)
                    {
                        var values = AreaDict[DKBH].AreaBase;
                        if (values != null)
                        {
                            Command.CommandText = string.Format("UPDATE GYYD_YDDW SET PZYDMJ={0},TDDJMJ={1},DYMJ={2} Where 地块所有人 IS NOT NULL AND DKBH='{3}'", values.PZYDMJ, values.TDDJMJ, values.DYMJ, DKBH);
                            try
                            {
                                Command.ExecuteNonQuery();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                            }
                        }
                    }
                    #endregion



                    string commandText = string.Empty;
                    foreach (var item in GYDWList)
                    {
                        commandText = "UPDATE GYYD_YDDW SET";
                        if (WayDict.ContainsKey(item.DKBH))
                        {
                            commandText += " SJYT='" + WayDict[item.DKBH] + "',";
                        }
                        AreaOne one = null;
                        if (AreaDict.ContainsKey(item.DKBH))
                        {
                            one = AreaDict[item.DKBH].AreaOne;
                            var percent = item.JZMJ / one.JZZMJ;
                            if (double.IsNaN(percent))
                            {
                                if (NumberDict.ContainsKey(item.DKBH))
                                {
                                    percent = ((double)1) / ((double)NumberDict[item.DKBH]);
                                }
                                else
                                {
                                    percent = .0;
                                }
                            }
                            one = one * percent;
                            //commandText += string.Format(" YDZMJ={0},WJPZYDMJ={1},JZZMJ={2}", one.YDZMJ,one.WJPZYDMJ,one.JZZMJ);
                            commandText += string.Format(" YDZMJ={0},WJPZYDMJ={1},JZZDMJ={2},WPZJZMJ={3},WPZJZZDMJ={4},JZZMJ={5},SFWYCYPT='{6}',CYPTMC='{7}',TDSYQK='{8}',YKFTDMJ={9},WKFTDMJ={10},",
                                                         one.YDZMJ, one.WJPZYDMJ, one.JZZDMJ, one.WPZJZMJ, one.WPZJZZDMJ, one.JZZMJ, one.SFWYCYPT ? "是" : "否", one.CYPTMC, one.TDSYQK, one.YKFTDMJ, one.WKFTDMJ);
                        }
                        if (FacDict.ContainsKey(item.QYBH))
                        {
                            var      fac  = FacDict[item.QYBH];
                            TempData body = null;
                            if (TempDict.ContainsKey(item.QYBH))
                            {
                                body = TempDict[item.QYBH];
                                if (body.merge == null)
                                {
                                    TempDict[item.QYBH].merge = fac;
                                }

                                if (body.Count == 1)
                                {
                                    fac = body.merge - body.Reduce;
                                }
                                else
                                {
                                    TempDict[item.QYBH].Count--;
                                    fac = fac * item.Percent;
                                    TempDict[item.QYBH].Reduce = body.Reduce + fac;
                                }
                            }
                            else
                            {
                                fac  = fac * item.Percent;
                                body = new TempData();
                                body.CurrentNumber = 0;
                            }

                            //commandText += string.Format(" SFGXQY='{0}',SFGSQY='{1}',CYRS={2},HYDM='{3}'",
                            //    fac.SFGXQY ? "是" : "否", fac.SFGSQY ? "是" : "否", fac.CYRS,fac.HYDM
                            //    );
                            commandText += string.Format(" SFGXQY='{0}',HYDM='{1}',XZQMC='{2}',SFGSQY='{3}',CYRS={4},LJGDZCTZ={5},YDL2012={6},YDL2013={7},YDL2014={8},GSRKSS2012={9},GSRKSS2013={10},GSRKSS2014={11},DSRKSS2012={12},DSRKSS2013={13},DSRKSS2014={14},ZYYSR2012={15},ZYYSR2013={16},ZYYSR2014={17},CZQYSL={18}",
                                                         fac.SFGXQY ? "是" : "否", fac.HYDM, fac.XZJDMC, fac.SFGSQY ? "是" : "否", fac.CYRS, fac.LJGDZCTZ, fac.YDL2012, fac.YDL2013, fac.YDL2014, fac.GSRKSS2012, fac.GSRKSS2013, fac.GSRKSS2014, fac.DSRKSS2012, fac.DSRKSS2013, fac.DSRKSS2014, fac.ZYYSR2012, fac.ZYYSR2013, fac.ZYYSR2014, body.CZQYSL
                                                         );
                        }
                        commandText += string.Format(" where DKBH='{0}' AND QYBH='{1}'", item.DKBH, item.QYBH);
                        try
                        {
                            Command.CommandText = commandText;
                            Command.ExecuteNonQuery();
                            Console.WriteLine("成功2");
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
                Connection.Close();
            }
        }