protected override void DeleteAction(string id)
        {
            foreach (var department in DepartmentServices.GetList(id.ToInteger()))
            {
                DepartmentServices.Delete(department);
            }

            DepartmentGroupServices.Delete(id.ToInteger());
        }
Exemple #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int Id = Convert.ToInt32(txtId.Text);

            DepartmentServices.Delete(Id);
            lblError.Text = "Designation Deleted.";
            DataGvProperties();
            Clear();
        }
        public ActionResult Delete()
        {
            this.SaveAccessLog("delete");
            if (Session["IsAdmin"] == null)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            string id     = this.HttpContext.Request["departid"];
            int    output = 0;

            try
            {
                this.SetConnectionDB();



                DepartmentServices services = new DepartmentServices(this.DBConnection);
                if (services.ERROR != null)
                {
                    throw new Exception(services.ERROR);
                }
                output = services.Delete(Int32.Parse(id));
            }
            catch (Exception ex)
            {
                FileHelper.SaveFile(new { data = id, ERROR = ex }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
                output = -2;
            }
            //*************************************XU LY VAN DE THONG BAO THANH CONG HAY THAT BAI********************
            this.GetLanguage();
            BlockDepartmentCreateLangModel blockLang = new BlockDepartmentCreateLangModel();

            blockLang.BlockName = "block_department_list";
            blockLang.SetLanguage(this.LANGUAGE_OBJECT);

            Session["msg_code"] = output;
            if (output > 1)
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_department_list.success_delete", this.LANGUAGE_OBJECT);
            }

            return(RedirectToAction("List"));
        }
Exemple #4
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         Db db = new Db(DbServices.ConnectionString);
         DepartmentServices.Delete(CurrentUser.Id, id, db);
         TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "DeleteConfirmed");
         // return RedirectToAction("Index");
     }
     catch (CfException cfex)
     {
         TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
     }
     catch (Exception ex)
     {
         TempData["Failure"] = ex.Message;
     }
     // return View(department);
     return(RedirectToAction("Index"));
 }
 protected override void DeleteAction(string id)
 {
     DepartmentServices.Delete(id.ToInteger());
 }