Пример #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Msg.Confirm("Are you sure you want to delete " + this.TxtUnit.Text + "?", "DELETE UNIT") == DialogResult.Yes)
            {
                int rowCnt = 0;


                SqlCommand Cmd = new SqlCommand();
                Cmd.Connection  = Server.Connection;
                Cmd.CommandText = "SELECT COUNT(*) FROM tbl_Item WHERE ItemUnitId=" + UnitID;
                rowCnt          = Convert.ToInt32(Cmd.ExecuteScalar());

                if (rowCnt != 0)
                {
                    Msg.Warn("Sorry you cannot delete " + this.TxtUnit.Text + "! Because it being used by an item.");
                    return;
                }

                Server.Delete("tbl_Unit", "WHERE UnitId=" + UnitID);

                Msg.Info("Successfully Deleted");

                this.BtnNew.PerformClick();
                this.FillList();
                this.GrpUnit.Enabled = false;
            }
        }
Пример #2
0
        private void BtnDeleteDelivery_Click(object sender, EventArgs e)
        {
            String ID = this.SelectedTrans["deliveryId"].ToString();

            if (Msg.Confirm("Are your sure you want to delete this delivery?", "DELETE DELIVERY") == DialogResult.Yes)
            {
                Server.Delete("tbl_delivery", "where deliveryId=" + ID);
                Server.Delete("tbl_delivery_dtl", "where deliveryId=" + ID);
                this.Fill();
            }
        }
Пример #3
0
        private void BtnApprovedDelivery_Click(object sender, EventArgs e)
        {
            String ID = this.SelectedTrans["deliveryId"].ToString();

            if (Msg.Confirm("Are your sure you want to approve this delivery?", "APPROVED DELIVERY") == DialogResult.Yes)
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = Server.Connection;
                cmd.CommandText = "UPDATE tbl_delivery SET Approve=1 WHERE deliveryId=" + ID;
                cmd.ExecuteNonQuery();
                this.Fill();
            }
        }
Пример #4
0
        private void BtnCancelRequest_Click(object sender, EventArgs e)
        {
            if (this.SelectedTrans != null)
            {
                String transId = this.SelectedTrans["transId"].ToString();

                if (Msg.Confirm("Are your sure you want to delete this request?", "DELETE REQUEST") == DialogResult.Yes)
                {
                    Server.Delete("tbl_trans", "where transId=" + transId);
                    Server.Delete("tbl_trans_dtl", "where transId=" + transId);
                    this.loadtrans();
                }
            }
            else
            {
                Msg.Warn("Please select atleast one request to delete!");
            }
        }
Пример #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Msg.Confirm("Are you sure you want to delete " + this.TxtItemName.Text + "?", "DELETE Item") == DialogResult.Yes)
            {
                int rowCnt = 0;


                SqlCommand Cmd = new SqlCommand();
                Cmd.Connection  = Server.Connection;
                Cmd.CommandText = "SELECT COUNT(*) FROM vw_delivery_dtl WHERE Item_No='" + ItemNo + "'";
                rowCnt          = Convert.ToInt32(Cmd.ExecuteScalar());

                if (rowCnt != 0)
                {
                    Msg.Warn("Sorry you cannot delete " + this.TxtItemName.Text + "! Because it being used in delivery.");
                    return;
                }

                Cmd             = new SqlCommand();
                Cmd.Connection  = Server.Connection;
                Cmd.CommandText = "SELECT COUNT(*) FROM vw_trans_dtl WHERE Item_No='" + ItemNo + "'";
                rowCnt          = Convert.ToInt32(Cmd.ExecuteScalar());

                if (rowCnt != 0)
                {
                    Msg.Warn("Sorry you cannot delete " + this.TxtItemName.Text + "! Because it being used in issuance.");
                    return;
                }

                Server.Delete("tbl_Item", "WHERE ItemNo='" + ItemNo + "'");

                Msg.Info("Successfully Deleted");

                this.BtnNew.PerformClick();
                this.FillList();
                this.GrpItem.Enabled = false;
            }
        }
Пример #6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Msg.Confirm("Are you sure you want to deactivate " + this.TxtUsername.Text + "?", "DEACTIVATE USER") == DialogResult.Yes)
            {
                SqlCommand cmd = new SqlCommand();

                try
                {
                    cmd.Connection  = Server.Connection;
                    cmd.CommandText = "UPDATE tbl_User SET Active=0 WHERE UserId=" + UserId.ToString();
                    cmd.ExecuteNonQuery();

                    Msg.Info("Deactivdated.");

                    this.BtnNew.PerformClick();
                    this.FillList();
                    this.GrpItem.Enabled = false;
                }
                catch (Exception ex)
                {
                    Msg.Error(ex.Message.ToString());
                }
            }
        }