protected bool SaveRecord()
        {
            try
            {
                ExpressionCalculator ca = new ExpressionCalculator();
                if (_obj.L4 != "")
                {
                    if (ca.ISIllegal(ca.CharConverter(_obj.L4)))
                    {
                        _obj.L2 = ca.Calculator(ca.CharConverter(_obj.L4), 2);
                    }
                }

                if (_obj.L13 != "0")
                    _obj.S6 = string.Format("{0:f}", double.Parse(_obj.L14) * 100 / double.Parse(_obj.L13));

            }
            catch { }
            if (_obj.L2 != 0)
                _obj.L10 = _obj.L9*100 / _obj.L2;

            try
            {
                int x = int.Parse(_obj.S2);
                if (x > DateTime.Now.Year)
                    _obj.Flag = "2";
                else
                    _obj.Flag = "1";
            }
            catch { _obj.Flag = "1"; }

            //����/�޸� ����
               // _obj.L30 = projectid;
            try
            {
                _obj.AreaID = projectid;
                if (IsCreate)
                {
                    _obj.UID += "|" + projectid;
                    Services.BaseService.Create<Substation_Info>(_obj);
                }
                else
                {
                    Services.BaseService.Update<Substation_Info>(_obj);
                }

            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false ;
            }

            //�����ѳɹ�
            return true;
        }
        private void InsertSubstation_Info()
        {
            //LayoutList ll1 = this.ctrlLayoutList1.FocusedObject;
            //if (ll1 == null)
            //    return;

            string columnname = "";

            try
            {
                DataTable dts = new DataTable();
                OpenFileDialog op = new OpenFileDialog();
                op.Filter = "Excel�ļ�(*.xls)|*.xls";
                if (op.ShowDialog() == DialogResult.OK)
                {
                    dts = GetExcel(op.FileName);
                    string str = "";
                    IList<Substation_Info> lii = new List<Substation_Info>();
                    DateTime s8 = DateTime.Now;
                    int x=0;
                    str = "";
                    for (int i = 0; i < dts.Rows.Count; i++)
                    {

                        if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0)
                            continue;

                        if (dts.Rows[i]["Title"].ToString() == "500ǧ��" || dts.Rows[i]["Title"].ToString() == "220ǧ��" || dts.Rows[i]["Title"].ToString() == "110ǧ������" || dts.Rows[i]["Title"].ToString() == "110ǧ��ר��")
                        {
                            if (dts.Rows[i]["Title"].ToString() == "110ǧ��ר��")
                            {
                                str = "ר��";
                            }
                            else if (dts.Rows[i]["Title"].ToString() == "110ǧ������")
                                str = "����";
                            else
                                str = "";
                            //continue;
                        }
                        try
                        {
                            int.Parse(dts.Rows[i]["S3"].ToString());
                        }
                        catch
                        {
                            continue;
                        }
                        Substation_Info l1 = new Substation_Info();
                        foreach (DataColumn dc in dts.Columns)
                        {
                            columnname = dc.ColumnName;
                            if (dts.Rows[i][dc.ColumnName].ToString() == "" )
                                continue;

                            switch (dc.ColumnName)
                            {
                                case "L2":
                                case "L9":
                                    double LL2 = 0;
                                    try
                                    {
                                        LL2 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString());
                                    }
                                    catch { }
                                    l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL2, null);
                                    break;

                                case "L10":
                                    double L10 = 0;
                                    try
                                    {
                                        L10 = ChangeDou(dts.Rows[i][dc.ColumnName].ToString());
                                    }
                                    catch { }
                                    l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, L10, null);
                                    break;
                                case "L1":
                                case "L3":
                                    int LL3 = 0;
                                    try
                                    {
                                        LL3 = Convert.ToInt32(dts.Rows[i][dc.ColumnName].ToString());
                                    }
                                    catch { }
                                    l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL3, null);
                                    break;

                                default:
                                    l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null);
                                    break;
                            }
                        }
                        l1.S4 = str;
                        l1.Flag = selectid;
                        l1.CreateDate = s8.AddSeconds(i);
                        l1.AreaID = ProjectUID;
                        lii.Add(l1);
                    }

                    foreach (Substation_Info lll in lii)
                    {
                        Substation_Info l1 = new Substation_Info();
                        //l1.UID += "|" + ProjectUID;
                        l1.AreaName = lll.AreaName;
                        l1.Title = lll.Title;
                        l1.AreaID = ProjectUID;
                        l1.Flag = selectid;
                        try
                        {
                            int tx = int.Parse(l1.S2);
                            if (tx > DateTime.Now.Year)
                                l1.Flag = "2";
                            else
                                l1.Flag = "1";
                        }
                        catch { l1.Flag = "1"; }
                        string con = "AreaID='" + ProjectUID + "' and Title='" + l1.Title + "' and Flag='" + selectid + "'";
                        object obj = Services.BaseService.GetObject("SelectSubstation_InfoByCon", con);

                        ExpressionCalculator ca = new ExpressionCalculator();
                        if (lll.L4 != "")
                        {
                            if (ca.ISIllegal(ca.CharConverter(lll.L4)))
                            {
                                lll.L2 = ca.Calculator(ca.CharConverter(lll.L4), 2);
                            }
                        }
                        if (obj != null)
                        {
                            lll.UID = ((Substation_Info)obj).UID;

                            Services.BaseService.Update<Substation_Info>(lll);
                        }
                        else
                        {
                            lll.UID += "|" + ProjectUID;
                            Services.BaseService.Create<Substation_Info>(lll);
                        }
                    }
                    this.ctrlSubstation_Info1.CalcTotal();
                }
            }
            catch (Exception ex) { MsgBox.Show(columnname + ex.Message); MsgBox.Show("�����ʽ����ȷ��"); }
        }
        protected bool SaveRecord()
        {
            try
            {
                ExpressionCalculator ca = new ExpressionCalculator();
                if (_obj.L4 != "")
                {
                    if (ca.ISIllegal(ca.CharConverter(_obj.L4)))
                    {
                        _obj.L2 = ca.Calculator(ca.CharConverter(_obj.L4), 2);
                    }
                }

                if (_obj.L13 != "0")
                {
                    _obj.S6 = string.Format("{0:f}", double.Parse(_obj.L14) * 100 / double.Parse(_obj.L13));
                }
            }
            catch { }
            if (_obj.L2 != 0)
            {
                _obj.L10 = _obj.L9 * 100 / _obj.L2;
            }

            try
            {
                int x = int.Parse(_obj.S2);
                if (x > DateTime.Now.Year)
                {
                    _obj.Flag = "2";
                }
                else
                {
                    _obj.Flag = "1";
                }
            }
            catch { _obj.Flag = "1"; }

            //创建/修改 对象
            // _obj.L30 = projectid;
            try
            {
                _obj.AreaID = projectid;
                if (IsCreate)
                {
                    _obj.UID += "|" + projectid;
                    Services.BaseService.Create <Substation_Info>(_obj);
                }
                else
                {
                    Services.BaseService.Update <Substation_Info>(_obj);
                }
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return(false);
            }

            //操作已成功
            return(true);
        }