Пример #1
0
        private void FormNewYear_Load(object sender, EventArgs e)
        {
            s.Add("S1");
            s.Add("S2");
            s.Add("S3");
            s.Add("S4");
            s.Add("S5");
            s.Add("S6");
            s.Add("S7");
            s.Add("S8");
            s.Add("S9");
            s.Add("S10");
            s.Add("S11");
            s.Add("S12");
            s.Add("S13");
            s.Add("S14");
            s.Add("S15");
            s.Add("S16");
            s.Add("S17");
            s.Add("S18");
            s.Add("S19");
            s.Add("S20");
            s.Add("S21");
            s.Add("S22");
            s.Add("S23");
            s.Add("S24");
            s.Add("S25");
            s.Add("S26");
            s.Add("S27");
            s.Add("S28");
            s.Add("S29");
            s.Add("S30");

            spinEdit1.Text = classname;
            classname1 = classname;
            if (!IsUpdate)
            {
                psp_sl = new Line_beicong();
                psp_sl.Type = type;
                psp_sl.Type2 = type2;
                psp_sl.Flag = flag;
            }
            else
            {
                Line_beicong ps = new Line_beicong();
                ps.Title = classname;
                ps.ClassType = classtype;
                ps.Flag = flag;
                ps.Type = type;
                ps.Type2 = type2;

                psp_sl = (Line_beicong)Common.Services.BaseService.GetObject("SelectLine_beicongByAll", ps);

            }
        }
Пример #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            string z = "自定义列";

            classname = psp_sl.Title = spinEdit1.Text + z;
            if (classname.ToString() == "")
            {
                MsgBox.Show("类别名称不能为空");
                return;
            }

            try
            {
                if (Common.Services.BaseService.GetObject("SelectLine_beicongByTitleTypeClass", psp_sl) == null)
                {
                    try
                    {
                        if (!IsUpdate)
                        {
                            bool bz = false;
                            string f = "";
                            foreach (string ss in s)
                            {
                                Line_beicong ps = new Line_beicong();
                                ps.Title = classname;
                                ps.Flag = flag;
                                ps.Type = type;
                                ps.Type2 = type2;
                                ps.ClassType = ss;

                                object obj = Common.Services.BaseService.GetObject("SelectLine_beicongByTitleTypeClass1", ps);
                                if (obj == null)
                                {
                                    classtype = ss;
                                    bz = true;
                                    f = ss;
                                    break;
                                }

                            }
                            if (bz)
                            {
                            psp_sl.ClassType = f;
                            Common.Services.BaseService.Create<Line_beicong>(psp_sl);
                                }

                            }
                            else
                            {
                                Common.Services.BaseService.Update<Line_beicong>(psp_sl);
                            }

                            this.DialogResult = DialogResult.OK;

                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("出错啦:" + ex.Message);
                    }
                }
                else
                {
                    MsgBox.Show("此分类已经存在,请重新输入!");
                }

            }
            catch { }
        }
