示例#1
0
        public void InitContorl() {
            int MaxWordWidth = CalcWidth();
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            decimal xlsum = 0;
            decimal maxxl = 0;
            string strSQL = "";
            if (MaxWordWidth < 300) {
                MaxWordWidth = 300;
            }
            if (parentTemple != null && templeList != null) {
                foreach (LP_Temple lp in templeList) {
                    bool flag;//= (lp.Status == CurrRecord.Status);
                    flag = lp.IsVisible == 0;
                    Label label = new Label();
                    label.Text = lp.CellName;
                    //string[] location = lp.CtrlLocation.Split(',');
                    string[] size = lp.CtrlSize.Split(',');
                    label.Location = new Point(currentPosX, currentPosY);
                    label.Size = new Size(MaxWordWidth, 14);
                    label.Visible = flag;
                    if (flag) {
                        currentPosY += 20;
                    }
                    Control ctrl;

                    if (lp.CtrlType.Contains("uc_gridcontrol")) {
                        ctrl = new uc_gridcontrol();
                        ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged);
                        ((uc_gridcontrol)ctrl).FocusedColumnChanged += new DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventHandler(gridView1_FocusedColumnChanged);
                    } else
                        ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
                    ctrl.Location = new Point(currentPosX, currentPosY);
                    ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
                    if (flag) {
                        currentPosY += int.Parse(size[1]) + 10;
                    }

                    ctrl.TextChanged += new EventHandler(ctrl_Leave);

                    ctrl.Enter += new EventHandler(ctrl_Enter);
                    ctrl.Leave += new EventHandler(ctrl_Leave);
                    ctrl.Visible = flag;
                    ctrl.Tag = lp;
                    ctrl.TabIndex = index;

                    if (lp.CtrlType.Contains("uc_gridcontrol")) {
                        (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar), lp);
                        (ctrl as uc_gridcontrol).iniTableRecordData(currRecord.ID, lp, currRecord.tqCode, currRecord.tqName);
                    }
                    index++;
                    ctrl.Name = lp.LPID;
                    dockPanel1.Controls.Add(label);
                    dockPanel1.Controls.Add(ctrl);
                    if (lp.CellName == "类型") {

                        Button btn_rec = new Button();
                        btn_rec.Location = new Point(ctrl.Location.X + 200, ctrl.Location.Y);
                        dockPanel1.Controls.Add(btn_rec);
                        btn_rec.Text = "重新生成";
                        btn_rec.Click += new EventHandler(btn_rec_Click);
                    }
                    if (lp.CellName.IndexOf("台区") > -1) {
                        ctrl.Text = currRecord.tqName;
                    } else
                        if (lp.CellName.IndexOf("低压线路") > -1) {

                            PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                            strSQL = " where left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "'"
                                + " and linevol='0.4'";
                            ctrl.Tag = lp;
                            xlsum = 0;
                            IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                            foreach (PS_xl xl in xlli) {
                                xlsum += lineLength(xl);
                            }
                            ctrl.Text = (Math.Round(xlsum, 1)).ToString();
                        } else
                            if (lp.CellName.IndexOf("最大供电半径") > -1) {

                                PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqName='" + currRecord.tqName + "'");
                                strSQL = "where left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "'";
                                //ctrl.Tag = lp;
                                xlsum = 0;
                                maxxl = 0;
                                IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                foreach (PS_xl xl in xlli) {

                                    xlsum = lineLength(xl);
                                    if (xlsum > maxxl) {
                                        maxxl = xlsum;
                                    }
                                }
                                ctrl.Text = (Math.Round(maxxl, 1)).ToString();
                            } else
                                if (lp.CellName.IndexOf("低压杆基数") > -1) {

                                    PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqcode='" + currRecord.tqCode + "'");
                                    lp.SqlSentence = "select case  when cast(count(*) as varchar) is null then '0' else cast(count(*) as varchar)  end   from dbo.PS_gt where  gtID in (select gtID"
                                                        + " from PS_gt where 5=5 and gtjg='否' and  left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "')";
                                    ctrl.Tag = lp;
                                } else
                                    if (lp.CellName.IndexOf("表箱数") > -1) {

                                        PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqcode='" + currRecord.tqCode + "'");
                                        lp.SqlSentence = "select cast(sum(sbNumber)as varchar) from PS_gtsb where 5=5  and sbName like '%表箱%'"
                                            + " and gtID in ("
                                            + "  (select gtID from PS_gt where 5=5 and LineCode in(select LineCode from PS_xl where 5=5 and  left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "')))";
                                        ctrl.Tag = lp;
                                    } else
                                        if (lp.CellName.IndexOf("四线的一类") > -1) {

                                            PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                            strSQL = "  where linenum='四线' and lineKind='一类' and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";
                                            ctrl.Tag = lp;
                                            xlsum = 0;
                                            IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                            foreach (PS_xl xl in xlli) {
                                                xlsum += lineLength(xl);
                                            }
                                            if (xlsum > 0)
                                                ctrl.Text = Math.Round(xlsum, 1).ToString();
                                        } else
                                            if (lp.CellName.IndexOf("四线的二类(km)") > -1) {

                                                PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                                strSQL = "where  linenum='四线' and  lineKind='二类'  and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";

                                                ctrl.Tag = lp;
                                                xlsum = 0;
                                                IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                                foreach (PS_xl xl in xlli) {
                                                    xlsum += lineLength(xl);
                                                }
                                                if (xlsum > 0)
                                                    ctrl.Text = Math.Round(xlsum, 1).ToString();
                                            } else
                                                if (lp.CellName.IndexOf("四线的三类(km)") > -1) {

                                                    PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                                    strSQL = "where  linenum='四线' and  lineKind='三类'  and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";

                                                    ctrl.Tag = lp;
                                                    xlsum = 0;
                                                    IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                                    foreach (PS_xl xl in xlli) {
                                                        xlsum += lineLength(xl);
                                                    }
                                                    if (xlsum > 0)
                                                        ctrl.Text = Math.Round(xlsum, 1).ToString();
                                                } else
                                                    if (lp.CellName.IndexOf("二线的一类") > -1) {

                                                        PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                                        strSQL = "where  linenum='二线' and  lineKind='一类'  and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";

                                                        ctrl.Tag = lp;
                                                        xlsum = 0;
                                                        IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                                        foreach (PS_xl xl in xlli) {
                                                            xlsum += lineLength(xl);
                                                        }
                                                        if (xlsum > 0)
                                                            ctrl.Text = Math.Round(xlsum, 1).ToString();
                                                    } else
                                                        if (lp.CellName.IndexOf("二线的二类(km)") > -1) {

                                                            PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                                            strSQL = "where  linenum='二线' and  lineKind='二类'  and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";

                                                            ctrl.Tag = lp;
                                                            xlsum = 0;
                                                            IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                                            foreach (PS_xl xl in xlli) {
                                                                xlsum += lineLength(xl);
                                                            }
                                                            if (xlsum > 0)
                                                                ctrl.Text = Math.Round(xlsum, 1).ToString();
                                                        } else
                                                            if (lp.CellName.IndexOf("二线的三类(km)") > -1) {

                                                                PS_tq tq = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tq>(" where tqCode='" + currRecord.tqCode + "'");
                                                                strSQL = "where  linenum='二线' and  lineKind='三类'  and left(linecode," + tq.tqCode.Length + ")='" + tq.tqCode + "' and linevol='0.4'";

                                                                ctrl.Tag = lp;
                                                                xlsum = 0;
                                                                IList<PS_xl> xlli = MainHelper.PlatformSqlMap.GetList<PS_xl>(strSQL);
                                                                foreach (PS_xl xl in xlli) {
                                                                    xlsum += lineLength(xl);
                                                                }
                                                                if (xlsum > 0)
                                                                    ctrl.Text = Math.Round(xlsum, 1).ToString();
                                                            }
                }
            }
            InitEvent();
            InitData();
            //if (RecordWorkTask.HaveRunSPYJRole(kind))
            //{
            //    if (hqyjcontrol == null) hqyjcontrol = new SPYJControl();
            //    hqyjcontrol.Size = new System.Drawing.Size(400, 200);
            //    hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
            //    currentPosY = currentPosY + hqyjcontrol.Size.Height;
            //    hqyjcontrol.RecordID = CurrRecord.ID;
            //    dockPanel1.Controls.Add(hqyjcontrol);
            //}

            //if (RecordWorkTask.HaveRunFuJianRole(kind))
            //{

            //    if (filecontrol==null) filecontrol = new DownFileControl();
            //    if(status=="add")
            //    filecontrol.FormType = "上传";
            //    else if (status == "edit")
            //    {
            //        filecontrol.FormType = "下载";
            //    }
            //    filecontrol.Size = new System.Drawing.Size(400, 300);
            //    filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
            //    currentPosY = currentPosY + filecontrol.Size.Height;
            //    filecontrol.UpfilePath = GetWorkFlowNmae(kind);
            //    if (currRecord==null)
            //    {
            //        currRecord = new LP_Record();
            //    }
            //    filecontrol.RecordID = CurrRecord.ID;
            //    dockPanel1.Controls.Add(filecontrol);
            //    currentPosY += 20;
            //}

            Button btn_Submit = new Button();
            dockPanel1.Controls.Add(btn_Submit);
            btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
            btn_Submit.Text = "提交";
            btn_Submit.Click += new EventHandler(btn_Submit_Click);
            Button btn_pic = new Button();
            dockPanel1.Controls.Add(btn_pic);
            btn_pic.Location = new Point(currentPosX + 200, 26);
            btn_pic.Click += new EventHandler(btn_pic_Click);

            btn_pic.Text = "生成台区图";
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }
示例#2
0
        public void InitContorl()
        {
            int MaxWordWidth = CalcWidth();
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            if (MaxWordWidth < 300)
            {
                MaxWordWidth = 300;
            }
            if (parentTemple != null && templeList != null)
            {
                if (_type != "")
                {
                    foreach (LP_Temple lp in templeList)
                    {
                        bool flag;//= (lp.Status == CurrRecord.Status);
                        flag = lp.IsVisible == 0;
                        Label label = new Label();
                        label.Text = lp.CellName;
                        //string[] location = lp.CtrlLocation.Split(',');
                        string[] size = lp.CtrlSize.Split(',');
                        label.Location = new Point(currentPosX, currentPosY);
                        label.Size = new Size(MaxWordWidth, 14);
                        label.Visible = flag;
                        if (flag)
                        {
                            currentPosY += 20;
                        }
                        Control ctrl;

                        if (lp.CtrlType.Contains("uc_gridcontrol"))
                        {
                            ctrl = new uc_gridcontrol();
                            ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged);
                            ((uc_gridcontrol)ctrl).FocusedColumnChanged += new DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventHandler(gridView1_FocusedColumnChanged);
                        }
                        else
                            ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
                        ctrl.Location = new Point(currentPosX, currentPosY);
                        ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
                        if (flag)
                        {
                            currentPosY += int.Parse(size[1]) + 10;
                        }


                        ctrl.TextChanged += new EventHandler(ctrl_Leave);

                        ctrl.Enter += new EventHandler(ctrl_Enter);
                        ctrl.Leave += new EventHandler(ctrl_Leave);
                        ctrl.Visible = flag;
                        ctrl.Tag = lp;
                        ctrl.TabIndex = index;
                        if (lp.CtrlType.Contains("uc_gridcontrol"))
                        {
                            (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar), lp);


                            (ctrl as uc_gridcontrol).iniTableRecordData(currRecord.ID, lp, currRecord.ID, currRecord.wdmc);

                        }
                        index++;
                        ctrl.Name = lp.LPID;
                        dockPanel1.Controls.Add(label);
                        dockPanel1.Controls.Add(ctrl);

                    }
                }
                InitEvent();
                InitData();
            }
            Button btn_Submit = new Button();
            dockPanel1.Controls.Add(btn_Submit);
            btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
            if (_type != "")
            {
                btn_Submit.Text = "提交";
                btn_Submit.Click += new EventHandler(btn_Submit_Click);
            }
            else
            {
                btn_Submit.Text = "关闭";
                btn_Submit.Click += new EventHandler(btn_Close);
            }
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();

        }
示例#3
0
        public void InitContorl()
        {
            int MaxWordWidth = CalcWidth();
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            if (MaxWordWidth < 300) MaxWordWidth = 300;
            try
            {
                if (parentTemple != null)
                {
                    foreach (LP_Temple lp in templeList)
                    {
                        bool flag;//= (lp.Status == CurrRecord.Status);
                        flag = lp.IsVisible == 0;
                        Label label = new Label();
                        ComboBoxEdit btTip = null;
                        CheckEdit ceTip = null;
                        label.Text = lp.CellName;
                        //string[] location = lp.CtrlLocation.Split(',');
                        string[] size = lp.CtrlSize.Split(',');
                        label.Location = new Point(currentPosX, currentPosY);
                        label.Size = new Size(MaxWordWidth, 14);
                        label.Visible = flag;
                        if (flag)
                        {
                            currentPosY += 20;
                        }
                        IList<WF_WorkTastTrans> wttli = MainHelper.PlatformSqlMap.GetList<WF_WorkTastTrans>(" where tlcjdid='" +
                            WorkFlowData.Rows[0]["WorkTaskId"].ToString()
                            + "' and cdfs like '下拉%' and tlcjdzdid='" + lp.LPID + "'");
                        if (lp.CtrlType.Contains("MemoEdit") && flag && (lp.SqlSentence != "" || wttli.Count > 0))
                        {
                            btTip = new ComboBoxEdit();
                            btTip.Name = "bt" + lp.LPID;
                            btTip.Location = new Point(currentPosX, currentPosY);
                            btTip.Size = new Size(300, 14);
                            btTip.Tag = lp;

                            ceTip = new CheckEdit();
                            ceTip.Name = "ce" + lp.LPID;
                            ceTip.Location = new Point(currentPosX + btTip.Width + 10, currentPosY);
                            ceTip.Size = new Size(80, 14);
                            ceTip.Text = "累加";
                            ceTip.Checked = false;
                            currentPosY += 30;
                        }
                        else
                            if (lp.CtrlType.Contains("TextEdit") && flag && (lp.SqlSentence != "" || wttli.Count > 0))
                            {
                                btTip = new ComboBoxEdit();
                                btTip.Name = "bt" + lp.LPID;
                                btTip.Location = new Point(currentPosX, currentPosY);
                                btTip.Size = new Size(300, 14);
                                btTip.Tag = lp;

                                ceTip = new CheckEdit();
                                ceTip.Name = "ce" + lp.LPID;
                                ceTip.Location = new Point(currentPosX + btTip.Width + 10, currentPosY);
                                ceTip.Size = new Size(80, 14);
                                ceTip.Text = "累加";
                                ceTip.Checked = false;
                                currentPosY += 30;
                            }

                        Control ctrl;

                        if (lp.CtrlType.Contains("uc_gridcontrol"))
                        {
                            ctrl = new uc_gridcontrol();
                            ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged);
                            ((uc_gridcontrol)ctrl).FocusedColumnChanged += new DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventHandler(gridView1_FocusedColumnChanged);
                        }
                        else
                            ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
                        ctrl.Location = new Point(currentPosX, currentPosY);
                        ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
                        if (flag)
                        {
                            currentPosY += int.Parse(size[1]) + 10;
                        }
                        ctrl.Enter += new EventHandler(ctrl_Enter);
                        ctrl.Leave += new EventHandler(ctrl_Leave);
                        ctrl.TextChanged += new EventHandler(ctrl_Leave);
                        ctrl.Visible = flag;
                        ctrl.Tag = lp;
                        ctrl.TabIndex = index;
                        if (btTip != null)
                        {
                            btTip.TabIndex = index;
                            index++;
                            btTip.TextChanged += new EventHandler(btTip_Click);
                        }
                        if (lp.CtrlType.Contains("uc_gridcontrol"))
                        {
                            label.Text = lp.CellName + "(Tab键可选下一格)";
                            (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar), lp);
                            //if (RecordWorkTask.HaveRunPowerRole(WorkConst.WorkTask_BindTable, WorkFlowData.Rows[0]["WorkFlowId"].ToString(), WorkFlowData.Rows[0]["WorkTaskId"].ToString()) || currRecord.Status == "填票")
                            {
                                (ctrl as uc_gridcontrol).iniTableRecordData(currRecord.ID, lp, WorkFlowData.Rows[0]["WorkFlowId"].ToString(), WorkFlowData.Rows[0]["WorkFlowInsId"].ToString());
                            }
                        }

                        index++;
                        ctrl.Name = lp.LPID;
                        dockPanel1.Controls.Add(label);
                        if (btTip != null)
                        {
                            dockPanel1.Controls.Add(btTip);
                            dockPanel1.Controls.Add(ceTip);
                        }
                        dockPanel1.Controls.Add(ctrl);
                        if (lp.CellName == "编号")
                        {
                            ctrlNumber = ctrl;
                        }
                        if (lp.CellName.Contains("编号2"))
                        {
                            ctrlNumber2 = ctrl;
                        }
                        if (lp.CtrlType.IndexOf("DateEdit") > -1)
                        {

                            if (lp.WordCount.ToLower().IndexOf("hh") > -1)
                            {
                                ((DateEdit)ctrl).Properties.VistaDisplayMode = DevExpress.Utils.DefaultBoolean.True;
                                ((DateEdit)ctrl).Properties.VistaEditTime = DevExpress.Utils.DefaultBoolean.True;
                            }
                        }
                        if (lp.CtrlType.Contains("SpinEdit") && lp.WordCount != "")
                        {
                            SpinEdit lue1 = (SpinEdit)ctrl;
                            if (lp.WordCount.IndexOf("p") > -1)
                            {
                                lue1.Properties.Increment = (decimal)0.0001;
                                lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            }
                            else
                                if (lp.WordCount.IndexOf(".") > -1)
                                {
                                    Regex r2 = new Regex(@"(?<=\.).*");
                                    lue1.Properties.Increment = (decimal)Math.Pow(0.1, r2.Match(lp.WordCount).Value.Length / 2);
                                    lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;

                                }
                            lue1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            lue1.Properties.EditFormat.FormatString = lp.WordCount;
                            lue1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            lue1.Properties.DisplayFormat.FormatString = lp.WordCount;
                            lue1.Properties.EditMask = lp.WordCount;

                        }
                    }
                }
                InitEvent();
                InitData();
                InitTaskData();
            }
            catch { }
            try
            {
                if (RecordWorkTask.HaveRunSPYJRole(kind))
                {
                    if (hqyjcontrol == null) hqyjcontrol = new SPYJControl();
                    hqyjcontrol.Size = new System.Drawing.Size(400, 200);
                    hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
                    currentPosY = currentPosY + hqyjcontrol.Size.Height;
                    hqyjcontrol.RecordID = CurrRecord.ID;
                    hqyjcontrol.TabIndex = index;
                    index++;
                    dockPanel1.Controls.Add(hqyjcontrol);
                }

                if (RecordWorkTask.HaveRunFuJianRole(kind))
                {

                    if (filecontrol == null) filecontrol = new DownFileControl();
                    if (status == "add")
                        filecontrol.FormType = "上传";
                    else if (status == "edit")
                    {
                        filecontrol.FormType = "下载";
                    }
                    filecontrol.Size = new System.Drawing.Size(400, 200);
                    filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
                    currentPosY = currentPosY + filecontrol.Size.Height;
                    filecontrol.UpfilePath = GetWorkFlowNmae(kind);
                    filecontrol.TaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                    if (currRecord == null)
                    {
                        currRecord = new LP_Record();
                    }
                    filecontrol.RecordID = CurrRecord.ID;
                    filecontrol.TabIndex = index;
                    index++;
                    dockPanel1.Controls.Add(filecontrol);
                    currentPosY += 20;
                }
                if (RecordWorkTask.HaveWorkFlowBackRole(WorkFlowData.Rows[0]["WorkTaskId"].ToString(), WorkFlowData.Rows[0]["WorkFlowId"].ToString()))
                {
                    Button btn_Back = new Button();
                    dockPanel1.Controls.Add(btn_Back);
                    btn_Back.Click += new EventHandler(btn_Back_Click);
                    btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10);
                    btn_Back.Text = "退回";

                    btn_Back = new Button();
                    dockPanel1.Controls.Add(btn_Back);
                    btn_Back.Click += new EventHandler(btn_Save_Click);
                    btn_Back.Location = new Point(currentPosX + 80 + btn_Back.Width, currentPosY + 10);
                    btn_Back.Text = "保存";
                }
                else
                {
                    Button btn_Back = new Button();
                    dockPanel1.Controls.Add(btn_Back);
                    btn_Back.Click += new EventHandler(btn_Save_Click);
                    btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10);
                    btn_Back.Text = "保存";

                }
            }
            catch { }
            Button btn_Submit = new Button();
            dockPanel1.Controls.Add(btn_Submit);
            btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
            btn_Submit.Text = "提交";
            btn_Submit.Click += new EventHandler(btn_Submit_Click);
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }
        public void InitContorl()
        {
            int MaxWordWidth = CalcWidth();
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            if (MaxWordWidth < 300)
            {
                MaxWordWidth = 300;
            }
            if (parentTemple != null && templeList!=null)
            {
                foreach (LP_Temple lp in templeList)
                {
                    bool flag;//= (lp.Status == CurrRecord.Status);
                    flag = lp.IsVisible==0;
                    Label label = new Label();
                    label.Text = lp.CellName;
                    //string[] location = lp.CtrlLocation.Split(',');
                    string[] size = lp.CtrlSize.Split(',');
                    label.Location = new Point(currentPosX, currentPosY);
                    label.Size = new Size(MaxWordWidth, 14);
                    label.Visible = flag;
                    if (flag)
                    {
                        currentPosY += 20;
                    }
                    Control ctrl;

                    if (lp.CtrlType.Contains("uc_gridcontrol"))
                    {
                        ctrl = new uc_gridcontrol();
                        ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged);
                        ((uc_gridcontrol)ctrl).FocusedColumnChanged += new DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventHandler(gridView1_FocusedColumnChanged);
                    }
                    else
                        ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
                    ctrl.Location = new Point(currentPosX, currentPosY);
                    ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
                    if (flag)
                    {
                        currentPosY += int.Parse(size[1]) + 10;
                    }

                   
                     ctrl.TextChanged += new EventHandler(ctrl_Leave);
                   
                    ctrl.Enter += new EventHandler(ctrl_Enter);
                    ctrl.Leave += new EventHandler(ctrl_Leave);
                    ctrl.Visible = flag;
                    ctrl.Tag = lp;
                    ctrl.TabIndex = index;
                  
                    if (lp.CtrlType.Contains("uc_gridcontrol"))
                    {
                        (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar), lp);
                        
                            (ctrl as uc_gridcontrol).iniTableRecordData(currRecord.ID, lp, modleGuid, orgname);
                       
                    }
                    index++;
                    if (lp.CellName.IndexOf("供电所名称") > -1)
                    {
                        ctrl.Text = orgname;
                    }
                    ctrl.Name = lp.LPID;
                    dockPanel1.Controls.Add(label);
                    dockPanel1.Controls.Add(ctrl);
                   
                }
            }
            InitEvent();
            InitData();
            //if (RecordWorkTask.HaveRunSPYJRole(kind))
            //{
            //    if (hqyjcontrol == null) hqyjcontrol = new SPYJControl();
            //    hqyjcontrol.Size = new System.Drawing.Size(400, 200);
            //    hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
            //    currentPosY = currentPosY + hqyjcontrol.Size.Height;
            //    hqyjcontrol.RecordID = CurrRecord.ID;
            //    dockPanel1.Controls.Add(hqyjcontrol);
            //}

            //if (RecordWorkTask.HaveRunFuJianRole(kind))
            //{

            if (filecontrol == null) filecontrol = new DownFileControl();
            if (status == "add")
                filecontrol.FormType = "上传";
            else if (status == "edit")
            {
                filecontrol.FormType = "下载";
            }
            filecontrol.Size = new System.Drawing.Size(400, 300);
            filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
            currentPosY = currentPosY + filecontrol.Size.Height;
            filecontrol.UpfilePath = "安全运行记录板";

            filecontrol.RecordID = currRecord.ID;
            dockPanel1.Controls.Add(filecontrol);
            currentPosY += 20;
            //}
           
            Button btn_Submit = new Button();
            dockPanel1.Controls.Add(btn_Submit);
            btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
            btn_Submit.Text = "提交";
            btn_Submit.Click += new EventHandler(btn_Submit_Click);
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }