private void InitSodata1()
        {
            string sid = "1";

            Hashtable hs = new Hashtable();
            Hashtable hs2 = new Hashtable();

            IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByPowerIDStuff", sid);
            foreach (LineInfo l1 in listLineInfo)
            {
                hs.Add(Guid.NewGuid().ToString(), l1.UID);
            }

            IList<Line_beizhu> ll1 = Common.Services.BaseService.GetList<Line_beizhu>("SelectLine_beizhuByFlag", sid);
            foreach (Line_beizhu ps in ll1)
            {
                hs2.Add(Guid.NewGuid().ToString(), ps.Code);
            }

            foreach (Line_beizhu p1 in ll1)
            {
                if (p1.Code != "" && !hs.ContainsValue(p1.Code))
                {
                    Services.BaseService.Delete<Line_beizhu>(p1);
                }
            }

            foreach (LineInfo l2 in listLineInfo)
            {
                if (!hs2.ContainsValue(l2.UID) && l2.Voltage != "")
                {
                    //���
                    try
                    {
                        //Line_Info line1 = new Line_Info();
                        //line1.DY = int.Parse(l2.Voltage.ToUpper().Replace("KV", ""));
                        //line1.Title = l2.LineName;
                        //line1.Code = l2.UID;
                        //line1.Flag = sid;
                        //Services.BaseService.Create<Line_Info>(line1);

                        Line_beizhu line1 = new Line_beizhu();

                        line1.Title = l2.LineName;
                        line1.Code = l2.UID;
                        line1.Flag = sid;

                        try
                        {
                            int dy = int.Parse(l2.Voltage.ToUpper().Replace("KV", ""));
                            line1.DY = dy;
                            line1.K1 = dy;
                            line1.L1 = dy;
                        }
                        catch { }

                        try
                        {
                            line1.L4 = l2.LineType;
                            line1.K2 = l2.LineType;

                        }
                        catch { }

                        try
                        {
                            line1.L5 = double.Parse(l2.Length);
                            line1.K5 = double.Parse(l2.Length);
                        }
                        catch { }

                        Services.BaseService.Create<Line_beizhu>(line1);

                    }
                    catch (Exception ex) { MsgBox.Show(ex.Message); }

                }
            }
        }
        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();

            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (isselect)
            {
                DialogResult = DialogResult.OK;
                return;
            }
            if (!InputCheck())
            {
                return;
            }

            if (SaveRecord())
            {
                if (checkEdit1.Checked)
                {
                    ctrls.RefreshData();
                    _obj = new Line_beizhu();
                    _obj.L6 = DateTime.Now;
                    _obj.Flag = flags1;
                    IList<Line_beizhu> list1 = new List<Line_beizhu>();
                    list1.Add(_obj);
                    this.vGridControl.DataSource = list1;
                }
                else
                {
                    DialogResult = DialogResult.OK;
                }

            }
        }