Пример #3
0
        private void InsertLineData1()
        {
            Line_beizhu z1 = new Line_beizhu();
            Line_beicong z2 = new Line_beicong();
            //try
            //{
            DataTable dts = new DataTable();
            OpenFileDialog op = new OpenFileDialog();
            op.Filter = "Excel�ļ�(*.xls)|*.xls";
            if (op.ShowDialog() == DialogResult.OK)
            {
                dts = GetExcel(op.FileName);
                for (int i = 1; i < dts.Rows.Count; i++)
                {
                    try
                    {
                        z1.Title = dts.Rows[i][0].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S1 = dts.Rows[i][1].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S2 = dts.Rows[i][2].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S3 = dts.Rows[i][3].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S4 = dts.Rows[i][4].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S5 = dts.Rows[i][5].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S6 = dts.Rows[i][6].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S7 = dts.Rows[i][7].ToString();

                    }
                    catch { }
                    try
                    {
                        z1.S8 = dts.Rows[i][8].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S9 = dts.Rows[i][9].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S10 = dts.Rows[i][10].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S11 = dts.Rows[i][11].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S12 = dts.Rows[i][12].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S13 = dts.Rows[i][13].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S14 = dts.Rows[i][14].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S15 = dts.Rows[i][15].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S16 = dts.Rows[i][16].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S17 = dts.Rows[i][17].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S18 = dts.Rows[i][18].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S19 = dts.Rows[i][19].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S20 = dts.Rows[i][20].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S21 = dts.Rows[i][21].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S22 = dts.Rows[i][22].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S23 = dts.Rows[i][23].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S24 = dts.Rows[i][24].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S25 = dts.Rows[i][25].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S26 = dts.Rows[i][26].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S27 = dts.Rows[i][27].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S28 = dts.Rows[i][28].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S29 = dts.Rows[i][29].ToString();
                    }
                    catch { }
                    try
                    {
                        z1.S30 = dts.Rows[i][30].ToString();
                    }
                    catch { }
                    if (z1.Title == "")
                        z1.Title = null;
                    if (z1.S1 == "")
                        z1.S1 = null;
                    if (z1.S2 == "")
                        z1.S2 = null;
                    if (z1.S3 == "")
                        z1.S3 = null;
                    if (z1.S4 == "")
                        z1.S4 = null;
                    if (z1.S5 == "")
                        z1.S5 = null;
                    if (z1.S6 == "")
                        z1.S6 = null;
                    if (z1.S7 == "")
                        z1.S7 = null;
                    if (z1.S8 == "")
                        z1.S8 = null;
                    if (z1.S9 == "")
                        z1.S9 = null;
                    if (z1.S10 == "")
                        z1.S10 = null;
                    if (z1.S11 == "")
                        z1.S11 = null;
                    if (z1.S12 == "")
                        z1.S12 = null;
                    if (z1.S13 == "")
                        z1.S13 = null;
                    if (z1.S14 == "")
                        z1.S14 = null;
                    if (z1.S15 == "")
                        z1.S15 = null;
                    if (z1.S16 == "")
                        z1.S16 = null;
                    if (z1.S17 == "")
                        z1.S17 = null;
                    if (z1.S18 == "")
                        z1.S18 = null;
                    if (z1.S19 == "")
                        z1.S19 = null;
                    if (z1.S20 == "")
                        z1.S20 = null;
                    if (z1.S21 == "")
                        z1.S21 = null;
                    if (z1.S22 == "")
                        z1.S22 = null;
                    if (z1.S23 == "")
                        z1.S23 = null;
                    if (z1.S24 == "")
                        z1.S24 = null;
                    if (z1.S25 == "")
                        z1.S25 = null;
                    if (z1.S26 == "")
                        z1.S26 = null;
                    if (z1.S27 == "")
                        z1.S27 = null;
                    if (z1.S28 == "")
                        z1.S28 = null;
                    if (z1.S29 == "")
                        z1.S29 = null;
                    if (z1.S30 == "")
                        z1.S30 = null;
                    z1.Flag = z;
                    z1.AreaID = null;
                    z1.AreaName = null;
                    z1.Code = null;
                    z1.IsConn = null;
                    z1.K22 = null;
                    z1.K2 = null;
                    z1.K3 = null;
                    z1.L2 = null;
                    z1.L3 = null;
                    z1.L4 = null;
                    z1.L6 = DateTime.Now;
                    z1.SubsationID = null;
                    z1.SubstationName = null;
                    z1.UID = Guid.NewGuid().ToString();
                    Services.BaseService.Create<Line_beizhu>(z1);
                    foreach (DataColumn dc in dts.Columns)
                    {
                        for (int j = 1; j <= dts.Columns.Count; j++)
                        {
                            if (dc.Caption.IndexOf("�Զ�����") >= 0)
                            {

                                z2.Title = dc.ColumnName;
                                z2.Type = z;
                                z2.Flag = "1";
                                z2.Type2 = "66";

                                z2.ClassType = "S" + j;
                                z2.UID = Guid.NewGuid().ToString();
                                Services.BaseService.Create<Line_beicong>(z2);
                                break;
                            }
                        }

                    }

                }

                this.ctrlLine_Info1.RefreshData();

            }
        }
Пример #4
0
        private void InitVisuble()
        {
            Line_beicong psl = new Line_beicong();
            psl.Flag = flag;
            psl.Type = type;
            psl.Type2 = type2;

            IList<Line_beicong> li = Itop.Client.Common.Services.BaseService.GetList<Line_beicong>("SelectLine_beicongByFlagType", psl);

            //foreach (GridColumn gc1 in this.ctrlLine_Info1.GridView.Columns)
            //{
            //    if (gc1.FieldName.Substring(0, 1) == "S")
            //    {
            //        foreach (PowerSubstationLine pss in li)
            //        {

            //            if (gc1.FieldName == pss.ClassType)
            //            {
            //                gc1.Caption = pss.Title;
            //                gc1.Visible = true;
            //                gc1.OptionsColumn.ShowInCustomizationForm = true;
            //            }
            //        }
            //    }

            //}

            foreach (GridBand gc in this.ctrlLine_Info1.GridView.Bands)
            {
                try
                {
                    if (gc.Columns[0].FieldName.Substring(0, 1) == "S")
                    {
                        gc.Visible = false;
                        foreach (Line_beicong pss in li)
                        {

                            if (gc.Columns[0].FieldName == pss.ClassType)
                            {
                                gc.Visible = true;
                                gc.Caption = pss.Title;
                                gc.Columns[0].Caption = pss.Title;
                                gc.Columns[0].Visible = true;
                                gc.Columns[0].OptionsColumn.ShowInCustomizationForm = true;

                            }
                        }
                    }
                }
                catch { }

            }
        }
Пример #5
0
        private void barDel1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            GridColumn gc = this.ctrlLine_Info1.GridView.FocusedColumn;

            if (gc == null)
                return;
            if (gc.FieldName.Substring(0, 1) != "S")
            {
                MsgBox.Show("����ɾ���̶���");
                return;
            }

            if (MsgBox.ShowYesNo("�Ƿ�ɾ�� " + gc.Caption + " ���������ݣ�") != DialogResult.Yes)
            {
                return;
            }

            foreach (GridBand gc1 in this.ctrlLine_Info1.GridView.Bands)
            {
                try
                {
                    if (gc1.Columns[0].Name == gc.Name)
                    {
                        gc1.Visible = false;
                    }
                }
                catch { }
            }

            //gc.Visible = false;
            //InitVisuble();
            gc.OptionsColumn.ShowInCustomizationForm = false;
            Substation_Info si = new Substation_Info();
            si.Title = gc.FieldName + "=''";
            si.Flag = flag;
            Itop.Client.Common.Services.BaseService.Update("UpdateLine_beizhuByFlag", si);

            Line_beicong psl = new Line_beicong();
            psl.ClassType = gc.FieldName;
            psl.Flag = flag;
            psl.Type = type;
            psl.Title = gc.Caption;
            psl.Type2 = type2;
            Itop.Client.Common.Services.BaseService.Update("DeleteLine_beicongByAll", psl);
        }
        private void FrmLine_InfoDialog_Load(object sender, EventArgs e)
        {
            if (isselect)
                this.vGridControl.Enabled = false;

            if (!IsCreate)
            {
                checkEdit1.Visible = false;
            }

            IList<Line_beizhu> list = new List<Line_beizhu>();
            list.Add(Object);
            this.vGridControl.DataSource = list;

            foreach (BaseRow gc in this.vGridControl.Rows)
            {
                if (gc.Properties.FieldName == "")
                    continue;
                if (gc.Properties.FieldName.Substring(0, 1) == "S")
                    gc.Visible = false;

                if (gc.Properties.FieldName.Substring(0, 1) == "K" && types2 == "66")
                    gc.Visible = false;

                if (gc.Properties.FieldName.Substring(0, 1) == "L" && types2 == "10")
                    gc.Visible = false;
            }

            Line_beicong psl = new Line_beicong();
            psl.Flag = flags1;
            psl.Type = types1;
            psl.Type2 = types2;

            IList<Line_beicong> li = Itop.Client.Common.Services.BaseService.GetList<Line_beicong>("SelectLine_beicongByFlagType", psl);

            foreach (BaseRow gc1 in this.vGridControl.Rows)
            {
                if (gc1.Properties.FieldName == "")
                {
                    if (types2 == "66")
                        gc1.Visible = false;
                    continue;
                }

                if (gc1.Properties.FieldName.Substring(0, 1) == "S")
                {
                    foreach (Line_beicong pss in li)
                    {

                        if (gc1.Properties.FieldName == pss.ClassType)
                        {
                            gc1.Properties.Caption = pss.Title;
                            gc1.Visible = true;
                        }
                    }
                }

            }

            //MessageBox.Show(liss.Count.ToString());

            Hashtable hs1 = new Hashtable();
            Hashtable hs2 = new Hashtable();
            Hashtable hs3 = new Hashtable();

            foreach (Line_beizhu liii in liss)
            {
                if (!hs1.ContainsValue(liii.K2))
                    hs1.Add(Guid.NewGuid().ToString(), liii.K2);

                if (!hs2.ContainsValue(liii.K3))
                    hs2.Add(Guid.NewGuid().ToString(), liii.K3);

                if (!hs3.ContainsValue(liii.K22))
                    hs3.Add(Guid.NewGuid().ToString(), liii.K22);
            }

            //MessageBox.Show(hs1.Count.ToString());
            //MessageBox.Show(hs2.Count.ToString());
            //MessageBox.Show(hs3.Count.ToString());
            foreach (DictionaryEntry de1 in hs1)
            {
                repositoryItemComboBox1.Items.Add(de1.Value.ToString());
            }

            foreach (DictionaryEntry de2 in hs2)
            {
                repositoryItemComboBox2.Items.Add(de2.Value.ToString());
            }

            //foreach (DictionaryEntry de3 in hs3)
            //{
            //    repositoryItemComboBox3.Items.Add(de3.Value.ToString());
            //}
        }