public void gvdBind_Consumption(int ObjectId, DateTime StartDate, DateTime EndDate) { if (StartDate.Date == DateTime.Now.Date) { List <DTReportModel> li = new List <DTReportModel>(); List <SwitchesReportDayModel> li_current = obj.getConsumptionToday(ObjectId, "Current"); if (li_current.Count > 0) { List <SwitchesReportDayModel> li_voltage = obj.getConsumptionToday(ObjectId, "Voltage"); for (int i = 0; i < li_current.Count; i++) { DTReportModel model = new DTReportModel(); model.Name = li_current[i].Name; model.Current = li_current[i].Value; model.Voltage = li_voltage[i].Value; model.Power = string.Format("{0:0.00}", (li_current[i].Value * li_voltage[i].Value) / 1000); li.Add(model); } } BindingClass.GridViewBind(Gvdconsumptionreport, li); } else { List <SwitchesReportConsumptionModel> li = obj.getConsumptionByDT(ObjectId, StartDate, EndDate); BindingClass.GridViewBind(Gvdconsumptionreport, li); } Gvdconsumptionreport.Visible = true; }
public void GvdBind_Consumption(int ObjectId, DateTime StartDate, DateTime EndDate) { if (StartDate.Date == DateTime.Now.Date) { List <CurrentDTReportModel> li = new List <CurrentDTReportModel>(); lblCConsmName.Text = ""; lblCConsmName.Text = ddlObject.SelectedItem.Text; List <ReportModel> li_current = RS.GetConsumptionReport(ObjectId, "Current"); if (li_current != null) { List <ReportModel> li_voltage = RS.GetConsumptionReport(ObjectId, "Voltage"); for (int i = 0; i < li_current.Count; i++) { CurrentDTReportModel obj = new CurrentDTReportModel(); obj.Name = li_current[i].Name; obj.Current = li_current[i].Value; obj.Voltage = li_voltage[i].Value; obj.Power = (li_current[i].Value * li_voltage[i].Value) / 1000; li.Add(obj); } } BindingClass.GridViewBind(gvdCurrentConsump, li); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myCurrentConsumptionModal", "$('#myCurrentConsumptionModal').modal(); gvdtempete('#gvdCurrentConsump');loadGraphConsumption();", true); } else { lblname.Text = ""; lblname.Text = ddlObject.SelectedItem.Text; List <SwitchesReportConsumptionModel> li = obj.getConsumptionByDT(ObjectId, StartDate, EndDate); BindingClass.GridViewBind(Gvdconsumptionreport, li); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal(); gvdtempete('#Gvdconsumptionreport');", true); } }