本文整理汇总了C#中Itop.Domain.Forecast.Ps_Forecast_Math类的典型用法代码示例。如果您正苦于以下问题:C# Ps_Forecast_Math类的具体用法?C# Ps_Forecast_Math怎么用?C# Ps_Forecast_Math使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ps_Forecast_Math类属于Itop.Domain.Forecast命名空间,在下文中一共展示了Ps_Forecast_Math类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckHasFixValue
public static void CheckHasFixValue(Hashtable ht, DataTable dt, string ForecastID, int type)
{
foreach (string key in ht.Keys)
{
bool have = false;
foreach (DataRow row in dt.Rows)
{
if (key==row["Title"].ToString())
{
have = true;
break;
}
}
if (!have)
{
try
{
Ps_Forecast_Math pfm = new Ps_Forecast_Math();
pfm.ID = Guid.NewGuid().ToString();
pfm.Title = key;
pfm.Forecast = type;
pfm.ForecastID = ForecastID;
object obj = Common.Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null);
if (obj != null)
pfm.Sort = ((int)obj) + 1;
else
pfm.Sort = 1;
Common.Services.BaseService.Create<Ps_Forecast_Math>(pfm);
}
catch (Exception)
{
}
}
}
}
示例2: LoadData
private void LoadData()
{
treeList1.DataSource = null;
bLoadingData = true;
if (dataTable != null)
{
dataTable.Columns.Clear();
this.treeList1.Columns.Clear();
//treeList1.Columns.Clear();
}
//((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit();
AddFixColumn();
for (int i = forecastReport.StartYear; i <= forecastReport.YcEndYear; i++)
{
AddColumn(i);
}
//((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit();
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = type;
IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
if (listTypes.Count != 3 || ((Ps_Forecast_Math)listTypes[0]).Col1 != "mh")
{
try
{ //删除数据
for (int i = 0; i < listTypes.Count; i++)
{
Common.Services.BaseService.Delete<Ps_Forecast_Math>((Ps_Forecast_Math)listTypes[i]);
}
}
catch
{
}
List<Ps_Forecast_Math> newlist = new List<Ps_Forecast_Math>() ;
Ps_Forecast_Math psp_Type1 = new Ps_Forecast_Math();
psp_Type1.ID = Guid.NewGuid().ToString();
psp_Type1.ForecastID = forecastReport.ID;
psp_Type1.Forecast = type;
psp_Type1.Title = "全社会用电量(亿kWh)";
psp_Type1.Sort = 1;
psp_Type1.Col1 = "mh";
Common.Services.BaseService.Create<Ps_Forecast_Math>(psp_Type1);
newlist.Add(psp_Type1);
Ps_Forecast_Math psp_Type2 = new Ps_Forecast_Math();
psp_Type2.ID = Guid.NewGuid().ToString();
psp_Type2.ForecastID = forecastReport.ID;
psp_Type2.Forecast = type;
psp_Type2.Title = "全社会最大负荷(MW)";
psp_Type2.Sort = 2;
psp_Type2.Col1 = "mh";
Common.Services.BaseService.Create<Ps_Forecast_Math>(psp_Type2);
newlist.Add(psp_Type2);
Ps_Forecast_Math psp_Type3 = new Ps_Forecast_Math();
psp_Type3.ID = Guid.NewGuid().ToString();
psp_Type3.ForecastID = forecastReport.ID;
psp_Type3.Forecast = type;
psp_Type3.Title = "最大小时数(时)";
psp_Type3.Sort = 3;
psp_Type3.Col1 = "mh";
Common.Services.BaseService.Create<Ps_Forecast_Math>(psp_Type3);
newlist.Add(psp_Type3);
dataTable = Itop.Common.DataConverter.ToDataTable(newlist);
}
else
{
dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(Ps_Forecast_Math));
for (int i = 0; i < listTypes.Count; i++)
{
Ps_Forecast_Math currtenpfm = (Ps_Forecast_Math)listTypes[i];
//更新换算单位
if (currtenpfm.Sort == 1)
{
CheckUnit(currtenpfm.Title.ToString());
}
break;
}
}
this.treeList1.DataSource = dataTable;
Application.DoEvents();
bLoadingData = false;
RefreshChart();
}
示例3: barButtonItem29_ItemClick
/// <summary>
/// ����Ƚ�
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void barButtonItem29_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
//dataTable
ArrayList a1 = new ArrayList();
ArrayList a2 = new ArrayList();
ArrayList a3 = new ArrayList();
ArrayList a4 = new ArrayList();
DataTable dt3 = new DataTable();
dt3.Columns.Add("A", typeof(int));
dt3.Columns.Add("B",typeof(bool));
dt3.Columns.Add("C", typeof(bool));
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
DataRow dr = dt3.NewRow();
dr["A"] = i;
//dr["B"] = true;
//dr["C"] = false;
dt3.Rows.Add(dr);
}
FormXuanZhe form = new FormXuanZhe();
//form.Text = this.Text + "- ����Ƚ�����";
form.DT2 = dataTable;
form.DT3 = dt3;
form.ReportForecastID = forecastReport.ID;
form.ForecastReport = forecastReport;
if (form.ShowDialog() != DialogResult.OK)
return;
a1 = form.A1;
a2 = form.A2;
a3 = form.A3;
a4 = form.A4;
DataTable dt = new DataTable();
foreach (DataColumn dc in dataTable.Columns)
{
dt.Columns.Add(dc.ColumnName, dc.DataType);
}
IList<Ps_Forecast_Math> li = new List<Ps_Forecast_Math>();
ArrayList al = new ArrayList();
foreach (DataRow dr in dataTable.Rows)
{
if (!(bool)dr["B"])
continue;
string id = dr["ID"].ToString();
Ps_Forecast_Math pfvalue = new Ps_Forecast_Math();//ƽ��ֵ
pfvalue.Title = dr["Title"].ToString() + "<ƽ��ֵ>";
pfvalue.Title = pfvalue.Title.Replace("�����õ���-", "");
pfvalue.ID = "999|" + Itop.Client.MIS.ProgUID;
pfvalue.ForecastID = forecastReport.ID;
pfvalue.Forecast = Convert.ToInt32(dr["Forecast"]);
int icount = 0;
for (int i = 0; i < a1.Count; i++)
{
int m = Convert.ToInt32(a1[i]);
Ps_Forecast_Math pf2 = Services.BaseService.GetOneByKey<Ps_Forecast_Math>(id);
Ps_Forecast_Math pf1 = new Ps_Forecast_Math();
Ps_Forecast_Math pf = new Ps_Forecast_Math();
//pf.Col4 = pid;
pf.Col1 = id;
pf.ForecastID = forecastReport.ID;
pf.Forecast = m;
IList<Ps_Forecast_Math> li2 = Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByCol1", pf);
if (li2.Count == 0)
{
pf1 = pf2;
pf1.Forecast = m;
pf1.ID = Guid.NewGuid().ToString();
}
else
{
pf1 = li2[0];
}
string str = "";
switch (m)
{
case 1:
str = "�������ʷ�";
break;
case 2:
str = "���Ʒ�";
break;
case 3:
str = "��ط�";
break;
case 4:
str = "����ϵ����";
break;
case 5:
str = "ָ��ƽ����";
break;
case 6:
str = "��ɫģ�ͷ�";
//.........这里部分代码省略.........
示例4: barButtonItem23_ItemClick
private void barButtonItem23_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
TreeListNode row = this.treeList1.FocusedNode;
if (row == null)
{
return;
}
string parentid = row["ParentID"].ToString();
FormTypeTitle frm = new FormTypeTitle();
frm.TypeTitle = row["Title"].ToString();
frm.Text = "�ķ�����";
if (frm.ShowDialog() == DialogResult.OK)
{
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
ForecastClass1.TreeNodeToDataObject(psp_Type, row);
//psp_Type = Itop.Common.DataConverter.RowToObject<Ps_Forecast_Math>(row);
psp_Type.Title = frm.TypeTitle;
try
{
Common.Services.BaseService.Update<Ps_Forecast_Math>(psp_Type);
row.SetValue("Title",frm.TypeTitle);
}
catch (Exception ex)
{
MsgBox.Show("�ij����" + ex.Message);
}
RefreshChart();
}
}
示例5: barButtonItem14_ItemClick
/// <summary>
/// ��������
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
FormForecastLoadData2 ffs = new FormForecastLoadData2();
// ffs.Type = type;
ffs.PID = pid;
ffs.StartYear = forecastReport.StartYear;
ffs.EndYear = forecastReport.EndYear;
if (ffs.ShowDialog() != DialogResult.OK)
return;
Hashtable hs = ffs.HS;
if (hs.Count == 0)
return;
string id = Guid.NewGuid().ToString();
if (New_Flag)
{
foreach (Ps_History de3 in hs.Values)
{
Ps_Forecast_Math py = new Ps_Forecast_Math();
py.Col1 = de3.ID;
py.Forecast = 0;
py.ForecastID = forecastReport.ID;
py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByCol1", py);
if (py == null)
{
Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math();
ForecastMath.Title = de3.Title;
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null);
}
id = id.Substring(0, 8);
ForecastMath.Col1 = de3.ID;
ForecastMath.ID = id + "|" + de3.ID;
ForecastMath.ParentID = id + "|" + de3.ParentID;
ForecastMath.Forecast = 0;
ForecastMath.ForecastID = forecastReport.ID;
ForecastMath.Sort = de3.Sort;
Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath);
}
else
{
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
py.GetType().GetProperty("y" + i).SetValue(py, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null);
}
Services.BaseService.Update<Ps_Forecast_Math>(py);
}
}
}
else
{
if (ffs.Selectid != "4")
{
foreach (Ps_History de3 in hs.Values)
{
Ps_Forecast_Math py = new Ps_Forecast_Math();
py.Col1 = de3.ID;
py.Forecast = 0;
py.ForecastID = forecastReport.ID;
py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByCol1", py);
if (py == null)
{
Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math();
ForecastMath.Title = de3.Title;
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null);
}
id = id.Substring(0, 8);
ForecastMath.Col1 = de3.ID;
ForecastMath.ID = id + "|" + de3.ID;
ForecastMath.ParentID = id + "|" + de3.ParentID;
ForecastMath.Forecast = 0;
ForecastMath.ForecastID = forecastReport.ID;
ForecastMath.Sort = de3.Sort;
Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath);
}
else
{
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
//.........这里部分代码省略.........
示例6: RefreshChart
/*
private void RefreshChart()
{
IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'");
IList<FORBaseColor> li = new List<FORBaseColor>();
bool bl = false;
ArrayList aldatablr = new ArrayList();
foreach (DataRow row in dataTable.Rows)
{
aldatablr.Add(row["ID"].ToString());
}
foreach (DataRow row in dataTable.Rows)
{
if (aldatablr.Contains(row["ParentID"].ToString()))
continue;
bl = false;
foreach (FORBaseColor bc in list)
{
if (row["Title"].ToString() == bc.Title && row["ParentID"]!=DBNull.Value)
{
bl = true;
FORBaseColor bc1 = new FORBaseColor();
bc1.Color1 = Color.Blue;
CopyBaseColor(bc1, bc);
li.Add(bc1);
}
}
if (!bl)
{
FORBaseColor bc1 = new FORBaseColor();
bc1.UID = Guid.NewGuid().ToString();
bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag;
bc1.Title = row["Title"].ToString();
bc1.Color = 16711680;
bc1.Color1 = Color.Blue;
Services.BaseService.Create<FORBaseColor>(bc1);
li.Add(bc1);
}
}
ArrayList hs = new ArrayList();
foreach (FORBaseColor bc2 in li)
{
hs.Add(bc2.Color1);
}
List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>();
for (int i = 0; i < treeList1.Nodes.Count; i++)
{
TreeListNode row = treeList1.Nodes[i];
foreach (TreeListColumn col in treeList1.Columns)
{
if (col.FieldName.IndexOf("y") > -1)
{
object obj = row[col.FieldName];
if (obj != DBNull.Value)
{
Ps_Forecast_Math v = new Ps_Forecast_Math();
v.ForecastID = forecastReport.ID;
v.ID = (string)row["ID"];
v.Title = (i + 1).ToString() + "." + row["Title"].ToString();
v.Sort = Convert.ToInt32(col.FieldName.Replace("y", ""));
v.y1990 = (double)row[col.FieldName];
listValues.Add(v);
}
}
}
}
chart1.Series.Clear();
ArrayList al = new ArrayList();
al.Add(Application.StartupPath+"/img/1.ico");
al.Add(Application.StartupPath + "/img/2.ico");
al.Add(Application.StartupPath + "/img/3.ico");
al.Add(Application.StartupPath + "/img/4.ico");
al.Add(Application.StartupPath + "/img/5.ico");
al.Add(Application.StartupPath + "/img/6.ico");
al.Add(Application.StartupPath + "/img/7.ico");
//al.Add("img/8.ico");
//al.Add("img/9.ico");
//al.Add("img/10.ico");
LegendItem legendItem;
LegendCell legendCell1;
LegendCell legendCell2;
LegendCell legendCell3;
Legend legend = new Legend();
legend.AutoFitText = false;
chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", "");
for (int i = 0; i < chart1.Series.Count; i++)
{
legendItem = new Dundas.Charting.WinControl.LegendItem();
//.........这里部分代码省略.........
示例7: InitMenu
private void InitMenu()
{
barButtonItem1.ImageIndex = -1;
barButtonItem25.ImageIndex = -1;
barButtonItem3.ImageIndex = -1;
barButtonItem2.ImageIndex = -1;
barButtonItem8.ImageIndex = -1;
barButtonItem4.ImageIndex = -1;
barButtonItem19.ImageIndex = -1;
//barButtonItem12.ImageIndex = -1;
//barButtonItem16.ImageIndex = -1;
//barButtonItem19.ImageIndex = -1;
barButtonItem30.ImageIndex = -1;
Ps_Forecast_Math psp_Typen = new Ps_Forecast_Math();
psp_Typen.ForecastID = forecastReport.ID;
psp_Typen.Forecast = 1;
IList listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem1.ImageIndex = 0;
psp_Typen.Forecast = 2;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem25.ImageIndex = 0;
psp_Typen.Forecast = 3;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem3.ImageIndex = 0;
psp_Typen.Forecast = 4;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem2.ImageIndex = 0;
psp_Typen.Forecast = 5;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem8.ImageIndex = 0;
psp_Typen.Forecast = 6;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem4.ImageIndex = 0;
psp_Typen.Forecast = 7;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem19.ImageIndex = 0;
psp_Typen.Forecast = 12;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem30.ImageIndex = 0;
psp_Typen.Forecast = 17;
listTypesn = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Typen);
if (listTypesn.Count > 0)
barButtonItem35.ImageIndex = 0;
}
示例8: LoadData
private void LoadData()
{
treeList1.DataSource = null;
bLoadingData = true;
if (dataTable2 != null)
{
dataTable1.Columns.Clear();
dataTable2.Columns.Clear();
treeList2.Columns.Clear();
treeList1.Columns.Clear();
}
if (dataTable2 != null)
{
treeList3.Columns.Clear();
}
if (dataTable1 != null)
{
dataTable1.Columns.Clear();
}
AddFixColumn();
AddFixColumn2();
AddFixColumn3();
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
AddColumn(i);
}
for (int i = forecastReport.StartYear; i <=forecastReport.EndYear; i++)
{
AddColumn2(i);
}
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
AddColumn3(i);
}
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = type;
IList<Ps_Forecast_Math> listTypes = Common.Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
dataTable2 = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_Forecast_Math));
treeList2.DataSource = dataTable2;
Hashtable ht = new Hashtable();
IList<Ps_BadData> list = new List<Ps_BadData>();
foreach (Ps_Forecast_Math pfm in listTypes)
{
Ps_BadData pb1 = new Ps_BadData();
pb1.ForecastID = pfm.ForecastID;
pb1.Forecast = type;
pb1.Col1 = pfm.ID;
Ps_BadData pb = new Ps_BadData();
IList<Ps_BadData> li = Common.Services.BaseService.GetList<Ps_BadData>("SelectPs_BadDataByCol1", pb1);
if (li.Count == 0)
{
pb = new Ps_BadData();
pb.ID = pfm.ID+"|m|"+type;
pb.Title = pfm.Title;
pb.ForecastID = pfm.ForecastID;
pb.Forecast = type;
pb.Col1 = pfm.ID;
pb.ParentID = pfm.ParentID + "|m|" + type;
Services.BaseService.Create<Ps_BadData>(pb);
}
else
pb = li[0];
list.Add(pb);
}
dataTable1 = Itop.Common.DataConverter.ToDataTable((IList)list, typeof(Ps_BadData));
treeList2.Columns["Title"].OptionsColumn.AllowEdit = false;
treeList1.DataSource = dataTable1;
Application.DoEvents();
bLoadingData = false;
}
示例9: LoadData
private void LoadData()
{
this.splitContainerControl1.SplitterPosition = (2 * this.splitterControl1.Width) / 3;
this.splitContainerControl2.SplitterPosition = splitContainerControl2.Height / 2;
treeList1.DataSource = null;
bLoadingData = true;
if (dataTable != null)
{
dataTable.Columns.Clear();
treeList1.Columns.Clear();
}
AddFixColumn();
for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++)
{
AddColumn(i);
}
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = type;
IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(Ps_Forecast_Math));
treeList1.DataSource = dataTable;
treeList1.Columns["Title"].OptionsColumn.AllowEdit = false;
Ps_Calc pcs = new Ps_Calc();
pcs.Forecast = 5;
pcs.ForecastID = forecastReport.ID;
IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
if (list1.Count > 0)
{
spinEdit1.Value = (decimal)list1[0].Value1;
}
Application.DoEvents();
bLoadingData = false;
}
示例10: comboBox1_SelectedIndexChanged
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedItem==null)
{
return;
}
if (comboBox1.SelectedItem.ToString() == "���Ʒ�")
{
if (!comboBox6.Items.Contains("���Ʒ�(�������ʷ�)"))
{
comboBox6.Items.Clear();
comboBox6.Items.Add("���Ʒ�(�������ʷ�)");
comboBox6.Items.Add("���Ʒ�(ֱ��)");
comboBox6.Items.Add("���Ʒ�(������)");
comboBox6.Items.Add("���Ʒ�(����)");
comboBox6.Items.Add("���Ʒ�(ָ��)");
comboBox6.Items.Add("���Ʒ�(��������)");
}
comboBox6.Visible = true;
comboBox6.Enabled = true;
label6.Visible = true;
label6.Enabled = true;
}
else if (comboBox1.SelectedItem.ToString() == "��ط�")
{
if (!comboBox6.Items.Contains("��ط�(ֱ��)"))
{
comboBox6.Items.Clear();
comboBox6.Items.Add("��ط�(ֱ��)");
comboBox6.Items.Add("��ط�(������)");
comboBox6.Items.Add("��ط�(����)");
comboBox6.Items.Add("��ط�(ָ��)");
comboBox6.Items.Add("��ط�(��������)");
}
comboBox6.Visible = true;
comboBox6.Enabled = true;
label6.Visible = true;
label6.Enabled = true;
}
else if (comboBox1.SelectedItem.ToString() == "ָ��ƽ����")
{
Ps_Calc pcs = new Ps_Calc();
pcs.Forecast = 5;
pcs.ForecastID = forecastReport.ID;
IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
if (list1.Count < 1)
{
MessageBox.Show("ƽ������δ���ã�����Ĭ��ֵ0.1����");
}
comboBox6.Visible = false;
comboBox6.Enabled = false;
label6.Visible = false;
label6.Enabled = false;
}
else if (comboBox1.SelectedItem.ToString() == "ר�Ҿ��߷�")
{
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = 7;
IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
if (listTypes.Count<1)
{
MessageBox.Show("ר�Ҿ��߷�û�����ݣ�ѡ��ʧ��");
comboBox1.SelectedIndex = -1;
}
}
else
{
comboBox6.Visible = false;
comboBox6.Enabled = false;
label6.Visible = false;
label6.Enabled = false;
}
}
示例11: FormForecastCalc4_Load
private void FormForecastCalc4_Load(object sender, EventArgs e)
{
#region ������չʵ��
Ps_YearRange py = new Ps_YearRange();
py.Col4 = "������չʵ������";
py.Col5 = Itop.Client.MIS.ProgUID;
IList<Ps_YearRange> li2 = Services.BaseService.GetList<Ps_YearRange>("SelectPs_YearRangeByCol5andCol4", py);
if (li2.Count > 0)
{
firstyear1 = li2[0].StartYear;
endyear1 = li2[0].FinishYear;
}
//�¾�������
//Ps_History psp_Type = new Ps_History();
//psp_Type.Forecast = 5;
//psp_Type.Col4 = Itop.Client.MIS.ProgUID;
//IList<Ps_History> listTypes = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type);
//DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_History));
//DataRow[] rows1 = dataTable.Select("Title like 'ȫ����GDP%'");
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = type;
IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(Ps_Forecast_Math));
DataRow[] rows1 = dataTable.Select("Title like 'ȫ����GDP%'");
DataRow[] rows4 = dataTable.Select("Title like 'ȫ����õ���%'");
//�µ�������
//Ps_History psp_Type2 = new Ps_History();
//psp_Type2.Forecast = 6;
//psp_Type2.Col4 = Itop.Client.MIS.ProgUID;
//IList<Ps_History> listTypes2 = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type2);
//DataTable dataTable2 = Itop.Common.DataConverter.ToDataTable((IList)listTypes2, typeof(Ps_History));
//DataRow[] rows4 = dataTable2.Select("Title like 'ȫ����õ���%'");
if (rows1.Length == 0 )
{
MessageBox.Show("ȱ�١�ȫ����GDP�����ݣ�");
this.Close();
return;
}
if (rows4.Length==0)
{
MessageBox.Show("����������ȱ�١�ȫ����õ��������ݣ�");
this.Close();
return;
}
#endregion
Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
pfs.Forecast = type;
pfs.ForecastID = forecastReport.ID;
IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);
if (li.Count != 0)
{
firstyear = li[0].StartYear;
endyear = li[0].EndYear;
}
Ps_Calc pcs = new Ps_Calc();
pcs.Forecast = type;
pcs.ForecastID = forecastReport.ID;
list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
HideToolBarButton();
dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Name");
newrow1 = dt.NewRow();
newrow1["ID"] = "ID";
newrow1["Name"] = "����ϵ��";
//newrow2 = dt.NewRow();
//newrow2["Name"] = "GDP������";
for (int i = firstyear; i <= forecastReport.YcEndYear; i++)
{
dt.Columns.Add(i.ToString(), typeof(double));
DevExpress.XtraVerticalGrid.Rows.EditorRow editorRow = new DevExpress.XtraVerticalGrid.Rows.EditorRow();
editorRow.Properties.FieldName = i.ToString().Trim();
editorRow.Properties.Caption =i.ToString().Trim();
editorRow.Height = 20;
editorRow.Properties.RowEdit = this.repositoryItemCalcEdit4;
this.vGridControl2.Rows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { editorRow });
double s1 = 0;
double s2 = 0;
double s3 = 0;
double s4 = 0;
double s5 = 0;
//.........这里部分代码省略.........
示例12: LoadData
private void LoadData()
{
treeList1.DataSource = null;
bLoadingData = true;
if (dataTable != null)
{
dataTable.Columns.Clear();
this.treeList1.Columns.Clear();
}
AddFixColumn();
for (int i = forecastReport.StartYear; i <= forecastReport.YcEndYear; i++)
{
AddColumn(i);
}
Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
psp_Type.ForecastID = forecastReport.ID;
psp_Type.Forecast = type;
IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(Ps_Forecast_Math));
this.treeList1.DataSource = dataTable;
Application.DoEvents();
bLoadingData = false;
this.chart_user1.All_Select(true);
RefreshChart();
}
示例13: GetResult
private void GetResult()
{
string sql = " Col4='yes' and (Forecast=1 or Forecast=2 or Forecast=5 or Forecast=6 or Forecast=7 or Forecast=13 or Forecast=15 or Forecast=20) and ParentID=''";
sql += " and ForecastID='" + forecastReport.ID + "'";
htable.Clear();
IList<Ps_Forecast_Math> list = Common.Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByWhere",sql);
foreach (Ps_Forecast_Math pfm in list)
{
if (!htable.ContainsKey(pfm.Title))
{
htable.Add(pfm.Title, pfm.Title);
}
}
foreach (string key in htable.Keys)
{
resulttable.Clear();
Ps_Forecast_Math pfm = new Ps_Forecast_Math();
pfm.ID = Guid.NewGuid().ToString();
pfm.Title = key.ToString()+"-推荐值";
pfm.Forecast = type;
pfm.ForecastID = forecastReport.ID;
Common.Services.BaseService.Create<Ps_Forecast_Math>(pfm);
string sqlr = " Col4='yes' and (Forecast=1 or Forecast=2 or Forecast=5 or Forecast=6 or Forecast=7 or Forecast=13 or Forecast=15 or Forecast=20) and ParentID=''";
sqlr += " and ForecastID='" + forecastReport.ID + "' and Title='" + key.ToString() + "'";
IList<Ps_Forecast_Math> listresult = Common.Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByWhere", sqlr);
foreach (Ps_Forecast_Math pfmr in listresult)
{
string title = string.Empty;
if (GetMetheod(pfmr.Forecast, out title))
{
pfmr.ID = Guid.NewGuid().ToString();
pfmr.Forecast = type;
pfmr.Title = title;
pfmr.ParentID = pfm.ID;
pfmr.Col2 = "0";
pfmr.Col4 = "";
Common.Services.BaseService.Create<Ps_Forecast_Math>(pfmr);
}
}
}
}
示例14: barButtonItem1_ItemClick
/// <summary>
/// ��Ӧ���û�����
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
IList<Ps_forecast_list> listReports = Common.Services.BaseService.GetList<Ps_forecast_list>("SelectPs_forecast_listByWhere", "UserID='" + Itop.Client.MIS.ProgUID + "' and Col1='2' and Title='" + forecastReport.Title + "'");
if (listReports.Count > 0)
{
WaitDialogForm wait = new WaitDialogForm("", "���ڸ�������, ���Ժ�...");
DataRow[] drlist = dataTable.Select("Title like '%-%'");
int typetemp = 0;
foreach (DataRow dr in drlist)
{
Ps_Forecast_Math psp_TypePan = new Ps_Forecast_Math();
string[] str = dr["Title"].ToString().Split('-');
if (str[0].Contains("����"))
typetemp = 2;
else
typetemp = 3;
//psp_Type.Forecast = 2;
//psp_Type.ForecastID = listReports[0].ID;
//psp_Type.Title=str[1];
object obj = Common.Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere",
"Forecast='" + typetemp + "' and ForecastID='" + listReports[0].ID + "' and Title='" + str[1] + "'");
if (obj == null)
continue;
Ps_Forecast_Math psp_Type = obj as Ps_Forecast_Math;
psp_TypePan = obj as Ps_Forecast_Math;
obj = Common.Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere",
"Forecast='" + typetemp + "' and ForecastID='" + listReports[0].ID + "' and ParentID='" + psp_Type.ID + "'" + " and Title='" + str[0] + "'");
if (obj == null)
continue;
psp_Type = obj as Ps_Forecast_Math;
Ps_Forecast_Math v = DataConverter.RowToObject<Ps_Forecast_Math>(dr);
v.ID = psp_Type.ID;
v.ParentID = psp_Type.ParentID;
v.Forecast = psp_Type.Forecast;
v.ForecastID = psp_Type.ForecastID;
v.Sort = psp_Type.Sort;
v.Title = psp_Type.Title;
v.Col1 = psp_Type.Col1;
v.Col2 = psp_Type.Col2;
v.Col3 = psp_Type.Col3;
v.Col4 = psp_Type.Col4;
Common.Services.BaseService.Update<Ps_Forecast_Math>(v);
updateAllPan(psp_TypePan, listReports[0]);
//////////////����
//string strtemp = "";
//if (typetemp==2)
//{
// strtemp = " and Title!='ͬʱ��'";
//}
//else
// if (typetemp == 3)
// {
// strtemp = "";
// }
//IList<Ps_Forecast_Math> mathlist = Common.Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByWhere",
// "Forecast='" + typetemp + "' and ForecastID='" + listReports[0].ID + "' and ParentID='" + psp_TypePan.ID + "'" + strtemp);
//double value = 0;
//for (int i = listReports[0].StartYear; i < listReports[0].EndYear; i++)
//{
// value = 0;
// foreach (Ps_Forecast_Math mat in mathlist)
// {
// if (mat.Title=="ͬʱ��")
// value*= (double)mat.GetType().GetProperty("y" + i.ToString()).GetValue(mat, null);
// else
// value += (double)mat.GetType().GetProperty("y" + i.ToString()).GetValue(mat, null);
// }
// psp_TypePan.GetType().GetProperty("y" + i.ToString()).SetValue(psp_TypePan, value, null);
// Common.Services.BaseService.Update<Ps_Forecast_Math>(psp_TypePan);
//}
}
wait.Close();
MessageBox.Show("���³ɹ���");
}
}
示例15: updateAllPan
private void updateAllPan(Ps_Forecast_Math psp_TypePan, Ps_forecast_list listReports)
{
string strtemp = "";
if (psp_TypePan.Forecast == 2)
{
strtemp = " and Title!='ͬʱ��'";
}
else
if (psp_TypePan.Forecast == 3)
{
strtemp = "";
}
IList<Ps_Forecast_Math> mathlist = Common.Services.BaseService.GetList<Ps_Forecast_Math>("SelectPs_Forecast_MathByWhere",
"Forecast='" + psp_TypePan.Forecast + "' and ForecastID='" + psp_TypePan.ForecastID + "' and ParentID='" + psp_TypePan.ID + "'" + strtemp+" order by sort desc");
Ps_Forecast_Math matcgui ;
Ps_Forecast_Math matdyh;
Ps_Forecast_Math mattsl;
//if (psp_TypePan.Title.Contains("���غϼ�"))
//{
matcgui = new Ps_Forecast_Math();//����
matdyh = new Ps_Forecast_Math();//���û�
mattsl = new Ps_Forecast_Math();//ͬʱ��
//}
double value = 0;
double value2 = 0;
for (int i = listReports.StartYear; i <= listReports.EndYear; i++)
{
value = 0;
value2 = 0;
foreach (Ps_Forecast_Math mat in mathlist)
{
if (psp_TypePan.Title.Contains("���غϼ�") && (mat.Title.Contains("����") || mat.Title.Contains("���û�") || mat.Title.Contains("ͬʱ��")))
{
if (mat.Title.Contains("����"))
{
matcgui = mat;
}
else
if (mat.Title.Contains("���û�"))
{
matdyh = mat;
}
else
if (mat.Title.Contains("ͬʱ��"))
{
mattsl = mat;
}
if (!mat.Title.Contains("ͬʱ��"))
continue;
}
if (mat.Title == "ͬʱ��")
value2 = value2 * Math.Round(Convert.ToDouble( mat.GetType().GetProperty("y" + i.ToString()).GetValue(mat, null)),2);
else
value2 += Math.Round(Convert.ToDouble(mat.GetType().GetProperty("y" + i.ToString()).GetValue(mat, null)), 2);
}
value += value2;
psp_TypePan.GetType().GetProperty("y" + i.ToString()).SetValue(psp_TypePan, value, null);
Common.Services.BaseService.Update<Ps_Forecast_Math>(psp_TypePan);
}
if (psp_TypePan.ParentID != "")
{
psp_TypePan = Common.Services.BaseService.GetOneByKey<Ps_Forecast_Math>(psp_TypePan.ParentID);
updateAllPan(psp_TypePan, listReports);
}
else
if (psp_TypePan.Title.Contains("���غϼ�"))
{
value = 0;
value2 = 0;
for (int i = listReports.StartYear; i <= listReports.EndYear; i++)
{
value2 = Math.Round(Convert.ToDouble(mattsl.GetType().GetProperty("y" + i.ToString()).GetValue(mattsl, null)),2);
if ( psp_TypePan.Forecast==3)
{
if(value2 != 0 )
{
value2=Math.Round(Convert.ToDouble(psp_TypePan.GetType().GetProperty("y" + i.ToString()).GetValue(psp_TypePan, null)),2)/value2;
value=value2-Math.Round(Convert.ToDouble(matdyh.GetType().GetProperty("y" + i.ToString()).GetValue(matdyh, null)),2);
matcgui.GetType().GetProperty("y" + i.ToString()).SetValue(matcgui, value, null);
Common.Services.BaseService.Update<Ps_Forecast_Math>(matcgui);
}
}
else
if (psp_TypePan.Forecast == 2)
{
value2 =Math.Round(Convert.ToDouble(psp_TypePan.GetType().GetProperty("y" + i.ToString()).GetValue(psp_TypePan, null)),2 );
value = value2 -Math.Round( Convert.ToDouble(matdyh.GetType().GetProperty("y" + i.ToString()).GetValue(matdyh, null)),2);
matcgui.GetType().GetProperty("y" + i.ToString()).SetValue(matcgui, value, null);
Common.Services.BaseService.Update<Ps_Forecast_Math>(matcgui);
}
}
}
}