예제 #1
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)
            {
                foreach (LP_Temple lp in templeList)
                {
                    bool flag;//= (lp.Status == CurrRecord.Status);
                    flag = true;
                    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);
                    }
                    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);
                    }
                    index++;
                    ctrl.Name = lp.LPID;
                    dockPanel1.Controls.Add(label);
                    dockPanel1.Controls.Add(ctrl);
                    if (lp.CellName == "编号")
                    {
                        ctrlNumber = 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, 200);
                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;
            }
            if (currRecord.Status!="存档"||(WorkFlowData!=null&& 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 = "退回";
            }
            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_Close);
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }
예제 #2
0
        public void InitContorl()
        {
            int MaxWordWidth = 0;
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;


            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();
                string statusstemp = RecordWorkTask.GetWorkTaskStatus(WorkFlowData, currRecord);
                if (statusstemp == "add")
                    filecontrol.FormType = "上传";
                else if (statusstemp == "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;
            }
            MaxWordWidth = CalcWidth();
            dockPanel1.Width = MaxWordWidth + 10;
            switch (status)
            {
                case "add":
                case "edit":
                    Button btn_Submit = new Button();
                    dockPanel1.Controls.Add(btn_Submit);
                    btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
                    btn_Submit.Click += new EventHandler(btn_Submit_Click);
                    btn_Submit.Text = "提交";
                    break;

                case "view":
                    Button btn_View = new Button();
                    dockPanel1.Controls.Add(btn_View);
                    btn_View.Location = new Point(currentPosX, currentPosY + 10);
                    btn_View.Click += new EventHandler(btn_View_Click);
                    btn_View.Text = "查看";
                    break;
            }
                    if (dockPanel1.ControlContainer.Controls.Count > 0)
                        dockPanel1.ControlContainer.Controls[0].Focus();

        }
예제 #3
0
        public void InitContorl()
        {
            int MaxWordWidth =0;
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            if (MaxWordWidth < 300) MaxWordWidth = 300;
       
            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, 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;
                filecontrol.TabIndex = index;
                index++;
                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_Hide);
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }
예제 #4
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();
        }
예제 #5
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)
            {
                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();
        }