コード例 #1
0
        public void Delete(int id)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                var workerStatusDeleteing = dbContext.tblWorkerStatus.SingleOrDefault(
                    x => x.statusNo == id);

                var workerStatusDeletInfo = new StringBuilder();
                workerStatusDeletInfo.Append("[tblWorkerStatus] { ");
                workerStatusDeletInfo.Append("statusNo = " + workerStatusDeleteing.statusNo.ToString() + ", ");
                workerStatusDeletInfo.Append("status = " + workerStatusDeleteing.status + " }");

                var newDelete = new tblDeleteItem()
                {
                    deleteDate = DateTime.Now,
                    itemInfo   = workerStatusDeletInfo.ToString(),
                    restored   = false
                };

                dbContext.tblDeleteItems.InsertOnSubmit(newDelete);
                dbContext.tblWorkerStatus.DeleteOnSubmit(workerStatusDeleteing);

                dbContext.SubmitChanges();
            }
        }
コード例 #2
0
        public void Delete(int id)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                var bankAccountsDeleteing = dbContext.tblBankAccounts.SingleOrDefault(
                    x => x.Id == id);

                var deleteInfo = new StringBuilder();
                deleteInfo.Append("[tblBankAccounts] { ");
                deleteInfo.Append("indexId = " + bankAccountsDeleteing.Id.ToString() + ", ");
                deleteInfo.Append("bank = " + bankAccountsDeleteing.bank + ", ");
                deleteInfo.Append("accountName = " + bankAccountsDeleteing.accountName + ", ");
                deleteInfo.Append("regNo = " + bankAccountsDeleteing.regNo.ToString() + ", ");
                deleteInfo.Append("accountNo = " + bankAccountsDeleteing.accountNo + ", ");
                deleteInfo.Append("balance = " + bankAccountsDeleteing.balance.ToString() + " }");

                var deleteingItem = new tblDeleteItem()
                {
                    deleteDate = DateTime.Now,
                    itemInfo   = deleteInfo.ToString(),
                    restored   = false
                };

                dbContext.tblBankAccounts.DeleteOnSubmit(bankAccountsDeleteing);
                dbContext.tblDeleteItems.InsertOnSubmit(deleteingItem);
                dbContext.SubmitChanges();
            }
        }
コード例 #3
0
        public void Delete(int WorkNumber)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                tblWorker workerItem = dbContext.tblWorkers.SingleOrDefault(x => x.workNo == WorkNumber);

                var workerDelete = new StringBuilder();
                workerDelete.Append("[tblWorkers] { ");
                workerDelete.Append("workNo = " + workerItem.workNo.ToString() + ", ");
                workerDelete.Append("name = " + workerItem.name + ", ");
                workerDelete.Append("surname = " + workerItem.surname + ", ");
                workerDelete.Append("workerStatus = " + workerItem.workerStatus.ToString() + ", ");
                workerDelete.Append("phoneNo = " + workerItem.phoneNo + ", ");
                workerDelete.Append("altPhoneNo = " + workerItem.altPhoneNo + ", ");
                workerDelete.Append("homeAddress = " + workerItem.homeAddress + ", ");
                workerDelete.Append("postNo = " + workerItem.postNo.ToString() + ", ");
                workerDelete.Append("email = " + workerItem.email + ", ");
                workerDelete.Append("active = ");
                if (workerItem.active == true)
                {
                    workerDelete.Append("1");
                }
                else
                {
                    workerDelete.Append("0");
                }
                workerDelete.Append(" }");

                var newDeleteItem = new tblDeleteItem()
                {
                    deleteDate = DateTime.Now,
                    itemInfo   = workerDelete.ToString(),
                    restored   = false
                };

                workerItem.active = false;

                dbContext.tblDeleteItems.InsertOnSubmit(newDeleteItem);

                dbContext.SubmitChanges();
            }
        }
