示例#1
0
        private void MoveRow(int sourceRow, int targetRow)
        {
            if (sourceRow == targetRow || sourceRow == targetRow + 1)
            {
                return;
            }

            LayoutView view    = layoutView1;
            DataRow    row1    = view.GetDataRow(targetRow);
            DataRow    row2    = view.GetDataRow(targetRow + 1);
            DataRow    dragRow = view.GetDataRow(sourceRow);
            decimal    val1    = (decimal)row1[OrderFieldName];

            if (row2 == null)
            {
                dragRow[OrderFieldName] = val1 + 1;
            }
            else
            {
                decimal val2 = (decimal)row2[OrderFieldName];
                dragRow[OrderFieldName] = (val1 + val2) / 2;
            }
        }
示例#2
0
 private void btAccept_Click(object sender, EventArgs e)
 {
     if (lvImages.SelectedRowsCount > 0)
     {
         try
         {
             ImgResult = (Bitmap)lvImages.GetDataRow(lvImages.GetSelectedRows()[0])[0];
             Close();
         }
         catch (Exception ex)
         {
             int num = (int)XtraMessageBox.Show(ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
     else
     {
         int num1 = (int)XtraMessageBox.Show(Messages.SelectRecord, Messages.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
示例#3
0
        //确定挑选
        private void btnComfirm_Click(object sender, EventArgs e)
        {
            PmIds = string.Empty;
            BaseView ViewType = gridCMain.MainView;

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Grid.GridView")
            {
                GridView grid = ViewType as GridView;
                for (int i = 0; i < grid.RowCount; i++)
                {
                    if (grid.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        PmIds += grid.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Layout.LayoutView")
            {
                LayoutView layout = ViewType as LayoutView;
                for (int i = 0; i < layout.RowCount; i++)
                {
                    if (layout.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        PmIds += layout.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Card.CardView")
            {
                CardView cardView1 = ViewType as CardView;
                for (int i = 0; i < cardView1.RowCount; i++)
                {
                    if (cardView1.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        PmIds += cardView1.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }

            //if (PmIds.TrimEnd(',').Split(',').Length == 1 && PmIds.Trim().Length > 0)
            //{
            //    DataTable dtOne = dt.Select("PM_Id = '" + PmIds.TrimEnd(',') + "' AND Fy_Id='" + dplFy.EditValue.ToString().Trim() + "' ").CopyToDataTable();
            //    frmSelectProdOne frmOne = new frmSelectProdOne(dsLoad.Tables[1], dtOne, PmIds.TrimEnd(','));
            //    if (frmOne.ShowDialog() == DialogResult.OK)
            //    {
            //        if (frmOne.IsSelect == true)
            //        {
            //            dtProd.Rows.Remove(dtProd.Select("PM_Id = '" + PmIds.TrimEnd(',') + "' ")[0]);
            //            gridCMain.DataSource = dtProd;
            //        }
            //    }
            //}
            //else
            //{
            //自动生成营销款号插入数据库
            if (PmIds == string.Empty)
            {
                MessageBox.Show("请先选择款式");
                return;
            }

            frmSelectProdMany frmMany = new frmSelectProdMany(dt, PmIds);

            if (frmMany.ShowDialog() == DialogResult.OK)
            {
                if (frmMany.IsSelect == true)
                {
                    string[] pmPmIds = PmIds.TrimEnd(',').Split(',');
                    for (int i = 0; i < pmPmIds.Length; i++)
                    {
                        dtProd.Rows.Remove(dtProd.Select("PM_Id = '" + pmPmIds[i].ToString() + "' ")[0]);
                    }
                    gridCMain.DataSource = dtProd;
                }

                this.grpPic.Controls.Clear();
                x    = 10;
                y    = 25;
                path = string.Empty;
            }
            //}
        }
        private void btnComfirm_Click(object sender, EventArgs e)
        {
            ids = string.Empty;
            BaseView ViewType = gridCMain.MainView;

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Grid.GridView")
            {
                GridView grid = ViewType as GridView;
                for (int i = 0; i < grid.RowCount; i++)
                {
                    if (grid.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        ids += grid.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Layout.LayoutView")
            {
                LayoutView layout = ViewType as LayoutView;
                for (int i = 0; i < layout.RowCount; i++)
                {
                    if (layout.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        ids += layout.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }

            if (ViewType.GetType().ToString() == "DevExpress.XtraGrid.Views.Card.CardView")
            {
                CardView cardView1 = ViewType as CardView;
                for (int i = 0; i < cardView1.RowCount; i++)
                {
                    if (cardView1.GetDataRow(i)["Checked"].ToString() == "True")
                    {
                        ids += cardView1.GetDataRow(i)["PM_Id"].ToString() + ",";
                    }
                }
            }
            //   MessageBox.Show("选中了" + ids.TrimEnd(','));

            if (ids.TrimEnd(',').Split(',').Length == 1 && ids.Trim().Length > 0)
            {
                DataTable        dtOne  = dt.Select("PM_Id = '" + ids.TrimEnd(',') + "' AND Fy_Id='" + dplFy.EditValue.ToString().Trim() + "' ").CopyToDataTable();
                frmSelectProdOne frmOne = new frmSelectProdOne(dsLoad.Tables[1], dtOne, ids.TrimEnd(','));
                if (frmOne.ShowDialog() == DialogResult.OK)
                {
                    if (frmOne.IsSelect == true)
                    {
                        dtProd.Rows.Remove(dtProd.Select("PM_Id = '" + ids.TrimEnd(',') + "' ")[0]);
                        gridCMain.DataSource = dtProd;
                    }
                }
            }
            else
            {
                //自动生成营销款号插入数据库
                frmSelectProdMany frmMany = new frmSelectProdMany(dt, ids);
                if (frmMany.ShowDialog() == DialogResult.OK)
                {
                    if (frmMany.IsSelect == true)
                    {
                        string[] pmids = ids.TrimEnd(',').Split(',');
                        for (int i = 0; i < pmids.Length; i++)
                        {
                            dtProd.Rows.Remove(dtProd.Select("PM_Id = '" + pmids[i].ToString() + "' ")[0]);
                        }
                        gridCMain.DataSource = dtProd;
                    }
                }
            }
        }