Exemple #1
0
 public void Open(bool t, DataTable dtt)
 {
     gridView1.Columns.Clear();
     GetColorSize();
     dt = AmountListClass.GetList(dtt);
     this.gridView1.CustomRowCellEdit -= new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     dtt.TableName           = "tableName";
     gridControl1.DataSource = dt;
     FormOpen.SunRow(dt);
     FormOpen.ReSumTable(dt);
     this.gridView1.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     _isCanEdit = t;
     _IsEdit    = true;
     gridView1.OptionsBehavior.Editable = t;
     SetWidth();
 }
Exemple #2
0
 public void Open(int mainID, int TableTypeID, bool t, int AmountTypeID)
 {
     gridView1.Columns.Clear();
     _mainID      = mainID;
     _tableTypeID = TableTypeID;
     this.gridView1.CustomRowCellEdit -= new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     dt                      = BasicClass.GetDataSet.GetDS(bllOT, "ShowTemInfo", new object[] { _mainID, _tableTypeID, t, AmountTypeID }).Tables[0];
     dt.TableName            = "tableName";
     gridControl1.DataSource = dt;
     FormOpen.SunRow(dt);
     FormOpen.ReSumTable(dt);
     this.gridView1.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     _isCanEdit = false;
     GetColorSize();
     SetWidth();
 }
Exemple #3
0
 public void ShowInfo(int MaterielID, int BrandID, bool t, DataTable dtt)
 {
     gridView1.Columns.Clear();
     GetColorSize();
     _mainID      = MaterielID;
     dt           = dtt;
     _tableTypeID = BrandID;
     this.gridView1.CustomRowCellEdit -= new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     dtt.TableName           = "tableName";
     gridControl1.DataSource = dt;
     FormOpen.SunRow(dt);
     FormOpen.ReSumTable(dt);
     this.gridView1.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
     _isCanEdit = false;
     _IsEdit    = true;
     gridView1.OptionsBehavior.Editable = t;
 }
Exemple #4
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Value != null)
            {
                if (e.RowHandle != 0 && e.RowHandle != gridView1.RowCount - 1)
                {
                    if (e.Column.ColumnHandle == 0 || e.Column.ColumnHandle == gridView1.Columns.Count - 2 || e.Column.ColumnHandle == gridView1.Columns.Count - 1)
                    {
                        if (e.Value.ToString().Trim() != "" && _reColor.Items.IndexOf(e.Value.ToString().Trim()) == -1)
                        {
                            if (DialogResult.Yes == XtraMessageBox.Show("所填內容不在已有列表中,是否新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
                            {
                                DataTable dtTem = _dtColor.Clone();
                                DataRow   dr    = dtTem.NewRow();
                                dr["ID"]          = 0;
                                dr["Name"]        = e.Value.ToString().Trim();
                                dr["Value"]       = 0;
                                dr["IsEnd"]       = 0;
                                dr["IsUse"]       = true;
                                dr["ColorTypeID"] = 0;
                                dr["Sn"]          = (int.Parse(_dtColor.Rows[_dtColor.Rows.Count - 1]["Sn"].ToString()) + 1).ToString().PadLeft(3, '0');
                                dr["A"]           = 1;
                                dtTem.Rows.Add(dr);
                                dtTem.Rows[0]["ID"] = BasicClass.GetDataSet.Add(bllC, dtTem);
                                _dtColor.Rows.Add(dtTem.Rows[0].ItemArray);
                                _reColor.Items.Add(e.Value.ToString().Trim());
                                return;
                            }
                            else
                            {
                                gridView1.SetFocusedValue("");
                            }
                        }
                    }
                }
                if (e.RowHandle == 0)
                {
                    if (e.Value.ToString().Trim() != "" && _reSize.Items.IndexOf(e.Value.ToString().Trim()) == -1)
                    {
                        if (_liS.IndexOf(e.Value.ToString().Trim()) == -1)
                        {
                            if (DialogResult.Yes == XtraMessageBox.Show("所填內容不在已有列表中,是否新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
                            {
                                DataTable dtTem = _dtSize.Clone();
                                DataRow   dr    = dtTem.NewRow();
                                dr["ID"]         = 0;
                                dr["Name"]       = e.Value.ToString().Trim();
                                dr["IsEnd"]      = 0;
                                dr["IsUse"]      = true;
                                dr["SizeTypeID"] = 0;
                                dr["Sn"]         = string.Empty;// (int.Parse(_dtSize.Rows[_dtSize.Rows.Count - 1]["Sn"].ToString()) + 1).ToString().PadLeft(3, '0');
                                dr["A"]          = 1;
                                dtTem.Rows.Add(dr);
                                BasicClass.GetDataSet.Add(bllS, dtTem);
                                _dtSize.Rows.Add(dtTem.Rows[0].ItemArray);
                                _reSize.Items.Add(e.Value.ToString().Trim());
                                _liS.Add(e.Value.ToString().Trim());
                            }
                            else
                            {
                                gridView1.SetFocusedValue("");
                            }
                        }
                        else
                        {
                            gridView1.SetFocusedValue("");
                            return;
                        }
                    }
                }
                if (e.RowHandle == gridView1.RowCount - 2)
                {
                    DataTable dttem = (DataTable)(gridControl1.DataSource);
                    dttem.Rows.RemoveAt(dttem.Rows.Count - 1);
                    dttem.Rows.Add(dttem.NewRow());
                    dttem.Rows.Add(dttem.NewRow());
                    FormOpen.ReSumTable(dttem);
                    gridView1.SetRowCellValue(gridView1.RowCount - 1, gridView1.Columns[0], "合计");
                    return;
                }
                if (e.Column.ColumnHandle == gridView1.Columns.Count - 4)
                {
                    int c = gridView1.Columns.Count;

                    DataTable dttem = (DataTable)(gridControl1.DataSource);
                    dttem.Columns.Add("Columns" + c.ToString(), typeof(string));
                    dttem.Rows[0]["Columns" + c.ToString()] = "";
                    dttem.Columns["Columns" + c.ToString()].SetOrdinal(dttem.Columns.Count - 4);
                    gridView1.Columns.Add();

                    gridView1.Columns[c].FieldName    = "Columns" + c.ToString();
                    gridView1.Columns[c].VisibleIndex = c - 3;
                    gridView1.Columns[c].Visible      = true;
                    gridView1.Columns[c].Width        = gridView1.Columns[1].Width;
                    return;
                }
                if (e.RowHandle != 0 && e.RowHandle != gridView1.RowCount - 1 && e.Column.ColumnHandle > 0 && e.Column.ColumnHandle < gridView1.Columns.Count - 3)
                {
                    DataTable dttem = (DataTable)(gridControl1.DataSource);
                    FormOpen.ReSumTable(dttem);
                }
                _IsEdit    = true;
                _isCanEdit = true;
                int sAmount = 0;
                try
                {
                    sAmount = int.Parse(gridView1.GetRowCellValue(gridView1.RowCount - 1, gridView1.Columns[gridView1.Columns.Count - 3]).ToString());
                }
                catch { }
                ChangeVal(sAmount, "总数");
            }
        }