private void btDel_Click(object sender, EventArgs e) { //获取焦点对象 PSP_ImgInfo obj = FocusedObject; if (obj == null) { return; } //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { return; } //执行删除操作 try { Services.BaseService.Delete <PSP_ImgInfo>(obj); } catch (Exception exc) { HandleException.TryCatch(exc); return; } this.gridView.BeginUpdate(); //记住当前焦点行索引 int iOldHandle = this.gridView.FocusedRowHandle; //从链表中删除 //ObjectList.Remove(obj); gridView.DeleteRow(iOldHandle); //刷新表格 gridControl.RefreshDataSource(); //设置新的焦点行索引 GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle); this.gridView.EndUpdate(); }
public void DeleteObject(string type) { //获取焦点对象 Line_Info obj = FocusedObject; if (obj == null) { return; } if (obj.S4 == "no") { MessageBox.Show("不能删除此行!"); return; } //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { return; } //执行删除操作 try { Services.BaseService.Delete <Line_Info>(obj); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return; } RefreshData(type); //this.bandedGridView2.BeginUpdate(); ////记住当前焦点行索引 //int iOldHandle = this.bandedGridView2.FocusedRowHandle; ////从链表中删除 //ObjectList.Remove(obj); ////刷新表格 //gridControl.RefreshDataSource(); ////设置新的焦点行索引 //GridHelper.FocuseRowAfterDelete(this.bandedGridView2, iOldHandle); //this.bandedGridView2.EndUpdate(); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData(string type) { try { PSP_EachList pe = new PSP_EachList(); pe.Types = type; IList <PSP_EachList> list = Services.BaseService.GetList <PSP_EachList>("SelectPSP_EachListByTypes", pe); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { IList <LineType> list = Services.BaseService.GetStrongList <LineType>(); for (int i = 0; i < list.Count; i++) { list[i].ObjColor = Color.FromArgb(Convert.ToInt32(list[i].Color)); } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected override void Del() { DevExpress.XtraGrid.Columns.GridColumn gc = this.gridView1.FocusedColumn; if (gc.FieldName.IndexOf("Y") < 0) { return; } Ps_Volume obj = null; foreach (Ps_Volume pv in list) { if (pv.Years == Convert.ToInt32(gc.FieldName.Replace("Y", ""))) { obj = pv; break; } } if (obj == null) { return; } //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { return; } //执行删除操作 try { Services.BaseService.Delete <Ps_Volume>(obj); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return; } InitData(); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { if (type == "1") { //colType.Caption = "回路数"; //colT1.Caption = "气象条件"; //colT2.Caption = "导线型号"; //colT3.Caption = "地线型号"; //gridColumn2.Visible = false; //gridColumn3.Visible = false; //colT1.Visible = false; //colT2.Visible = false; //colT3.Visible = false; //colType.Visible = false; this.gridView.GroupPanelText = "线路造价信息"; } if (type == "2") { //gridColumn4.Visible = false; //gridColumn5.Visible = false; //gridColumn6.Visible = false; //gridColumn7.Visible = false; this.gridView.GroupPanelText = "变电站造价信息"; } IList <Project_Sum> list = Services.BaseService.GetList <Project_Sum>("SelectProject_SumByS5", type); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 删除焦点对象 /// </summary> public void DeleteObject() { //获取焦点对象 PSP_PowerSubstationInfo obj = FocusedObject; if (obj == null) { return; } //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { return; } //执行删除操作 try { // Services.BaseService.Delete<PSP_PowerSubstationInfo>(obj); Services.BaseService.Update("DeletePSP_PowerSubstationInfoByUID", obj.UID); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return; } this.gridView1.BeginUpdate(); //记住当前焦点行索引 int iOldHandle = this.gridView1.FocusedRowHandle; //从链表中删除 ObjectList.Remove(obj); //刷新表格 gridControl.RefreshDataSource(); //设置新的焦点行索引 GridHelper.FocuseRowAfterDelete(this.gridView1, iOldHandle); this.gridView1.EndUpdate(); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { //IList<RtfAttachFiles> list = Services.BaseService.GetStrongList<RtfAttachFiles>(); catygory = this.Name; //string s = " C_UID like'%" + catygory + "%' order by CreateDate"; string s = " C_UID ='" + catygory + "' order by CreateDate"; IList <RtfAttachFiles> list = Services.BaseService.GetList <RtfAttachFiles>("SelectRtfAttachFilesByWhere", s); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
public bool InitData(string svgUid) { try { //LineInfo line = new LineInfo(); //line.SvgUID = svgUid; // line.LayerID = sid; // DataTable dt = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectLineInfoBySvgUID", line), typeof(LineInfo)); string line = " where SvgUID='" + svgUid + "' and Type='05' order by Name "; DataTable dt = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectPSPDEVByCondition", line), typeof(PSPDEV)); gridControl.DataSource = dt; gridControl.Text = "线路列表"; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
public bool InitData(string svgUid) { try { Hashtable hs = new Hashtable(); hs.Add("ParentEleID", "0"); hs.Add("SvgUID", svgUid); //gle.UID = sid; DataTable dt = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectglebePropertParentIDTopAll", hs), typeof(glebeProperty)); gridControl.DataSource = dt; gridControl.Text = "电力平衡表"; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (IsCreate) { //_obj.UID = (int)Services.BaseService.Create<PowerEachList>(_obj); if (!isp) { Common.Services.BaseService.Create("InsertPowerEachList", _obj); //_obj.UID = (string)Common.Services.BaseService.Create("InsertPowerEachList", _obj); } else { if (bl) { Common.Services.BaseService.Create("InsertPowerEachListBy", _obj); } else { Common.Services.BaseService.Create("InsertPowerEachList", _obj); } } } else { Services.BaseService.Update <PowerEachList>(_obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData1() { try { string con = " ,PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + duanluqi.SvgUID + "'AND PSPDEV.type='" + duanluqi.Type + "'order by PSPDEV.number"; IList list = Services.BaseService.GetList("SelectPSPDEVByCondition", con); string filepath = Path.GetTempPath() + "\\" + Path.GetFileName("duanluqi.xml"); if (File.Exists(filepath)) { this.gridView.RestoreLayoutFromXml(filepath); } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { IList <Substation_Info> list = Services.BaseService.GetStrongList <Substation_Info>(); int i = 1; foreach (Substation_Info listtemp in list) { listtemp.AreaID = i.ToString(); i++; } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { PSP_VolumeBalance_Calc pvc = new PSP_VolumeBalance_Calc(); pvc.Type = type; pvc.Flag = flag; IList <PSP_VolumeBalance_Calc> list = Services.BaseService.GetList <PSP_VolumeBalance_Calc>("SelectPSP_VolumeBalance_CalcByTypeFlag", pvc); this.gridControl.DataSource = list; SaveSum(); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData1() { try { IList <PSP_PowerSubstationInfo> list = Services.BaseService.GetList <PSP_PowerSubstationInfo>("SelectPSP_PowerSubstationInfoByFlag", flags1 + "|" + Itop.Client.MIS.ProgUID.Substring(0, 20)); //string filepath = Path.GetTempPath() + "\\" + Path.GetFileName("PowerSubstationLayOut.xml"); // if (File.Exists(filepath)) //{ //this.bandedGridView1.RestoreLayoutFromXml(filepath); //this.gridView1.re // } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData1() { try { //string filepath = ""; IList list = Services.BaseService.GetList("SelectPSPDEVBySvgUIDAndType", duanluqi); string filepath = Path.GetTempPath() + "\\" + Path.GetFileName("duanluqi.xml"); if (File.Exists(filepath)) { this.gridView.RestoreLayoutFromXml(filepath); } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { string pjt = " ProjectID='" + MIS.ProgUID + "'"; IList <PS_Table_AreaWH> lt = Common.Services.BaseService.GetList <PS_Table_AreaWH>("SelectPS_Table_AreaWHByConn", pjt); repositoryItemLookUpEdit1.DataSource = lt; try { //IList<BurdenMonth> list = Services.BaseService.GetStrongList<BurdenMonth>(); IList <BurdenMonth> list = Services.BaseService.GetList <BurdenMonth>("SelectBurdenMonthByWhere", " uid like '%" + Itop.Client.MIS.ProgUID + "%' order by BurdenYear "); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (IsCreate) { Services.BaseService.Create <PSP_ForecastReports>(_obj); } else { Services.BaseService.Update <PSP_ForecastReports>(_obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { PowerEachTotal pet = new PowerEachTotal(); pet.PowerLineUID = lineuid; list.Clear(); dataTable = new DataTable(); list = Services.BaseService.GetList <PowerEachTotal>("SelectPowerEachTotalList", pet); dataTable = DataConverter.ToDataTable((IList)list, typeof(PowerEachTotal)); this.treeList1.DataSource = dataTable; this.treeList1.ExpandAll(); treeList1.MoveFirst(); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData() { try { IList <BaseColor> list = Services.BaseService.GetStrongList <BaseColor>(); foreach (BaseColor bb in list) { Color cl = ColorTranslator.FromOle(bb.Color); bb.Color1 = cl; } this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (IsCreate) { UCDeviceBase.DataService.Create <LayoutList>(_obj); } else { UCDeviceBase.DataService.Update <LayoutList>(_obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (IsCreate) { Services.BaseService.Create <Substation_Info>(_obj); } else { Services.BaseService.Update("UpdateSubstation_InfoAreaName", _obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //删除地区 //获取焦点对象 //修改地区 object obj = this.gridView.GetRow(this.gridView.FocusedRowHandle); if (obj == null) { return; } PSP_35KVPingHeng objCopy = (PSP_35KVPingHeng)obj; objCopy.Title = objCopy.DiQu; //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { return; } //执行删除操作 try { Services.BaseService.Update("UpdatePSP_35KVPingHengByTypeAndTitleByDelete", obj); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return; } InitData(); }
public bool RefreshData() { string pjt = " ProjectID='" + MIS.ProgUID + "'"; IList <PS_Table_AreaWH> lt = Common.Services.BaseService.GetList <PS_Table_AreaWH>("SelectPS_Table_AreaWHByConn", pjt); repositoryItemLookUpEdit1.DataSource = lt; try { IList <BurdenLine> list = Services.BaseService.GetList <BurdenLine>("SelectBurdenLineByWhere", " uid like '%" + Itop.Client.MIS.ProgUID + "%' order by BurdenDate"); //if (indexlist.Count > 0) //{ // VisibleColumns(indexlist); //} this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (types2 == "1000") { if (_obj.L1 == 0) { MsgBox.Show("电压等级没有选择!"); return(false); } _obj.DY = _obj.L1; // _obj.L1 = 66; _obj.K1 = _obj.L1; _obj.K2 = _obj.L4; _obj.K5 = _obj.L5; } else if (types2 == "10") { if (_obj.K1 == 0) { MsgBox.Show("电压等级没有选择!"); return(false); } _obj.DY = _obj.K1; _obj.L1 = _obj.K1; //_obj.K1 = 10; _obj.L4 = _obj.K2; _obj.L5 = _obj.K5; } else { } _obj.Flag = flags1; double ss1 = 0; double ss2 = 0; double ss3 = 0; double ss4 = 0; double ss5 = 0; try { ss1 = _obj.K6; }catch {} try { ss2 = _obj.K20; } catch { } try { ss3 = _obj.k21; } catch { } try { ss3 = _obj.k21; } catch { } try { ss4 = _obj.K10; } catch { } try { ss5 = _obj.K12; } catch { } _obj.K5 = ss1 + ss2 + ss3; _obj.K13 = Convert.ToInt32(ss4 + ss5); double k1 = 0; //最大电流 double k2 = 0; //安全电流 double k3 = 0; //电压 double k4 = 0; //配变总容量 double g3 = 1.73205; double m1 = 0; double m2 = 0; try { k1 = _obj.K16; } catch { } try { k2 = Convert.ToDouble(_obj.K8); } catch { } try { k3 = Convert.ToDouble(_obj.K1); } catch { } try { k4 = Convert.ToDouble(_obj.K13); } catch { } if (k2 != 0) { m1 = k1 * 100 / k2; } if (k4 != 0) { m2 = k1 * g3 * k3 * 100 / k4; } _obj.K19 = m1; _obj.K17 = m2; if (IsCreate) { _obj.CreateDate = DateTime.Now; Services.BaseService.Create <Line_Info>(_obj); } else { if (_obj.CreateDate.Year < 1900 || _obj.CreateDate == null || _obj.CreateDate.ToString() == "") { _obj.CreateDate = DateTime.Now; } Services.BaseService.Update <Line_Info>(_obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
public bool RefreshData(string layer, bool isrun, string power) { IList <Line_Info> lists = new List <Line_Info>(); try { Line_Info ll1 = new Line_Info(); ll1.AreaID = layer; ll1.DY = int.Parse(power); //if (isrun) //{ // lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByXZ", ll1); // filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshData1layout1.xml"); //} //else //{ // lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByGH", ll1); // filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshData1layout2.xml"); //} //if (File.Exists(filepath1)) //{ // this.bandedGridView2.RestoreLayoutFromXml(filepath1); //} if (isrun) { lists = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByXZ", ll1); } else { lists = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByGH", ll1); } this.gridControl.DataSource = lists; //foreach (GridColumn gc in this.bandedGridView2.Columns) //{ // gc.Visible = false; // gc.OptionsColumn.ShowInCustomizationForm = false; // if (gc.FieldName == "Title" || gc.FieldName == "DY" || gc.FieldName == "K2" || gc.FieldName == "K5") // { // gc.Visible = true; // gc.OptionsColumn.ShowInCustomizationForm = true; // } //} bandedGridView2.OptionsView.ColumnAutoWidth = true; foreach (GridBand gc in this.bandedGridView2.Bands) { try { gc.Visible = false; if (gc.Columns[0].FieldName == "Title" || gc.Columns[0].FieldName == "DY" || gc.Columns[0].FieldName == "K2" || gc.Columns[0].FieldName == "K5") { gc.Visible = true; gc.Caption = gc.Columns[0].Caption; gc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } } catch { } } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
public bool RefreshData(string type, string con) { IList <Line_Info> list = new List <Line_Info>(); string conn = ""; try { types1 = type; int dd = 0; if (types2 == "220") { dd = 220; } else if (types2 == "66") { dd = 66; } else if (types2 == "10") { dd = 10; } Line_Info li = new Line_Info(); li.DY = dd; li.Flag = type; string filepath1 = ""; Econ ec = new Econ(); if (types2 == "220") { conn = "Code='' and Flag='" + type + "'" + con; list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); if (FlagsType == "") { ec.UID = "RefreshDatalayout2"; } else { ec.UID = FlagsType + "RefreshDatalayout2"; } } if (types2 == "66") { conn = "DY>10 and 10000>=DY and AreaID='" + projectid + "' " + con;// ; list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); if (FlagsType == "") { ec.UID = "RefreshDatalayout1"; } else { ec.UID = FlagsType + "RefreshDatalayout1"; } } if (types2 == "10") { conn = " DY>0 and 10>=DY " + con; list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType + "RefreshDatalayout2.xml"); if (FlagsType == "") { ec.UID = "RefreshDatalayout2"; } else { ec.UID = FlagsType + "RefreshDatalayout2"; } } IList <Econ> listxml = Services.BaseService.GetList <Econ>("SelectEconByKey", ec); //if (listxml.Count != 0) //{ // MemoryStream ms = new MemoryStream(listxml[0].ExcelData); // this.bandedGridView2.RestoreLayoutFromStream(ms); //} //if (types2 == "66") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); } //else if (types2 == "10") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); } string s = " ProjectID='" + Itop.Client.MIS.ProgUID + "'"; IList list1 = Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", s); repositoryItemLookUpEdit1.DisplayMember = "Title"; repositoryItemLookUpEdit1.NullText = ""; repositoryItemLookUpEdit1.ValueMember = "ID"; repositoryItemLookUpEdit1.DataSource = list1; //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (types2 == "66") { if (_obj.L1 == 0) { MsgBox.Show("电压等级没有选择!"); return(false); } _obj.DY = _obj.L1; // _obj.L1 = 66; _obj.K1 = _obj.L1; _obj.K2 = _obj.L4; _obj.K5 = _obj.L5; } else if (types2 == "10") { if (_obj.K1 == 0) { MsgBox.Show("电压等级没有选择!"); return(false); } _obj.DY = _obj.K1; _obj.L1 = _obj.K1; //_obj.K1 = 10; _obj.L4 = _obj.K2; _obj.L5 = _obj.K5; } else { } _obj.Flag = types1; double ss1 = 0; double ss2 = 0; double ss3 = 0; double ss4 = 0; double ss5 = 0; try { ss1 = _obj.K6; }catch {} try { ss2 = _obj.K20; } catch { } try { //ss3=_obj.k21; } catch { } try { ss4 = _obj.K10; } catch { } try { ss5 = _obj.K12; } catch { } _obj.K5 = ss1 + ss2 + ss3; _obj.K13 = Convert.ToInt32(ss4 + ss5); double k1 = 0; //最大电流 double k2 = 0; //安全电流 double k3 = 0; //电压 double k4 = 0; //配变总容量 double g3 = 1.73205; double m1 = 0; double m2 = 0; try { k1 = _obj.K16; } catch { } try { k2 = Convert.ToDouble(_obj.K8); } catch { } try { k3 = Convert.ToDouble(_obj.K1); } catch { } try { k4 = Convert.ToDouble(_obj.K13); } catch { } if (k2 != 0) { m1 = k2 * 100 / k1; } if (k4 != 0) { m2 = k1 * g3 * k3 * 100 / k4; } _obj.K19 = m1; _obj.K17 = m2; _obj.AreaID = projectid; try { if (_obj.L6 != "" && int.Parse(_obj.L6) > DateTime.Now.Year) { _obj.Flag = "2"; } else { _obj.Flag = "1"; } } catch { _obj.Flag = "1"; } if (IsCreate) { _obj.CreateDate = DateTime.Now; _obj.UID += "|" + projectid; Services.BaseService.Create <Line_Info>(_obj); } else { if (_obj.CreateDate.Year < 1900 || _obj.CreateDate == null || _obj.CreateDate.ToString() == "") { _obj.CreateDate = DateTime.Now; } if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "廊坊") { Services.BaseService.Update("UpdateLine_InfoXingHao", _obj); } else { Services.BaseService.Update <Line_Info>(_obj); } } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }
public bool RefreshData(string type) { IList <Line_Info> list = new List <Line_Info>(); try { flags1 = type; int dd = 0; if (types2 == "66") { dd = 66; } else if (types2 == "10") { dd = 10; } else if (Type2 == "1000") { dd = 1000; } Line_Info li = new Line_Info(); li.DY = dd; li.Flag = flags1; string filepath1 = ""; if (types2 == "66") { list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByFlagDy", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout1.xml"); } if (types2 == "10") { list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByFlagDy1", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout2.xml"); } if (Type2 == "1000") { list = Services.BaseService.GetList <Line_Info>("SelectLine_InfoByFlagDy", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout3.xml"); } if (File.Exists(filepath1)) { this.bandedGridView2.RestoreLayoutFromXml(filepath1); } //if (types2 == "66") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); } //else if (types2 == "10") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); } //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
protected bool SaveRecord() { //创建/修改 对象 try { if (types2 == "66") { //if (_obj.L1 == 0) //{ // MsgBox.Show("电压等级没有选择!"); // return false; //} _obj.DY = _obj.L1; // _obj.L1 = 66; _obj.K1 = _obj.L1; _obj.K2 = _obj.L4; _obj.K5 = _obj.L5; } else if (types2 == "10") { //if (_obj.K1 == 0) //{ // MsgBox.Show("电压等级没有选择!"); // return false; //} _obj.DY = _obj.K1; _obj.L1 = _obj.K1; //_obj.K1 = 10; _obj.L4 = _obj.K2; _obj.L5 = _obj.K5; } //else //{ //} _obj.Flag = types1; double ss1 = 0; double ss2 = 0; double ss3 = 0; double ss4 = 0; double ss5 = 0; try { ss1 = _obj.K6; } catch { } try { ss2 = _obj.K20; } catch { } try { ss3 = _obj.K21; } catch { } try { ss3 = _obj.K21; } catch { } try { ss4 = _obj.K10; } catch { } try { ss5 = _obj.K12; } catch { } _obj.K5 = ss1 + ss2 + ss3; _obj.K13 = Convert.ToInt32(ss4 + ss5); double k1 = 0; //最大电流 double k2 = 0; //安全电流 double k3 = 0; //电压 double k4 = 0; //配变总容量 double g3 = 1.73205; double m1 = 0; double m2 = 0; try { k1 = _obj.K16; } catch { } try { k2 = Convert.ToDouble(_obj.K8); } catch { } try { k3 = Convert.ToDouble(_obj.K1); } catch { } try { k4 = Convert.ToDouble(_obj.K13); } catch { } if (k2 != 0) { m1 = k1 * 100 / k2; } if (k4 != 0) { m2 = k1 * g3 * k3 * 100 / k4; } _obj.K19 = m1; _obj.K17 = m2; if (IsCreate) { Services.BaseService.Create <Line_beizhu>(_obj); } else { Services.BaseService.Update <Line_beizhu>(_obj); } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } //操作已成功 return(true); }