private void OnActivateView(PivotView view) { if (ActivateView != null) { ActivateView(this, view); } }
public ActionResult Edit(int id, FormCollection collection) { bool DidItWork = false; string CrudAction = "Edit"; try { PivotViewBusinessLayer bl = new PivotViewBusinessLayer(); PivotView a = bl.PivotViews(String.Empty).Where(p => p.ViewID == id).Single(); #region Pull from Form Collection a.ViewDesc = (string)collection["ViewDesc"]; #endregion StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer(); DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name); if (DidItWork == false) { return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name))); } else { return(RedirectToAction("Index")); } } catch { return(View()); } }
// GET: PivotView/Edit/5 public ActionResult Edit(int id) { PivotViewBusinessLayer bl = new PivotViewBusinessLayer(); PivotView o = bl.PivotViews(String.Empty).Where(p => p.ViewID == id).Single(); ViewBag.ID = id; return(View(o)); }
public void ActiveViewChanged(object sender, PivotView view) { if (view == PivotView.FeedItems) { listView.ItemsSource = FeedManager.FeedItems; OnEnableButtons(ButtonFlags.Multiselect | ButtonFlags.Search); } }
public void ActiveViewChanged(object sender, PivotView view) { if (view == PivotView.Feeds) { listView.ItemsSource = FeedManager.Feeds; OnEnableButtons(ButtonFlags.Add | ButtonFlags.Remove); } }
private async void View_ScriptNotify(object sender, NotifyEventArgs e) { try { if (!string.IsNullOrEmpty(e.Value)) { JObject jsonBody = JObject.Parse(e.Value); string method = jsonBody["method"].ToString(); string data = jsonBody["data"].ToString(); switch (method) { case "ToListPage": ImageListModel model = data.ToEntity <ImageListModel>(); PivotView.AddSelect(model.Title, new ListPage(model.Id, NowUrl, ImageCount)); break; case "ToHomePage": PivotView.AddSelect("主页", new HomePage(data)); break; case "DownTorrent": var torrent = _torrents.First(x => x.DownUrl == data); try { var file = await Http.GetBtyeAsync(data); AppSettings.DownPath = await FileHelper.DownFile(torrent.Name + ".torrent", file, AppSettings.DownPath); ShowWebViewToast(torrent.Name + "下载成功!"); } catch (Exception ex) { ShowWebViewToast(torrent.Name + "下载失败! 错误信息:" + ex.Message); } break; } } } catch (Exception ex) { ShowMessage(ex.Message); } }
private void View_ScriptNotify(object sender, NotifyEventArgs e) { if (!string.IsNullOrEmpty(e.Value)) { JObject jsonBody = JObject.Parse(e.Value); string method = jsonBody["method"].ToString(); string data = jsonBody["data"].ToString(); switch (method) { case "ToDetailPage": ImageListModel model = data.ToEntity <ImageListModel>(); PivotView.AddSelect(model.Title, new DetailPage(model.Herf)); break; case "Search": Search(data); break; } } }
private void OnViewChanged(PivotView view) { if (ActiveViewChanged != null) { ActiveViewChanged(this, view); } }
public void SwitchTo(PivotView view) { pivot.SelectionChanged -= pivot_SelectionChanged; switch (view) { case PivotView.Feeds: Pivot.SelectedIndex = 0; OnViewChanged(PivotView.Feeds); CurrentView = view; break; case PivotView.FeedItems: Pivot.SelectedIndex = 1; OnViewChanged(PivotView.FeedItems); CurrentView = view; break; case PivotView.Player: Pivot.SelectedIndex = 2; OnViewChanged(PivotView.Player); CurrentView = view; break; default: break; } pivot.SelectionChanged += pivot_SelectionChanged; }
public void ActivateView(object sender, PivotView view) { SwitchTo(view); }
private void QueryData() { try { //QueryLunchBiz biz = new QueryLunchBiz(); //QueryLunchDTO a = new QueryLunchDTO(); //a.SQLCommand = "exec __SelectPivot".ToNZString(); //DataSet ds = biz.ExecuteSQLCommand(a); //pivotMPA.DataSource // this solution call connection string from web service (fast but can see user+wpd) //pivotMPA.ConnectionString = RptServ.GetAdoConnectionString(); //pivotMPA.CommandText = Command; // this solution call data from web service (slow but secure) //string strResult = RptServ.LoadPivotData(Command); //if (strResult.StartsWith("Error")) //{ // msgBox msgBox = new msgBox(); // msgBox.MessageNo = "10011"; // msgBox.MessageErr = strResult; // msgBox.ShowDialog(); //} //else //{ //XmlDocument oxmldoc = new XmlDocument(); //oxmldoc.LoadXml(strResult); //oxmldoc.Save(strFileXML); //pivotMPA.ConnectionString = "Provider=MSPersist"; //pivotMPA.CommandText = strFileXML; ReportBIZ biz = new ReportBIZ(); ReportCriteriaDTO.INV060 cri = new ReportCriteriaDTO.INV060(); cri.DateFrom = dtPeriodBegin.Value.Value; cri.DateTo = dtPeriodEnd.Value.Value; DataSet dsData = biz.LoadINV060_ProductionSummaryByItem(cri); if (dsData != null && dsData.Tables.Count > 0) { if (dsData.Tables[0].Rows.Count > m_iErrorRecords) { //Message . show "Error" MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(TKPMessages.eValidate.VLM0206.ToString(), new object[] { m_iErrorRecords })); return; } if (dsData.Tables[0].Rows.Count > m_iWarningRecords) { MessageDialogResult dr = MessageDialog.ShowConfirmation(this, EVOFramework.Message.LoadMessage(TKPMessages.eConfirm.CFM0011.ToString(), new object[] { m_iWarningRecords }), MessageDialogButtons.YesNo); if (dr != MessageDialogResult.Yes) { return; } } } else { return; } string strDateFrom = dtPeriodBegin.Value.GetValueOrDefault().ToString("yyyyMMdd"); string strDateTo = dtPeriodEnd.Value.GetValueOrDefault().ToString("yyyyMMdd"); pivotMPA.ConnectionString = Common.CurrentDatabase.OleDbConnectionString; pivotMPA.CommandText = string.Format("exec S_INV060_ProductionSummaryByItem @pDtm_DateFrom='{0}', @pDtm_DateTo='{1}' ", strDateFrom, strDateTo); //pivotMPA.CommandText = "select * from __ProductionSummary2"; PivotView pView = pivotMPA.ActiveView; PivotFieldSets fSets = pivotMPA.ActiveView.FieldSets; // Add Category to the Row axis and Item to the Column axis // Data Row pView.RowAxis.InsertFieldSet(fSets[eTableColumn.Day.ToString()], 0, true); //pView.RowAxis.InsertFieldSet(fSets[eTableColumn.yyyymm.ToString()], 0, true); //pView.RowAxis.InsertFieldSet(fSets[eTableColumn.yyyy.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.CustName.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.PartNo.ToString()], 0, true); pView.RowAxis.InsertFieldSet(fSets[eTableColumn.MasterNo.ToString()], 0, true); // remove subtotal of empFullName //pView.RowAxis.FieldSets[eTableColumn.EmpFullName.ToString()].Fields[eTableColumn.EmpFullName.ToString()].set_Subtotals(0, false); // hidden detail pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].Expanded = false; //pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].Expanded = false; //pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].Expanded = false; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].Expanded = false; // set size //ResizeGroupFieldSets(pView.RowAxis.FieldSets[eTableColumn.EmpID.ToString()].Fields[eTableColumn.EmpID.ToString()], 62); //ResizeGroupFieldSets(pView.RowAxis.FieldSets[eTableColumn.EmpFullName.ToString()].Fields[eTableColumn.EmpFullName.ToString()], 80); // set font and back color SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].SubtotalBackColor = "#C0FFC0"; //SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //pView.RowAxis.FieldSets[eTableColumn.yyyymm.ToString()].Fields[eTableColumn.yyyymm.ToString()].SubtotalBackColor = "#C0FFC0"; //SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //pView.RowAxis.FieldSets[eTableColumn.yyyy.ToString()].Fields[eTableColumn.yyyy.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].SubtotalBackColor = "#C0FFC0"; SetFontFieldSets(pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].SubtotalBackColor = "#C0FFC0"; // Data Column pView.ColumnAxis.InsertFieldSet(fSets[eTableColumn.Process.ToString()], 0, true); // set font and back color SetFontFieldSets(pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].SubtotalBackColor = "#C0FFC0"; // Group filter pView.FilterAxis.InsertFieldSet(fSets[eTableColumn.Month.ToString()], 0, true); SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Fields[eTableColumn.Month.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); pView.FilterAxis.InsertFieldSet(fSets[eTableColumn.ItemLevel.ToString()], 0, true); SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Fields[eTableColumn.ItemLevel.ToString()].SubtotalFont, String.Empty, 0, "Blue", false); //SetFontFieldSets(pView.FilterAxis.FieldSets[eTableColumn.AreaID.ToString()].Fields[eTableColumn.AreaID.ToString()].DetailFont, String.Empty, 0, "Green", true); //pView.FilterAxis.InsertFieldSet(fSets["PositionID"], 0, true); ////pView.FilterAxis.InsertFieldSet(fSets["DeptID"], 0, true); ////pView.FilterAxis.InsertFieldSet(fSets["ProjectGroup"], 0, true); //pView.FilterAxis.InsertFieldSet(fSets["DeptID"], 0, true); //// set font and back color ////SetFontFieldSets(pView.FilterAxis.FieldSets["PositionID"].Fields["PositionID"].SubtotalFont, String.Empty, 0, "Blue", false); ////pView.FilterAxis.FieldSets["PositionID"].Fields["PositionID"].SubtotalBackColor = "#C0FFC0"; ////SetFontFieldSets(pView.FilterAxis.FieldSets["ProjectGroup"].Fields["ProjectGroup"].SubtotalFont, String.Empty, 0, "Blue", false); ////pView.FilterAxis.FieldSets["ProjectGroup"].Fields["ProjectGroup"].SubtotalBackColor = "#C0FFC0"; // Data Detail pView.DataAxis.InsertFieldSet(fSets[eTableColumn.Qty.ToString()], 0, true); pView.DataAxis.FieldSets[eTableColumn.Qty.ToString()].Fields[eTableColumn.Qty.ToString()].NumberFormat = "#,##0.00"; //pView.DataAxis.InsertFieldSet(fSets[eTableColumn.NG.ToString()], 0, true); //pView.DataAxis.FieldSets[eTableColumn.NG.ToString()].Fields[eTableColumn.NG.ToString()].NumberFormat = "#,##0.00"; //pView.DataAxis.InsertFieldSet(fSets[eTableColumn.OK.ToString()], 0, true); //pView.DataAxis.FieldSets[eTableColumn.OK.ToString()].Fields[eTableColumn.OK.ToString()].NumberFormat = "#,##0.00"; //// set size //ResizeDetailFieldSets(pView.DataAxis.FieldSets["LoadUsage"].Fields["LoadUsage"], 50); // insert total of data detail PivotTotal TotalQty; TotalQty = pView.AddTotal("Total Qty", pView.DataAxis.FieldSets[eTableColumn.Qty.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); TotalQty.NumberFormat = "#,##0;#,##0;"; TotalQty.AutoFit = true; TotalQty.Width = 50; pView.DataAxis.InsertTotal(TotalQty, 0); pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; pView.ExpandMembers = PivotTableExpandEnum.plExpandNever; //PivotTotal TotalNG; //TotalNG = pView.AddTotal("Total NG", pView.DataAxis.FieldSets[eTableColumn.NG.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); //TotalNG.NumberFormat = "#,##0.00;#,##0.00;"; //TotalNG.AutoFit = true; //TotalNG.Width = 50; //pView.DataAxis.InsertTotal(TotalNG, 0); //pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; //PivotTotal TotalOK; //TotalOK = pView.AddTotal("Total OK", pView.DataAxis.FieldSets[eTableColumn.OK.ToString()].Fields[0], PivotTotalFunctionEnum.plFunctionSum); //TotalOK.NumberFormat = "#,##0.00;#,##0.00;"; //TotalOK.AutoFit = true; //TotalOK.Width = 50; //pView.DataAxis.InsertTotal(TotalOK, 0); //pView.ExpandDetails = PivotTableExpandEnum.plExpandNever; // Remove Blank Data //pView.ColumnAxis.FieldSets[eTableColumn.MonthsName.ToString()].Fields[eTableColumn.MonthsName.ToString()].ExcludedMembers = ""; //caption สำหรับ column / row pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Fields[eTableColumn.Day.ToString()].Caption = "Day"; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Fields[eTableColumn.CustName.ToString()].Caption = "Customer Name"; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Fields[eTableColumn.PartNo.ToString()].Caption = "Part No."; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Fields[eTableColumn.MasterNo.ToString()].Caption = "Master No."; pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Fields[eTableColumn.Process.ToString()].Caption = "Process"; pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Fields[eTableColumn.Month.ToString()].Caption = "Month"; pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Fields[eTableColumn.ItemLevel.ToString()].Caption = "Item Level"; //caption สำหรับ parameter ที่ไม่ได้ใช้ pView.RowAxis.FieldSets[eTableColumn.Day.ToString()].Caption = "Day"; pView.RowAxis.FieldSets[eTableColumn.CustName.ToString()].Caption = "Customer Name"; pView.RowAxis.FieldSets[eTableColumn.PartNo.ToString()].Caption = "Part No."; pView.RowAxis.FieldSets[eTableColumn.MasterNo.ToString()].Caption = "Master No."; pView.ColumnAxis.FieldSets[eTableColumn.Process.ToString()].Caption = "Process"; pView.FilterAxis.FieldSets[eTableColumn.Month.ToString()].Caption = "Month"; pView.FilterAxis.FieldSets[eTableColumn.ItemLevel.ToString()].Caption = "Item Level"; // Display All Items (Include Visible) pView.TotalAllMembers = false; pivotMPA.Visible = true; } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }