Example #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sbDelete_Click(object sender, EventArgs e)
        {
            //仓库ID
            string      strWarehouseId = string.Empty;
            LogedInUser CurrentUser    = ClientSession.GetInstance().CurrentUser;
            DataRow     dr             = gridView3.GetDataRow(gridView3.FocusedRowHandle);

            if (dr != null)
            {
                strWarehouseId = dr["id"].ToString();

                if (strWarehouseId != null)
                {
                    //if (WarehouseMgrBLL.GetInstance().JudgeCanUse(strWarehouseId) < 1)
                    //{
                    if (XtraMessageBox.Show("确认作废记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        try
                        {
                            WarehouseMgrBLL.GetInstance().Delete(strWarehouseId, CurrentUser);
                            for (int i = 0; i < this.gridView3.RowCount; i++)
                            {
                                DataRow drrow = gridView3.GetDataRow(i);
                                if (drrow["id"].ToString() == dr["id"].ToString())
                                {
                                    drrow["state"] = "不可用";
                                    this.gridView3.FocusedRowHandle = i;
                                }
                            }
                            XtraMessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show("保存时发送错误:" + ex.Message.ToString());
                        }
                        finally
                        {
                            //this.bindingList();
                        }
                    }
                    //}
                    //else
                    //{
                    //    XtraMessageBox.Show(" 库房可用,无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                }
            }
        }
Example #2
0
        private void bindingList()
        {
            LogedInUser CurrentUser = ClientSession.GetInstance().CurrentUser;

            DtWarehouse = WarehouseMgrBLL.GetInstance().GetWarehouseInfoDt(CurrentUser);

            base.InitFromCacheByData(DtWarehouse);

            try
            {
                this.bindingSourceWarehouse.DataSource = null;
                this.bindingSourceWarehouse.DataSource = DtWarehouse.DefaultView;
            }
            catch (Exception)
            {
                throw;
            }
        }