Пример #1
0
        public static List <LineRoadModel> GetLineRoadDesignModelLst(DbDataReader lineRoadDesignDR)
        {
            List <LineRoadModel> lrmodelht = new List <LineRoadModel>();

            if (null != lineRoadDesignDR && lineRoadDesignDR.HasRows)
            {
                try
                {
                    while (lineRoadDesignDR.Read())
                    {
                        LineRoadModel tmplrmodel = new LineRoadModel();

                        Type type = tmplrmodel.GetType();
                        foreach (PropertyInfo p in type.GetProperties())
                        {
                            string proName = p.Name.Trim();
                            Type   pt      = p.PropertyType;
                            object proValue;
                            if (pt.Equals(typeof(bool)))
                            {
                                proValue = lineRoadDesignDR[proName];
                            }
                            else
                            {
                                proValue = lineRoadDesignDR[proName].ToString().Trim();
                            }



                            type.GetProperty(proName).SetValue(tmplrmodel, proValue, null);
                        }
                        lrmodelht.Add(tmplrmodel);//将表中的主键作为key值,将对象赋予到哈希表中
                    }
                }
                catch
                {
                    lineRoadDesignDR.Close();
                }
                lineRoadDesignDR.Close();
            }

            return(lrmodelht);
        }
Пример #2
0
        private LineRoadDesignClass CreateLRDesignStrucByFrm(string Lrmodelid)
        {
            LineRoadModel tmplrmodel = new LineRoadModel();

            tmplrmodel.LineRoadDesignDetailID = Lrmodelid;
            //1,测网设计;
            if (this.rb_CeWangYes.Checked)//绘制测网;
            {
                tmplrmodel.ifAddCeWang  = true;
                tmplrmodel.IfCeWangHeng = this.chb_cWHeng.Checked;
                tmplrmodel.IfCeWangZong = this.chb_cwZong.Checked;
                if (null != this.cb_CeWangStyle.SelectedValue)
                {
                    tmplrmodel.cewangstyle = this.cb_CeWangStyle.SelectedValue.ToString();
                }
                tmplrmodel.cewangfixlen   = this.tb_CeWangFixLen.Text.Trim();
                tmplrmodel.cewangsepnum   = this.tb_CeWangSepNum.Text.Trim();
                tmplrmodel.duishuminvalue = this.tb_CWDuiShuMin.Text.Trim();
                tmplrmodel.duishuParam    = this.tb_CWDuiShuParam.Text.Trim();
            }
            else
            {
                tmplrmodel.ifAddCeWang = false;
            }
            //2,线道样式
            tmplrmodel.IfLeftSecondKD      = this.chb_ifLeftSecondKD.Checked;
            tmplrmodel.IfRightSecondKD     = this.chb_ifRightSecondKD.Checked;
            tmplrmodel.IfzhengMiLine       = this.chb_ifZhengMiLine.Checked;
            tmplrmodel.LineRoadWidth       = this.tb_LineGroupWidth.Text.Trim();
            tmplrmodel.LineRoadName        = this.tb_LineRoadName.Text.Trim();
            tmplrmodel.LineroadTitleHeight = this.tb_titleStartHeight.Text.Trim();
            if (null != this.cb_LineRoadStyle.SelectedValue)
            {
                tmplrmodel.LineRoadStyle = this.cb_LineRoadStyle.SelectedValue.ToString();
            }

            //3,线道头左侧线
            tmplrmodel.TitleLeftFrameLineChecked = this.chk_IfDrawTitleLeft.Checked;
            if (null != this.cb_leftline.SelectedValue)
            {
                tmplrmodel.LeftLineStyle = this.cb_leftline.SelectedValue.ToString().Trim();
            }
            tmplrmodel.LeftLineLength = this.tb_leftlineLength.Text;

            //4,线道所包含的绘图项
            for (int i = 0; i < this.lb_selected.Items.Count; i++)
            {
                string tmpItem = this.lb_selected.Items[i].ToString();


                string[] tmpItemArr = tmpItem.Split(';');
                if (tmpItemArr.Length == 3)
                {
                    string        id    = tmpItemArr[0];
                    string        style = tmpItemArr[1];
                    string        name  = tmpItemArr[2];
                    DrawItemStyle dis   = EnumUtil.GetEnumByStr(style, DrawItemStyle.NoneItem);
                    if (dis.Equals(DrawItemStyle.LineItem))
                    {
                        tmplrmodel.CurveItemCollections = tmplrmodel.CurveItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.TextItem))
                    {
                        tmplrmodel.TextItemCollections = tmplrmodel.TextItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.HCGZItem))
                    {
                        tmplrmodel.HcgzItemCollections = tmplrmodel.HcgzItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.SymbolItem))
                    {
                        tmplrmodel.SymbolItemCollections = tmplrmodel.SymbolItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.ImageItem))
                    {
                        tmplrmodel.ImageItemCollections = tmplrmodel.ImageItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.MultiHatchCurveItem))
                    {
                        tmplrmodel.MultiHatchCurveItemCollections = tmplrmodel.MultiHatchCurveItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.HatchRectItem))
                    {
                        tmplrmodel.HatchRectItemCollections = tmplrmodel.HatchRectItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.NormalPuTuItem))
                    {
                        tmplrmodel.NormalPuTuItemCollections = tmplrmodel.NormalPuTuItemCollections + id + ";";
                    }
                    else if (dis.Equals(DrawItemStyle.CurveHasHatchItem))
                    {
                        tmplrmodel.CurveHasHatchItemCollections = tmplrmodel.CurveHasHatchItemCollections + id + ";";
                    }
                }
            }
            LineRoadDesignClass tmplr = new LineRoadDesignClass(tmplrmodel);

            return(tmplr);
        }