private void initGrfStfH() { grfStf = new C1FlexGrid(); grfStf.Font = fEdit; grfStf.Dock = System.Windows.Forms.DockStyle.Fill; grfStf.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfStf); grfStf.AfterDataRefresh += new System.ComponentModel.ListChangedEventHandler(this.StatusBar_AfterDataRefresh); grfStf.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfStf_CellChanged); grfStf.LeaveCell += new System.EventHandler(this.grfStf_LeaveCell); grfStf.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(this.grfStf_AfterRowColChange); //this.grfCus.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(this.grfCus_AfterRowColChange); //new C1.Win.C1FlexGrid.RangeEventHandler(this.c1FlexGrid1_AfterRowColChange); //splitContainer1.Panel1.Controls.Add(this.grfCus); panel2.Controls.Add(this.grfStf); //grfCus.ShowThemedHeaders = ShowThemedHeadersEnum.None; //grfCus.Styles.Clear(); //Mac(grfCus.Styles); //Controls.Add(sB); C1Theme theme = C1ThemeController.GetThemeByName("Office2013Red", false); C1ThemeController.ApplyThemeToObject(grfStf, theme); }
//public static GridCrudCommandsColumnBuilder<T> CrudCommands<T>(this GridColumnFactory<T> factory, FilterRow filterRow = null) where T : class //{ // if (filterRow != null) // filterRow.AddCell(new ButtonFilterCell()); // var templateColumnBuilder = factory.Template(model => { }); // return new GridCrudCommandsColumnBuilder<T>(templateColumnBuilder); //} public static GridBoundColumnBuilder <TModel> Bound <TModel, TValue>(this GridColumnFactory <TModel> factory, Expression <Func <TModel, TValue> > expression, FilterRow filterRow) where TModel : class { GridBoundColumnBuilder <TModel> builder = factory.Bound(expression); filterRow.AddCell(new TextFilterCell(builder.Column.Member)); return(builder); }
public static GridBoundColumnBuilder <TModel> ForeignKey <TModel, TValue>(this GridColumnFactory <TModel> factory, Expression <Func <TModel, TValue> > expression, IEnumerable data, string dataFieldValue, string dataFieldText, FilterRow filterRow) where TModel : class { GridBoundColumnBuilder <TModel> builder = factory.ForeignKey(expression, data, dataFieldValue, dataFieldText); filterRow.AddCell(new DropDownFilterCell(builder.Column.Member, data, dataFieldValue, dataFieldText)); return(builder); }
private void initGrfInvH() { grfCop = new C1FlexGrid(); grfCop.Font = fEdit; grfCop.Dock = System.Windows.Forms.DockStyle.Fill; grfCop.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfCop); grfCop.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(this.grfCus_AfterRowColChange); //grfCop.DoubleClick += new System.EventHandler(this.grfCus_DoubleClick); panel1.Controls.Add(this.grfCop); }
private void setGrfStf() { DataTable dt = new DataTable(); dt = bc.bcDB.stfDB.selectByLevel("'5','6'"); grfStf.Rows.Count = 1; //grfLab.Cols[colOrderId].Visible = false; grfStf.Rows.Count = dt.Rows.Count + 1; grfStf.Cols.Count = dt.Columns.Count + 1; grfStf.Cols[colStfId].Caption = "ID"; grfStf.Cols[colStfName].Caption = "Name"; grfStf.Cols[colStfName].Width = 350; grfStf.Cols[colStfId].Width = 100; int i = 0; decimal aaa = 0; for (int col = 0; col < dt.Columns.Count; ++col) { grfStf.Cols[col + 1].DataType = dt.Columns[col].DataType; //grfOrdDrug.Cols[col + 1].Caption = dt.Columns[col].ColumnName; grfStf.Cols[col + 1].Name = dt.Columns[col].ColumnName; } foreach (DataRow row1 in dt.Rows) { i++; if (i == 1) { continue; } grfStf[i, colStfId] = row1["MNC_USR_NAME"].ToString(); grfStf[i, colStfName] = row1["MNC_USR_FULL"].ToString(); //row1[0] = (i - 2); } CellNoteManager mgr = new CellNoteManager(grfStf); //grfOrdDrug.Cols[colXrayResult].Visible = false; grfStf.Cols[colStfId].AllowEditing = false; grfStf.Cols[colStfName].AllowEditing = false; FilterRow fr = new FilterRow(grfStf); grfStf.AllowFiltering = true; grfStf.AfterFilter += GrfStf_AfterFilter; //}).Start(); }
private void initGrf() { //C1FlexGrid _flex = new C1FlexGrid(); //_flex.Font = fEdit; _flex.Dock = System.Windows.Forms.DockStyle.Fill; _flex.Location = new System.Drawing.Point(0, 0); this.Controls.Add(_flex); String tableName = "InventoryManagement"; string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common"; string conn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}\\C1NWind.mdb"; //return String.Format(conn, path); string connectionString = String.Format(conn, path); string commandText = $"select * from [{tableName}]"; OleDbDataAdapter adapter = new OleDbDataAdapter(commandText, connectionString); DataTable table = new DataTable(tableName); adapter.Fill(table); //_flex.DataSource = table; _flex.Rows.Count = table.Rows.Count + 2; _flex.Cols.Count = table.Columns.Count + 1; // Set DataType, Caption, and Names // DataType and Name are used in FilterRow to apply Condition Filters for (int col = 0; col < table.Columns.Count; ++col) { _flex.Cols[col + 1].DataType = table.Columns[col].DataType; _flex.Cols[col + 1].Caption = table.Columns[col].ColumnName; _flex.Cols[col + 1].Name = table.Columns[col].ColumnName; } for (int row = 0; row < table.Rows.Count; ++row) { for (int col = 0; col < table.Columns.Count; ++col) { _flex[row + 2, col + 1] = table.Rows[row][col]; } } FilterRow filterRow = new FilterRow(_flex); _flex.AllowFiltering = true; _flex.AfterFilter += _flex_AfterFilter2; _flex.AfterRowColChange += _flex_AfterRowColChange1; }
private void initGrfDept() { grfExpnC = new C1FlexGrid(); grfExpnC.Font = fEdit; grfExpnC.Dock = System.Windows.Forms.DockStyle.Fill; grfExpnC.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfExpnC); grfExpnC.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(this.grfDept_AfterRowColChange); //grfExpnC.CellButtonClick += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellButtonClick); //grfExpnC.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellChanged); panel2.Controls.Add(grfExpnC); theme1.SetTheme(grfExpnC, "Office2013Red"); }
private void initGrfDept() { grfDept.Font = fEdit; grfDept.Dock = System.Windows.Forms.DockStyle.Fill; grfDept.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfDept); grfDept.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(this.grfDept_AfterRowColChange); grfDept.CellButtonClick += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellButtonClick); grfDept.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellChanged); this.Controls.Add(this.grfDept); C1Theme theme = C1ThemeController.GetThemeByName("Office2013Red", false); C1ThemeController.ApplyThemeToObject(grfDept, theme); }
private void initGrfContH() { grfCont = new C1FlexGrid(); grfCont.Font = fEdit; grfCont.Dock = System.Windows.Forms.DockStyle.Fill; grfCont.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfCont); grfCont.DoubleClick += new System.EventHandler(this.grfCont_DoubleClick); //grfBank.CellButtonClick += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfBank_CellButtonClick); panel2.Controls.Add(this.grfCont); C1Theme theme = C1ThemeController.GetThemeByName("Office2013Red", false); C1ThemeController.ApplyThemeToObject(grfCont, theme); }
private void initGrfStockDrug() { grfDrug = new C1FlexGrid(); grfDrug.Font = fEdit; grfDrug.Dock = System.Windows.Forms.DockStyle.Fill; grfDrug.Location = new System.Drawing.Point(0, 0); //FilterRow fr = new FilterRow(grfPosi); grfDrug.AfterRowColChange += GrfPkg_AfterRowColChange; //grfAgn.CellButtonClick += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfPosi_CellButtonClick); //grfAgn.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfPosi_CellChanged); panel1.Controls.Add(this.grfDrug); FilterRow fr = new FilterRow(grfDrug); grfDrug.AllowFiltering = true; grfDrug.AfterFilter += GrfDrug_AfterFilter; C1Theme theme = C1ThemeController.GetThemeByName("Office2013Red", false); C1ThemeController.ApplyThemeToObject(grfDrug, theme); }
private void initGrfDept() { grfExpn = new C1FlexGrid(); grfExpn.Font = fEdit; grfExpn.Dock = System.Windows.Forms.DockStyle.Fill; grfExpn.Location = new System.Drawing.Point(0, 0); FilterRow fr = new FilterRow(grfExpn); //grfExpn.AfterRowColChange += GrfExpn_AfterRowColChange; //grfExpnC.CellButtonClick += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellButtonClick); //grfExpnC.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellChanged); ContextMenu menuGw = new ContextMenu(); menuGw.MenuItems.Add("&แก้ไข รายการเบิก", new EventHandler(ContextMenu_edit)); //menuGw.MenuItems.Add("&แก้ไข", new EventHandler(ContextMenu_Gw_Edit)); //menuGw.MenuItems.Add("&ยกเลิก", new EventHandler(ContextMenu_Gw_Cancel)); grfExpn.ContextMenu = menuGw; panel2.Controls.Add(grfExpn); theme1.SetTheme(grfExpn, "Office2013Red"); }
private void setGrf2019New() { //grfDept.Rows.Count = 7; //grf2019.Clear(); grf2019.Rows.Count = 1; DataTable dt = new DataTable(); dt = ic.ivfDB.oStkdDB.selectAllOnhand(); //grfBloodLab.Rows.Count = dt.Rows.Count + 1; grf2019.Rows.Count = dt.Rows.Count + 1; //grfBloodLab.DataSource = dt; grf2019.Cols.Count = 7; //CellStyle cs = grf2019.Styles.Add("bool"); //cs.DataType = typeof(bool); //cs.ImageAlign = ImageAlignEnum.LeftCenter; grf2019.Cols[colStkName].Width = 330; grf2019.Cols[colStkOnhand].Width = 80; grf2019.Cols[colStkStatus].Width = 80; grf2019.Cols[colStkRemark].Width = 80; grf2019.Cols[colStkUnit].Width = 80; grf2019.ShowCursor = true; //grdFlex.Cols[colID].Caption = "no"; //grfDept.Cols[colCode].Caption = "รหัส"; //CellRange rg = grf2019.GetCellRange(2, colName, grf2019.Rows.Count - 1, colPrice); //rg.Style = cs; //rg.Style = grf2019.Styles["bool"]; for (int col = 0; col < dt.Columns.Count; ++col) { grf2019.Cols[col + 1].DataType = dt.Columns[col].DataType; grf2019.Cols[col + 1].Caption = dt.Columns[col].ColumnName; grf2019.Cols[col + 1].Name = dt.Columns[col].ColumnName; } grf2019.Cols[colStkName].Caption = "Name"; grf2019.Cols[colStkOnhand].Caption = "On Hand"; grf2019.Cols[colStkStatus].Caption = "Status"; grf2019.Cols[colStkRemark].Caption = "หมายเหตุ"; grf2019.Cols[colStkUnit].Caption = "unit"; int i = 0; decimal aaa = 0; foreach (DataRow row in dt.Rows) { try { i++; if (i == 1) { continue; } //if (i == 2) continue; grf2019[i, 0] = (i - 1); //Decimal.TryParse(row[ic.ivfDB.oStkdDB.ostkD.Price].ToString(), out aaa); grf2019[i, colStkName] = row[ic.ivfDB.oStkdDB.ostkD.DUName].ToString(); grf2019[i, colStkId] = row[ic.ivfDB.oStkdDB.ostkD.DUID].ToString(); grf2019[i, colStkOnhand] = row[ic.ivfDB.oStkdDB.ostkD.on_hand].ToString(); grf2019[i, colStkUnit] = row[ic.ivfDB.oStkdDB.ostkD.UnitType].ToString(); grf2019[i, colStkStatus] = "onhand"; grf2019[i, colStkRemark] = ""; } catch (Exception ex) { String err = ""; } } CellNoteManager mgr = new CellNoteManager(grf2019); grf2019.Cols[colStkId].Visible = false; //grfBloodLab.Cols[colBlInclude].Visible = false; //grfBloodLab.Cols[colBlPrice].Visible = false; grf2019.Cols[colStkName].AllowEditing = false; grf2019.Cols[colStkStatus].AllowEditing = false; FilterRow fr = new FilterRow(grf2019); grf2019.AllowFiltering = true; grf2019.AfterFilter += Grf2019_AfterFilter; //theme1.SetTheme(grfFinish, ic.theme); }
private void initGrfNote() { //grfNote = new C1FlexGrid(); //grfNote.Font = fEdit; //_flex.Font = fEdit; _flex.Dock = System.Windows.Forms.DockStyle.Fill; _flex.Location = new System.Drawing.Point(0, 0); this.Controls.Add(_flex); DataTable dt = new DataTable(); dt = ic.ivfDB.oSItmDB.selectBySpecialItem2(); //grf.DataSource = dt; //_flex.Dock = System.Windows.Forms.DockStyle.Fill; //_flex.Location = new System.Drawing.Point(0, 0); //grf.Rows.Count = 10; int colBlId = 1, colBlName = 2, colBlQty = 3, colBlPrice = 4, colBlInclude = 5, colBlRemark = 6; int i = 0; decimal aaa = 0; _flex.Rows.Count = dt.Rows.Count + 2; _flex.Cols.Count = dt.Columns.Count + 3; //grf.Cols[col + 1].DataType = table.Columns[col].DataType; //grf.Cols[col + 1].Caption = table.Columns[col].ColumnName; //grf.Cols[colBlPrice].DataType = typeof(Decimal); //grf.Cols[colBlName].DataType = dt.Columns[ic.ivfDB.oSItmDB.sitm.SName].DataType; //grf.Cols[colBlQty].DataType = typeof(Decimal); //grf.Cols[colBlRemark].DataType = dt.Columns[ic.ivfDB.oSItmDB.sitm.SName].DataType; //grf.Cols[colBlId].DataType = typeof(Int32); _flex.Cols[colBlPrice].Caption = "Price"; _flex.Cols[colBlName].Caption = "Name"; _flex.Cols[colBlQty].Caption = "Qty"; _flex.Cols[colBlRemark].Caption = "Remark"; _flex.Cols[colBlId].Caption = "ID"; //for (int col = 0; col < dt.Columns.Count; ++col) //{ //grf.Cols[colBlId].DataType = dt.Columns["SID"].DataType; //grf.Cols[colBlId].Name = dt.Columns["SID"].ColumnName; //grf.Cols[colBlPrice].DataType = dt.Columns["Price"].DataType; //grf.Cols[colBlPrice].Name = dt.Columns["Price"].ColumnName; //grf.Cols[colBlName].DataType = dt.Columns["SName"].DataType; //grf.Cols[colBlName].Name = dt.Columns["SName"].ColumnName; //grf.Cols[colBlRemark].DataType = dt.Columns["bilgrpname"].DataType; //grf.Cols[colBlRemark].Name = dt.Columns["bilgrpname"].ColumnName; //} for (int col = 0; col < dt.Columns.Count; ++col) { _flex.Cols[col + 1].DataType = dt.Columns[col].DataType; //_flex.Cols[col + 1].Caption = dt.Columns[col].ColumnName; _flex.Cols[col + 1].Name = dt.Columns[col].ColumnName; } for (int row = 0; row < dt.Rows.Count; ++row) { for (int col = 0; col < dt.Columns.Count; ++col) { _flex[row + 2, col + 1] = dt.Rows[row][col]; } } //foreach (DataRow row in dt.Rows) //{ // try // { // i++; // if (i == 1) continue; // Decimal.TryParse(row[ic.ivfDB.oSItmDB.sitm.Price].ToString(), out aaa); // grf[i, colBlPrice] = aaa.ToString("#,##0"); // grf[i, colBlId] = row[ic.ivfDB.oSItmDB.sitm.SID].ToString(); // grf[i, colBlName] = row[ic.ivfDB.oSItmDB.sitm.SName].ToString(); // grf[i, colBlQty] = "1"; // grf[i, colBlRemark] = row["bilgrpname"].ToString(); // } // catch (Exception ex) // { // String err = ""; // } //} FilterRow fr = new FilterRow(_flex); _flex.AllowFiltering = true; _flex.AfterFilter += _flex_AfterFilter1; _flex.AfterRowColChange += _flex_AfterRowColChange; //grfImg.MouseDown += GrfImg_MouseDown; //grfNote.DoubleClick += GrfNote_DoubleClick; //grfExpnC.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grfDept_CellChanged); //ContextMenu menuGw = new ContextMenu(); //menuGw.MenuItems.Add("Upload รูปบัตรประชาชน", new EventHandler(ContextMenu_grfimg_upload_ptt)); //menuGw.MenuItems.Add("Upload สำเนาบัตรประชาชน ที่มีลายเซ็น", new EventHandler(ContextMenu_grfimg_upload_ptt)); //menuGw.MenuItems.Add("Upload รูป Passport", new EventHandler(ContextMenu_grfimg_upload_ptt)); //menuGw.MenuItems.Add("ยกเลิก", new EventHandler(ContextMenu_grfimg_Cancel)); //grfImgOld.ContextMenu = menuGw; //pnNote.Controls.Add(grfNote); //theme1.SetTheme(grfNote, "Office2016Colorful"); }
private void setGrfRx() { //grfDept.Rows.Count = 7; //grfRx.Clear(); DataTable dt = new DataTable(); dt = ic.ivfDB.oStkdDB.selectBySockDrug1(); grfRx.Rows.Count = dt.Rows.Count + 1; //grfEmbryo.Rows.Count = dt.Rows.Count + 1; //grfRx.DataSource = dt; grfRx.Cols.Count = 9; CellStyle cs = grfRx.Styles.Add("bool"); cs.DataType = typeof(bool); cs.ImageAlign = ImageAlignEnum.LeftCenter; grfRx.Cols[colRxName].Width = 300; grfRx.Cols[colRxInclude].Width = 60; grfRx.Cols[colRxPrice].Width = 80; grfRx.Cols[colRxRemark].Width = 100; grfRx.Cols[colRxUsE].Width = 400; grfRx.Cols[colRxUsT].Width = 400; grfRx.Cols[colRxQty].Width = 60; grfRx.ShowCursor = true; //grdFlex.Cols[colID].Caption = "no"; //grfDept.Cols[colCode].Caption = "รหัส"; CellRange rg = grfRx.GetCellRange(2, colBlInclude, grfRx.Rows.Count - 1, colBlInclude); rg.Style = cs; rg.Style = grfRx.Styles["bool"]; for (int col = 0; col < dt.Columns.Count; ++col) { grfRx.Cols[col + 1].DataType = dt.Columns[col].DataType; grfRx.Cols[col + 1].Caption = dt.Columns[col].ColumnName; grfRx.Cols[col + 1].Name = dt.Columns[col].ColumnName; } grfRx.Cols[colRxName].Caption = "Name"; grfRx.Cols[colRxInclude].Caption = "Include"; grfRx.Cols[colRxPrice].Caption = "Price"; grfRx.Cols[colRxQty].Caption = "QTY"; grfRx.Cols[colRxRemark].Caption = "Remark"; grfRx.Cols[colRxUsE].Caption = "Usage English."; grfRx.Cols[colRxUsT].Caption = "Usage Thai"; int i = 0; decimal aaa = 0; foreach (DataRow row in dt.Rows) { try { i++; if (i == 1) { continue; } grfRx[i, colBlId] = row["DUID"].ToString(); grfRx[i, colRxName] = row["DUName"].ToString(); Decimal.TryParse(row[ic.ivfDB.oLabiDB.labI.Price].ToString(), out aaa); grfRx[i, colRxPrice] = aaa.ToString("#,##0"); grfRx[i, colRxQty] = "1"; grfRx[i, colBlRemark] = ""; grfRx[i, colRxUsE] = row["EUsage"].ToString(); grfRx[i, colRxUsT] = row["TUsage"].ToString(); //Row row1 = grfRx.Rows.Add(); //row1[colBlId] = row["DUID"].ToString(); //row1[colBlName] = row["DUName"].ToString(); //row1[colBlPrice] = row["Price"].ToString(); //row1[colBlRemark] = ""; //if (i == 1) continue; //if (i == 2) continue; grfRx[i, 0] = (i - 2); } catch (Exception ex) { String err = ""; } } CellNoteManager mgr = new CellNoteManager(grfRx); grfRx.Cols[colBlId].Visible = false; grfRx.Cols[colBlRemark].Visible = false; //grfRx.Cols[colBlPrice].Visible = false; //FilterRowUnBound fr = new FilterRowUnBound(grfRx); grfRx.Cols[colBlName].AllowEditing = false; grfRx.Cols[colBlPrice].AllowEditing = false; grfRx.Cols[colBlRemark].AllowEditing = true; grfRx.Cols[colRxUsE].AllowEditing = true; grfRx.Cols[colRxUsT].AllowEditing = true; FilterRow fr = new FilterRow(grfRx); grfRx.AllowFiltering = true; grfRx.AfterFilter += GrfRx_AfterFilter; //theme1.SetTheme(grfFinish, ic.theme); }
public static GridButtonsColumnBuilder ButtonsCrud <TModel>(this GridColumnFactory <TModel> factory, FilterRow filterRow = null) where TModel : class { return(factory.Buttons(buttons => { buttons.Add(); buttons.Edit(); buttons.Delete(); }, filterRow)); }
public static GridButtonsColumnBuilder Buttons <TModel>(this GridColumnFactory <TModel> factory, Action <GridButtonsColumnFactory <TModel> > buttonAction, FilterRow filterRow = null) where TModel : class { if (filterRow != null) { filterRow.AddCell(new ButtonFilterCell()); } GridButtonsColumn <TModel> column = new GridButtonsColumn <TModel>(factory.Container); buttonAction(new GridButtonsColumnFactory <TModel>(column)); factory.Container.Columns.Add(column); return(new GridButtonsColumnBuilder(column)); }
private void setGrfStk(String column) { //grfDept.Rows.Count = 7; //grfStk.Clear(); grfStk.Rows.Count = 1; DataTable dt = new DataTable(); dt = ic.ivfDB.oStkdDB.selectAll2(column); //grfBloodLab.Rows.Count = dt.Rows.Count + 1; grfStk.Rows.Count = dt.Rows.Count + 1; //grfBloodLab.DataSource = dt; grfStk.Cols.Count = 8; //CellStyle cs = grfStk.Styles.Add("bool"); //cs.DataType = typeof(bool); //cs.ImageAlign = ImageAlignEnum.LeftCenter; grfStk.Cols[colName].Width = 330; grfStk.Cols[colUnit].Width = 80; grfStk.Cols[colOrderPoint].Width = 80; grfStk.Cols[colOnhand].Width = 80; grfStk.Cols[colOrderPoint].Width = 80; grfStk.Cols[colOrderAmount].Width = 80; grfStk.ShowCursor = true; //grdFlex.Cols[colID].Caption = "no"; //grfDept.Cols[colCode].Caption = "รหัส"; //CellRange rg = grfStk.GetCellRange(2, colName, grfStk.Rows.Count - 1, colPrice); //rg.Style = cs; //rg.Style = grfStk.Styles["bool"]; for (int col = 0; col < dt.Columns.Count; ++col) { grfStk.Cols[col + 1].DataType = dt.Columns[col].DataType; grfStk.Cols[col + 1].Caption = dt.Columns[col].ColumnName; grfStk.Cols[col + 1].Name = dt.Columns[col].ColumnName; } grfStk.Cols[colName].Caption = "Name"; grfStk.Cols[colUnit].Caption = "Unit"; grfStk.Cols[colOnhand].Caption = "On Hand"; grfStk.Cols[colOrderPoint].Caption = "จุดสั่งซื้อ"; grfStk.Cols[colOrderAmount].Caption = "จำนวนสั่งซื้อ"; grfStk.Cols[colPrice].Caption = "Price"; int i = 0; decimal aaa = 0; foreach (DataRow row in dt.Rows) { try { i++; if (i == 1) { continue; } //if (i == 2) continue; grfStk[i, 0] = (i - 1); Decimal.TryParse(row[ic.ivfDB.oStkdDB.ostkD.Price].ToString(), out aaa); grfStk[i, colPrice] = aaa.ToString("#,##0"); grfStk[i, colId] = row[ic.ivfDB.oStkdDB.ostkD.DUID].ToString(); grfStk[i, colName] = row[ic.ivfDB.oStkdDB.ostkD.DUName].ToString(); grfStk[i, colUnit] = row[ic.ivfDB.oStkdDB.ostkD.UnitType].ToString(); grfStk[i, colOrderPoint] = row[ic.ivfDB.oStkdDB.ostkD.order_point + column].ToString(); grfStk[i, colOrderAmount] = row[ic.ivfDB.oStkdDB.ostkD.order_amount + column].ToString(); grfStk[i, colOnhand] = row[ic.ivfDB.oStkdDB.ostkD.on_hand + column].ToString(); } catch (Exception ex) { String err = ""; } } CellNoteManager mgr = new CellNoteManager(grfStk); grfStk.Cols[colId].Visible = false; //grfBloodLab.Cols[colBlInclude].Visible = false; //grfBloodLab.Cols[colBlPrice].Visible = false; grfStk.Cols[colName].AllowEditing = false; grfStk.Cols[colOrderPoint].AllowEditing = false; grfStk.Cols[colOrderAmount].AllowEditing = false; grfStk.Cols[colOnhand].AllowEditing = false; FilterRow fr = new FilterRow(grfStk); grfStk.AllowFiltering = true; grfStk.AfterFilter += GrfStk_AfterFilter; //theme1.SetTheme(grfFinish, ic.theme); }
private int RefreshTotal(string screenID, string viewName, out int read, out int unread) { read = -1; unread = -1; string actualScreenID = PXContext.GetScreenID(); using (new PXPreserveScope()) { try { PXContext.SetScreenID(screenID); PXGraph graph = CreateGraph(screenID); if (graph == null || graph.PrimaryView == null) { return(-1); } if (viewName == null) { viewName = graph.PrimaryView; } PXView view = graph.Views[viewName]; PXView viewFilters; PXFilterRow[] filters = null; if (graph.Views.TryGetValue(viewName + PXFilterableAttribute.FilterHeaderName, out viewFilters)) { foreach (FilterHeader fHeader in viewFilters.SelectMulti()) { if (fHeader.IsDefault == true) { int s = 0; int t = 0; IList f = graph.ExecuteSelect(viewName + PXFilterableAttribute.FilterRowName, new object[] { fHeader.FilterID }, null, null, null, new PXFilterRow[] { new PXFilterRow(typeof(FilterRow.isUsed).Name, PXCondition.EQ, true, null) }, ref s, 0, ref t) as IList; if (f != null && f.Count > 0) { filters = new PXFilterRow[f.Count]; PXCache frc = graph.Caches[typeof(FilterRow)]; for (int i = 0; i < f.Count; i++) { FilterRow r = (FilterRow)f[i]; var filter = new PXFilterRow(r.DataField, (PXCondition)r.Condition, frc.GetValueExt(r, "ValueSt"), frc.GetValueExt(r, "ValueSt2")); if (r.OpenBrackets != null) { filter.OpenBrackets = r.OpenBrackets.Value; } if (r.CloseBrackets != null) { filter.CloseBrackets = r.CloseBrackets.Value; } filter.OrOperator = r.Operator == 1; filters[i] = filter; } } break; } } } int start = 0; int total = 0; read = -1; unread = -1; using (var scope = new PXFieldScope(view, typeof(CRActivity.noteID), typeof(EPView.status))) foreach (object record in view.Select(null, null, null, null, null, filters, ref start, 101, ref total)) { PXResult result = record as PXResult; if (result != null) { EPView v = result.GetItem <EPView>(); if (v != null) { if (v.Status != null && v.Status == EPViewStatusAttribute.VIEWED) { read += 1; } else { unread += 1; } } } } if (read != -1 || unread != -1) { read += 1; unread += 1; } return(total); } finally { PXContext.SetScreenID(actualScreenID); } } }
//private void initConfigSpreadGrd() //{ // grdView = new FpSpread(); // grdView.Font = fEdit; // FarPoint.Win.Spread.EnhancedInterfaceRenderer outlinelook = new FarPoint.Win.Spread.EnhancedInterfaceRenderer(); // outlinelook.RangeGroupBackgroundColor = Color.LightGreen; // outlinelook.RangeGroupButtonBorderColor = Color.Red; // outlinelook.RangeGroupLineColor = Color.Blue; // grdView.InterfaceRenderer = outlinelook; // grdView.AccessibleDescription = ""; // grdView.Dock = System.Windows.Forms.DockStyle.Fill; // grdView.Location = new System.Drawing.Point(0, 0); // grdView.Sheets.Count = 1; // grdView.Sheets[0].OperationMode = FarPoint.Win.Spread.OperationMode.ReadOnly; // grdView.BorderStyle = BorderStyle.None; // grdView.Sheets[0].Columns[colID, colRemark].AllowAutoFilter = true; // grdView.Sheets[0].Columns[colID, colRemark].AllowAutoSort = true; // grdView.Sheets[0].AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.EnhancedContextMenu; // grdView.Sheets[0].ColumnCount = colCnt; // grdView.Sheets[0].RowCount = 1; // FarPoint.Win.Spread.CellType.TextCellType objTextCell = new FarPoint.Win.Spread.CellType.TextCellType(); // Controls.Add(grdView); //} private void initConfigFlexGrd() { grfFlex = new C1FlexGrid(); grfAddr = new C1FlexGrid(); grfFlex.Font = fEdit; grfAddr.Font = fEdit; grfFlex.Dock = System.Windows.Forms.DockStyle.Fill; grfFlex.Location = new System.Drawing.Point(0, 0); // initialize grid //grdFlex.Styles = new C1FlexGrid.CellStyleCollection(@"Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;} Highlight{BackColor:Highlight;ForeColor:HighlightText;} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} EmptyArea{BackColor:AppWorkspace;Border:Flat,1,ControlDarkDark,Both;} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} "); //grdFlex.DataSource = xC.xtDB.cusDB.lCus; if (flag == Search.Customer) { grfFlex.DataSource = xC.iniDB.cusDB.selectCusAll(); } else if (flag == Search.Importer) { grfFlex.DataSource = xC.iniDB.cusDB.selectImpAll(); } else if (flag == Search.Forwarder) { grfFlex.DataSource = xC.iniDB.fwdDB.dtFwd; } else if (flag == Search.EntryType) { grfFlex.DataSource = xC.iniDB.ettDB.selectAll(); } else if (flag == Search.PortOfLoading) { grfFlex.DataSource = xC.iniDB.polDB.selectAll(); } else if (flag == Search.Privilege) { grfFlex.DataSource = xC.iniDB.pvlDB.selectAll(); } else if (flag == Search.Staff) { grfFlex.DataSource = xC.xtDB.stfDB.selectAll1(); } else if (flag == Search.Country) { grfFlex.DataSource = xC.iniDB.cotDB.selectAll(); } else if (flag == Search.EntryType) { grfFlex.DataSource = xC.iniDB.ettDB.selectAll(); } else if (flag == Search.PortImport) { grfFlex.DataSource = xC.iniDB.ptiDB.selectAll(); } else if (flag == Search.IncoTerm) { grfFlex.DataSource = xC.iniDB.ictDB.selectAll(); } else if (flag == Search.TermPayment) { grfFlex.DataSource = xC.iniDB.tpmDB.selectAll(); } else if (flag == Search.Insurance) { grfFlex.DataSource = xC.iniDB.cusDB.selectInsrAll(); } else if (flag == Search.Currency) { grfFlex.DataSource = xC.iniDB.currDB.selectAll(); } else if (flag == Search.Truck) { grfFlex.DataSource = xC.iniDB.trkDB.selectAll(); } else if (flag == Search.TruckCop) { grfFlex.DataSource = xC.iniDB.cusDB.selectTrkCopAll(); } else if (flag == Search.AddressPlaceAddr) { grfFlex.DataSource = xC.iniDB.cusDB.selectImpAll(); } else if (flag == Search.AddressContainerYard) { grfFlex.DataSource = xC.iniDB.cusDB.selectContainerYardAll(); } else if (flag == Search.ContainerYard) { grfFlex.DataSource = xC.iniDB.cusDB.selectContainerYardAll(); } else if (flag == Search.Items) { grfFlex.DataSource = xC.iniDB.itmDB.selectAll1("1"); } grfFlex.Cols[colID].Width = 60; grfFlex.Cols[colNameT].Width = 20; //grdFlex.ShowCursor = true; //grdFlex.Cols[colID].Caption = "no"; grfFlex.Cols[colID].Caption = "code"; grfFlex.Cols[colNameT].Caption = "name t"; FilterRow fr = new FilterRow(grfFlex); sB = new StatusBar(); //sB.AutoSizeElement = C1.Framework.AutoSizeElement.Width; sB.Location = new System.Drawing.Point(0, 228); sB.Name = "c1StatusBar1"; sB.Size = new System.Drawing.Size(440, 23); grfFlex.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(grfFlex_AfterRowColChange); grfFlex.AfterDataRefresh += new System.ComponentModel.ListChangedEventHandler(this.c1StatusBar_AfterDataRefresh); grfFlex.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.grdFlex_CellChanged); grfFlex.LeaveCell += new System.EventHandler(this.grdFlex_LeaveCell); //c1StatusBar.Dock // create styles with data types, formats, etc //CellStyle cs = _flex.Styles.Add("emp"); //cs.DataType = typeof(string); //cs.ComboList = "|Tom|Dick|Harry"; //cs.ForeColor = Color.Navy; //cs.Font = new Font(Font, FontStyle.Bold); //_flex[r, 1] Panel panel1 = new Panel(); if (!txtS.Equals("")) { grfFlex[1, colNameT] = txtS; } if ((flag == Search.AddressPlaceAddr) || (flag == Search.ContainerYard)) { Panel panel2 = new Panel(); panel2.Dock = DockStyle.Bottom; panel2.Height = 180; Controls.Add(panel2); panel1.Dock = DockStyle.Top; panel1.Height = this.Height - sB.Height - panel2.Height - 45; grfAddr.Dock = DockStyle.Fill; grfAddr.Location = new System.Drawing.Point(0, 0); panel2.Controls.Add(grfAddr); } else { panel1.Dock = DockStyle.Fill; } panel1.Controls.Add(grfFlex); Controls.Add(panel1); Controls.Add(sB); }