示例#1
0
        public ActionResult Delete(JArray selectedRows, FormCollection values)
        {
            var ids = selectedRows.Select(x => x.ToString()).ToList();

            Rep.Delete(t => ids.Contains(t._id));
            OnUpdated(values);
            return(UIHelper.Result());
        }
示例#2
0
 public void DeleteOrders(string id, int townId, bool isFrom)
 {
     //Rep.Delete(new BsonValue(new OrdersDataId(id, townId, isFrom)));
     Rep.Delete($"{id},{townId},{isFrom}");
 }
 public ActionResult Delete(JArray selectedRows, FormCollection values)
 {
     Rep.Delete(t => selectedRows.Select(Convert.ToInt32).Contains(t.Rid));
     OnUpdated(values);
     return(UIHelper.Result());
 }
        private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            #region txtRepID
            if (sender == txtRepID)
            {
                if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3)
                {
                    return;
                }

                if (e.KeyCode.ToString() == "F2")
                {
                    if (oRep.ViewByID())
                    {
                        ShowRep();
                        txtName.Focus();
                    }
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtRepID.Text.Trim().Length == 0)
                    {
                        Clear();
                        txtName.Focus();
                    }

                    if (oRep.Find(Convert.ToInt32(txtRepID.Text)))
                    {
                        ShowRep();
                        txtName.Focus();
                    }
                    else
                    {
                        Clear();
                    }
                }
            }
            #endregion



            #region Default Option
            //Default option
            switch (e.KeyCode)
            {
            case Keys.Tab:
                if (!e.Shift)
                {
                    this.SelectNextControl(this.ActiveControl, true, true, true, true);
                }
                break;

            case Keys.Enter:
                if (sender == txtFax)
                {
                    return;
                }
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
                break;

            case Keys.Down:
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
                break;

            case Keys.Up:
                this.SelectNextControl(this.ActiveControl, false, true, true, true);
                break;

            case Keys.F8:
                break;

            case Keys.F3:
            {
                if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    MessageBox.Show("Operation Cancelled");
                    return;
                }
                else
                {
                    oRep.Delete();
                    Clear();
                    txtRepID.Focus();
                }
            }
            break;

            case Keys.F7:
                this.Close();
                break;

            case Keys.PageDown:
                Save();
                txtRepID.Focus();
                break;


                //case Keys.<some key>:
                // ......;
                // break;
            }
            #endregion
        }