public FrmStorageTemperature_Confirm(string transportId) { InitializeComponent(); g = panel1.CreateGraphics(); List <CodeContent> list = CommonDAO.GetInstance().GetCodeContentByKind("ú³¡Î¶ÈÒDZàºÅ"); foreach (var item in list) { ddlPoleCode.Items.Add(new ComboBoxItem(item.Code.ToString(), item.Code.ToString())); } List <StorageArea> StorageAreas = commonDAO.SelfDber.Entities <StorageArea>(" where 1=1 order by FuelStorageId,StartPoint"); foreach (var item in StorageAreas) { ddlUnitName.Items.Add(new ComboBoxItem(item.AreaName.ToString(), item.AreaName.ToString())); } if (!string.IsNullOrEmpty(transportId)) { this.transportId = transportId; StorageTemperature entity = commonDAO.SelfDber.Get <StorageTemperature>(this.transportId); if (entity != null) { ddlPoleCode.Text = entity.PoleCode; ddlUnitName.Text = entity.UnitName; txtPointX.Text = entity.PointX.ToString("f2"); txtPointY.Text = entity.PointY.ToString("f2"); Temperature.Text = entity.Temperature.ToString("f2"); } } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnDelete_Click(object sender, EventArgs e) { GridButtonXEditControl btn = sender as GridButtonXEditControl; if (btn == null) { return; } StorageTemperature entity = btn.EditorCell.GridRow.DataItem as StorageTemperature; if (entity == null) { return; } if (MessageBoxEx.Show("确定要删除该测温杆记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Dbers.GetInstance().SelfDber.Delete <StorageTemperature>(entity.Id); } catch (Exception) { } BindData(); } }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ddlUnitName.Text)) { MessageBox.Show("ú³¡·ÖÇøÃû³Æ²»ÄÜΪ¿Õ£¡"); CreateImg(); return; } if (string.IsNullOrEmpty(ddlPoleCode.Text)) { MessageBox.Show("²âθ˱àºÅ²»ÄÜΪ¿Õ£¡"); CreateImg(); return; } if (commonDAO.SelfDber.Count <StorageTemperature>(" where PoleCode='" + ddlPoleCode.Text + "'") > 0) { MessageBox.Show("´Ë²âθ˱àºÅÒѱ»ÉèÖã¡"); CreateImg(); return; } //if (commonDAO.SelfDber.Count<StorageTemperature>(" where UnitName='" + ddlUnitName.Text // + "' and Id != '" + this.transportId + "'" // + "' and PointX != '" + txtPointX.Text + "'" // + "' and PointY != '" + txtPointY.Text + "'") > 0) //{ // MessageBox.Show("´ËÇøÓòµÄ(X,Y)×ø±êÒÑÉèÖÃÁËÆäËû±àºÅµÄ²âθˣ¡"); // return; //} StorageTemperature entity = commonDAO.SelfDber.Get <StorageTemperature>(this.transportId); if (entity != null) { entity.UnitName = ddlUnitName.Text; entity.PoleCode = ddlPoleCode.Text; entity.PointX = Convert.ToDecimal(txtPointX.Text); entity.PointY = Convert.ToDecimal(txtPointY.Text); entity.Temperature = Convert.ToDecimal(Temperature.Text); commonDAO.SelfDber.Update <StorageTemperature>(entity); this.DialogResult = DialogResult.OK; this.Close(); } else { entity = new StorageTemperature(); entity.UnitName = ddlUnitName.Text; entity.PoleCode = ddlPoleCode.Text; entity.PointX = Convert.ToDecimal(txtPointX.Text); entity.PointY = Convert.ToDecimal(txtPointY.Text); entity.Temperature = Convert.ToDecimal(Temperature.Text); commonDAO.SelfDber.Insert <StorageTemperature>(entity); this.DialogResult = DialogResult.OK; this.Close(); } }
private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e) { foreach (GridRow item in e.GridPanel.Rows) { try { StorageTemperature entity = item.DataItem as StorageTemperature; item.Cells["cellPointX"].Value = entity.PointX.ToString("f2"); item.Cells["cellPointY"].Value = entity.PointY.ToString("f2"); item.Cells["cellTemperature"].Value = entity.Temperature.ToString("f2"); } catch (Exception) { } } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnCarDeduction_Click(object sender, EventArgs e) { GridButtonXEditControl btn = sender as GridButtonXEditControl; if (btn == null) { return; } StorageTemperature buyFuelTransport = btn.EditorCell.GridRow.DataItem as StorageTemperature; if (buyFuelTransport == null) { return; } new FrmStorageTemperature_Confirm(buyFuelTransport.Id).ShowDialog(); BindData(); }
private ViewModels.Home.CalculateResultSummary Calculate(StorageRedundancy redundancy, StorageTemperature temperature, List <ViewModels.Home.CalculateResultDetail> details) { var tmp = new ViewModels.Home.CalculateResultSummary(); tmp.StorageRedundancy = redundancy; tmp.StorageTemperature = temperature; tmp.TotalGB = details.Sum(x => x.GbStored); tmp.TotalPrice = details.Sum(x => x.TotalPrice); tmp.AveragePricePerGB = tmp.TotalPrice / tmp.TotalGB; tmp.AveragePricePerTB = tmp.AveragePricePerGB * 1000; return(tmp); }
private ViewModels.Home.CalculateResultDetail Calculate(StorageRedundancy redundancy, StorageTemperature temperature, ViewModels.Home.CalculateArgs args, int month, List <AtRestPrice> atRestPrices, OtherPrice mainTransactionRate, OtherPrice otherTransactionRate, OtherPrice retreivedRate, OtherPrice writeRate, OtherPrice replicationRate) { var tmp = new ViewModels.Home.CalculateResultDetail(); tmp.Month = month; tmp.GbStored = (args.StartingStorage * 1000) + (month * args.MonthlyGrowthStorage * 1000); if (month == 0) { tmp.GbWritten = (args.StartingStorage * 1000); } else { tmp.GbWritten = (args.MonthlyGrowthStorage * 1000); } tmp.GbRetreived = tmp.GbStored * args.PctStorageRetrieval; var price = atRestPrices.Where(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.SizeCutoff > tmp.GbStored) .OrderByDescending(x => x.Amount) .FirstOrDefault(); //This allows for sizing storage over 4 PBs if (price == null) { price = atRestPrices.Where(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature) .OrderBy(x => x.Amount) .FirstOrDefault(); } tmp.PricePerGb = price.Amount; tmp.StoredPrice = tmp.GbStored * tmp.PricePerGb; tmp.MainTransPrice = args.MainTransactions * mainTransactionRate.Amount; tmp.OtherTransPrice = args.OtherTransactions * otherTransactionRate.Amount; tmp.PriceRetreived = tmp.GbRetreived * retreivedRate.Amount; tmp.PriceWrites = tmp.GbWritten * writeRate.Amount; tmp.PriceReplication = tmp.GbWritten * replicationRate.Amount; tmp.TotalPrice = tmp.StoredPrice + tmp.MainTransPrice + tmp.OtherTransPrice + tmp.PriceRetreived + tmp.PriceWrites + tmp.PriceReplication; return(tmp); }
private List <ViewModels.Home.CalculateResultDetail> Calculate(StorageRedundancy redundancy, StorageTemperature temperature, ViewModels.Home.CalculateArgs args) { var results = new List <ViewModels.Home.CalculateResultDetail>(); var atRestPrices = AtRestPrice.GetDefault(); var otherPrices = OtherPrice.GetDefault(); var mainTransactionRate = otherPrices.FirstOrDefault(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.PriceType == OtherPriceType.BlobBlockPutListCreateContainer); var otherTransactionRate = otherPrices.FirstOrDefault(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.PriceType == OtherPriceType.BlobBlockOther); var retreivedRate = otherPrices.FirstOrDefault(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.PriceType == OtherPriceType.DataRetrieval); var writeRate = otherPrices.FirstOrDefault(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.PriceType == OtherPriceType.DataWrite); var replicationRate = otherPrices.FirstOrDefault(x => x.StorageRedundancy == redundancy && x.StorageTemperature == temperature && x.PriceType == OtherPriceType.GeoReplication); for (int i = 0; i <= args.MonthsToProject; i++) { results.Add(Calculate(redundancy, temperature, args, i, atRestPrices, mainTransactionRate, otherTransactionRate, retreivedRate, writeRate, replicationRate)); } return(results); }