private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //��ӵ��� PSP_35KVPingHeng p35 = new PSP_35KVPingHeng(); p35.Type = type; using (FrmPSP_35KVPingHengDialog dlg = new FrmPSP_35KVPingHengDialog()) { dlg.IsCreate = true; //�����½���־ dlg.Object = p35; if (dlg.ShowDialog() != DialogResult.OK) { return; } InitData(); } }
private void InitData() { IList<PSP_35KVPingHeng> list = Services.BaseService.GetList<PSP_35KVPingHeng>("SelectPSP_35KVPingHengByType", type); //this.gridControl.DataSource = list; string s1 = ""; string s2 = ""; int cou = list.Count; int ss = cou / 4; DateTime dtime = DateTime.Now; PSP_35KVPingHeng p31 = new PSP_35KVPingHeng(); p31.SortID1 = "ȫ��"; p31.DiQu="ȫ��"; p31.Title = "��縺��"; p31.SortID2 = 1; p31.CreateTime = dtime; PSP_35KVPingHeng p32 = new PSP_35KVPingHeng(); p32.SortID1 = "ȫ��"; p32.DiQu = "ȫ��"; p32.Title = "����ƽ�⸺��"; p32.SortID2 = 2; p32.CreateTime = dtime; PSP_35KVPingHeng p33 = new PSP_35KVPingHeng(); p33.SortID1 = "ȫ��"; p33.DiQu = "ȫ��"; p33.Title = "��Ҫ35ǧ���ܵ����"; p33.SortID2 = 3; p33.CreateTime = dtime; PSP_35KVPingHeng p34 = new PSP_35KVPingHeng(); p34.SortID1 = "ȫ��"; p34.DiQu = "ȫ��"; p34.Title = "��Ҫ35ǧ���������"; p34.SortID2 = 4; p34.CreateTime = dtime; PSP_35KVPingHeng p35 = new PSP_35KVPingHeng(); p35.SortID1 = "ȫ��"; p35.DiQu = "ȫ��"; p35.Title = "����35ǧ���������"; p35.SortID2 = 5; p35.CreateTime = dtime; PSP_35KVPingHeng p36 = new PSP_35KVPingHeng(); p36.SortID1 = "ȫ��"; p36.DiQu = "ȫ��"; p36.Title = "������35ǧ���������"; p36.SortID2 = 6; p36.CreateTime = dtime; for (int i = 0; i<ss; i++) { PSP_35KVPingHeng p1 = list[4 * i]; PSP_35KVPingHeng p2 = list[4 * i+1]; PSP_35KVPingHeng p3 = list[4 * i+2]; PSP_35KVPingHeng p4 = list[4 * i+3]; PSP_35KVPingHeng p5 = new PSP_35KVPingHeng(); p5.UID = Guid.NewGuid().ToString(); p5.SortID1 = p1.SortID1; p5.SortID2 = 3; p5.DiQu = p1.DiQu; p5.Title = "��Ҫ35ǧ���ܵ����"; p5.CreateTime = p1.CreateTime; PSP_35KVPingHeng p6 = new PSP_35KVPingHeng(); p6.UID = Guid.NewGuid().ToString(); p6.SortID1 = p1.SortID1; p6.SortID2 = 6; p6.DiQu = p1.DiQu; p6.Title = "������35ǧ���������"; p6.CreateTime = p1.CreateTime; for (int j = 1; j <= 40; j++) { double d1=0; double d2=0; double d3=0; double d4=0; double d31 = 0; double d32 = 0; double d33 = 0; double d34 = 0; double d35 = 0; double d36 = 0; try{ d1=(double)p1.GetType().GetProperty("L"+j).GetValue(p1,null); }catch{} try{ d2 = (double)p2.GetType().GetProperty("L" + j).GetValue(p2, null); }catch{} try{ d3 = (double)p3.GetType().GetProperty("L" + j).GetValue(p3, null); }catch{} try{ d4 = (double)p4.GetType().GetProperty("L" + j).GetValue(p4, null); }catch{} try { d31 = (double)p31.GetType().GetProperty("L" + j).GetValue(p31, null); } catch { } try { d32 = (double)p32.GetType().GetProperty("L" + j).GetValue(p32, null); } catch { } try { d33 = (double)p33.GetType().GetProperty("L" + j).GetValue(p33, null); } catch { } try { d34 = (double)p34.GetType().GetProperty("L" + j).GetValue(p34, null); } catch { } try { d35 = (double)p35.GetType().GetProperty("L" + j).GetValue(p35, null); } catch { } try { d36 = (double)p36.GetType().GetProperty("L" + j).GetValue(p36, null); } catch { } p5.GetType().GetProperty("L" + j).SetValue(p5, d1 - d2,null); p6.GetType().GetProperty("L" + j).SetValue(p6, d3 - d4,null); p31.GetType().GetProperty("L" + j).SetValue(p31, d31+d1, null); p32.GetType().GetProperty("L" + j).SetValue(p32, d32 + d2, null); p33.GetType().GetProperty("L" + j).SetValue(p33, d33 + d1-d2, null); p34.GetType().GetProperty("L" + j).SetValue(p34, d34 + d3, null); p35.GetType().GetProperty("L" + j).SetValue(p35, d35 + d4, null); p36.GetType().GetProperty("L" + j).SetValue(p36, d36 + d3-d4, null); } list.Add(p5); list.Add(p6); } list.Add(p31); list.Add(p32); list.Add(p33); list.Add(p34); list.Add(p35); list.Add(p36); gridControl.DataSource = list; InitVisuble(); }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� PSP_35KVPingHeng obj = new PSP_35KVPingHeng(); //ִ����Ӳ��� using (FrmPSP_35KVPingHengDialog dlg = new FrmPSP_35KVPingHengDialog()) { dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //ɾ���� GridColumn gc = this.gridView.FocusedColumn; if (gc == null) return; if (gc.FieldName.Substring(0, 1) != "L") { MsgBox.Show("����ɾ���̶���"); return; } if (MsgBox.ShowYesNo("�Ƿ�ɾ�� " + gc.Caption + " ���������ݣ�") != DialogResult.Yes) { return; } foreach (GridColumn gc1 in this.gridView.Columns) { try { if (gc1.Name == gc.Name) { gc1.Visible = false; } } catch { } } gc.OptionsColumn.ShowInCustomizationForm = false; PSP_35KVPingHeng si = new PSP_35KVPingHeng(); si.Title = gc.FieldName + "=0"; si.Type = type; Itop.Client.Common.Services.BaseService.Update("UpdatePSP_35KVPingHengByTypeWhere", si); PSP_35KVStyle psl = new PSP_35KVStyle(); psl.ClassType = gc.FieldName; psl.Type = type; psl.Title = gc.Caption; Itop.Client.Common.Services.BaseService.Update("DeletePSP_35KVStyleByAll", psl); }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� PSP_35KVPingHeng obj = FocusedObject; if (obj == null) { return; } //���������һ������ PSP_35KVPingHeng objCopy = new PSP_35KVPingHeng(); DataConverter.CopyTo<PSP_35KVPingHeng>(obj, objCopy); //ִ���IJ��� using (FrmPSP_35KVPingHengDialog dlg = new FrmPSP_35KVPingHengDialog()) { dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<PSP_35KVPingHeng>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }