Beispiel #1
0
        private void deleteFormMessage()
        {
            foreach (Form frm in Application.OpenForms)
            {
                if (frm is DrillForm)
                {
                    DrillForm drillform = (DrillForm)frm;

                    if (m_iDrillId == drillform.m_iDrillID)
                    {
                        ((DrillForm)frm).removeLable(unix);
                    }
                }
                else if (frm is CirculateForm)
                {
                    ((CirculateForm)frm).removeLable(unix);
                }
                else if (frm is DirectionalForm)
                {
                    ((DirectionalForm)frm).removeLable(unix);
                }
                else if (frm is DrillingGasForm)
                {
                    ((DrillingGasForm)frm).removeLable(unix);
                }
                else if (frm is DrillPVTForm)
                {
                    ((DrillPVTForm)frm).removeLable(unix);
                }
            }
        }
Beispiel #2
0
        private void setFormTagValue(string strValue)
        {
            foreach (Form frm in Application.OpenForms)
            {
                if (frm is DrillForm)
                {
                    DrillForm drillForm = (DrillForm)frm;
                    drillForm.setTagValues(strValue);
                }

                if (frm is CirculateForm)
                {
                    CirculateForm circulateForm = (CirculateForm)frm;
                    circulateForm.setTagValues(strValue);
                }

                if (frm is DirectionalForm)
                {
                    DirectionalForm directionalForm = (DirectionalForm)frm;
                    directionalForm.setTagValues(strValue);
                }
            }
        }
Beispiel #3
0
        private void OK_Click(object sender, EventArgs e)
        {
            bool reset = false;//定义是否重新启动页面

            #region 语言设置
            try
            {
                RadListDataItem selectLanguage = (RadListDataItem)rdp_language.SelectedItem.Value;
                if (selectLanguage.Value.ToString() != AppDrill.language)
                {
                    SetValue("Language", selectLanguage.Value.ToString());
                    AppDrill.language = selectLanguage.Value.ToString();
                    reset             = true;
                }
            }
            catch
            { }
            #endregion

            #region  择切换井
            RadListDataItem selectedItem = (RadListDataItem)rdp_wellNo.SelectedItem.Value;//必须取value然后转换再获取value
            var             DrillId      = -1;
            if (int.TryParse(selectedItem.Value.ToString(), out DrillId))
            {
                try
                {
                    if (DrillId != -1 && DrillId != AppDrill.DrillID)
                    {
                        SetValue("DrillID", DrillId.ToString());
                        AppDrill.DrillID = DrillId;
                        CurrentDrill c = _db.CurrentDrill.FirstOrDefault();
                        if (c != null && AppDrill.permissionId == 1)
                        {
                            c.CurrentDirllId = DrillId;//修改当前井号
                        }
                        //切换井之后进行自动导入测点操作
                        List <DrillTag> tag_list = _db.DrillTag.Where(o => o.DrillId == DrillId).ToList();
                        //如果查询到换井之后没数据,那么自动导入1号井的测点数据
                        if (tag_list.Count == 0)
                        {
                            _db.Database.ExecuteSqlCommand(@"insert into DrillTag SELECT [DrillId]={0}
                                                                                              ,[Tag]
                                                                                              ,[DefaultFrom]
                                                                                              ,[DefaultTo]
                                                                                              ,[Unit]
                                                                                              ,[HValue]
                                                                                              ,[LValue]
                                                                                              ,[Type]
                                                                                              ,[AlarmFlag]
                                                                                              ,[IsBool]
                                                                                              ,[dataMakeTime]={1}
                                                                                              ,[dataMakeUser]={2}
                                                                                              ,[dataMakePGM]={3}
                                                                                              ,[dataUpdTime]={4}
                                                                                              ,[dataUpdUser]={5}
                                                                                              ,[dataUpdPGM]={6}
                                                                                          FROM [DrillOS].[dbo].[DrillTag] where DrillId=1", new object[] { DrillId, DateTime.Now, AppDrill.username, "AddTag", DateTime.Now, AppDrill.username, "AddTag" });
                        }
                        _db.SaveChanges();
                        reset = true;
                    }
                }
                catch { }
            }
            #endregion

            #region 公英制选择
            try
            {
                RadListDataItem selectedType = (RadListDataItem)rdp_sys.SelectedItem.Value;//必须取value然后转换再获取value
                if (selectedType.Value.ToString() != "-1" && selectedType.Value.ToString() != AppDrill.UnitFormat)
                {
                    RadListDataItem selectSys = (RadListDataItem)rdp_sys.SelectedItem.Value;
                    SetValue("System", selectSys.Value.ToString());
                    AppDrill.UnitFormat = selectedType.Value.ToString();
                    reset = true;
                }
            }
            catch { }
            #endregion
            #region 界面设置启用
            try
            {
                string formSet = "";
                if (check_dir.Checked)
                {
                    formSet += "DirectionalForm";
                }
                if (check_gas.Checked)
                {
                    if (string.IsNullOrEmpty(formSet))
                    {
                        formSet += "DrillingGasForm";
                    }
                    else
                    {
                        formSet += ",DrillingGasForm";
                    }
                }
                if (check_tool.Checked)
                {
                    if (string.IsNullOrEmpty(formSet))
                    {
                        formSet += "ToolManageForm";
                    }
                    else
                    {
                        formSet += ",ToolManageForm";
                    }
                }
                if (check_rota.Checked)
                {
                    if (string.IsNullOrEmpty(formSet))
                    {
                        formSet += "RotaForm";
                    }
                    else
                    {
                        formSet += ",RotaForm";
                    }
                }
                string old_formSet = "";
                for (int i = 0; i < AppDrill.FormSet.Length; i++)
                {
                    if (i == 0)
                    {
                        old_formSet += AppDrill.FormSet[i];
                    }
                    else
                    {
                        old_formSet += "," + AppDrill.FormSet[i];
                    }
                }
                if (formSet != old_formSet)
                {
                    SetValue("FormSet", formSet);
                    AppDrill.FormSet = formSet.Split(',');
                    reset            = true;
                }
            }
            catch { }
            #endregion
            this.Close();
            //判断是否应该进行重启
            if (reset)
            {
                List <Form> disForm = new List <Form>();
                int         num     = Application.OpenForms.Count;
                for (int i = 0; i < num; i++)
                {
                    Form f = Application.OpenForms[i];
                    if (f.Name != "LoginForm")
                    {
                        disForm.Add(f);
                    }
                }
                foreach (var item in disForm)
                {
                    item.Dispose();
                }
                AppDrill.message.Clear();
                AppDrill.Command.Clear();
                //开启全部带有数据显示的界面
                DrillForm main = new DrillForm();
                main.Size = new System.Drawing.Size(1920, 1080);
                main.Show();
                //CirculateForm circulate = new CirculateForm();
                //circulate.WindowState = FormWindowState.Minimized;
                //circulate.Show();
                //DrillPVTForm pvt = new DrillPVTForm();
                //pvt.WindowState = FormWindowState.Minimized;
                //pvt.Show();
                //if (AppDrill.FormSet.Contains("DrillingGasForm"))
                //{
                //    DrillingGasForm gas = new DrillingGasForm();
                //    gas.WindowState = FormWindowState.Minimized;
                //    gas.Show();
                //}
                //if (AppDrill.FormSet.Contains("DirectionalForm"))
                //{
                //    DirectionalForm direction = new DirectionalForm();
                //    direction.WindowState = FormWindowState.Minimized;
                //    direction.Show();
                //}
            }
        }