コード例 #4
0
        public void Delete(int department)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                tblDepartment item = dbContext.tblDepartments.SingleOrDefault(
                    x => x.department == department);

                var itemString = new StringBuilder();
                itemString.Append("[tblDepartment] { ");
                itemString.Append("department = " + item.department.ToString() + ", ");
                itemString.Append("cvrNo = " + item.cvrNo.ToString() + ", ");
                itemString.Append("phoneNo = " + item.phoneNo + ", ");
                itemString.Append("altPhoneNo = " + item.altPhoneNo + ", ");
                itemString.Append("_address = " + item._address + ", ");
                itemString.Append("postNo = " + item.postNo.ToString() + ",");
                itemString.Append("email = " + item.email + ", ");

                if ((bool)item.active)
                {
                    itemString.Append("active = " + "1, ");
                }
                else
                {
                    itemString.Append("active = " + "1, ");
                }

                itemString.Append("departmentHeadNo = " + item.departmentHeadNo.ToString() + " }");

                var deleteItem = new tblDeleteItem()
                {
                    itemInfo   = itemString.ToString(),
                    deleteDate = DateTime.Now,
                    restored   = false,
                };

                item.active = false;

                dbContext.tblDeleteItems.InsertOnSubmit(deleteItem);

                dbContext.SubmitChanges();
            }
        }
コード例 #5
0
        public void Delete(int id)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                var deleteingItem = dbContext.tblPrivateCustomers.SingleOrDefault(
                    x => x.privateCustomersNo == id);

                var deleteingInfo = new StringBuilder();
                deleteingInfo.Append("[tblPrivateCustomers] { ");
                deleteingInfo.Append("privateCustomersNo = " + deleteingItem.privateCustomersNo.ToString() + ", ");
                deleteingInfo.Append("name = " + deleteingItem.name + ", ");
                deleteingInfo.Append("surname = " + deleteingItem.surname + ", ");
                deleteingInfo.Append("phoneNo = " + deleteingItem.phoneNo + ", ");
                deleteingInfo.Append("altPhoneNo = " + deleteingItem.altPhoneNo + ", ");
                deleteingInfo.Append("homeAddress = " + deleteingItem.homeAddress + ", ");
                deleteingInfo.Append("postNo = " + deleteingItem.postNo.ToString() + ", ");
                deleteingInfo.Append("email = " + deleteingItem.email + ", ");
                deleteingInfo.Append("active = ");
                if (deleteingItem.active == true)
                {
                    deleteingInfo.Append("1");
                }
                else
                {
                    deleteingInfo.Append("0");
                }
                deleteingInfo.Append(" }");

                var deleteData = new tblDeleteItem()
                {
                    deleteDate = DateTime.Now,
                    itemInfo   = deleteingItem.ToString(),
                    restored   = false
                };

                deleteingItem.active = false;
                dbContext.tblDeleteItems.InsertOnSubmit(deleteData);

                dbContext.SubmitChanges();
            }
        }
コード例 #6
0
        public void Delete(Interface.IpostNo postNumber)
        {
            using (LMCdatabaseDataContext dbContext = new LMCdatabaseDataContext(this.connectionString))
            {
                tblPostNo postNo = dbContext.tblPostNos.SingleOrDefault(x => x.ID == postNumber.Id);
                dbContext.tblPostNos.DeleteOnSubmit(postNo);

                var deleteItem = new StringBuilder();
                deleteItem.Append("[tblPostNo] { ");
                deleteItem.Append("ID = " + postNo.ID + ", ");
                deleteItem.Append("postNo = " + postNo.postNo + ", ");
                deleteItem.Append("city = " + postNo.city);
                deleteItem.Append("} ");

                tblDeleteItem newDelete = new tblDeleteItem
                {
                    itemInfo   = deleteItem.ToString(),
                    deleteDate = DateTime.Now,
                    restored   = false
                };

                dbContext.SubmitChanges();
            }
        }