public async Task <bool> DeleteCustomerAsync(string customerId)
 {
     try
     {
         return(await Task.Run(() =>
         {
             return customerDAL.DeleteCustomer(customerId);
         }).ConfigureAwait(false));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        public ActionResult Delete(int id)
        {
            customerDAL.DeleteCustomer(id);
            TempData["SuccessMsg"] = "Customer Deleted Successfully";

            return(RedirectToAction("Index"));
        }
예제 #3
0
        public void DeleteCustomerTest()
        {
            CustomerDAL dal = new CustomerDAL(ConfigurationManager.ConnectionStrings["Shipper"].ConnectionString);

            dal.DeleteCustomer(3);

            Assert.IsTrue(dal.GetCustomerById(3).CustomerID != 3, "item still in db");;
        }
예제 #4
0
        private void btnDelCus_Click(object sender, EventArgs e)
        {
            CustomerDAL.DeleteCustomer(int.Parse(comAllCus.SelectedValue.ToString()));

            // comAllCus.SelectedValue would give just the cusID
            MessageBox.Show("YOU HAVE JUST DELETED " + comAllCus.Text);

            // Refresh the combo box
            refreshCombo();
        }
예제 #5
0
 public bool Delete(Customer currentElement)
 {
     try
     {
         CustomerDAL cusDal = new CustomerDAL();
         return(cusDal.DeleteCustomer(currentElement));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
 //ta bort kund
 public void DeleteCustomer(int customerID)
 {
     try
     {
         //skickar tillbaka antal ändrade rader
         CustomerDAL.DeleteCustomer(customerID);
     }
     catch
     {
         throw new ApplicationException();
     }
 }
 public void DeleteCustomer(Customer customers)
 {
     //using Exception handling concept(using try and catch).
     try
     {
         if (customers.CustomerName != null && customers.CustomerId != null)
         {
             cdal.DeleteCustomer(customers);
         }
     }
     catch (Exception ex)//catching Exception
     {
         throw new Exception("Customer Name and ID cannot be null");
     }
 }
예제 #8
0
        public string delete(string EmailId)
        {
            string result = "";

            try
            {
                CustomerDAL customerObj = new CustomerDAL();
                result = customerObj.DeleteCustomer(EmailId);
            }
            catch (Exception)
            {
                result = "Failed";
            }
            return(result);
        }
예제 #9
0
        static void Main(string[] args)
        {
            CustomerDAL     customerDAL = new CustomerDAL();
            List <Customer> customers   = customerDAL.GetCustomers();
            int             pageCount;
            List <Customer> customers1 = customerDAL.GetCustomers(5, out pageCount, pageNo: 2);
            Customer        customer   = customerDAL.GetCustomerDetails("ALFKI");


            if ((customers != null) && (customers.Count > 0))
            {
                foreach (var item in customers)
                {
                    Console.WriteLine(item.CustomerID + "||" + item.ContactName);
                }
            }

            Console.WriteLine("----------------------------------------------------------");

            if ((customers1 != null) && (customers1.Count > 0))
            {
                foreach (var item in customers1)
                {
                    Console.WriteLine(item.CustomerID + "||" + item.ContactName);
                }
            }
            Console.WriteLine("----------------------------------------------------------");
            Console.WriteLine("Page Count: " + pageCount);
            Console.WriteLine("----------------------------------------------------------");
            Console.WriteLine(customer.CustomerID + "||" + customer.ContactName);
            Console.WriteLine("----------------------------------------------------------");
            Console.WriteLine("----------------------------------------------------------");
            if (customerDAL.DeleteCustomer("ERNSH"))
            {
                Console.WriteLine("deleted ernsh");
            }
            Console.WriteLine("----------------------------------------------------------");
            customer.Fax = "030-0076546";
            Console.WriteLine("----------------------------------------------------------");
            if (customerDAL.UpdateCustomer(customer))
            {
                Console.WriteLine("Updating ALFKI");
            }
            Console.WriteLine("----------------------------------------------------------");
            Console.ReadLine();
        }
예제 #10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Getting  User ID for Deleted A row
            cutomrbll.id = int.Parse(txtCustomID.Text);

            bool success = customrdal.DeleteCustomer(cutomrbll);

            // Data is Deleted Successfully Success is True

            if (success == true)
            {
                MessageBox.Show("Successfuly  Deleting Row  ");
            }
            else
            {
                MessageBox.Show("Failled!!!! TO  Delete Data");
            }
            //Refressing DataGGRid View
            clear();
            DataTable DT = customrdal.SelectCustomer();

            dgvCustomer.DataSource = DT;
        }
        protected void rpCustomer_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Add")
            {
                if (e.Item.ItemType == ListItemType.Header)
                {
                    TextBox txtCustomerCompanyNameAdd = e.Item.FindControl("txtCustomerCompanyNameAdd") as TextBox;
                    TextBox txtContactNameAdd         = e.Item.FindControl("txtContactNameAdd") as TextBox;
                    TextBox txtAddressAdd             = e.Item.FindControl("txtAddressAdd") as TextBox;
                    TextBox txtEmailAdd  = e.Item.FindControl("txtEmailAdd") as TextBox;
                    TextBox txtPhone1Add = e.Item.FindControl("txtPhone1Add") as TextBox;
                    TextBox txtPhone2Add = e.Item.FindControl("txtPhone2Add") as TextBox;
                    TextBox txtQQAdd     = e.Item.FindControl("txtQQAdd") as TextBox;
                    TextBox txtOthersAdd = e.Item.FindControl("txtOthersAdd") as TextBox;

                    CustomerDAL dal      = new CustomerDAL();
                    Customer    customer = new Customer()
                    {
                        CustomerCompanyName = txtCustomerCompanyNameAdd.Text,
                        ContactName         = txtContactNameAdd.Text,
                        Address             = txtAddressAdd.Text,
                        Email          = txtEmailAdd.Text,
                        Phone1         = txtPhone1Add.Text,
                        Phone2         = txtPhone2Add.Text,
                        QQ             = txtQQAdd.Text,
                        CustomerOthers = txtOthersAdd.Text
                    };
                    dal.AddCustomer(customer);
                    dal.Save();
                }
            }
            if (e.CommandName == "Delete")
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    HiddenField hfId = e.Item.FindControl("hfId") as HiddenField;
                    CustomerDAL dal  = new CustomerDAL();
                    dal.DeleteCustomer(int.Parse(hfId.Value));
                }
            }
            if (e.CommandName == "Save")
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    TextBox txtCustomerCompanyName = e.Item.FindControl("txtCustomerCompanyName") as TextBox;
                    TextBox txtContactName         = e.Item.FindControl("txtContactName") as TextBox;
                    TextBox txtAddress             = e.Item.FindControl("txtAddress") as TextBox;
                    TextBox txtEmail  = e.Item.FindControl("txtEmail") as TextBox;
                    TextBox txtPhone1 = e.Item.FindControl("txtPhone1") as TextBox;
                    TextBox txtPhone2 = e.Item.FindControl("txtPhone2") as TextBox;
                    TextBox txtQQ     = e.Item.FindControl("txtQQ") as TextBox;
                    TextBox txtOthers = e.Item.FindControl("txtOthers") as TextBox;

                    HiddenField hfId     = e.Item.FindControl("hfId") as HiddenField;
                    CustomerDAL dal      = new CustomerDAL();
                    var         customer = dal.GetCustomerById(int.Parse(hfId.Value));
                    customer.CustomerCompanyName = txtCustomerCompanyName.Text;
                    customer.ContactName         = txtContactName.Text;
                    customer.Address             = txtAddress.Text;
                    customer.Email          = txtEmail.Text;
                    customer.Phone1         = txtPhone1.Text;
                    customer.Phone2         = txtPhone2.Text;
                    customer.QQ             = txtQQ.Text;
                    customer.CustomerOthers = txtOthers.Text;
                    dal.Save();
                }
            }
            BindRepeater();
            SetFocus(source);
        }
예제 #12
0
        public int DeleteCustomer(Int64 customerID)
        {
            CustomerDAL objDAL = new CustomerDAL();

            return(objDAL.DeleteCustomer(customerID));
        }
예제 #13
0
 public void DeleteCustomer(string pnr)
 {
     CustomerDAL.DeleteCustomer(pnr);
 }
예제 #14
0
 public bool DeleteCustomer(int idCustomer)
 {
     return(db.DeleteCustomer(idCustomer));
 }
예제 #15
0
 public void DeleteCustomer(int customerid)
 {
     CustomerDAL.DeleteCustomer(customerid);
 }
예제 #16
0
 public string DelCustomer(string stCustomerID)
 {
     m_dataResponse = m_dalCustomer.DeleteCustomer(stCustomerID);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
예제 #17
0
 public bool DeleteCustomer(Customer e)
 {
     return(customerDAL.DeleteCustomer(e));
 }
예제 #18
0
 public bool DeleteCustomer(int ID)
 {
     return(customerDAL.DeleteCustomer(ID));
 }
예제 #19
0
 public ResponseModel DeleteCustomer(List <Customer> list)
 {
     return(_dal.DeleteCustomer(list));
 }